Compare commits

..

11 Commits

Author SHA1 Message Date
Martin Pander
40223d29dc Refactor llm config 2026-07-31 15:02:59 +02:00
Martin Pander
b9899ef8ea Update work ai models 2026-07-30 08:52:36 +02:00
Martin Pander
de71ebc2bf Add tuicr 2026-07-29 21:58:11 +02:00
Martin Pander
377d1cb03a Refactor pi plan mode 2026-07-23 20:09:34 +02:00
Martin Pander
23d13f93b7 Enable pi at home 2026-07-23 19:41:05 +02:00
Martin Pander
6ab4c60360 Update 2026-07-23 17:03:39 +02:00
Martin Pander
784ea6bcea Add langdock api key env var on work mode 2026-07-23 16:06:54 +02:00
Martin Pander
5ed9fdc4bd Integrate pi 2026-07-23 16:01:18 +02:00
Martin Pander
8f0ad7ba77 tmux 2026-07-15 07:44:44 +02:00
Martin Pander
533ca8390f update 2026-07-14 09:25:27 +02:00
Martin Pander
cbe19bad55 nvim; tmux 2026-07-14 09:02:44 +02:00
26 changed files with 1577 additions and 324 deletions

254
flake.lock generated
View File

@@ -1,30 +1,5 @@
{ {
"nodes": { "nodes": {
"blueprint": {
"inputs": {
"nixpkgs": [
"llm-agents",
"nixpkgs"
],
"systems": [
"llm-agents",
"systems"
]
},
"locked": {
"lastModified": 1776249299,
"narHash": "sha256-Dt9t1TGRmJFc0xVYhttNBD6QsAgHOHCArqGa0AyjrJY=",
"owner": "numtide",
"repo": "blueprint",
"rev": "56131e8628f173d24a27f6d27c0215eff57e40dd",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "blueprint",
"type": "github"
}
},
"bun2nix": { "bun2nix": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
@@ -70,11 +45,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1782772816, "lastModified": 1784665499,
"narHash": "sha256-s9BuFv0mRuZx9C1MF8qPHRdcAK14ONi0A5m6E2wqOoM=", "narHash": "sha256-9BMxlTxCCDAeoNLtb1a/st7udtTIJep+wpUzquA29VU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "bun2nix", "repo": "bun2nix",
"rev": "5a39d717029e94163ac223aee8d5c9946cafed1c", "rev": "0f2a1f0b6f42cebe3b149bf62d38754c5e0e9729",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -142,6 +117,24 @@
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib_2" "nixpkgs-lib": "nixpkgs-lib_2"
}, },
"locked": {
"lastModified": 1772408722,
"narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_4": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_3"
},
"locked": { "locked": {
"lastModified": 1769996383, "lastModified": 1769996383,
"narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=",
@@ -156,24 +149,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -181,11 +156,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1783221248, "lastModified": 1784350909,
"narHash": "sha256-ESQnuNHEDChsB4IxoLRhscVahqkDWkTb+qdIz8euYt4=", "narHash": "sha256-ZWyzLbS1yKUTeFJLmdVuWNnHttL333/ldJbEE+KzCrM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "af2beae5f0fae0a4310cc0e6aef2572f56090353", "rev": "4ce190229c73d44536caa7072f6308fb2d8feeb3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -202,11 +177,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1783221248, "lastModified": 1784350909,
"narHash": "sha256-ESQnuNHEDChsB4IxoLRhscVahqkDWkTb+qdIz8euYt4=", "narHash": "sha256-ZWyzLbS1yKUTeFJLmdVuWNnHttL333/ldJbEE+KzCrM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "af2beae5f0fae0a4310cc0e6aef2572f56090353", "rev": "4ce190229c73d44536caa7072f6308fb2d8feeb3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -219,16 +194,14 @@
"hunk": { "hunk": {
"inputs": { "inputs": {
"bun2nix": "bun2nix", "bun2nix": "bun2nix",
"nixpkgs": [ "nixpkgs": "nixpkgs"
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1783426737, "lastModified": 1784815837,
"narHash": "sha256-yQFZXU2rFrwR+OJMktg9Zvrn3jnfVcQAuT8fWVNsnCs=", "narHash": "sha256-fVBvarngVvsCS1QaKU2LSa/YmZn2l8oOkXI+EYWlURc=",
"owner": "modem-dev", "owner": "modem-dev",
"repo": "hunk", "repo": "hunk",
"rev": "059dd13c8bd27fe503ef59652077edf0041034c8", "rev": "b358e0c92eabaa35529d3f3d9afaad2944c825e4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -254,19 +227,18 @@
}, },
"llm-agents": { "llm-agents": {
"inputs": { "inputs": {
"blueprint": "blueprint",
"bun2nix": "bun2nix_2", "bun2nix": "bun2nix_2",
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_2",
"systems": "systems_2", "systems": "systems_2",
"treefmt-nix": "treefmt-nix_2" "treefmt-nix": "treefmt-nix_2"
}, },
"locked": { "locked": {
"lastModified": 1783567605, "lastModified": 1784790164,
"narHash": "sha256-LyF84yqWppXAAEOAkL325Lt+DrVmkbbeXGzDgX9zMzI=", "narHash": "sha256-woSpbXXGmy1zUnetetY6WiVdXz0WFGAsxHgCc+87oqU=",
"owner": "numtide", "owner": "numtide",
"repo": "llm-agents.nix", "repo": "llm-agents.nix",
"rev": "a4c847460f0e773d02d0655ce28dc6b532dd65d6", "rev": "de9fa923ea0ebed9093f758468d7ed7c5da09739",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -277,37 +249,31 @@
}, },
"nix-darwin": { "nix-darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": "nixpkgs_3"
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1783395956, "lastModified": 1784500460,
"narHash": "sha256-AAbexQvDoK+6GFJdhY6kqjA+6ECKRkidgWxkn4gMwAA=", "narHash": "sha256-UvORnAxTRHax7RG74W8Z2t4GvIkX6AjJ5kk0QlwZomo=",
"owner": "LnL7", "owner": "nix-darwin",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "d5bd9cd77aea4c0a8f49e7fd85545671a208ed15", "rev": "57a3171f94705599a2499248ca5758d5eb47c0e0",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "LnL7", "id": "nix-darwin",
"repo": "nix-darwin", "type": "indirect"
"type": "github"
} }
}, },
"nixos-vscode-server": { "nixos-vscode-server": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-parts": "flake-parts_3"
"nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1770124655, "lastModified": 1784312229,
"narHash": "sha256-yHmd2B13EtBUPLJ+x0EaBwNkQr9LTne1arLVxT6hSnY=", "narHash": "sha256-2uHCSUw341o3my1R0U0YCfbnMEazylxb58evWsjGL50=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixos-vscode-server", "repo": "nixos-vscode-server",
"rev": "92ce71c3ba5a94f854e02d57b14af4997ab54ef0", "rev": "2f984dfbe7e5271b5c413d3e734374cc1306c921",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -324,11 +290,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1780705040, "lastModified": 1784058838,
"narHash": "sha256-pVadZqLm8RJcwLuDzJm7d2KO6e+RHPpIa/2qdqtn+B4=", "narHash": "sha256-499ZAnS4nWV2Wtgoi3WdbIVuZbNoN7KptltceQhZc38=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixos-wsl", "repo": "nixos-wsl",
"rev": "add6b01c7ca72240046b5d541a74845423f1ee35", "rev": "787a4c128292010ad182eed66f879fa688592e4c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -340,16 +306,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1783279667, "lastModified": 1777954456,
"narHash": "sha256-/NAkDSsve+GNM0Bt6tleJdCGfsTlK89nPjkVOzZMo0s=", "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f205b5574fd0cb7da5b702a2da51507b7f4fdd1b", "rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@@ -370,6 +336,21 @@
} }
}, },
"nixpkgs-lib_2": { "nixpkgs-lib_2": {
"locked": {
"lastModified": 1772328832,
"narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "c185c7a5e5dd8f9add5b2f8ebeff00888b070742",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-lib_3": {
"locked": { "locked": {
"lastModified": 1769909678, "lastModified": 1769909678,
"narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=", "narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=",
@@ -386,11 +367,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1783389287, "lastModified": 1784432872,
"narHash": "sha256-0xIy4dVLqq47rA+mRy0hXDfjhQd4E5PoIns/RmB7nR4=", "narHash": "sha256-n3gKTBIV4ZA5VQpUakffBe3KGu4+mhPoA34rrqS0GkA=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0ad6f47ea4fe188f4bc8f0380f93ae8523337c6c", "rev": "fd1462031fdee08f65fd0b4c6b64e22239a77870",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -402,11 +383,11 @@
}, },
"nixpkgs-wsl-stable": { "nixpkgs-wsl-stable": {
"locked": { "locked": {
"lastModified": 1783389287, "lastModified": 1784432872,
"narHash": "sha256-0xIy4dVLqq47rA+mRy0hXDfjhQd4E5PoIns/RmB7nR4=", "narHash": "sha256-n3gKTBIV4ZA5VQpUakffBe3KGu4+mhPoA34rrqS0GkA=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0ad6f47ea4fe188f4bc8f0380f93ae8523337c6c", "rev": "fd1462031fdee08f65fd0b4c6b64e22239a77870",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -418,11 +399,43 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1783224372, "lastModified": 1784555310,
"narHash": "sha256-8i/87eeoqiGE4yOTjwSA3Eh/ziJRQEmd/unYU+K27sk=", "narHash": "sha256-/FCliTPgiuV1owejZFNx3Ch9irdvkOfOFl+HHZ+DrtM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "421eebfd0ec7bccd4abe826ce62d7e6e83129493",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1783279667,
"narHash": "sha256-/NAkDSsve+GNM0Bt6tleJdCGfsTlK89nPjkVOzZMo0s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f205b5574fd0cb7da5b702a2da51507b7f4fdd1b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1784497964,
"narHash": "sha256-vlHUuqAcbcH2RKmHbPiuQzbv1pnzzavXnI62RD0bqCU=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d407951447dcd00442e97087bf374aad70c04cea", "rev": "241313f4e8e508cb9b13278c2b0fa25b9ca27163",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -432,7 +445,23 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_5": {
"locked": {
"lastModified": 1782175435,
"narHash": "sha256-EMzXKmnOtBQ2MnvpiNOm7E+kOMvdPrIKaeg52Tip2Uk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "89570f24e97e614aa34aa9ab1c927b6578a43775",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_6": {
"locked": { "locked": {
"lastModified": 1771369470, "lastModified": 1771369470,
"narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=", "narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
@@ -457,7 +486,7 @@
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixos-vscode-server": "nixos-vscode-server", "nixos-vscode-server": "nixos-vscode-server",
"nixos-wsl": "nixos-wsl", "nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_4",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-wsl-stable": "nixpkgs-wsl-stable", "nixpkgs-wsl-stable": "nixpkgs-wsl-stable",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
@@ -466,9 +495,7 @@
}, },
"sops-nix": { "sops-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": "nixpkgs_5"
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1783174389, "lastModified": 1783174389,
@@ -514,25 +541,10 @@
"type": "github" "type": "github"
} }
}, },
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"tasksquire": { "tasksquire": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_3", "flake-parts": "flake-parts_4",
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_6"
}, },
"locked": { "locked": {
"lastModified": 1771878653, "lastModified": 1771878653,
@@ -579,11 +591,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1780220602, "lastModified": 1784369104,
"narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=", "narHash": "sha256-47cxbcZODibHv3rELFQ9vZly0vUNkND/atn/U7HLeb0=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "db947814a175b7ca6ded66e21383d938df01c227", "rev": "df3c0640565d04a0261253cdd89fce78ec50168a",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -24,20 +24,17 @@
inputs.nixpkgs.follows = "nixpkgs-wsl-stable"; inputs.nixpkgs.follows = "nixpkgs-wsl-stable";
}; };
nix-darwin = { # nix-darwin = {
url = "github:LnL7/nix-darwin"; # url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs"; # };
};
# individual packages # individual packages
sops-nix = { sops-nix = {
url = "github:Mic92/sops-nix"; url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
}; };
nixos-vscode-server = { nixos-vscode-server = {
url = "github:nix-community/nixos-vscode-server"; url = "github:nix-community/nixos-vscode-server";
inputs.nixpkgs.follows = "nixpkgs";
}; };
tasksquire = { tasksquire = {
@@ -46,7 +43,6 @@
hunk = { hunk = {
url = "github:modem-dev/hunk"; url = "github:modem-dev/hunk";
inputs.nixpkgs.follows = "nixpkgs";
}; };
llm-agents.url = "github:numtide/llm-agents.nix"; llm-agents.url = "github:numtide/llm-agents.nix";
@@ -56,11 +52,11 @@
let let
linuxSystem = "x86_64-linux"; linuxSystem = "x86_64-linux";
linuxAarchSystem = "aarch64-linux"; linuxAarchSystem = "aarch64-linux";
darwinSystem = "aarch64-darwin"; # darwinSystem = "aarch64-darwin";
pkgsLinux = nixpkgs.legacyPackages.${linuxSystem}; pkgsLinux = nixpkgs.legacyPackages.${linuxSystem};
pkgsLinuxAarch = nixpkgs.legacyPackages.${linuxAarchSystem}; pkgsLinuxAarch = nixpkgs.legacyPackages.${linuxAarchSystem};
pkgsDarwin = nixpkgs.legacyPackages.${darwinSystem}; # pkgsDarwin = nixpkgs.legacyPackages.${darwinSystem};
in in
{ {
@@ -117,17 +113,17 @@
}; };
}; };
# --- Darwin Systems (Mac) --- # # --- Darwin Systems (Mac) ---
darwinConfigurations."Martins-MacBook-Pro" = nix-darwin.lib.darwinSystem { # darwinConfigurations."Martins-MacBook-Pro" = nix-darwin.lib.darwinSystem {
specialArgs = { inherit self inputs; }; # specialArgs = { inherit self inputs; };
modules = [ # modules = [
./hosts/home/darwin/configuration.nix # ./hosts/home/darwin/configuration.nix
{ # {
nixpkgs.hostPlatform = darwinSystem; # nixpkgs.hostPlatform = darwinSystem;
} # }
]; # ];
}; # };
#
# --- Standalone Home Manager --- # --- Standalone Home Manager ---
homeConfigurations = { homeConfigurations = {
"nix@work" = home-manager.lib.homeManagerConfiguration { "nix@work" = home-manager.lib.homeManagerConfiguration {
@@ -142,17 +138,17 @@
]; ];
}; };
"nix@home" = home-manager.lib.homeManagerConfiguration { # "nix@home" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs-stable.legacyPackages.${darwinSystem}; # pkgs = nixpkgs-stable.legacyPackages.${darwinSystem};
extraSpecialArgs = { inherit self inputs; }; # extraSpecialArgs = { inherit self inputs; };
modules = [ # modules = [
./hosts/home/nix/home.nix # ./hosts/home/nix/home.nix
{ # {
nixpkgs.config.allowUnfree = true; # nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [ (import ./modules/overlays/unstable.nix nixpkgs) ]; # nixpkgs.overlays = [ (import ./modules/overlays/unstable.nix nixpkgs) ];
} # }
]; # ];
}; # };
}; };
}; };
} }

View File

@@ -17,7 +17,8 @@
dot.llm = { dot.llm = {
enable = true; enable = true;
gemini-cli.enable = true; pi.enable = true;
pi.enableConfig = true;
opencode.enable = true; opencode.enable = true;
opencode.enableConfig = true; opencode.enableConfig = true;
# pi.enable = true; # pi.enable = true;

View File

@@ -21,6 +21,8 @@
opencode.enableConfig = true; opencode.enableConfig = true;
opencode.workMode = true; opencode.workMode = true;
pi.enable = true; pi.enable = true;
pi.enableConfig = true;
pi.workMode = true;
}; };
dot.tmux.workMode = true; dot.tmux.workMode = true;

View File

@@ -17,7 +17,7 @@
./dev.nix ./dev.nix
./nvim.nix ./nvim.nix
./task.nix ./task.nix
./opencode.nix ./llm.nix
]; ];
config = { config = {

View File

@@ -1,40 +1,7 @@
{ config, pkgs, lib, inputs, ... }: { pkgs, ... }:
let
cfg = config.dot.llm;
in
{ {
options.dot.llm = { config = {
enable = lib.mkEnableOption "LLM tools";
claude-code.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable claude-code";
};
opencode.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable opencode";
};
gemini-cli.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable gemini-cli";
};
pi.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable pi";
};
bubblewrap.enable = lib.mkOption {
type = lib.types.bool;
default = pkgs.stdenv.isLinux;
description = "Enable bubblewrap (Linux only)";
};
};
config = lib.mkMerge [
{
programs.direnv = { programs.direnv = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
@@ -55,17 +22,7 @@ in
visidata visidata
codespelunker codespelunker
jq jq
inputs.hunk.packages.${pkgs.stdenv.hostPlatform.system}.hunk unstable.tuicr
];
}
(lib.mkIf cfg.enable {
home.packages =
(lib.optional cfg.claude-code.enable pkgs.unstable.claude-code) ++
(lib.optional cfg.opencode.enable pkgs.unstable.opencode) ++
(lib.optional cfg.gemini-cli.enable pkgs.unstable.gemini-cli) ++
(lib.optional cfg.pi.enable inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.pi) ++
(lib.optional (cfg.bubblewrap.enable && pkgs.stdenv.isLinux) pkgs.unstable.bubblewrap);
})
]; ];
};
} }

