188 Commits

Author SHA1 Message Date
woozu-shin
6b273740dd style: apply prettier formatting from pre-commit hook
Some checks failed
Bump version / bump-version (push) Has been cancelled
Update token count / update-tokens (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 14:46:11 +09:00
woozu-shin
576d5ce366 Merge upstream/main: resolve conflicts preserving local customizations
Some checks failed
Bump version / bump-version (push) Has been cancelled
Update token count / update-tokens (push) Has been cancelled
Merge 207 upstream commits (up to v1.2.41) while keeping Apple Container
runtime support and MiniMax model forwarding. Remove deleted telegram.ts
and credential-proxy.ts imports, widen CONTAINER_RUNTIME_BIN type for
Apple Container detection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 14:44:28 +09:00
woozu-shin
cd8d043eaf Apply prettier formatting to container-runtime and router
Some checks failed
Bump version / bump-version (push) Has been cancelled
Update token count / update-tokens (push) Has been cancelled
Sync upstream & merge-forward skill branches / sync-and-merge (push) Has been cancelled
Merge-forward skill branches / merge-forward (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 14:32:45 +09:00
woozu-shin
ef1aff1532 Add MiniMax API support, Apple Container runtime, and stop script
Some checks failed
Bump version / bump-version (push) Has been cancelled
Sync upstream & merge-forward skill branches / sync-and-merge (push) Has been cancelled
Merge-forward skill branches / merge-forward (push) Has been cancelled
Update token count / update-tokens (push) Has been cancelled
- Add ASSISTANT_NAME and claude-minimax.sh for MiniMax API usage
- Switch container runtime from Docker to Apple Container
- Add CJK character restriction notice to CLAUDE.md files
- Add stop.sh for graceful shutdown

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 14:31:55 +09:00
gavrielc
acb0abaf8b fix: broken tests and stale .env.example
- Fix container-runner bug: stopContainer() returns void but was
  passed to exec() as a command string. Replace with direct call
  and try/catch.
- Mock container-runtime in tests so they don't need Docker running.
- Increase claw-skill test timeout to handle slower python startup.
- Clear .env.example (telegram token was added by mistake).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 23:19:07 +03:00
gavrielc
e73bf2f324 Merge branch 'main' into fix/message-history-overflow 2026-03-27 21:39:41 +03:00
exe.dev user
c98205ca0d fix: prevent full message history from being sent to container agents
When lastAgentTimestamp was missing (new group, corrupted state, or
startup recovery), the empty-string fallback caused getMessagesSince to
return up to 200 messages — the entire group history. This sent a
massive prompt to the container agent instead of just recent messages.

Fix: recover the cursor from the last bot reply timestamp in the DB
(proof of what we already processed), and cap all prompt queries to a
configurable MAX_MESSAGES_PER_PROMPT (default 10). Covers all three
call sites: processGroupMessages, the piping path, and
recoverPendingMessages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 18:38:40 +00:00
gavrielc
bd94c8144a Merge branch 'main' into fix/security-stopcontainer-mount 2026-03-27 17:15:06 +03:00
gavrielc
fee05f7ee8 Merge branch 'main' into ipc-fix 2026-03-27 17:10:13 +03:00
gavrielc
f138f25c79 Merge branch 'main' into fix/env-parser-single-char 2026-03-27 17:09:38 +03:00
gavrielc
e9e9e05290 Merge branch 'main' into ipc-fix 2026-03-27 17:02:42 +03:00
gavrielc
7e7492ebba style: apply prettier formatting to logger
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 15:13:39 +03:00
gavrielc
7b22e23761 chore: replace pino/pino-pretty with built-in logger
Drop 23 transitive dependencies by replacing pino + pino-pretty with a
~70-line logger that matches the same output format and API. All 80+
call sites work unchanged. Production deps now: @onecli-sh/sdk,
better-sqlite3, cron-parser.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 15:13:34 +03:00
snw35
f5375972c4 Preserve isMain on IPC updates 2026-03-26 23:20:30 +00:00
root
0f01fe2c07 fix(env): prevent crash on single-character .env values
A value like `X=a` would pass the startsWith/endsWith quote check
(both `"` and `'` are single chars), then slice(1, -1) would produce
an empty string, silently dropping the value. Add length >= 2 guard
before checking for surrounding quotes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 19:01:17 -03:00
root
a4fd4f2a2f fix(security): prevent command injection in stopContainer and mount path injection
**stopContainer (container-runtime.ts):**
- Validate container name against `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$` before
  passing to shell command. Rejects names with shell metacharacters
  (`;`, `$()`, backticks, etc.) that could execute arbitrary commands.
- Changed return type from string to void — callers no longer build
  shell commands from the return value.

**mount-security.ts:**
- Reject container paths containing `:` to prevent Docker `-v` option
  injection (e.g., `repo:rw` could override readonly flags).
- Don't permanently cache "file not found" for mount allowlist — the
  file may be created later without requiring a service restart. Only
  parse/structural errors are permanently cached.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 19:00:28 -03:00
NanoClaw User
eda14f472b fix: include script field in task snapshot for current_tasks.json
The task snapshot mappings in index.ts were omitting the script field,
making it appear that scheduled tasks had no script even when one was
stored in the database.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 13:20:24 +00:00
gavrielc
c16d70cdf7 Merge branch 'main' into fix/1272-telegram-dm-backfill 2026-03-25 23:28:35 +02:00
gavrielc
3699363eb7 Merge branch 'main' into fix/claw-mounts 2026-03-25 22:47:14 +02:00
gavrielc
23e9e1c150 Merge branch 'main' into codex/fix-issue-1141-per-group-trigger 2026-03-25 22:38:04 +02:00
gavrielc
89681a6d0d Merge branch 'main' into fix/ismain-template-selection 2026-03-25 17:36:27 +02:00
gavrielc
115b0a3167 Merge branch 'main' into fix/ipc-register-group-claude-md 2026-03-25 17:36:01 +02:00
gavrielc
deece6bf35 Merge branch 'main' into feat/scheduled-task-scripts-clean 2026-03-25 17:27:59 +02:00
gavrielc
b112fafff4 Merge branch 'main' into fix/agent-runner-cache-refresh 2026-03-25 17:27:23 +02:00
Ken Bolton
300dcda9c9 Merge branch 'main' into fix/claw-mounts 2026-03-25 11:13:16 -04:00
NanoClaw User
0240f48751 fix: use main template for isMain groups in runtime registration
Main groups (e.g. telegram_main) should get the full main template
with Admin Context section, not the minimal global template.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:43:08 +00:00
Gabi Simons
15b9aa99ff Merge branch 'main' into feat/scheduled-task-scripts-clean 2026-03-25 06:58:09 -07:00
NanoClaw User
80f6fb2b9a style: fix prettier formatting in registerGroup template copy
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:37:01 +00:00
Daniel M
5395b732a5 Merge branch 'main' into fix/ipc-register-group-claude-md 2026-03-25 15:21:53 +02:00
gavrielc
675a6d87a3 chore: remove accidentally merged Telegram channel code
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:25:58 +02:00
Gabi Simons
1b18d50ae4 Merge branch 'main' into feat/scheduled-task-scripts-clean 2026-03-25 02:25:23 -07:00
ingyukoh
4e3189da8f fix: create CLAUDE.md from template when registering groups via IPC
The registerGroup() function in index.ts creates the group folder and
logs subdirectory but never copies the global CLAUDE.md template.
Agents in newly registered groups start without identity or
instructions until the container is manually fixed.

Copy groups/global/CLAUDE.md into the new group folder on registration,
substituting the assistant name if it differs from the default.

Closes #1391
2026-03-25 16:17:26 +09:00
gavrielc
11847a1af0 fix: validate timezone to prevent crash on POSIX-style TZ values
POSIX-style TZ strings like IST-2 cause a hard RangeError crash in
formatMessages because Intl.DateTimeFormat only accepts IANA identifiers.

- Add isValidTimezone/resolveTimezone helpers to src/timezone.ts
- Make formatLocalTime fall back to UTC on invalid timezone
- Validate TZ candidates in config.ts before accepting
- Add timezone setup step to detect and prompt when autodetection fails
- Use node:22-slim in Dockerfile (node:24-slim Trixie package renames)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 01:04:59 +02:00
gavrielc
57e520c7e1 Merge origin/main: catch up with upstream (OneCLI, diagnostics, credential proxy)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 00:34:29 +02:00
MrBob
0015931e37 fix: honor per-group trigger patterns 2026-03-24 12:26:17 -03:00
Daniel M
d05a8dec49 fix: refresh stale agent-runner source cache on code changes
Closes #1361

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:21:13 +00:00
Gabi Simons
35722801e3 style: fix prettier formatting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:49:42 +02:00
Gabi Simons
14247d0b57 skill: add /use-native-credential-proxy, remove dead proxy code
Add SKILL.md for the native credential proxy feature skill.
Delete src/credential-proxy.ts and src/credential-proxy.test.ts
which became dead code after PR #1237 (OneCLI integration).
These files live on the skill/native-credential-proxy branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:37:27 +02:00
Ken Bolton
724fe7250d fix(claw): mount group folder and sessions into container
claw was running containers with no volume mounts, so the agent
always saw an empty /workspace/group. Add build_mounts() to
replicate the same bind-mounts that container-runner.ts sets up
(group folder, .claude sessions, IPC dir, agent-runner source,
and project root for main).

Also includes upstream fix from qwibitai/nanoclaw#1368:
graceful terminate() before kill() on output sentinel, and early
return after a successful structured response so exit code stays 0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 20:36:05 -04:00
woozu-shin
b172c1880e Merge skill/apple-container: switch container runtime from Docker to Apple Container
Some checks failed
Sync upstream & merge-forward skill branches / sync-and-merge (push) Has been cancelled
Bump version / bump-version (push) Has been cancelled
Merge-forward skill branches / merge-forward (push) Has been cancelled
Update token count / update-tokens (push) Has been cancelled
Apple Container provides faster container startup on macOS (~500ms vs 2-5s)
with native resource usage. This merges:
- container-runtime.ts: Apple Container API (system status/start, ls --format json)
- container-runtime.test.ts: Apple Container-specific tests
- container-runner.ts: .env shadow mount fix and privilege dropping
- container/Dockerfile: mount --bind for .env shadowing
- container/build.sh: default runtime set to container

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 08:43:02 +09:00
woozu-shin
4dc270d2dd nanoclaw init
Some checks failed
Sync upstream & merge-forward skill branches / sync-and-merge (push) Has been cancelled
Merge-forward skill branches / merge-forward (push) Has been cancelled
Bump version / bump-version (push) Has been cancelled
Update token count / update-tokens (push) Has been cancelled
2026-03-24 01:43:09 +09:00
woozu-shin
a1b8c70b5c Merge remote-tracking branch 'telegram/main'
Some checks failed
Bump version / bump-version (push) Has been cancelled
Sync upstream & merge-forward skill branches / sync-and-merge (push) Has been cancelled
Merge-forward skill branches / merge-forward (push) Has been cancelled
Update token count / update-tokens (push) Has been cancelled
2026-03-24 01:14:05 +09:00
Guy Ben Aharon
2583af7ead fix: ensure OneCLI agents exist for all groups on startup 2026-03-23 14:45:58 +02:00
Guy Ben Aharon
e9369617fb feat: replace credential proxy with OneCLI gateway for secret injection 2026-03-23 14:45:58 +02:00
RichardCao
00ff0e00eb fix(db): default Telegram backfill chats to DMs 2026-03-23 16:53:26 +08:00
Claude
b30b5a6a8f style: apply prettier formatting to modified files
https://claude.ai/code/session_01JPjzhBp9PR5LtfLWVDrYrH
2026-03-21 11:57:22 +02:00
Claude
30ebcaa61e feat: add ESLint with error-handling rules
Add ESLint v9.35+ with typescript-eslint recommended config and
error-handling rules: preserve-caught-error (enforces { cause } when
re-throwing), no-unused-vars with caughtErrors:all, and
eslint-plugin-no-catch-all (warns on catch blocks that don't rethrow).

Fix existing violations: add error cause to container-runtime rethrow,
prefix unused vars with underscore, remove unused imports.

https://claude.ai/code/session_01JPjzhBp9PR5LtfLWVDrYrH
2026-03-21 11:57:22 +02:00
sasaki takeru
cf3d9dcbd5 fix: reduce docker stop timeout for faster restarts
Pass -t 1 to docker stop, reducing SIGTERM-to-SIGKILL grace period from
10s to 1s. NanoClaw containers are stateless (--rm, mounted filesystems)
so they don't need a long grace period. Makes restarts ~10x faster.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:05:19 +02:00
moktamd
cf899049f7 security: stop logging user prompt content on container errors
Container error logs wrote the full ContainerInput (including user
prompt) to disk on every non-zero exit. The structured log stream
also included the first 200 chars of agent output.

- container-runner: only include full input at verbose level; error
  path now logs prompt length and session ID instead
- index: log output length instead of content snippet

Fixes #1150
2026-03-19 21:03:07 +02:00
Gabi Simons
b7f1d48423 style: fix prettier formatting in db.ts 2026-03-18 14:04:31 +02:00