Commit e34c53e

HPCesia <me@hpcesia.com>
2026-10-09 17:36:09
crush: mannualy add cline pass models
Assisted-by: crush:deepseek-v4.1-flash
1 parent b09a2a2
Changed files (1)
modules
dev
agents
modules/dev/agents/crush/default.nix
@@ -83,6 +83,45 @@
               --name "dcg" \
               --matcher '^bash$' \
               --command "${lib.getExe pkgs.nur.repos.hpcesia.dcg}"
+
+            provider add cline \
+              --type openai-compat \
+              --base-url "https://api.cline.bot/api/v1/" \
+              --discover-models false
+
+            # The feed lists ids without capabilities, so join it with OpenRouter.
+            _cline_pass_models="$(${lib.getExe pkgs.curl} -fsSL --max-time 20 \
+              "https://api.cline.bot/api/v1/ai/cline/recommended-models" || true)"
+            if [ -n "$_cline_pass_models" ]; then
+              ${lib.getExe pkgs.curl} -fsSL --max-time 30 \
+                "https://openrouter.ai/api/v1/models" \
+                | ${lib.getExe pkgs.jq} -r --argjson cp "$_cline_pass_models" '
+                  (.data // []
+                    | map({key: (.id | split("/") | last), value: .})
+                    | from_entries) as $or
+                  | $cp.clinePass[]?
+                  | (.id | sub("^cline-pass/"; "")) as $slug
+                  | ($or[$slug] // {}) as $m
+                  | [
+                      $slug,
+                      (($m.name // $slug) | sub("^[^:]+: "; "")),
+                      ($m.context_length // 128000),
+                      ($m.top_provider.max_completion_tokens // 8192),
+                      (($m | length) == 0
+                        or (($m.supported_parameters // []) | index("reasoning")) != null
+                        or $m.reasoning != null),
+                      ((($m.architecture.input_modalities // []) | index("image")) != null)
+                    ]
+                  | @tsv
+                ' \
+                | while IFS=$'\t' read -r slug name ctx maxtokens canreason images; do
+                    model add "cline/cline-pass/$slug" --name "$name" \
+                      --context-window "$ctx" \
+                      --default-max-tokens "$maxtokens" \
+                      --can-reason "$canreason" \
+                      --supports-images "$images" </dev/null
+                  done
+            fi
           '';
         };
       };
@@ -100,7 +139,7 @@
           };
 
           "crush/crush.json" = {
-            # crushrc has no theme option (v0.96.1), the theme is only settable here.
+            # crushrc has no theme option, so the theme is set here.
             value = {
               options.tui.active_theme = "catppuccin-mocha";
             };