View File

@@ -56,6 +56,7 @@
ignores = [ ignores = [
".direnv/" ".direnv/"
".envrc" ".envrc"
".pi/"
]; ];
}; };

124
modules/home/llm.nix Normal file
View File

@@ -0,0 +1,124 @@
{ config, pkgs, lib, inputs, ... }:
let
cfg = config.dot.llm;
piPath = "${config.dot.dotfilesPath}/modules/pi/agent";
opencodePath = "${config.dot.dotfilesPath}/modules/opencode";
in
{
options.dot.llm = {
enable = lib.mkEnableOption "LLM tools";
claude-code.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable claude-code";
};
gemini-cli.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable gemini-cli";
};
bubblewrap.enable = lib.mkOption {
type = lib.types.bool;
default = pkgs.stdenv.isLinux;
description = "Enable bubblewrap (Linux only)";
};
opencode = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable opencode";
};
enableConfig = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable managed OpenCode configuration";
};
workMode = lib.mkEnableOption "work-specific opencode configuration";
};
pi = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable pi";
};
enableConfig = lib.mkEnableOption "managed pi coding agent configuration" // {
default = true;
};
workMode = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Apply work machine (WSL NixOS) specific pi patches";
};
};
};
config = lib.mkMerge [
(lib.mkIf cfg.enable {
home.packages =
(lib.optional cfg.claude-code.enable pkgs.unstable.claude-code) ++
(lib.optional cfg.opencode.enable pkgs.unstable.opencode) ++
(lib.optional cfg.gemini-cli.enable pkgs.unstable.gemini-cli) ++
(lib.optional cfg.pi.enable (
let
pi = inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.pi;
in
if cfg.pi.workMode then
# Work machine runs WSL NixOS, which needs the checks disabled and the
# Bun binary's ELF interpreter patched to the correct dynamic linker.
pi.overrideAttrs (oldAttrs: {
doInstallCheck = false;
# Run patchelf after the package is installed/fixed up by nix
postFixup = (oldAttrs.postFixup or "") + ''
# 1. Target the actual Bun binary inside libexec, not the shell wrapper in bin/
TARGET_BIN="$out/libexec/pi/pi"
if [ -f "$TARGET_BIN" ]; then
# 2. Make it writable in the build store so patchelf can edit it
chmod +w "$TARGET_BIN"
# 3. Running patchelf to set the interpreter forces it to rebuild the ELF headers
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$TARGET_BIN"
fi
'';
})
else
pi
)) ++
(lib.optional (cfg.bubblewrap.enable && pkgs.stdenv.isLinux) pkgs.unstable.bubblewrap);
})
# pi coding agent configuration
(lib.mkIf cfg.pi.enableConfig {
home.file = {
".pi/agent/settings.json".source =
config.lib.file.mkOutOfStoreSymlink
"${piPath}/${if cfg.pi.workMode then "settings.work" else "settings.home"}.json";
".pi/agent/extensions".source =
config.lib.file.mkOutOfStoreSymlink "${piPath}/extensions-common";
} // lib.optionalAttrs cfg.pi.workMode {
".pi/agent/extensions-work".source =
config.lib.file.mkOutOfStoreSymlink "${piPath}/extensions-work";
".pi/agent/models.json".source =
config.lib.file.mkOutOfStoreSymlink "${piPath}/models.work.json";
};
})
# OpenCode configuration
(lib.mkIf cfg.opencode.enableConfig {
xdg.configFile."opencode/opencode.json".source =
config.lib.file.mkOutOfStoreSymlink
"${opencodePath}/opencode.${if cfg.opencode.workMode then "work" else "home"}.json";
})
];
}

