diff --git a/Cargo.lock b/Cargo.lock index 3f3db030d..5e750dbba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1109,9 +1109,9 @@ checksum = "f5438dd2b2ff4c6df6e1ce22d825ed2fa93ee2922235cc45186991717f0a892d" [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-traits" @@ -1808,9 +1808,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd" +checksum = "9da98b7d9b7dad93488a84b8248efc35352b0b2657397d4167e7ad67e5d535e5" dependencies = [ "deranged", "itoa", @@ -1825,15 +1825,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.25" +version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd" +checksum = "78cc610bac2dcee56805c99642447d4c5dbde4d01f752ffea0199aee1f601dc4" dependencies = [ "num-conv", "time-core", diff --git a/dotagents b/dotagents index 69b0cf456..46bfb6407 160000 --- a/dotagents +++ b/dotagents @@ -1 +1 @@ -Subproject commit 69b0cf4569a5aa6b10f12bdef3a11fa22dbf850c +Subproject commit 46bfb64074cdc32801053c667df1384d7e52dc54 diff --git a/flake.lock b/flake.lock index 680fad304..ee01aa68d 100644 --- a/flake.lock +++ b/flake.lock @@ -428,11 +428,11 @@ ] }, "locked": { - "lastModified": 1769045341, - "narHash": "sha256-3tmn4wU1XBmaL7VnZQrtBkQZcth3O+utruKCZ6xEUYc=", + "lastModified": 1769290218, + "narHash": "sha256-mRDeXF+wTVXnQaA5s/t3XOYf5GGx44Gwn7upakoQtKI=", "owner": "clawdbot", "repo": "nix-clawdbot", - "rev": "fbbf80bc829180cc1e7c76bd2565de96e624d4e8", + "rev": "6982258bd093b7b569c2671592d7027e0191c1b3", "type": "github" }, "original": { diff --git a/home-manager/modules/clawdbot/default.nix b/home-manager/modules/clawdbot/default.nix index 1a69ce4df..a3b23dbf1 100644 --- a/home-manager/modules/clawdbot/default.nix +++ b/home-manager/modules/clawdbot/default.nix @@ -62,6 +62,54 @@ lib.mkIf (!env.isCI) { '' ); + # Inject gateway auth token into clawdbot.json for local mode on kyber (tokenFile deprecated) + home.activation.clawdbotGatewayToken = lib.mkIf (lib ? hm && lib.hm ? dag && host.isKyber) ( + lib.hm.dag.entryAfter [ "clawdbotSecrets" "clawdbotConfigFiles" ] '' + TOKEN_FILE="${clawdbotDir}/gateway-token" + CONFIG_FILE="${homeDir}/.clawdbot/clawdbot.json" + if [ -f "$TOKEN_FILE" ] && [ -f "$CONFIG_FILE" ]; then + TOKEN=$(${pkgs.coreutils}/bin/cat "$TOKEN_FILE" | ${pkgs.coreutils}/bin/tr -d '\n') + # Inject token into gateway.auth.token + ${pkgs.jq}/bin/jq --arg token "$TOKEN" \ + '.gateway.auth.token = $token' \ + "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && \ + ${pkgs.coreutils}/bin/mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" + echo "Injected gateway auth token into clawdbot config" + fi + '' + ); + + # Inject telegram bot token into clawdbot.json for kyber (botTokenFile deprecated) + home.activation.clawdbotTelegramToken = lib.mkIf (lib ? hm && lib.hm ? dag && host.isKyber) ( + lib.hm.dag.entryAfter [ "clawdbotSecrets" "clawdbotConfigFiles" ] '' + TOKEN_FILE="${clawdbotDir}/telegram-token" + CONFIG_FILE="${homeDir}/.clawdbot/clawdbot.json" + if [ -f "$TOKEN_FILE" ] && [ -f "$CONFIG_FILE" ]; then + TOKEN=$(${pkgs.coreutils}/bin/cat "$TOKEN_FILE" | ${pkgs.coreutils}/bin/tr -d '\n') + # Inject botToken into channels.telegram + ${pkgs.jq}/bin/jq --arg token "$TOKEN" \ + '.channels.telegram.botToken = $token' \ + "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && \ + ${pkgs.coreutils}/bin/mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" + echo "Injected telegram bot token into clawdbot config" + fi + '' + ); + + # Clean up deprecated config keys (byProvider, etc.) on kyber + home.activation.clawdbotCleanDeprecated = lib.mkIf (lib ? hm && lib.hm ? dag && host.isKyber) ( + lib.hm.dag.entryAfter [ "clawdbotTelegramToken" ] '' + CONFIG_FILE="${homeDir}/.clawdbot/clawdbot.json" + if [ -f "$CONFIG_FILE" ]; then + # Remove deprecated keys that cause config validation errors + ${pkgs.jq}/bin/jq 'del(.messages.queue.byProvider)' \ + "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && \ + ${pkgs.coreutils}/bin/mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" + echo "Cleaned deprecated config keys from clawdbot config" + fi + '' + ); + # Inject gateway token into clawdbot.json for remote mode (tokenFile not supported upstream) home.activation.clawdbotRemoteToken = lib.mkIf (lib ? hm && lib.hm ? dag && !host.isKyber) ( lib.hm.dag.entryAfter [ "clawdbotSecrets" "clawdbotConfigFiles" ] '' @@ -168,7 +216,7 @@ lib.mkIf (!env.isCI) { # Default settings defaults = { - model = "anthropic/claude-opus-4-5"; + model = "cliproxy/claude-opus-4-5-20251101"; thinkingDefault = "high"; }; @@ -187,17 +235,24 @@ lib.mkIf (!env.isCI) { configOverrides = # Kyber only: Local gateway mode with browser + bridge for nodes lib.optionalAttrs host.isKyber { + # Explicitly disable memory plugin slot (upstream defaults to "memory-core" if undefined) + # Set to "none" to disable the slot (empty string gets normalized to default) + plugins.slots.memory = "none"; + # Override messages.queue to use byChannel instead of deprecated byProvider + messages.queue = { + mode = "interrupt"; + byChannel = { + discord = "queue"; + telegram = "interrupt"; + webchat = "queue"; + }; + }; gateway = { mode = "local"; bind = "lan"; - auth = { - tokenFile = "${clawdbotDir}/gateway-token"; - }; - }; - bridge = { - enabled = true; - bind = "lan"; # Allow nodes to connect from LAN/ingress + # auth.token injected by activation script (tokenFile deprecated in new clawdbot) }; + # bridge removed - deprecated in new clawdbot version browser = { enabled = true; headless = true; @@ -211,7 +266,7 @@ lib.mkIf (!env.isCI) { providers = { cliproxy = { baseUrl = "http://localhost:8317/v1"; - apiKeyFile = "${clawdbotDir}/cliproxy-key"; + # apiKey injected by activation script (apiKeyFile deprecated) api = "openai-completions"; models = let @@ -324,6 +379,23 @@ lib.mkIf (!env.isCI) { }; }; }; + # Telegram channel config (moved from root telegram key to channels.telegram) + channels.telegram = { + # botToken injected by activation script + allowFrom = [ + 983653361 + 2104262990 + ]; + groups = { + "*" = { + requireMention = false; + }; + "-1003612372477" = { + enabled = true; + requireMention = false; + }; + }; + }; } # All other hosts (macOS + non-kyber Linux): Remote mode - connect to kyber gateway // lib.optionalAttrs (!host.isKyber) { @@ -350,24 +422,8 @@ lib.mkIf (!env.isCI) { apiKeyFile = "${clawdbotDir}/anthropic-key"; }; - # Telegram provider - kyber gateway only (reads from ~/.config/clawdbot/telegram-token) - providers.telegram = { - enable = host.isKyber; - botTokenFile = "${clawdbotDir}/telegram-token"; - allowFrom = [ - 983653361 - 2104262990 - ]; - groups = { - "*" = { - requireMention = false; - }; - "-1003612372477" = { - enabled = true; - requireMention = false; - }; - }; - }; + # Telegram config moved to configOverrides.channels.telegram (new clawdbot schema) + # providers.telegram deprecated - see configOverrides above # # iMessage provider - macOS only (reads messages from anyone) # providers.imessage = { diff --git a/overlays/default.nix b/overlays/default.nix index 7f91defce..95663febe 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,118 +1,9 @@ { inputs }: -let - # Override clawdbot source to v2026.1.21 - clawdbotSourceOverride = { - owner = "clawdbot"; - repo = "clawdbot"; - rev = "80c1edc3ff43b3bd3b7b545eed79f303d992f7dc"; - hash = "sha256-IsTNC79KXKL7ByBh7zUmH6qXx0YFdiQ4a4TI40C53U8="; - pnpmDepsHash = "sha256-tGzKcCiZNlWlKMNNFmxcFpIvO92G9myhM+OYaGea4hw="; - }; - # Override clawdbot-app to v2026.1.21 (fixes broken app package) - clawdbotAppOverride = { - version = "2026.1.21"; - url = "https://github.com/clawdbot/clawdbot/releases/download/v2026.1.21/Clawdbot-2026.1.21.zip"; - hash = "sha256-EhGRakuN0dhEkXvrOd21t79odf4T2jY7oKFRubLqGbI="; - }; -in [ inputs.nur.overlays.default inputs.neovim-nightly-overlay.overlays.default - # Custom clawdbot overlay with version override (replaces inputs.nix-clawdbot.overlays.default) - ( - final: prev: - let - clawdbotVersion = "2026.1.21"; - basePkgs = import "${inputs.nix-clawdbot}/nix/packages" { - pkgs = prev; - sourceInfo = clawdbotSourceOverride; - }; - # Override version in clawdbot-gateway (it's hardcoded in the derivation) - # src is already correct from sourceInfo, just need to update version string - clawdbot-gateway = basePkgs.clawdbot-gateway.overrideAttrs (old: { - version = clawdbotVersion; - __intentionallyOverridingVersion = true; - }); - # Build clawdbot-app with fixed version (upstream has broken app package) - clawdbot-app = - if prev.stdenv.isDarwin then - prev.stdenvNoCC.mkDerivation { - pname = "clawdbot-app"; - version = clawdbotAppOverride.version; - src = prev.fetchzip { - url = clawdbotAppOverride.url; - hash = clawdbotAppOverride.hash; - stripRoot = false; - }; - dontUnpack = true; - installPhase = '' - mkdir -p "$out/Applications" - app_path="$(find "$src" -maxdepth 2 -name '*.app' -print -quit)" - if [ -z "$app_path" ]; then - echo "Clawdbot.app not found in $src" >&2 - exit 1 - fi - cp -pR "$app_path" "$out/Applications/Clawdbot.app" - ''; - meta = with prev.lib; { - description = "Clawdbot macOS app bundle"; - homepage = "https://github.com/clawdbot/clawdbot"; - license = licenses.mit; - platforms = platforms.darwin; - }; - } - else - null; - # Rebuild batteries bundle with the overridden gateway and app - clawdbot = prev.callPackage "${inputs.nix-clawdbot}/nix/packages/clawdbot-batteries.nix" { - clawdbot-gateway = clawdbot-gateway; - inherit clawdbot-app; - extendedTools = (import "${inputs.nix-clawdbot}/nix/tools/extended.nix" { pkgs = prev; }).tools; - }; - toolNames = (import "${inputs.nix-clawdbot}/nix/tools/extended.nix" { pkgs = prev; }).toolNames; - withTools = - { - toolNamesOverride ? null, - excludeToolNames ? [ ], - }: - let - toolSets = import "${inputs.nix-clawdbot}/nix/tools/extended.nix" { - pkgs = prev; - inherit toolNamesOverride excludeToolNames; - }; - innerPkgs = import "${inputs.nix-clawdbot}/nix/packages" { - pkgs = prev; - sourceInfo = clawdbotSourceOverride; - inherit toolNamesOverride excludeToolNames; - }; - innerGateway = innerPkgs.clawdbot-gateway.overrideAttrs (old: { - version = clawdbotVersion; - __intentionallyOverridingVersion = true; - }); - in - innerPkgs - // { - clawdbot-gateway = innerGateway; - clawdbot = prev.callPackage "${inputs.nix-clawdbot}/nix/packages/clawdbot-batteries.nix" { - clawdbot-gateway = innerGateway; - inherit clawdbot-app; - extendedTools = toolSets.tools; - }; - }; - in - { - inherit clawdbot clawdbot-gateway; - clawdbotPackages = { - inherit - clawdbot - clawdbot-gateway - toolNames - withTools - ; - }; - } - // (if prev.stdenv.isDarwin then { inherit clawdbot-app; } else { }) - ) + # Use default nix-clawdbot overlay (updated to latest version with PR #1554 fix) + inputs.nix-clawdbot.overlays.default (final: prev: { # Ensure neovim-unwrapped exposes a lua attribute for wrapper consumers (e.g., home-manager) neovim-unwrapped =