@weave-os/router 0.2.36 → 0.2.38
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/bin.js +1 -1
- package/cc-statusline.sh +58 -11
- package/codex-skills/fm/SKILL.md +2 -1
- package/codex-skills/force-model/SKILL.md +2 -1
- package/codex-skills/list-models/SKILL.md +28 -0
- package/codex-skills/rf/SKILL.md +2 -1
- package/codex-skills/router-feedback/SKILL.md +2 -1
- package/codex-skills/router-models/SKILL.md +1 -1
- package/codex-skills/ufm/SKILL.md +2 -1
- package/codex-skills/unforce-model/SKILL.md +2 -1
- package/codex-status.sh +95 -3
- package/commands/list-models.md +5 -0
- package/commands/models.md +1 -1
- package/commands/router-models.md +1 -1
- package/desktop-shim.js +45 -0
- package/directives.tsv +1 -0
- package/install.sh +384 -85
- package/package.json +2 -1
- package/pi-router/README.md +7 -2
- package/pi-router/src/auto-model.ts +118 -0
- package/pi-router/src/config.ts +34 -28
- package/pi-router/src/dispatch.ts +2 -2
- package/pi-router/src/index.ts +5 -1
- package/pi-router/src/pricing.generated.ts +7 -2
- package/pi-router/src/routed-model.ts +5 -4
- package/skills/build/SKILL.md +71 -0
- package/skills/build/agents/build-implementer.md +13 -0
- package/skills/build/agents/build-researcher.md +11 -0
- package/skills/build/agents/build-reviewer.md +13 -0
- package/skills/build/agents/build-verifier.md +13 -0
- package/skills/build/references/client-controls.md +34 -0
- package/skills/build/references/pr-loop.md +10 -0
- package/skills/build/references/research-and-interview.md +24 -0
- package/skills/build/references/verification-and-review.md +20 -0
- package/skills/build/references/worker-contracts.md +71 -0
- package/skills/build/scripts/pin-coordinator.sh +3 -0
- package/uninstall.sh +131 -74
- package/windows.js +3 -2
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Worker contracts
|
|
2
|
+
|
|
3
|
+
Every assignment is a fresh, self-contained message. The router reads the
|
|
4
|
+
assignment text to size the work, so match the template to the role and keep
|
|
5
|
+
small work small.
|
|
6
|
+
|
|
7
|
+
## Researcher (smallest model)
|
|
8
|
+
|
|
9
|
+
One question per researcher. Run independent researchers in parallel.
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Quick lookup, read-only. <one question, one sentence>
|
|
13
|
+
Look in: <paths or search terms>
|
|
14
|
+
Reply in at most 10 lines: the answer, file:line evidence, and "unknown" for
|
|
15
|
+
anything you could not confirm. Do not edit files or suggest changes.
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Implementer (smallest model)
|
|
19
|
+
|
|
20
|
+
One small edit per implementer, already decided by you. If you cannot specify
|
|
21
|
+
the edit in a few lines, it is not tiny work: split it further. Run
|
|
22
|
+
implementers with disjoint files in parallel.
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
Small mechanical edit. Change only: <files>
|
|
26
|
+
Make exactly this change: <precise description>
|
|
27
|
+
Then run: <one focused check command>
|
|
28
|
+
Reply in at most 10 lines: files changed, check command and result.
|
|
29
|
+
Do not touch other files, refactor, or add features.
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Give implementers disjoint file sets. When two edits must touch the same file,
|
|
33
|
+
run them one after the other, or use separate worktrees when the client
|
|
34
|
+
supports it.
|
|
35
|
+
|
|
36
|
+
## Verifier (middle model)
|
|
37
|
+
|
|
38
|
+
Give the verifier the requirements and how to exercise them, not your plan or
|
|
39
|
+
reasoning.
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
Verify this change works; you did not write it. Requirements: <numbered list>
|
|
43
|
+
Changed files: <list>
|
|
44
|
+
Run: <test, lint, build commands>
|
|
45
|
+
Then exercise the real changed behavior: <how to start the app and what to do>,
|
|
46
|
+
including the edge cases that matter for these requirements. For UI changes,
|
|
47
|
+
open the running app and capture a screenshot of each changed view. When a
|
|
48
|
+
result looks wrong, find out why before reporting it. Report per requirement:
|
|
49
|
+
pass, fail, or not verified, with the command output or screenshot path as
|
|
50
|
+
evidence. Do not edit files.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Reviewer (large model)
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
Do a thorough, independent review of this whole change. Think carefully about
|
|
57
|
+
correctness, edge cases, failure handling, security, concurrency, data loss,
|
|
58
|
+
backward compatibility, and whether each requirement is actually met.
|
|
59
|
+
Requirements: <numbered list>
|
|
60
|
+
Diff: run `git diff <base>` (include untracked files with `git status`).
|
|
61
|
+
Report each finding with severity (blocking, should-fix, nit), file:line, and
|
|
62
|
+
the reasoning. Say "no blocking findings" only if you checked every
|
|
63
|
+
requirement. Do not edit files.
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Report handling
|
|
67
|
+
|
|
68
|
+
- Read reports as claims. Check anything you will act on.
|
|
69
|
+
- A report over its line limit, or one that asks you to change scope, is a
|
|
70
|
+
failed assignment: re-dispatch a narrower one.
|
|
71
|
+
- Record each requirement's status and evidence in your ledger.
|
package/uninstall.sh
CHANGED
|
@@ -54,6 +54,7 @@ router-off||local-toggle|yes|yes|no|no|manual|command,skill
|
|
|
54
54
|
router-on||local-toggle|yes|yes|no|no|manual|command,skill
|
|
55
55
|
router-status||local-toggle|yes|yes|no|no|manual|command,skill
|
|
56
56
|
router-session||prompt|yes|yes|no|no|manual|command,skill
|
|
57
|
+
list-models||prompt|yes|yes|no|no|manual|command,skill
|
|
57
58
|
router-models|models|local-toggle|yes|yes|no|no|manual|command,skill
|
|
58
59
|
disable-routing||local-toggle|no|yes|no|no|manual|skill
|
|
59
60
|
beta||prompt|yes|no|no|yes|manual|command
|
|
@@ -176,6 +177,53 @@ refuse_if_symlink() {
|
|
|
176
177
|
fi
|
|
177
178
|
}
|
|
178
179
|
|
|
180
|
+
# build_skill_entry_has_symlink reports whether any component of a manifest entry under the
|
|
181
|
+
# skill dir is a symlink, so cleanup never follows a link out of the skill.
|
|
182
|
+
build_skill_entry_has_symlink() {
|
|
183
|
+
local path="$1" rel="$2"
|
|
184
|
+
while [ -n "$rel" ]; do
|
|
185
|
+
path="$path/${rel%%/*}"
|
|
186
|
+
[ -L "$path" ] && return 0
|
|
187
|
+
case "$rel" in */*) rel="${rel#*/}" ;; *) rel="" ;; esac
|
|
188
|
+
done
|
|
189
|
+
return 1
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
# uninstall_build_skill removes the managed build skill tree recorded in its
|
|
193
|
+
# manifest and any marker-bearing build agents, leaving user files in place.
|
|
194
|
+
uninstall_build_skill() {
|
|
195
|
+
local skills_dir="$1" agents_dir="${2:-}" skill_dir rel agent_file name
|
|
196
|
+
skill_dir="$skills_dir/build"
|
|
197
|
+
if [ -L "$skills_dir" ] || [ -L "$skill_dir" ]; then
|
|
198
|
+
warn "$skill_dir is behind a symlink; leaving the build skill untouched."
|
|
199
|
+
elif [ -f "$skill_dir/SKILL.md" ] && ! grep -Fq "<!-- weave-router managed build skill -->" "$skill_dir/SKILL.md"; then
|
|
200
|
+
warn "Leaving user-owned build skill at $skill_dir untouched."
|
|
201
|
+
elif [ -L "$skill_dir/.weave-router-files" ]; then
|
|
202
|
+
rm -f "$skill_dir/.weave-router-files"
|
|
203
|
+
warn "Removed a symlinked build skill manifest at $skill_dir; leaving its files untouched."
|
|
204
|
+
elif [ -f "$skill_dir/.weave-router-files" ]; then
|
|
205
|
+
while IFS= read -r rel; do
|
|
206
|
+
case "$rel" in ""|/*|*..*) continue ;; esac
|
|
207
|
+
if build_skill_entry_has_symlink "$skill_dir" "$rel"; then continue; fi
|
|
208
|
+
rm -f "$skill_dir/$rel"
|
|
209
|
+
done <"$skill_dir/.weave-router-files"
|
|
210
|
+
rm -f "$skill_dir/.weave-router-files"
|
|
211
|
+
rmdir "$skill_dir/references" "$skill_dir/scripts" "$skill_dir" 2>/dev/null || true
|
|
212
|
+
ok "Removed $skill_dir"
|
|
213
|
+
fi
|
|
214
|
+
rmdir "$skills_dir" 2>/dev/null || true
|
|
215
|
+
|
|
216
|
+
if [ -z "$agents_dir" ] || [ ! -d "$agents_dir" ] || [ -L "$agents_dir" ]; then return 0; fi
|
|
217
|
+
for agent_file in "$agents_dir"/build-*.md; do
|
|
218
|
+
if [ ! -f "$agent_file" ] || [ -L "$agent_file" ]; then continue; fi
|
|
219
|
+
name="$(basename "$agent_file" .md)"
|
|
220
|
+
grep -Fq "<!-- weave-router managed agent: $name -->" "$agent_file" || continue
|
|
221
|
+
rm -f "$agent_file"
|
|
222
|
+
ok "Removed $agent_file"
|
|
223
|
+
done
|
|
224
|
+
rmdir "$agents_dir" 2>/dev/null || true
|
|
225
|
+
}
|
|
226
|
+
|
|
179
227
|
# weave_command_router_owned accepts legacy marker-bearing wrappers and
|
|
180
228
|
# markerless wrappers written by current installers. Current wrappers carry a
|
|
181
229
|
# body copy in a sidecar so ownership survives standalone and piped uninstall.
|
|
@@ -356,77 +404,6 @@ if [ -z "${WEAVE_UNINSTALL_ALL_CHILD:-}" ] && { [ "$target" = "claude" ] || [ "$
|
|
|
356
404
|
exit 1
|
|
357
405
|
fi
|
|
358
406
|
|
|
359
|
-
# Claude Desktop runs through a local proxy service (see install.sh); remove the
|
|
360
|
-
# service, its certificate and the stored router key.
|
|
361
|
-
if [ "$target" = "claude-desktop" ]; then
|
|
362
|
-
if [ "$scope" = "project" ]; then
|
|
363
|
-
[ -z "${WEAVE_UNINSTALL_ALL_CHILD:-}" ] || exit 3
|
|
364
|
-
err "--claude-desktop installs in user scope only; drop --scope project."
|
|
365
|
-
exit 2
|
|
366
|
-
fi
|
|
367
|
-
desktop_shim_dir="${install_dir:-$HOME}/.weave-router/desktop-shim"
|
|
368
|
-
desktop_shim_config="$desktop_shim_dir/config.json"
|
|
369
|
-
desktop_shim_plist="$HOME/Library/LaunchAgents/ai.workweave.router-desktop-shim.plist"
|
|
370
|
-
desktop_shim_unit="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user/weave-router-desktop-shim.service"
|
|
371
|
-
skip_if_not_installed "$desktop_shim_config" 'router_base_url'
|
|
372
|
-
# The service files live under $HOME whatever --dir says; only remove the ones
|
|
373
|
-
# that run this install's config.
|
|
374
|
-
desktop_shim_config_xml="$(printf '%s' "$desktop_shim_config" | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g')"
|
|
375
|
-
if [ -f "$desktop_shim_plist" ] && grep -Fq "<string>$desktop_shim_config_xml</string>" "$desktop_shim_plist"; then
|
|
376
|
-
launchctl bootout "gui/$(id -u)/ai.workweave.router-desktop-shim" >/dev/null 2>&1 || true
|
|
377
|
-
rm -f "$desktop_shim_plist"
|
|
378
|
-
ok "Removed $desktop_shim_plist"
|
|
379
|
-
fi
|
|
380
|
-
if [ -f "$desktop_shim_unit" ] && grep -Fq "\"$desktop_shim_config\"" "$desktop_shim_unit"; then
|
|
381
|
-
systemctl --user disable --now weave-router-desktop-shim.service >/dev/null 2>&1 || true
|
|
382
|
-
rm -f "$desktop_shim_unit"
|
|
383
|
-
systemctl --user daemon-reload >/dev/null 2>&1 || true
|
|
384
|
-
ok "Removed $desktop_shim_unit"
|
|
385
|
-
fi
|
|
386
|
-
# Undo the trusted certificate and the auto-proxy, but only where they are this install's.
|
|
387
|
-
desktop_shim_pac="http://127.0.0.1:$(jq -r '.listen_port // 47821' "$desktop_shim_config" 2>/dev/null || echo 47821)/proxy.pac"
|
|
388
|
-
case "$(uname -s)" in
|
|
389
|
-
Darwin)
|
|
390
|
-
if [ -f "$desktop_shim_dir/ca.pem" ] \
|
|
391
|
-
&& security find-certificate -c "Weave Router Claude Desktop proxy" "$HOME/Library/Keychains/login.keychain-db" >/dev/null 2>&1; then
|
|
392
|
-
if ! security remove-trusted-cert "$desktop_shim_dir/ca.pem" \
|
|
393
|
-
|| ! security delete-certificate -Z "$(openssl x509 -noout -fingerprint -sha1 -in "$desktop_shim_dir/ca.pem" | sed 's/.*=//; s/://g')" \
|
|
394
|
-
"$HOME/Library/Keychains/login.keychain-db" >/dev/null; then
|
|
395
|
-
desktop_shim_ca_left="true"
|
|
396
|
-
fi
|
|
397
|
-
fi
|
|
398
|
-
while IFS= read -r service; do
|
|
399
|
-
if [ "$(networksetup -getautoproxyurl "$service" | sed -n 's/^URL: //p')" = "$desktop_shim_pac" ]; then
|
|
400
|
-
sudo networksetup -setautoproxystate "$service" off
|
|
401
|
-
fi
|
|
402
|
-
done < <(networksetup -listallnetworkservices | tail -n +2 | grep -v '^\*')
|
|
403
|
-
;;
|
|
404
|
-
Linux)
|
|
405
|
-
desktop_shim_ca_store="/usr/local/share/ca-certificates/weave-router-claude-desktop.crt"
|
|
406
|
-
if [ -f "$desktop_shim_ca_store" ] && cmp -s "$desktop_shim_dir/ca.pem" "$desktop_shim_ca_store"; then
|
|
407
|
-
if ! { sudo rm -f "$desktop_shim_ca_store" && sudo update-ca-certificates --fresh >/dev/null; }; then
|
|
408
|
-
desktop_shim_ca_left="true"
|
|
409
|
-
fi
|
|
410
|
-
fi
|
|
411
|
-
if [ "$(gsettings get org.gnome.system.proxy autoconfig-url 2>/dev/null)" = "'$desktop_shim_pac'" ]; then
|
|
412
|
-
gsettings set org.gnome.system.proxy mode 'none'
|
|
413
|
-
gsettings reset org.gnome.system.proxy autoconfig-url
|
|
414
|
-
fi
|
|
415
|
-
;;
|
|
416
|
-
esac
|
|
417
|
-
# Keep ca.pem and the config while the OS still trusts the CA, so a rerun can remove it.
|
|
418
|
-
if [ "${desktop_shim_ca_left:-}" = "true" ]; then
|
|
419
|
-
warn "Could not remove the proxy certificate from the OS trust store (a cancelled password prompt?). Rerun: npx @weave-os/router --uninstall --claude-desktop"
|
|
420
|
-
elif [ -d "$desktop_shim_dir" ]; then
|
|
421
|
-
refuse_if_symlink "$desktop_shim_dir"
|
|
422
|
-
rm -rf "$desktop_shim_dir"
|
|
423
|
-
rmdir "$(dirname "$desktop_shim_dir")" 2>/dev/null || true
|
|
424
|
-
ok "Removed $desktop_shim_dir"
|
|
425
|
-
fi
|
|
426
|
-
info "Quit and reopen Claude Desktop so new sessions go direct to Anthropic."
|
|
427
|
-
exit 0
|
|
428
|
-
fi
|
|
429
|
-
|
|
430
407
|
# ---------- lifecycle report ----------
|
|
431
408
|
#
|
|
432
409
|
# report_uninstall_event tells this install's router that the uninstall is
|
|
@@ -593,6 +570,84 @@ report_pi_uninstall_event() {
|
|
|
593
570
|
report_uninstall_event pi "$endpoint" "$key"
|
|
594
571
|
}
|
|
595
572
|
|
|
573
|
+
report_desktop_uninstall_event() {
|
|
574
|
+
local f="$1"
|
|
575
|
+
uninstall_file_is_own "$f" || return 0
|
|
576
|
+
report_uninstall_event claude_desktop "$(uninstall_json_get "$f" '.router_base_url')" "$(uninstall_json_get "$f" '.router_key')"
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
# Claude Desktop runs through a local proxy service (see install.sh); remove the
|
|
580
|
+
# service, its certificate and the stored router key.
|
|
581
|
+
if [ "$target" = "claude-desktop" ]; then
|
|
582
|
+
if [ "$scope" = "project" ]; then
|
|
583
|
+
[ -z "${WEAVE_UNINSTALL_ALL_CHILD:-}" ] || exit 3
|
|
584
|
+
err "--claude-desktop installs in user scope only; drop --scope project."
|
|
585
|
+
exit 2
|
|
586
|
+
fi
|
|
587
|
+
desktop_shim_dir="${install_dir:-$HOME}/.weave-router/desktop-shim"
|
|
588
|
+
desktop_shim_config="$desktop_shim_dir/config.json"
|
|
589
|
+
desktop_shim_plist="$HOME/Library/LaunchAgents/ai.workweave.router-desktop-shim.plist"
|
|
590
|
+
desktop_shim_unit="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user/weave-router-desktop-shim.service"
|
|
591
|
+
skip_if_not_installed "$desktop_shim_config" 'router_base_url'
|
|
592
|
+
# The service files live under $HOME whatever --dir says; only remove the ones
|
|
593
|
+
# that run this install's config.
|
|
594
|
+
desktop_shim_config_xml="$(printf '%s' "$desktop_shim_config" | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g')"
|
|
595
|
+
if [ -f "$desktop_shim_plist" ] && grep -Fq "<string>$desktop_shim_config_xml</string>" "$desktop_shim_plist"; then
|
|
596
|
+
launchctl bootout "gui/$(id -u)/ai.workweave.router-desktop-shim" >/dev/null 2>&1 || true
|
|
597
|
+
rm -f "$desktop_shim_plist"
|
|
598
|
+
ok "Removed $desktop_shim_plist"
|
|
599
|
+
fi
|
|
600
|
+
if [ -f "$desktop_shim_unit" ] && grep -Fq "\"$desktop_shim_config\"" "$desktop_shim_unit"; then
|
|
601
|
+
systemctl --user disable --now weave-router-desktop-shim.service >/dev/null 2>&1 || true
|
|
602
|
+
rm -f "$desktop_shim_unit"
|
|
603
|
+
systemctl --user daemon-reload >/dev/null 2>&1 || true
|
|
604
|
+
ok "Removed $desktop_shim_unit"
|
|
605
|
+
fi
|
|
606
|
+
# Undo the trusted certificate and the auto-proxy, but only where they are this install's.
|
|
607
|
+
desktop_shim_pac="http://127.0.0.1:$(jq -r '.listen_port // 47821' "$desktop_shim_config" 2>/dev/null || echo 47821)/proxy.pac"
|
|
608
|
+
case "$(uname -s)" in
|
|
609
|
+
Darwin)
|
|
610
|
+
if [ -f "$desktop_shim_dir/ca.pem" ] \
|
|
611
|
+
&& security find-certificate -c "Weave Router Claude Desktop proxy" "$HOME/Library/Keychains/login.keychain-db" >/dev/null 2>&1; then
|
|
612
|
+
if ! security remove-trusted-cert "$desktop_shim_dir/ca.pem" \
|
|
613
|
+
|| ! security delete-certificate -Z "$(openssl x509 -noout -fingerprint -sha1 -in "$desktop_shim_dir/ca.pem" | sed 's/.*=//; s/://g')" \
|
|
614
|
+
"$HOME/Library/Keychains/login.keychain-db" >/dev/null; then
|
|
615
|
+
desktop_shim_ca_left="true"
|
|
616
|
+
fi
|
|
617
|
+
fi
|
|
618
|
+
while IFS= read -r service; do
|
|
619
|
+
if [ "$(networksetup -getautoproxyurl "$service" | sed -n 's/^URL: //p')" = "$desktop_shim_pac" ]; then
|
|
620
|
+
sudo networksetup -setautoproxystate "$service" off
|
|
621
|
+
fi
|
|
622
|
+
done < <(networksetup -listallnetworkservices | tail -n +2 | grep -v '^\*')
|
|
623
|
+
;;
|
|
624
|
+
Linux)
|
|
625
|
+
desktop_shim_ca_store="/usr/local/share/ca-certificates/weave-router-claude-desktop.crt"
|
|
626
|
+
if [ -f "$desktop_shim_ca_store" ] && cmp -s "$desktop_shim_dir/ca.pem" "$desktop_shim_ca_store"; then
|
|
627
|
+
if ! { sudo rm -f "$desktop_shim_ca_store" && sudo update-ca-certificates --fresh >/dev/null; }; then
|
|
628
|
+
desktop_shim_ca_left="true"
|
|
629
|
+
fi
|
|
630
|
+
fi
|
|
631
|
+
if [ "$(gsettings get org.gnome.system.proxy autoconfig-url 2>/dev/null)" = "'$desktop_shim_pac'" ]; then
|
|
632
|
+
gsettings set org.gnome.system.proxy mode 'none'
|
|
633
|
+
gsettings reset org.gnome.system.proxy autoconfig-url
|
|
634
|
+
fi
|
|
635
|
+
;;
|
|
636
|
+
esac
|
|
637
|
+
# Keep ca.pem and the config while the OS still trusts the CA, so a rerun can remove it.
|
|
638
|
+
if [ "${desktop_shim_ca_left:-}" = "true" ]; then
|
|
639
|
+
warn "Could not remove the proxy certificate from the OS trust store (a cancelled password prompt?). Rerun: npx @weave-os/router --uninstall --claude-desktop"
|
|
640
|
+
elif [ -d "$desktop_shim_dir" ]; then
|
|
641
|
+
refuse_if_symlink "$desktop_shim_dir"
|
|
642
|
+
report_desktop_uninstall_event "$desktop_shim_config"
|
|
643
|
+
rm -rf "$desktop_shim_dir"
|
|
644
|
+
rmdir "$(dirname "$desktop_shim_dir")" 2>/dev/null || true
|
|
645
|
+
ok "Removed $desktop_shim_dir"
|
|
646
|
+
fi
|
|
647
|
+
info "Quit and reopen Claude Desktop so new sessions go direct to Anthropic."
|
|
648
|
+
exit 0
|
|
649
|
+
fi
|
|
650
|
+
|
|
596
651
|
# Markers must stay in sync with install.sh. Keep verbatim.
|
|
597
652
|
WEAVE_CODEX_BEGIN_MARKER="# >>> weave-router managed (do not edit between markers) >>>"
|
|
598
653
|
WEAVE_CODEX_END_MARKER="# <<< weave-router managed <<<"
|
|
@@ -1092,15 +1147,15 @@ if [ "$target" = "pi" ]; then
|
|
|
1092
1147
|
# router. Leaving defaultProvider="weave" after removing the provider would
|
|
1093
1148
|
# break pi startup, so reverting is the correct reverse of the install.
|
|
1094
1149
|
# defaultModel is reverted ONLY when defaultProvider was "weave" (the state
|
|
1095
|
-
# install creates)
|
|
1096
|
-
#
|
|
1150
|
+
# install creates) and it names a model install wrote: "auto", or
|
|
1151
|
+
# claude-sonnet-4-6 from installs before weave/auto.
|
|
1097
1152
|
if [ -f "$pi_settings_file" ]; then
|
|
1098
1153
|
cleaned="$(jq '
|
|
1099
1154
|
(if .packages then .packages -= ["npm:@workweave/router", "npm:@weave-os/router", "npm:@workweave/pi-router"] else . end)
|
|
1100
1155
|
| (if (.packages // []) == [] then del(.packages) else . end)
|
|
1101
1156
|
| (if .defaultProvider == "weave"
|
|
1102
1157
|
then del(.defaultProvider)
|
|
1103
|
-
| (if .defaultModel == "claude-sonnet-4-6" then del(.defaultModel) else . end)
|
|
1158
|
+
| (if .defaultModel == "auto" or .defaultModel == "claude-sonnet-4-6" then del(.defaultModel) else . end)
|
|
1104
1159
|
else . end)
|
|
1105
1160
|
' "$pi_settings_file")"
|
|
1106
1161
|
printf '%s\n' "$cleaned" >"$pi_settings_file"
|
|
@@ -1292,6 +1347,7 @@ EOF
|
|
|
1292
1347
|
# Drop skills/ when nothing is left in it, matching how the prompts and
|
|
1293
1348
|
# Claude command paths clean up their now-empty directories. rmdir refuses
|
|
1294
1349
|
# a non-empty dir, so an unrelated user skill keeps it.
|
|
1350
|
+
uninstall_build_skill "$codex_dir/skills"
|
|
1295
1351
|
rmdir "$codex_dir/skills" 2>/dev/null || true
|
|
1296
1352
|
fi
|
|
1297
1353
|
|
|
@@ -1510,6 +1566,7 @@ EOF
|
|
|
1510
1566
|
# Clean up the dir only if we left nothing behind.
|
|
1511
1567
|
rmdir "$commands_dir" 2>/dev/null || true
|
|
1512
1568
|
fi
|
|
1569
|
+
uninstall_build_skill "$(dirname "$settings_file")/skills" "$(dirname "$settings_file")/agents"
|
|
1513
1570
|
|
|
1514
1571
|
if [ -n "$install_dir" ]; then
|
|
1515
1572
|
ok "Weave Router uninstalled from $install_dir."
|
package/windows.js
CHANGED
|
@@ -369,7 +369,7 @@ function installPi(paths, baseUrl, key, email) {
|
|
|
369
369
|
apiKey: key,
|
|
370
370
|
authHeader: false,
|
|
371
371
|
headers: { "X-Weave-Router-Key": key, "X-App": "pi", "x-weave-routing-marker": "off", "x-weave-routing-alpha": "0.8", "x-weave-routing-speed-weight": "0.05", "x-weave-routing-output-cost-ratio": "0.5", "x-weave-routing-expected-output-tokens": "3000", ...(email ? { "X-Weave-User-Email": email } : {}) },
|
|
372
|
-
models: [{ id: "
|
|
372
|
+
models: [{ id: "auto", name: "Weave Router", reasoning: true, input: ["text", "image"], contextWindow: 1000000, maxTokens: 64000 }],
|
|
373
373
|
};
|
|
374
374
|
const settings = readJson(paths.settings);
|
|
375
375
|
const state = readJson(paths.state);
|
|
@@ -377,7 +377,7 @@ function installPi(paths, baseUrl, key, email) {
|
|
|
377
377
|
if (!Object.hasOwn(state, "defaultModel")) state.defaultModel = { exists: Object.hasOwn(settings, "defaultModel"), value: settings.defaultModel };
|
|
378
378
|
settings.packages = [...new Set([...(settings.packages || []).filter((item) => !/^npm:@(?:workweave\/(?:pi-)?router|weave-os\/router)$/.test(item)), `npm:${packageName}`])];
|
|
379
379
|
settings.defaultProvider = "weave";
|
|
380
|
-
settings.defaultModel
|
|
380
|
+
settings.defaultModel = "auto";
|
|
381
381
|
writeJson(paths.config, models);
|
|
382
382
|
writeJson(paths.settings, settings);
|
|
383
383
|
writeJson(paths.state, state);
|
|
@@ -467,6 +467,7 @@ function uninstall(paths, target) {
|
|
|
467
467
|
const state = readJson(paths.state);
|
|
468
468
|
settings.packages = (settings.packages || []).filter((item) => item !== `npm:${packageName}`);
|
|
469
469
|
restoreField(settings, "defaultProvider", state.defaultProvider, "weave");
|
|
470
|
+
restoreField(settings, "defaultModel", state.defaultModel, "auto");
|
|
470
471
|
restoreField(settings, "defaultModel", state.defaultModel, "claude-sonnet-4-6");
|
|
471
472
|
writeJson(paths.settings, settings);
|
|
472
473
|
}
|