View File

@@ -58,6 +58,7 @@ in
nvim-lspconfig nvim-lspconfig
lspkind-nvim lspkind-nvim
# opencode-nvim # opencode-nvim
pi-nvim
bullets-vim bullets-vim
nvim-dap nvim-dap
nvim-nio nvim-nio
@@ -75,7 +76,9 @@ in
image-nvim image-nvim
img-clip-nvim img-clip-nvim
vim-nix vim-nix
indent-blankline-nvim
(nvim-treesitter.withPlugins (p: [ p.awk p.bash p.c p.c_sharp p.cpp p.css p.diff p.dockerfile p.doxygen p.git_config p.gitcommit p.go p.gomod p.gosum p.gotmpl p.helm p.haskell p.html p.http p.java p.javascript p.json p.latex p.lua p.markdown p.markdown_inline p.matlab p.nix p.printf p.python p.regex p.rust p.sql p.strace p.supercollider p.svelte p.swift p.terraform p.tmux p.toml p.typescript p.vim p.xml p.yaml p.zig ])) (nvim-treesitter.withPlugins (p: [ p.awk p.bash p.c p.c_sharp p.cpp p.css p.diff p.dockerfile p.doxygen p.git_config p.gitcommit p.go p.gomod p.gosum p.gotmpl p.helm p.haskell p.html p.http p.java p.javascript p.json p.latex p.lua p.markdown p.markdown_inline p.matlab p.nix p.printf p.python p.regex p.rust p.sql p.strace p.supercollider p.svelte p.swift p.terraform p.tmux p.toml p.typescript p.vim p.xml p.yaml p.zig ]))
nvim-treesitter-context
]; ];
initLua = '' initLua = ''

View File

@@ -1,92 +0,0 @@
{ config, lib, inputs, ... }:
let
cfg = config.dot.llm.opencode;
in
{
options.dot.llm.opencode = {
enableConfig = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable managed OpenCode configuration";
};
workMode = lib.mkEnableOption "work-specific opencode configuration";
};
config = lib.mkIf cfg.enableConfig {
# Declare the sops secret
sops.secrets.langdock_api_key = {
# Uses defaultSopsFile from secrets.nix
};
# Create the OpenCode config.json template with secret substitution
sops.templates."opencode/opencode.json" = {
content = builtins.toJSON (let
baseConfig = {
"$schema" = "https://opencode.ai/config.json";
default_agent = "plan";
};
workConfig = {
enabled_providers = [ "anthropic" "langdock-openai" "ollama" ];
model = "anthropic/claude-opus-4-6-default";
small_model = "anthropic/claude-haiku-4-5-20251001";
provider = {
langdock-openai = {
npm = "@ai-sdk/openai-compatible";
name = "Langdock OpenAI";
options = {
baseURL = "https://api.langdock.com/openai/eu/v1";
apiKey = config.sops.placeholder.langdock_api_key;
};
models = {
"gpt-5.5" = { name = "GPT-5.5"; };
"gpt-5.4" = { name = "GPT-5.4"; };
"gpt-5.4-mini" = { name = "GPT-5.4 mini"; };
};
};
anthropic = {
options = {
baseURL = "https://api.langdock.com/anthropic/eu/v1";
apiKey = config.sops.placeholder.langdock_api_key;
};
models = {
"claude-opus-4-8-default" = { name = "Opus 4.8"; };
"claude-opus-4-7-default" = { name = "Opus 4.7"; };
"claude-opus-4-6-default" = { name = "Opus 4.6"; };
"claude-sonnet-4-6-default" = { name = "Sonnet 4.6"; };
"claude-haiku-4-5-20251001" = { name = "Haiku 4.5"; };
};
whitelist = ["claude-opus-4-8-default" "claude-opus-4-7-default" "claude-opus-4-6-default" "claude-sonnet-4-6-default" "claude-haiku-4-5-20251001"];
};
# ollama = {
# npm = "@ai-sdk/openai-compatible";
# name = "Ollama (Local)";
# options = {
# baseURL = "http://192.168.11.23:11434/v1";
# };
# models = {
# "qwen3-coder:30b" = { name = "Qwen 3 Coder 30B"; };
# "codellama:34b-instruct" = { name = "CodeLlama 34B Instruct"; };
# };
# };
};
};
personalConfig = {
plugin = [ "opencode-gemini-auth@latest" ];
model = "google/gemini-3-pro-preview";
small_model = "google/gemini-3-flash-preview";
enabled_providers = [ "google" ];
};
in
# Merge base config with the selected mode config
baseConfig // (if cfg.workMode then workConfig else personalConfig)
);
};
# Link the generated config to the expected location
xdg.configFile."opencode/opencode.json".source = config.lib.file.mkOutOfStoreSymlink config.sops.templates."opencode/opencode.json".path;
};
}

