@marcopeg/hal 1.0.17 → 1.0.18
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 +26 -22
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/marcopeg/hal/main/images/hal.jpg" alt="HAL 9000" width="120" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">HAL</h1>
|
|
2
6
|
|
|
3
7
|
A Telegram bot that provides access to AI coding agents as a personal assistant. Run multiple engines (Claude Code, GitHub Copilot, and more) across multiple projects simultaneously, each with its own dedicated Telegram bot.
|
|
4
8
|
|
|
@@ -132,10 +136,10 @@ Every field is optional. Project entries are matched to base projects by `name`
|
|
|
132
136
|
|
|
133
137
|
Any string value in `hal.config.json` or `hal.config.local.json` (except inside `context` blocks — see [Context Injection](#context-injection)) can reference an environment variable with `${VAR_NAME}` syntax. Variables are resolved at boot time from the following sources in priority order (first match wins):
|
|
134
138
|
|
|
135
|
-
1.
|
|
136
|
-
2.
|
|
137
|
-
3.
|
|
138
|
-
4.
|
|
139
|
+
1. `{config-dir}/.env.local` _(gitignored)_
|
|
140
|
+
2. `{config-dir}/.env`
|
|
141
|
+
3. `{project-cwd}/.env.local` _(gitignored)_
|
|
142
|
+
4. `{project-cwd}/.env`
|
|
139
143
|
5. Shell environment (`process.env`)
|
|
140
144
|
|
|
141
145
|
```bash
|
|
@@ -237,8 +241,8 @@ export default async (context) => ({
|
|
|
237
241
|
})
|
|
238
242
|
```
|
|
239
243
|
|
|
240
|
-
- **Input**: fully-resolved `Record
|
|
241
|
-
- **Output**: a `Record
|
|
244
|
+
- **Input**: fully-resolved `Record\<string, string\>` context
|
|
245
|
+
- **Output**: a `Record\<string, string\>` — the final context passed to the engine
|
|
242
246
|
- If a hook throws, the bot logs the error and falls back to the pre-hook context
|
|
243
247
|
|
|
244
248
|
#### Prompt format
|
|
@@ -395,16 +399,16 @@ The slug is used as a folder name for log and data paths. It is derived from:
|
|
|
395
399
|
|
|
396
400
|
| Value | Resolved Path |
|
|
397
401
|
|-------|---------------|
|
|
398
|
-
| _(empty)_ |
|
|
399
|
-
| `~` |
|
|
400
|
-
| Relative path (e.g. `.mydata`) |
|
|
402
|
+
| _(empty)_ | `{project-cwd}/.hal/users` |
|
|
403
|
+
| `~` | `{config-dir}/.hal/{slug}/data` |
|
|
404
|
+
| Relative path (e.g. `.mydata`) | `{project-cwd}/{value}` |
|
|
401
405
|
| Absolute path | Used as-is |
|
|
402
406
|
|
|
403
407
|
### Log Files
|
|
404
408
|
|
|
405
409
|
When `logging.persist: true`, logs are written to:
|
|
406
410
|
```
|
|
407
|
-
|
|
411
|
+
{config-dir}/.hal/logs/{project-slug}/YYYY-MM-DD.txt
|
|
408
412
|
```
|
|
409
413
|
|
|
410
414
|
### Engine Configuration
|
|
@@ -458,7 +462,7 @@ The `engine` object supports five fields:
|
|
|
458
462
|
- **CLI:** `claude` — install and authenticate via [Claude Code CLI](https://github.com/anthropics/claude-code) (see [Prerequisites](#prerequisites)).
|
|
459
463
|
- **Project files:** `CLAUDE.md`, `.claude/settings.json` (see [How It Works](#how-it-works)).
|
|
460
464
|
- **Config:** `engine.name: "claude"`. Optional: `engine.command`, `engine.model` (passed as `--model`), `engine.session`, `engine.sessionMsg`.
|
|
461
|
-
- **Sessions:** When `engine.session` is `true`, the CLI is invoked with `--resume
|
|
465
|
+
- **Sessions:** When `engine.session` is `true`, the CLI is invoked with `--resume {sessionId}`. `/clean` clears the stored session and replies with a static message (no engine call).
|
|
462
466
|
|
|
463
467
|
#### GitHub Copilot
|
|
464
468
|
|
|
@@ -575,8 +579,8 @@ You can add your own slash commands as `.mjs` files. When a user sends `/mycomma
|
|
|
575
579
|
|
|
576
580
|
| Location | Scope |
|
|
577
581
|
|----------|-------|
|
|
578
|
-
| `{project.cwd}/.hal/commands
|
|
579
|
-
| `{configDir}/.hal/commands
|
|
582
|
+
| `{project.cwd}/.hal/commands/{name}.mjs` | Project-specific |
|
|
583
|
+
| `{configDir}/.hal/commands/{name}.mjs` | Global — available to all projects |
|
|
580
584
|
|
|
581
585
|
Project-specific commands take precedence over global ones on name collision.
|
|
582
586
|
|
|
@@ -605,7 +609,7 @@ Tokens following the command name, split on whitespace.
|
|
|
605
609
|
/status → args = []
|
|
606
610
|
```
|
|
607
611
|
|
|
608
|
-
#### `ctx: Record
|
|
612
|
+
#### `ctx: Record\<string, string\>`
|
|
609
613
|
|
|
610
614
|
The fully-resolved context that would be sent to the AI for this message — identical to what the engine sees in its `# Context` header. Includes all implicit keys plus any config vars and hook results:
|
|
611
615
|
|
|
@@ -658,7 +662,7 @@ interface Agent {
|
|
|
658
662
|
call(
|
|
659
663
|
prompt: string,
|
|
660
664
|
options?: { onProgress?: (message: string) => void }
|
|
661
|
-
): Promise
|
|
665
|
+
): Promise\<string\>;
|
|
662
666
|
}
|
|
663
667
|
```
|
|
664
668
|
|
|
@@ -668,7 +672,7 @@ Unlike regular user messages, agent calls have no session history and no context
|
|
|
668
672
|
|--------|------|-------------|
|
|
669
673
|
| `onProgress` | `(message: string) => void` | Called during execution with activity updates (e.g. `"Reading: /path/to/file"`). Use it to keep the user informed while the agent is working. |
|
|
670
674
|
|
|
671
|
-
Returns the agent's final text output as a string. Throws on failure — the bot's command error handler will catch it and reply with `Command failed:
|
|
675
|
+
Returns the agent's final text output as a string. Throws on failure — the bot's command error handler will catch it and reply with `Command failed: {message}`.
|
|
672
676
|
|
|
673
677
|
```js
|
|
674
678
|
export default async function({ args, gram, agent }) {
|
|
@@ -700,7 +704,7 @@ The project-level context object. Useful fields:
|
|
|
700
704
|
| `projectCtx.config.cwd` | `string` | Absolute path to the project directory |
|
|
701
705
|
| `projectCtx.config.configDir` | `string` | Absolute path to the directory containing `hal.config.json` |
|
|
702
706
|
| `projectCtx.config.dataDir` | `string` | Absolute path to user data storage root |
|
|
703
|
-
| `projectCtx.config.context` | `Record
|
|
707
|
+
| `projectCtx.config.context` | `Record\<string, string\> \| undefined` | Raw config-level context values (pre-hook) |
|
|
704
708
|
| `projectCtx.logger` | Pino logger | Structured logger — use for debug output that ends up in log files |
|
|
705
709
|
|
|
706
710
|
### Examples
|
|
@@ -714,7 +718,7 @@ The project-level context object. Useful fields:
|
|
|
714
718
|
[Claude Code skills](https://docs.anthropic.com/en/docs/claude-code/skills) live in `.claude/skills/` inside the project directory (shared across all engines). Each skill is a folder containing a `SKILL.md` file with a YAML frontmatter block and a prompt body:
|
|
715
719
|
|
|
716
720
|
```
|
|
717
|
-
|
|
721
|
+
{project-cwd}/
|
|
718
722
|
└── .claude/
|
|
719
723
|
└── skills/
|
|
720
724
|
└── chuck/
|
|
@@ -734,16 +738,16 @@ At boot time (and whenever `SKILL.md` files change) the bot reads every skill fo
|
|
|
734
738
|
|
|
735
739
|
When a user invokes a skill command (e.g. `/chuck`) the bot:
|
|
736
740
|
1. Reads the `SKILL.md` prompt body
|
|
737
|
-
2. Appends any user arguments as `User input:
|
|
741
|
+
2. Appends any user arguments as `User input: {args}` if present
|
|
738
742
|
3. Calls the AI engine with that prompt via the engine-agnostic `agent.call()` interface
|
|
739
743
|
4. Sends the response back to the user
|
|
740
744
|
|
|
741
|
-
Skills can be **overridden per-project**: create a `.hal/commands
|
|
745
|
+
Skills can be **overridden per-project**: create a `.hal/commands/{name}.mjs` file with the same name as the skill and the `.mjs` handler takes full precedence.
|
|
742
746
|
|
|
743
747
|
**Command precedence** (highest wins):
|
|
744
748
|
|
|
745
749
|
```
|
|
746
|
-
project .hal/commands
|
|
750
|
+
project .hal/commands/{name}.mjs > global .hal/commands/{name}.mjs > .claude/skills/{name}/
|
|
747
751
|
```
|
|
748
752
|
|
|
749
753
|
See [`examples/obsidian/.claude/skills/chuck/`](examples/obsidian/.claude/skills/chuck/SKILL.md) and [`examples/obsidian/.claude/skills/weather/`](examples/obsidian/.claude/skills/weather/SKILL.md) for example skills.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marcopeg/hal",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -24,16 +24,21 @@
|
|
|
24
24
|
"keywords": [
|
|
25
25
|
"telegram",
|
|
26
26
|
"claude",
|
|
27
|
+
"codex",
|
|
28
|
+
"copilot",
|
|
29
|
+
"cursors",
|
|
30
|
+
"agent",
|
|
31
|
+
"opencode",
|
|
27
32
|
"bot",
|
|
28
33
|
"ai",
|
|
29
34
|
"assistant"
|
|
30
35
|
],
|
|
31
36
|
"author": "",
|
|
32
|
-
"license": "
|
|
33
|
-
"description": "Telegram bot
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"description": "Telegram bot for AI coding agents. Multi-project and multi-engine: run Claude Code, Copilot, Codex, or OpenCode per project, each with its own bot.",
|
|
34
39
|
"repository": {
|
|
35
40
|
"type": "git",
|
|
36
|
-
"url": ""
|
|
41
|
+
"url": "https://github.com/marcopeg/hal.git"
|
|
37
42
|
},
|
|
38
43
|
"dependencies": {
|
|
39
44
|
"chokidar": "^5.0.0",
|