@weave-os/router 0.2.15 → 0.2.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weave-os/router",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "description": "One-command installer that points Claude Code, Codex, opencode, or pi at the Weave Router. For pi it also ships the routing extension, loaded via pi.extensions.",
5
5
  "bin": {
6
6
  "weave-router": "bin.js",
@@ -20,6 +20,7 @@
20
20
  "uninstall.sh",
21
21
  "cc-statusline.sh",
22
22
  "codex-status.sh",
23
+ "codex-directive.sh",
23
24
  "registry.sh",
24
25
  "directives.tsv",
25
26
  "commands/",
@@ -7,7 +7,7 @@ export interface ModelPricing {
7
7
  cacheReadMultiplier: number;
8
8
  }
9
9
 
10
- export const PRICING_VERSION = "catalog-sha256:d6d491a07143ad7d";
10
+ export const PRICING_VERSION = "catalog-sha256:a96c21de7b4ad8ef";
11
11
 
12
12
  export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.freeze({
13
13
  "claude-fable-5": { inputUsdPerMillion: 10, outputUsdPerMillion: 50, cacheReadMultiplier: 0.1 },
@@ -58,11 +58,12 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
58
58
  "gpt-5.5-mini": { inputUsdPerMillion: 0.5, outputUsdPerMillion: 2.5, cacheReadMultiplier: 0.1 },
59
59
  "gpt-5.5-nano": { inputUsdPerMillion: 0.15, outputUsdPerMillion: 0.6, cacheReadMultiplier: 0.1 },
60
60
  "gpt-5.5-pro": { inputUsdPerMillion: 30, outputUsdPerMillion: 180, cacheReadMultiplier: 1 },
61
- "gpt-5.6-luna": { inputUsdPerMillion: 1, outputUsdPerMillion: 6, cacheReadMultiplier: 0.1 },
62
- "gpt-5.6-luna-pro": { inputUsdPerMillion: 1, outputUsdPerMillion: 6, cacheReadMultiplier: 0.1 },
63
- "gpt-5.6-sol": { inputUsdPerMillion: 5, outputUsdPerMillion: 30, cacheReadMultiplier: 0.1 },
64
- "gpt-5.6-sol-pro": { inputUsdPerMillion: 5, outputUsdPerMillion: 30, cacheReadMultiplier: 0.1 },
65
- "gpt-5.6-terra": { inputUsdPerMillion: 2.5, outputUsdPerMillion: 15, cacheReadMultiplier: 0.1 },
61
+ "gpt-5.6-luna": { inputUsdPerMillion: 0.2, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.1 },
62
+ "gpt-5.6-luna-pro": { inputUsdPerMillion: 0.2, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.1 },
63
+ "gpt-5.6-sol": { inputUsdPerMillion: 4, outputUsdPerMillion: 20, cacheReadMultiplier: 0.1 },
64
+ "gpt-5.6-sol-pro": { inputUsdPerMillion: 4, outputUsdPerMillion: 20, cacheReadMultiplier: 0.1 },
65
+ "gpt-5.6-terra": { inputUsdPerMillion: 2, outputUsdPerMillion: 12, cacheReadMultiplier: 0.1 },
66
+ "gpt-6-astra": { inputUsdPerMillion: 10, outputUsdPerMillion: 50, cacheReadMultiplier: 0.1 },
66
67
  "grok-4.5": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
67
68
  "grok-4.6": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
68
69
  "minimax/minimax-m2.7": { inputUsdPerMillion: 0.3, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.2 },
package/uninstall.sh CHANGED
@@ -27,7 +27,6 @@ set -euo pipefail
27
27
  scope="user"
28
28
  scope_explicit="false"
29
29
  install_dir=""
30
- script_dir="$(cd "$(dirname "$0")" 2>/dev/null && pwd || true)"
31
30
 
32
31
  # ---------- directive registry (embedded) ----------
33
32
  #
@@ -45,7 +44,7 @@ router-feedback|rf|prompt|yes|yes|yes|no|manual|command,skill
45
44
  router-off||local-toggle|yes|yes|no|no|manual|command,skill
46
45
  router-on||local-toggle|yes|yes|no|no|manual|command,skill
47
46
  router-status||local-toggle|yes|yes|no|no|manual|command,skill
48
- router-session||prompt|yes|no|no|no|manual|command
47
+ router-session||prompt|yes|yes|no|no|manual|command,skill
49
48
  router-models|models|local-toggle|yes|yes|no|no|manual|command,skill
50
49
  disable-routing||local-toggle|no|yes|no|no|manual|skill
51
50
  beta||prompt|yes|no|no|yes|manual|command
@@ -206,11 +205,17 @@ fi
206
205
  WEAVE_CODEX_BEGIN_MARKER="# >>> weave-router managed (do not edit between markers) >>>"
207
206
  WEAVE_CODEX_END_MARKER="# <<< weave-router managed <<<"
208
207
 
209
- # strip_codex_block rewrites config.toml without the managed block and any
208
+ # strip_codex_block rewrites config.toml without the managed block, any
210
209
  # top-level `model_provider = "weave"` that lived outside the markers (which
211
- # can happen if the user copy-pasted our key into their own config). Other
212
- # top-level model_provider values are preserved so we don't yank a user back
213
- # into the OpenAI default when they meant to keep their own.
210
+ # can happen if the user copy-pasted our key into their own config), and any
211
+ # `[model_providers.weave]` table outside them. Other top-level model_provider
212
+ # values are preserved so we don't yank a user back into the OpenAI default
213
+ # when they meant to keep their own.
214
+ #
215
+ # The out-of-marker table has to go for the same reason install.sh strips it:
216
+ # Codex rewrites config.toml through a TOML serializer and our comment markers
217
+ # do not survive, so a marker-only uninstall reported success while leaving the
218
+ # provider -- and the router key inside it -- on disk.
214
219
  strip_codex_block() {
215
220
  local config_file="$1"
216
221
  local tmp; tmp="$(mktemp -t weave-codex-uninstall.XXXXXX)"
@@ -218,7 +223,15 @@ strip_codex_block() {
218
223
  $0 == begin { skip = 1; next }
219
224
  $0 == end { skip = 0; next }
220
225
  skip { next }
221
- /^[[:space:]]*\[/ { in_section = 1 }
226
+ /^[[:space:]]*\[/ {
227
+ in_section = 1
228
+ if ($0 ~ /^[[:space:]]*\[[[:space:]]*model_providers[[:space:]]*\.[[:space:]]*weave[[:space:]]*(\.[^]]*)?\][[:space:]]*(#.*)?$/) {
229
+ in_weave_provider = 1
230
+ next
231
+ }
232
+ in_weave_provider = 0
233
+ }
234
+ in_weave_provider { next }
222
235
  !in_section && /^[[:space:]]*model_provider[[:space:]]*=[[:space:]]*"weave"[[:space:]]*$/ { next }
223
236
  { print }
224
237
  ' "$config_file" >"$tmp"
@@ -245,6 +258,9 @@ if [ "$target" = "opencode" ]; then
245
258
  printf "Project directory to uninstall from [default: %s]: " "$default_project_dir"
246
259
  read -r project_dir_choice </dev/tty || project_dir_choice=""
247
260
  project_dir="${project_dir_choice:-$default_project_dir}"
261
+ # Expand a leading ~ since `read` doesn't.
262
+ # The pattern intentionally matches a literal tilde.
263
+ # shellcheck disable=SC2088
248
264
  case "$project_dir" in
249
265
  "~") project_dir="$HOME" ;;
250
266
  "~/"*) project_dir="$HOME/${project_dir#~/}" ;;
@@ -395,6 +411,9 @@ if [ "$target" = "pi" ]; then
395
411
  printf "Project directory to uninstall from [default: %s]: " "$default_project_dir"
396
412
  read -r project_dir_choice </dev/tty || project_dir_choice=""
397
413
  project_dir="${project_dir_choice:-$default_project_dir}"
414
+ # Expand a leading ~ since `read` doesn't.
415
+ # The pattern intentionally matches a literal tilde.
416
+ # shellcheck disable=SC2088
398
417
  case "$project_dir" in
399
418
  "~") project_dir="$HOME" ;;
400
419
  "~/"*) project_dir="$HOME/${project_dir#~/}" ;;
@@ -501,6 +520,9 @@ if [ "$target" = "codex" ]; then
501
520
  printf "Project directory to uninstall from [default: %s]: " "$default_project_dir"
502
521
  read -r project_dir_choice </dev/tty || project_dir_choice=""
503
522
  project_dir="${project_dir_choice:-$default_project_dir}"
523
+ # Expand a leading ~ since `read` doesn't.
524
+ # The pattern intentionally matches a literal tilde.
525
+ # shellcheck disable=SC2088
504
526
  case "$project_dir" in
505
527
  "~") project_dir="$HOME" ;;
506
528
  "~/"*) project_dir="$HOME/${project_dir#~/}" ;;
@@ -525,12 +547,15 @@ if [ "$target" = "codex" ]; then
525
547
  codex_config_file="$codex_dir/config.toml"
526
548
  if [ "$scope" = "user" ] && [ -z "$install_dir" ]; then
527
549
  codex_status_file="$HOME/.weave/codex-status.sh"
550
+ codex_directive_file="$HOME/.weave/codex-directive.sh"
528
551
  else
529
552
  codex_status_file="$codex_dir/weave-status.sh"
553
+ codex_directive_file="$codex_dir/weave-directive.sh"
530
554
  fi
531
555
  codex_status_disabled_marker="$(dirname "$codex_status_file")/.weave-router-disabled"
532
556
  refuse_if_symlink "$codex_config_file"
533
557
  refuse_if_symlink "$codex_status_file"
558
+ refuse_if_symlink "$codex_directive_file"
534
559
  refuse_if_symlink "$codex_status_disabled_marker"
535
560
 
536
561
  if [ -f "$codex_config_file" ]; then
@@ -567,6 +592,16 @@ if [ "$target" = "codex" ]; then
567
592
  fi
568
593
  fi
569
594
 
595
+ if [ -f "$codex_directive_file" ]; then
596
+ if grep -Fq '<!-- weave-router managed codex directive -->' "$codex_directive_file"; then
597
+ rm -f "$codex_directive_file"
598
+ ok "Removed $codex_directive_file"
599
+ rmdir "$(dirname "$codex_directive_file")" 2>/dev/null || true
600
+ else
601
+ warn "Leaving user-owned Codex directive helper at $codex_directive_file untouched."
602
+ fi
603
+ fi
604
+
570
605
  # Remove only the prompt files this installer owns; leave any user-authored
571
606
  # entries in prompts/ alone. The dir itself is dropped only if empty after.
572
607
  codex_prompts_dir="$codex_dir/prompts"
@@ -672,6 +707,9 @@ else
672
707
  printf "Project directory to uninstall from [default: %s]: " "$default_project_dir"
673
708
  read -r project_dir_choice </dev/tty || project_dir_choice=""
674
709
  project_dir="${project_dir_choice:-$default_project_dir}"
710
+ # Expand a leading ~ since `read` doesn't.
711
+ # The pattern intentionally matches a literal tilde.
712
+ # shellcheck disable=SC2088
675
713
  case "$project_dir" in
676
714
  "~") project_dir="$HOME" ;;
677
715
  "~/"*) project_dir="$HOME/${project_dir#~/}" ;;