View File

@@ -1,5 +1,11 @@
{ inputs, config, ... }: { inputs, config, lib, ... }:
let
# Both pi and opencode talk to Langdock on work machines and expect the API
# key in the environment, so the secret is managed here rather than in the
# individual agent modules.
needsLangdock = config.dot.llm.pi.workMode || config.dot.llm.opencode.workMode;
in
{ {
imports = [ imports = [
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
@@ -12,9 +18,24 @@
age = { age = {
keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
}; };
secrets = lib.mkIf needsLangdock {
langdock_api_key = {
# Uses defaultSopsFile from secrets.nix
};
};
}; };
home.sessionVariables = { home.sessionVariables = {
SOPS_AGE_KEY_FILE = config.sops.age.keyFile; SOPS_AGE_KEY_FILE = config.sops.age.keyFile;
}; };
# Export the decrypted langdock API key as an env var. The secret lives in a
# runtime file, so it is read at shell startup rather than baked into the Nix
# store via home.sessionVariables.
programs.zsh.initContent = lib.mkIf needsLangdock ''
if [ -r "${config.sops.secrets.langdock_api_key.path}" ]; then
export LANGDOCK_API_KEY="$(cat "${config.sops.secrets.langdock_api_key.path}")"
fi
'';
} }

View File

@@ -150,15 +150,15 @@ in
${lib.optionalString cfg.workMode '' ${lib.optionalString cfg.workMode ''
bind C-s display-popup -E "projectSelector" bind C-s display-popup -E "projectSelector"
bind C-n display-popup -E -xC -yC -w 95% -h 95% -d "/mnt/c/Users/marti/Documents/notes/Work/" "vim quick_notes.md" bind C-n display-popup -E -xC -yC -w 95% -h 95% -d "/mnt/c/Users/marti/Documents/notes/Work/" "vim -c 'nnoremap q :wqa<CR>' quick_notes.md"
bind C-q display-popup -E -xC -yC -w 95% -h 95% " \ bind C-q display-popup -E -xC -yC -w 95% -h 95% " \
SESSION_NAME=\$(tmux display-message -p '#S'); \ SESSION_NAME=\$(tmux display-message -p '#S'); \
if [ \"\$SESSION_NAME\" = 'misc' ]; then \ if [ \"\$SESSION_NAME\" = 'misc' ]; then \
cd '/mnt/c/Users/marti/Documents/notes/Work/' && vim task_notes.md; \ cd '/mnt/c/Users/marti/Documents/notes/Work/' && vim -c 'nnoremap q :wqa<CR>' task_notes.md; \
else \ else \
cd \"\$HOME/pro/\$SESSION_NAME\" && vim task_notes.md; \ cd \"\$HOME/pro/\$SESSION_NAME\" && vim -c 'nnoremap q :wqa<CR>' task_notes.md; \
fi" fi"
bind C-p display-popup -E -xC -yC -w 95% -h 95% -d "/mnt/c/Users/marti/Documents/notes/Work/development/" "vim mbpr.md" bind C-p display-popup -E -xC -yC -w 95% -h 95% -d "/mnt/c/Users/marti/Documents/notes/Work/development/" "vim -c 'nnoremap q :wqa<CR>' mbpr.md"
''} ''}
####################################### #######################################

View File

@@ -38,7 +38,10 @@ vim.lsp.config('basedpyright', {
analysis = { analysis = {
indexing = true, indexing = true,
typeCheckingMode = "standard", typeCheckingMode = "standard",
autoImportCompletions = true autoImportCompletions = true,
diagnosticSeverityOverrides = {
reportAttributeAccessIssue = "none",
},
} }
} }
} }

View File

@@ -103,6 +103,11 @@ vim.keymap.set('v', '<leader>cf',
end end
) )
vim.keymap.set("n", "<leader>ai", ":PiAsk<CR>", { desc = "Ask pi" })
vim.keymap.set("v", "<leader>ai", ":PiAskSelection<CR>", { desc = "Ask pi (selection)" })
vim.keymap.set("n", "<leader>ac", ":PiCancel<CR>", { desc = "Cancel pi request" })
vim.keymap.set("n", "<leader>al", ":PiLog<CR>", { desc = "Show session log" })
-- Yanky -- Yanky
vim.keymap.set({"n","x"}, "p", "<Plug>(YankyPutAfter)") vim.keymap.set({"n","x"}, "p", "<Plug>(YankyPutAfter)")
vim.keymap.set({"n","x"}, "P", "<Plug>(YankyPutBefore)") vim.keymap.set({"n","x"}, "P", "<Plug>(YankyPutBefore)")
@@ -135,10 +140,11 @@ vim.keymap.set('n', "<leader>dt", function() require("dap").terminate() end)
vim.keymap.set('n', "<leader>dw", function() require("dap.ui.widgets").hover() end) vim.keymap.set('n', "<leader>dw", function() require("dap.ui.widgets").hover() end)
vim.keymap.set('n', "<leader>dv", function() require("dap-view").toggle() end) vim.keymap.set('n', "<leader>dv", function() require("dap-view").toggle() end)
vim.keymap.set('n', "<F5>", function() require("dap").continue() end) vim.keymap.set('n', "<F5>", function() require("dap").continue() end, { desc = "Debug: Continue/Start" })
vim.keymap.set('n', "<F1>", function() require("dap").step_over() end) vim.keymap.set('n', "<S-F5>", function() require("dap").terminate() end, { desc = "Debug: Stop" })
vim.keymap.set('n', "<F2>", function() require("dap").step_into() end) vim.keymap.set('n', "<F6>", function() require("dap").pause() end, { desc = "Debug: Pause" })
vim.keymap.set('n', "<F3>", function() require("dap").step_out() end) vim.keymap.set('n', "<F9>", function() require("dap").toggle_breakpoint() end, { desc = "Debug: Toggle Breakpoint" })
vim.keymap.set('n', "<F4>", function() require("dap").run_to_cursor() end) vim.keymap.set('n', "<F10>", function() require("dap").step_over() end, { desc = "Debug: Step Over" })
vim.keymap.set('n', "<F11>", function() require("dap").step_into() end, { desc = "Debug: Step Into" })
vim.keymap.set('n', "<S-F11>", function() require("dap").step_out() end, { desc = "Debug: Step Out" })

View File

@@ -523,3 +523,12 @@ require('render-markdown').setup({
}, },
}) })
require('treesitter-context').setup{
multiwindow = true,
}
vim.api.nvim_set_hl(0, "TreesitterContextBottom", {
underline = true,
sp = "Grey"
})
require('ibl').setup()

View File

@@ -0,0 +1,12 @@
{
"$schema": "https://opencode.ai/config.json",
"default_agent": "plan",
"plugin": [
"opencode-gemini-auth@latest"
],
"model": "google/gemini-3-pro-preview",
"small_model": "google/gemini-3-flash-preview",
"enabled_providers": [
"google"
]
}

View File

@@ -0,0 +1,75 @@
{
"$schema": "https://opencode.ai/config.json",
"default_agent": "plan",
"enabled_providers": [
"anthropic",
"langdock-openai",
"sparkr",
"sparkl"
],
"model": "anthropic/claude-opus-5-default",
"small_model": "anthropic/claude-sonnet-5-default",
"provider": {
"sparkr": {
"npm": "@ai-sdk/openai-compatible",
"name": "sparkr",
"options": {
"baseURL": "http://192.168.10.110:8000/v1",
"apiKey": "vllm"
},
"models": {
"Qwen/Qwen3-Coder-Next-FP8": {
"name": "Qwen3 Coder Next FP8 (local vLLM)",
"tool_call": true,
"reasoning": false,
"limit": { "context": 262144, "output": 8192 }
}
}
},
"sparkl": {
"npm": "@ai-sdk/openai-compatible",
"name": "sparkl",
"options": {
"baseURL": "http://192.168.10.111:8000/v1",
"apiKey": "vllm"
},
"models": {
"Qwen/Qwen3-30B-A3B": {
"name": "Qwen3 30B A3B (local vLLM)",
"tool_call": true,
"reasoning": true,
"limit": { "context": 16384, "output": 8192 }
}
}
},
"langdock-openai": {
"npm": "@ai-sdk/openai-compatible",
"name": "Langdock OpenAI",
"options": {
"baseURL": "https://api.langdock.com/openai/eu/v1",
"apiKey": "{env:LANGDOCK_API_KEY}"
},
"models": {
"gpt-5.6-sol": { "name": "GPT-5.6 Sol" },
"gpt-5.6-terra": { "name": "GPT-5.6 Terra" },
"gpt-5.6-luna": { "name": "GPT-5.6 Luna" }
}
},
"anthropic": {
"options": {
"baseURL": "https://api.langdock.com/anthropic/eu/v1",
"apiKey": "{env:LANGDOCK_API_KEY}"
},
"models": {
"claude-opus-5-default": { "name": "Opus 5" },
"claude-opus-4-8-default": { "name": "Opus 4.8" },
"claude-sonnet-5-default": { "name": "Sonnet 5" }
},
"whitelist": [
"claude-opus-4-8-default",
"claude-opus-5-default",
"claude-sonnet-5-default"
]
}
}
}

View File

@@ -0,0 +1,66 @@
# Plan Mode Extension
Read-only exploration mode for safe code analysis.
## Features
- **Built-in write tools disabled**: Disables edit/write while preserving other active tools
- **Bash allowlist**: Only read-only bash commands are allowed
- **Plan extraction**: Extracts numbered steps from `Plan:` sections
- **Progress tracking**: Widget shows completion status during execution
- **[DONE:n] markers**: Explicit step completion tracking
- **Session persistence**: State survives session resume
## Commands
- `/plan` - Toggle plan mode
- `/todos` - Show current plan progress
- `Ctrl+Alt+P` - Toggle plan mode (shortcut)
## Usage
1. Enable plan mode with `/plan` or `--plan` flag
2. Ask the agent to analyze code and create a plan
3. The agent should output a numbered plan under a `Plan:` header:
```
Plan:
1. First step description
2. Second step description
3. Third step description
```
4. Choose "Execute the plan" when prompted
5. During execution, the agent marks steps complete with `[DONE:n]` tags
6. Progress widget shows completion status
## How It Works
### Plan Mode (Read-Only)
- Built-in edit/write tools disabled
- Other active tools remain available
- Bash commands filtered through allowlist
- Agent creates a plan without making changes
### Execution Mode
- Full tool access restored
- Agent executes steps in order
- `[DONE:n]` markers track completion
- Widget shows progress
### Command Allowlist
Safe commands (allowed):
- File inspection: `cat`, `head`, `tail`, `less`, `more`
- Search: `grep`, `find`, `rg`, `fd`
- Directory: `ls`, `pwd`, `tree`
- Git read: `git status`, `git log`, `git diff`, `git branch`
- Package info: `npm list`, `npm outdated`, `yarn info`
- System info: `uname`, `whoami`, `date`, `uptime`
Blocked commands:
- File modification: `rm`, `mv`, `cp`, `mkdir`, `touch`
- Git write: `git add`, `git commit`, `git push`
- Package install: `npm install`, `yarn add`, `pip install`
- System: `sudo`, `kill`, `reboot`
- Editors: `vim`, `nano`, `code`

View File

@@ -0,0 +1,579 @@
/**
* Plan Mode Extension
*
* Read-only exploration + structured planning + gated step-by-step execution.
*
* Features:
* - /plan command or Ctrl+Alt+P to toggle read-only plan mode
* - Bash restricted to allowlisted read-only commands, edit/write disabled
* - `submit_plan` tool: model returns a STRUCTURED plan (title + steps + risks + files)
* - Plans are saved to `.pi/plans/<slug>-<timestamp>.md` (recognizable name + timestamp)
* - Per-step execution gating: you approve/skip/stop each step before it runs
* - Progress tracking widget + footer status, persisted across resume
*/
import type { AgentMessage } from "@earendil-works/pi-agent-core";
import type { TextContent } from "@earendil-works/pi-ai";
import {
CONFIG_DIR_NAME,
type ExtensionAPI,
type ExtensionContext,
} from "@earendil-works/pi-coding-agent";
import { Key } from "@earendil-works/pi-tui";
import { mkdir, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { Type, type Static } from "typebox";
import { isSafeCommand } from "./utils.ts";
// Tools
const PLAN_MODE_TOOLS = ["read", "bash", "grep", "find", "ls", "questionnaire", "submit_plan"];
const NORMAL_MODE_TOOLS = ["read", "bash", "edit", "write"];
const PLAN_MODE_DISABLED_TOOLS = new Set<string>(["edit", "write"]);
const PLAN_MANAGED_TOOLS = new Set<string>([...PLAN_MODE_TOOLS, ...NORMAL_MODE_TOOLS]);
type Phase = "planning" | "awaiting-approval" | "executing";
interface PlanStep {
text: string;
completed?: boolean;
skipped?: boolean;
}
interface StoredPlan {
title: string;
createdAt: string;
steps: PlanStep[];
risks?: string[];
files?: string[];
}
interface PlanModeState {
enabled: boolean;
phase?: Phase;
plan?: StoredPlan;
currentStepIndex?: number;
planFilePath?: string;
toolsBeforePlanMode?: string[];
}
// ---- submit_plan tool schema ----
const submitPlanSchema = Type.Object({
title: Type.String({
description: "A short, recognizable name for this plan (e.g. 'Add OAuth login').",
}),
steps: Type.Array(
Type.Object({
description: Type.String({ description: "A single, concrete, actionable step." }),
}),
{ description: "Ordered list of steps to implement the plan." },
),
risks: Type.Optional(Type.Array(Type.String(), { description: "Potential risks, caveats, or open questions." })),
files: Type.Optional(Type.Array(Type.String(), { description: "Files likely to be created or modified." })),
});
export type SubmitPlanInput = Static<typeof submitPlanSchema>;
// ---- file persistence helpers ----
function slugify(title: string): string {
const slug = title
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "")
.slice(0, 50)
.replace(/-+$/g, "");
return slug || "plan";
}
function fileTimestamp(): string {
const d = new Date();
const p = (n: number) => String(n).padStart(2, "0");
return `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`;
}
function renderPlanMarkdown(plan: StoredPlan): string {
const lines: string[] = [];
lines.push(`# ${plan.title}`);
lines.push("");
lines.push(`_Created: ${plan.createdAt}_`);
lines.push("");
lines.push("## Steps");
lines.push("");
plan.steps.forEach((s, i) => {
const box = s.completed ? "x" : " ";
const suffix = s.skipped ? " _(skipped)_" : "";
lines.push(`${i + 1}. [${box}] ${s.text}${suffix}`);
});
if (plan.risks?.length) {
lines.push("");
lines.push("## Risks");
lines.push("");
for (const r of plan.risks) lines.push(`- ${r}`);
}
if (plan.files?.length) {
lines.push("");
lines.push("## Files");
lines.push("");
for (const f of plan.files) lines.push(`- ${f}`);
}
lines.push("");
return lines.join("\n");
}
export default function planModeExtension(pi: ExtensionAPI): void {
let planModeEnabled = false;
let phase: Phase | undefined;
let plan: StoredPlan | undefined;
let currentStepIndex = 0;
let awaitingStep = false;
let planFilePath: string | undefined;
let toolsBeforePlanMode: string[] | undefined;
pi.registerFlag("plan", {
description: "Start in plan mode (read-only exploration)",
type: "boolean",
default: false,
});
// ---- tool management ----
function uniqueToolNames(toolNames: string[]): string[] {
return [...new Set(toolNames)];
}
function getPlanModeTools(activeToolNames: string[]): string[] {
return uniqueToolNames([
...activeToolNames.filter((name) => !PLAN_MODE_DISABLED_TOOLS.has(name)),
...PLAN_MODE_TOOLS,
]);
}
function getNormalModeTools(activeToolNames: string[]): string[] {
return uniqueToolNames([
...NORMAL_MODE_TOOLS,
...activeToolNames.filter((name) => !PLAN_MANAGED_TOOLS.has(name)),
]);
}
function enablePlanModeTools(): void {
if (toolsBeforePlanMode === undefined) {
toolsBeforePlanMode = pi.getActiveTools();
}
pi.setActiveTools(getPlanModeTools(toolsBeforePlanMode));
}
function restoreNormalModeTools(): void {
pi.setActiveTools(toolsBeforePlanMode ?? getNormalModeTools(pi.getActiveTools()));
toolsBeforePlanMode = undefined;
}
// ---- state ----
function persistState(): void {
pi.appendEntry("plan-mode", {
enabled: planModeEnabled,
phase,
plan,
currentStepIndex,
planFilePath,
toolsBeforePlanMode,
} satisfies PlanModeState);
}
async function persistPlanFile(): Promise<void> {
if (!planFilePath || !plan) return;
try {
await writeFile(planFilePath, renderPlanMarkdown(plan), "utf8");
} catch {
// ignore write failures
}
}
async function savePlanFile(ctx: ExtensionContext, p: StoredPlan): Promise<string> {
const dir = join(ctx.cwd, CONFIG_DIR_NAME, "plans");
await mkdir(dir, { recursive: true });
const path = join(dir, `${slugify(p.title)}-${fileTimestamp()}.md`);
await writeFile(path, renderPlanMarkdown(p), "utf8");
return path;
}
// ---- UI ----
function updateStatus(ctx: ExtensionContext): void {
if (phase === "executing" && plan) {
const done = plan.steps.filter((s) => s.completed).length;
ctx.ui.setStatus("plan-mode", ctx.ui.theme.fg("accent", `📋 ${done}/${plan.steps.length}`));
} else if (planModeEnabled) {
ctx.ui.setStatus("plan-mode", ctx.ui.theme.fg("warning", "⏸ plan"));
} else {
ctx.ui.setStatus("plan-mode", undefined);
}
if ((phase === "executing" || phase === "awaiting-approval") && plan) {
const lines = [ctx.ui.theme.fg("accent", plan.title)];
plan.steps.forEach((s, i) => {
let mark: string;
let text = s.text;
if (s.completed) {
mark = ctx.ui.theme.fg("success", "☑ ");
text = ctx.ui.theme.fg("muted", ctx.ui.theme.strikethrough(text));
} else if (s.skipped) {
mark = ctx.ui.theme.fg("muted", "⊘ ");
text = ctx.ui.theme.fg("muted", text);
} else if (phase === "executing" && i === currentStepIndex) {
mark = ctx.ui.theme.fg("accent", "▶ ");
} else {
mark = ctx.ui.theme.fg("muted", "☐ ");
}
lines.push(`${mark}${text}`);
});
ctx.ui.setWidget("plan-todos", lines);
} else {
ctx.ui.setWidget("plan-todos", undefined);
}
}
// ---- mode toggle ----
function togglePlanMode(ctx: ExtensionContext): void {
planModeEnabled = !planModeEnabled;
phase = planModeEnabled ? "planning" : undefined;
plan = undefined;
planFilePath = undefined;
currentStepIndex = 0;
awaitingStep = false;
if (planModeEnabled) {
enablePlanModeTools();
ctx.ui.notify("Plan mode enabled. Built-in write tools disabled. Ask for a plan, then submit_plan.");
} else {
restoreNormalModeTools();
ctx.ui.notify("Plan mode disabled. Full access restored.");
}
updateStatus(ctx);
persistState();
}
// ---- execution gating ----
function finishExecution(ctx: ExtensionContext): void {
if (plan) {
const summary = plan.steps
.map((s) => (s.completed ? `~~${s.text}~~` : s.skipped ? `${s.text} (skipped)` : s.text))
.join("\n");
pi.sendMessage(
{ customType: "plan-complete", content: `**Plan "${plan.title}" complete!** ✓\n\n${summary}`, display: true },
{ triggerTurn: false },
);
}
phase = undefined;
awaitingStep = false;
updateStatus(ctx);
persistState();
void persistPlanFile();
}
async function gateNext(ctx: ExtensionContext): Promise<void> {
if (!plan) {
phase = undefined;
return;
}
if (currentStepIndex >= plan.steps.length) {
finishExecution(ctx);
return;
}
const step = plan.steps[currentStepIndex];
if (!step) {
finishExecution(ctx);
return;
}
const choice = await ctx.ui.select(
`Step ${currentStepIndex + 1}/${plan.steps.length}: ${step.text}`,
["Execute this step", "Skip this step", "Stop execution"],
);
if (choice?.startsWith("Execute")) {
awaitingStep = true;
updateStatus(ctx);
const stepMsg = `Execute ONLY step ${currentStepIndex + 1} of ${plan.steps.length} from plan "${plan.title}":
${step.text}
Do just this one step. Do NOT start any other step. Stop when this step is done.`;
pi.sendMessage(
{ customType: "plan-step", content: stepMsg, display: true },
{ triggerTurn: true, deliverAs: "followUp" },
);
} else if (choice?.startsWith("Skip")) {
step.skipped = true;
currentStepIndex++;
updateStatus(ctx);
persistState();
await persistPlanFile();
await gateNext(ctx);
} else {
ctx.ui.notify("Plan execution stopped.", "info");
phase = undefined;
awaitingStep = false;
updateStatus(ctx);
persistState();
}
}
async function handleApproval(ctx: ExtensionContext): Promise<void> {
if (!plan) {
phase = undefined;
return;
}
const choice = await ctx.ui.select(
`Plan "${plan.title}" — ${plan.steps.length} steps.\nWhat next?`,
["Execute step-by-step", "Stay in plan mode", "Refine the plan", "Save plan to file"],
);
if (choice?.startsWith("Execute")) {
planModeEnabled = false;
phase = "executing";
currentStepIndex = 0;
awaitingStep = false;
restoreNormalModeTools();
updateStatus(ctx);
persistState();
await gateNext(ctx);
} else if (choice === "Refine the plan") {
phase = "planning";
const refinement = await ctx.ui.editor("Refine the plan:", "");
updateStatus(ctx);
persistState();
if (refinement?.trim()) {
pi.sendUserMessage(refinement.trim(), { deliverAs: "followUp" });
}
} else if (choice === "Save plan to file") {
try {
planFilePath = await savePlanFile(ctx, plan);
ctx.ui.notify(`Plan saved to ${planFilePath}`, "info");
persistState();
} catch {
ctx.ui.notify("Failed to save plan.", "error");
}
} else {
phase = "planning";
updateStatus(ctx);
persistState();
}
}
// ---- commands & shortcuts ----
pi.registerCommand("plan", {
description: "Toggle plan mode (read-only exploration + structured planning)",
handler: async (_args, ctx) => togglePlanMode(ctx),
});
pi.registerCommand("plan-status", {
description: "Show the current plan and progress",
handler: async (_args, ctx) => {
if (!plan) {
ctx.ui.notify("No plan yet. Enable /plan and ask the agent to submit_plan.", "info");
return;
}
const list = plan.steps
.map((s, i) => `${i + 1}. ${s.completed ? "✓" : s.skipped ? "⊘" : "○"} ${s.text}`)
.join("\n");
const loc = planFilePath ? `\n\nFile: ${planFilePath}` : "";
ctx.ui.notify(`Plan "${plan.title}" (${phase ?? "idle"}):\n${list}${loc}`, "info");
},
});
pi.registerCommand("plan-continue", {
description: "Resume gated step-by-step execution of the current plan",
handler: async (_args, ctx) => {
if (phase !== "executing" || !plan) {
ctx.ui.notify("No plan execution in progress.", "info");
return;
}
if (awaitingStep) {
ctx.ui.notify("A step is already running.", "info");
return;
}
await gateNext(ctx);
},
});
pi.registerCommand("plan-save", {
description: "Save the current plan to a file in .pi/plans/",
handler: async (_args, ctx) => {
if (!plan) {
ctx.ui.notify("No plan to save. Submit a plan first.", "info");
return;
}
try {
planFilePath = await savePlanFile(ctx, plan);
ctx.ui.notify(`Plan saved to ${planFilePath}`, "info");
persistState();
} catch {
ctx.ui.notify("Failed to save plan.", "error");
}
},
});
pi.registerShortcut(Key.ctrlAlt("p"), {
description: "Toggle plan mode",
handler: async (ctx) => togglePlanMode(ctx),
});
// ---- submit_plan tool ----
pi.registerTool({
name: "submit_plan",
label: "Submit Plan",
description:
"Submit a structured implementation plan for user approval. ONLY available in plan mode. " +
"Call this once analysis is finished and you are ready to propose the work. After calling it, stop and wait for the user.",
promptSnippet: "Submit a structured plan (title + numbered steps) for approval while in plan mode",
promptGuidelines: [
"Use submit_plan to deliver your plan when in plan mode instead of writing a free-form 'Plan:' section.",
"After calling submit_plan, do not take further action; wait for the user to approve, refine, or execute.",
],
parameters: submitPlanSchema,
async execute(_toolCallId, params: SubmitPlanInput, _signal, _onUpdate, ctx) {
if (!planModeEnabled) {
return {
content: [
{ type: "text", text: "submit_plan is only available in plan mode. Enable it with /plan first." },
],
isError: true,
details: {},
};
}
plan = {
title: params.title.trim() || "Untitled plan",
createdAt: new Date().toISOString(),
steps: params.steps
.map((s) => ({ text: s.description.trim(), completed: false }))
.filter((s) => s.text.length > 0),
risks: params.risks?.map((r) => r.trim()).filter(Boolean),
files: params.files?.map((f) => f.trim()).filter(Boolean),
};
currentStepIndex = 0;
awaitingStep = false;
phase = "awaiting-approval";
persistState();
updateStatus(ctx);
return {
content: [
{
type: "text",
text: `Plan "${plan.title}" with ${plan.steps.length} step(s) submitted. Stop here and wait for the user to approve, refine, or execute. Use /plan-save to save the plan to a file.`,
},
],
details: { title: plan.title, steps: plan.steps.length },
terminate: true,
};
},
});
// ---- block destructive bash in plan mode ----
pi.on("tool_call", async (event) => {
if (!planModeEnabled || event.toolName !== "bash") return;
const command = event.input.command as string;
if (!isSafeCommand(command)) {
return {
block: true,
reason: `Plan mode: command blocked (not allowlisted). Use /plan to disable plan mode first.\nCommand: ${command}`,
};
}
});
// ---- strip stale plan-mode context when not in plan mode ----
pi.on("context", async (event) => {
if (planModeEnabled) return;
return {
messages: event.messages.filter((m) => {
const msg = m as AgentMessage & { customType?: string };
if (msg.customType === "plan-mode-context") return false;
if (msg.role !== "user") return true;
const content = msg.content;
if (typeof content === "string") return !content.includes("[PLAN MODE ACTIVE]");
if (Array.isArray(content)) {
return !content.some(
(c) => c.type === "text" && (c as TextContent).text?.includes("[PLAN MODE ACTIVE]"),
);
}
return true;
}),
};
});
// ---- inject plan-mode instructions ----
pi.on("before_agent_start", async () => {
if (!planModeEnabled) return;
return {
message: {
customType: "plan-mode-context",
content: `[PLAN MODE ACTIVE]
You are in plan mode - a read-only exploration mode for safe code analysis.
Restrictions:
- Built-in edit and write tools are disabled
- Bash is restricted to an allowlist of read-only commands
- Do NOT attempt to make changes - only investigate and plan
Explore the code, ask clarifying questions if needed, then call the "submit_plan" tool with:
- title: a short, recognizable name for the plan
- steps: an ordered list of concrete, actionable steps
- risks: optional caveats or open questions
- files: optional files you expect to create or modify
Do NOT write a free-form "Plan:" section - use the submit_plan tool instead.
After submitting, stop and wait for the user.`,
display: false,
},
};
});
// ---- drive approval + gated execution when the agent settles ----
pi.on("agent_settled", async (_event, ctx) => {
if (!ctx.hasUI) return;
if (phase === "awaiting-approval") {
await handleApproval(ctx);
return;
}
if (phase === "executing" && awaitingStep) {
awaitingStep = false;
const step = plan?.steps[currentStepIndex];
if (step) step.completed = true;
currentStepIndex++;
updateStatus(ctx);
persistState();
await persistPlanFile();
await gateNext(ctx);
}
});
// ---- restore state on session start / resume ----
pi.on("session_start", async (_event, ctx) => {
if (pi.getFlag("plan") === true) {
planModeEnabled = true;
phase = "planning";
}
const entries = ctx.sessionManager.getEntries();
const planModeEntry = entries
.filter((e: { type: string; customType?: string }) => e.type === "custom" && e.customType === "plan-mode")
.pop() as { data?: PlanModeState } | undefined;
if (planModeEntry?.data) {
const d = planModeEntry.data;
planModeEnabled = d.enabled ?? planModeEnabled;
phase = d.phase ?? phase;
plan = d.plan ?? plan;
currentStepIndex = d.currentStepIndex ?? currentStepIndex;
planFilePath = d.planFilePath ?? planFilePath;
toolsBeforePlanMode = d.toolsBeforePlanMode ?? toolsBeforePlanMode;
awaitingStep = false; // never resume mid-step automatically
}
if (planModeEnabled) {
enablePlanModeTools();
}
updateStatus(ctx);
if (phase === "executing" && plan && ctx.hasUI) {
ctx.ui.notify(`Plan "${plan.title}" execution paused. Use /plan-continue to resume.`, "info");
}
});
}

View File

@@ -0,0 +1,168 @@
/**
* Pure utility functions for plan mode.
* Extracted for testability.
*/
// Destructive commands blocked in plan mode
const DESTRUCTIVE_PATTERNS = [
/\brm\b/i,
/\brmdir\b/i,
/\bmv\b/i,
/\bcp\b/i,
/\bmkdir\b/i,
/\btouch\b/i,
/\bchmod\b/i,
/\bchown\b/i,
/\bchgrp\b/i,
/\bln\b/i,
/\btee\b/i,
/\btruncate\b/i,
/\bdd\b/i,
/\bshred\b/i,
/(^|[^<])>(?!>)/,
/>>/,
/\bnpm\s+(install|uninstall|update|ci|link|publish)/i,
/\byarn\s+(add|remove|install|publish)/i,
/\bpnpm\s+(add|remove|install|publish)/i,
/\bpip\s+(install|uninstall)/i,
/\bapt(-get)?\s+(install|remove|purge|update|upgrade)/i,
/\bbrew\s+(install|uninstall|upgrade)/i,
/\bgit\s+(add|commit|push|pull|merge|rebase|reset|checkout|branch\s+-[dD]|stash|cherry-pick|revert|tag|init|clone)/i,
/\bsudo\b/i,
/\bsu\b/i,
/\bkill\b/i,
/\bpkill\b/i,
/\bkillall\b/i,
/\breboot\b/i,
/\bshutdown\b/i,
/\bsystemctl\s+(start|stop|restart|enable|disable)/i,
/\bservice\s+\S+\s+(start|stop|restart)/i,
/\b(vim?|nano|emacs|code|subl)\b/i,
];
// Safe read-only commands allowed in plan mode
const SAFE_PATTERNS = [
/^\s*cat\b/,
/^\s*head\b/,
/^\s*tail\b/,
/^\s*less\b/,
/^\s*more\b/,
/^\s*grep\b/,
/^\s*find\b/,
/^\s*ls\b/,
/^\s*pwd\b/,
/^\s*echo\b/,
/^\s*printf\b/,
/^\s*wc\b/,
/^\s*sort\b/,
/^\s*uniq\b/,
/^\s*diff\b/,
/^\s*file\b/,
/^\s*stat\b/,
/^\s*du\b/,
/^\s*df\b/,
/^\s*tree\b/,
/^\s*which\b/,
/^\s*whereis\b/,
/^\s*type\b/,
/^\s*env\b/,
/^\s*printenv\b/,
/^\s*uname\b/,
/^\s*whoami\b/,
/^\s*id\b/,
/^\s*date\b/,
/^\s*cal\b/,
/^\s*uptime\b/,
/^\s*ps\b/,
/^\s*top\b/,
/^\s*htop\b/,
/^\s*free\b/,
/^\s*git\s+(status|log|diff|show|branch|remote|config\s+--get)/i,
/^\s*git\s+ls-/i,
/^\s*npm\s+(list|ls|view|info|search|outdated|audit)/i,
/^\s*yarn\s+(list|info|why|audit)/i,
/^\s*node\s+--version/i,
/^\s*python\s+--version/i,
/^\s*curl\s/i,
/^\s*wget\s+-O\s*-/i,
/^\s*jq\b/,
/^\s*sed\s+-n/i,
/^\s*awk\b/,
/^\s*rg\b/,
/^\s*fd\b/,
/^\s*bat\b/,
/^\s*eza\b/,
];
export function isSafeCommand(command: string): boolean {
const isDestructive = DESTRUCTIVE_PATTERNS.some((p) => p.test(command));
const isSafe = SAFE_PATTERNS.some((p) => p.test(command));
return !isDestructive && isSafe;
}
export interface TodoItem {
step: number;
text: string;
completed: boolean;
}
export function cleanStepText(text: string): string {
let cleaned = text
.replace(/\*{1,2}([^*]+)\*{1,2}/g, "$1") // Remove bold/italic
.replace(/`([^`]+)`/g, "$1") // Remove code
.replace(
/^(Use|Run|Execute|Create|Write|Read|Check|Verify|Update|Modify|Add|Remove|Delete|Install)\s+(the\s+)?/i,
"",
)
.replace(/\s+/g, " ")
.trim();
if (cleaned.length > 0) {
cleaned = cleaned.charAt(0).toUpperCase() + cleaned.slice(1);
}
if (cleaned.length > 50) {
cleaned = `${cleaned.slice(0, 47)}...`;
}
return cleaned;
}
export function extractTodoItems(message: string): TodoItem[] {
const items: TodoItem[] = [];
const headerMatch = message.match(/\*{0,2}Plan:\*{0,2}\s*\n/i);
if (!headerMatch) return items;
const planSection = message.slice(message.indexOf(headerMatch[0]) + headerMatch[0].length);
const numberedPattern = /^\s*(\d+)[.)]\s+\*{0,2}([^*\n]+)/gm;
for (const match of planSection.matchAll(numberedPattern)) {
const text = match[2]
.trim()
.replace(/\*{1,2}$/, "")
.trim();
if (text.length > 5 && !text.startsWith("`") && !text.startsWith("/") && !text.startsWith("-")) {
const cleaned = cleanStepText(text);
if (cleaned.length > 3) {
items.push({ step: items.length + 1, text: cleaned, completed: false });
}
}
}
return items;
}
export function extractDoneSteps(message: string): number[] {
const steps: number[] = [];
for (const match of message.matchAll(/\[DONE:(\d+)\]/gi)) {
const step = Number(match[1]);
if (Number.isFinite(step)) steps.push(step);
}
return steps;
}
export function markCompletedSteps(text: string, items: TodoItem[]): number {
const doneSteps = extractDoneSteps(text);
for (const step of doneSteps) {
const item = items.find((t) => t.step === step);
if (item) item.completed = true;
}
return doneSteps.length;
}

View File

@@ -0,0 +1,178 @@
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
export default function (pi: ExtensionAPI) {
// ── Anthropic via Langdock ──────────────────────────────────────────────
pi.registerProvider("anthropic", {
baseUrl: "https://api.langdock.com/anthropic/eu",
apiKey: "$LANGDOCK_API_KEY",
api: "anthropic-messages",
models: [
{
id: "claude-opus-4-8-default",
name: "Opus 4.8",
reasoning: true,
input: ["text", "image"],
contextWindow: 200000,
maxTokens: 32000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
compat: { forceAdaptiveThinking: true },
},
{
id: "claude-opus-5-default",
name: "Opus 5",
reasoning: true,
input: ["text", "image"],
contextWindow: 200000,
maxTokens: 32000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
compat: { forceAdaptiveThinking: true },
},
{
id: "claude-sonnet-5-default",
name: "Sonnet 5",
reasoning: true,
input: ["text", "image"],
contextWindow: 200000,
maxTokens: 16384,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
compat: { forceAdaptiveThinking: true },
},
],
});
// ── OpenAI via Langdock ─────────────────────────────────────────────────
pi.registerProvider("openai", {
baseUrl: "https://api.langdock.com/openai/eu/v1",
apiKey: "$LANGDOCK_API_KEY",
api: "openai-completions",
models: [
{
id: "gpt-5.6-sol",
name: "GPT-5.6 Sol",
reasoning: true,
input: ["text", "image"],
contextWindow: 272000,
maxTokens: 128000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
{
id: "gpt-5.6-terra",
name: "GPT-5.6 Terra",
reasoning: true,
input: ["text", "image"],
contextWindow: 272000,
maxTokens: 128000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
{
id: "gpt-5.6-luna",
name: "GPT-5.6 Luna",
reasoning: true,
input: ["text", "image"],
contextWindow: 272000,
maxTokens: 128000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
{
id: "gpt-5.5",
name: "GPT-5.5",
reasoning: true,
input: ["text", "image"],
contextWindow: 272000,
maxTokens: 128000,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
{
id: "gpt-5.4-mini",
name: "GPT-5.4 Mini",
reasoning: false,
input: ["text"],
contextWindow: 272000,
maxTokens: 16384,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
],
});
// ── Google via Langdock ─────────────────────────────────────────────────
// pi.registerProvider("google", {
// baseUrl: "https://api.langdock.com/google/eu/v1beta",
// apiKey: "$LANGDOCK_API_KEY",
// api: "google-generative-ai",
// models: [
// {
// id: "models/gemini-3.5-flash",
// name: "Gemini 3.5 Flash",
// reasoning: true,
// input: ["text", "image"],
// contextWindow: 1048576,
// maxTokens: 8192,
// cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
// },
// {
// id: "models/gemini-2.5-flash",
// name: "Gemini 2.5 Flash",
// reasoning: true,
// input: ["text", "image"],
// contextWindow: 1048576,
// maxTokens: 8192,
// cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
// },
// {
// id: "models/gemini-2.5-pro",
// name: "Gemini 2.5 Pro",
// reasoning: true,
// input: ["text", "image"],
// contextWindow: 2097152,
// maxTokens: 65536,
// cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
// },
// ],
// });
// ── Hide unwanted built-in providers ────────────────────────────────────
const keep = new Set([
"openrouter",
]);
const hide = [
"ant-ling",
"azure-openai",
"azure-openai-responses",
"deepseek",
"nvidia-nim",
"google-vertex",
"amazon-bedrock",
"google",
"mistral",
"groq",
"cerebras",
"cloudflare-ai-gateway",
"cloudflare-workers-ai",
"xai",
"vercel-ai-gateway",
"zai-coding-plan-global",
"zai-coding-plan-china",
"opencode-zen",
"opencode-go",
"huggingface",
"fireworks",
"together-ai",
"kimi-for-coding",
"minimax",
"xiaomi-mimo",
"xiaomi-mimo-china",
"xiaomi-mimo-amsterdam",
"xiaomi-mimo-singapore",
];
for (const provider of hide) {
if (!keep.has(provider)) {
try {
pi.unregisterProvider(provider);
} catch {
// provider may not exist in this build
}
}
}
}

View File

@@ -0,0 +1,51 @@
{
"providers": {
"sparkl": {
"baseUrl": "http://192.168.10.111:8000/v1",
"api": "openai-completions",
"apiKey": "vllm",
"compat": {
"supportsDeveloperRole": false,
"supportsReasoningEffort": false
},
"models": [
{
"id": "Qwen/Qwen3-30B-A3B",
"name": "Qwen3 30B A3B (local vLLM)",
"reasoning": true,
"input": ["text"],
"contextWindow": 16384,
"maxTokens": 8192,
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"compat": {
"thinkingFormat": "qwen-chat-template",
"maxTokensField": "max_tokens"
}
}
]
},
"sparkr": {
"baseUrl": "http://192.168.10.110:8000/v1",
"api": "openai-completions",
"apiKey": "vllm",
"compat": {
"supportsDeveloperRole": false,
"supportsReasoningEffort": false
},
"models": [
{
"id": "Qwen/Qwen3-Coder-Next-FP8",
"name": "Qwen3 Coder Next FP8 (local vLLM)",
"reasoning": false,
"input": ["text"],
"contextWindow": 262144,
"maxTokens": 8192,
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"compat": {
"maxTokensField": "max_tokens"
}
}
]
}
}
}

View File

@@ -0,0 +1,11 @@
{
"lastChangelogVersion": "0.81.1",
"theme": "light",
"defaultProvider": "openrouter",
"defaultModel": "deepseek/deepseek-v4-pro",
"defaultThinkingLevel": "high",
"hideThinkingBlock": false,
"enableInstallTelemetry": false,
"doubleEscapeAction": "tree",
"treeFilterMode": "all"
}

View File

@@ -0,0 +1,16 @@
{
"lastChangelogVersion": "0.81.1",
"theme": "light",
"defaultProvider": "openrouter",
"defaultModel": "deepseek/deepseek-v4-flash",
"defaultThinkingLevel": "high",
"hideThinkingBlock": false,
"retry": {
"enabled": true,
"maxRetries": 4,
"baseDelayMs": 10000
},
"enableInstallTelemetry": false,
"doubleEscapeAction": "tree",
"treeFilterMode": "all"
}

View File

@@ -0,0 +1,19 @@
{
"lastChangelogVersion": "0.81.1",
"theme": "light",
"defaultProvider": "sparkr",
"defaultModel": "Qwen/Qwen3-Coder-Next-FP8",
"defaultThinkingLevel": "high",
"hideThinkingBlock": false,
"retry": {
"enabled": true,
"maxRetries": 4,
"baseDelayMs": 10000
},
"enableInstallTelemetry": false,
"doubleEscapeAction": "tree",
"treeFilterMode": "all",
"extensions": [
"~/.pi/agent/extensions-work"
]
}

35
things.py Normal file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python3
"""things.py - description here."""
import argparse
def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
parser = argparse.ArgumentParser(description="things.py - description here.")
parser.add_argument(
"input",
nargs="?",
help="input file or value to process",
)
parser.add_argument(
"-o",
"--output",
help="output file (defaults to stdout)",
)
parser.add_argument(
"-v",
"--verbose",
action="store_true",
help="enable verbose output",
)
return parser.parse_args(argv)
def main() -> None:
args = parse_args()
if args.verbose:
print(f"input={args.input!r} output={args.output!r}")
if __name__ == "__main__":
main()