@weave-os/router 0.2.23 → 0.2.25
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/LICENSE +201 -89
- package/NOTICE +16 -0
- package/README.md +25 -8
- package/cc-statusline.sh +21 -0
- package/codex-status.sh +24 -1
- package/install.sh +349 -127
- package/opencode-weave/README.md +41 -63
- package/opencode-weave/package.json +1 -1
- package/opencode-weave/src/classifier-thread.ts +145 -0
- package/opencode-weave/src/index.ts +43 -620
- package/package.json +4 -3
- package/pi-router/src/pricing.generated.ts +8 -1
- package/uninstall.sh +187 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weave-os/router",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.25",
|
|
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",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"pi-router/",
|
|
29
29
|
"opencode-weave/",
|
|
30
30
|
"README.md",
|
|
31
|
-
"LICENSE"
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"NOTICE"
|
|
32
33
|
],
|
|
33
34
|
"scripts": {
|
|
34
35
|
"prepack": "node ./scripts/copy-installer.js"
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
"directory": "install/npm"
|
|
67
68
|
},
|
|
68
69
|
"homepage": "https://workweave.ai",
|
|
69
|
-
"license": "
|
|
70
|
+
"license": "Apache-2.0",
|
|
70
71
|
"keywords": [
|
|
71
72
|
"weave",
|
|
72
73
|
"router",
|
|
@@ -7,7 +7,7 @@ export interface ModelPricing {
|
|
|
7
7
|
cacheReadMultiplier: number;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const PRICING_VERSION = "catalog-sha256:
|
|
10
|
+
export const PRICING_VERSION = "catalog-sha256:ecb506fcec0b73ed";
|
|
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 },
|
|
@@ -20,12 +20,14 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
|
|
|
20
20
|
"claude-opus-4-7": { inputUsdPerMillion: 5, outputUsdPerMillion: 25, cacheReadMultiplier: 0.1 },
|
|
21
21
|
"claude-opus-4-8": { inputUsdPerMillion: 5, outputUsdPerMillion: 25, cacheReadMultiplier: 0.1 },
|
|
22
22
|
"claude-opus-5": { inputUsdPerMillion: 5, outputUsdPerMillion: 25, cacheReadMultiplier: 0.1 },
|
|
23
|
+
"claude-opus-5-5": { inputUsdPerMillion: 4, outputUsdPerMillion: 20, cacheReadMultiplier: 0.05 },
|
|
23
24
|
"claude-sonnet-4-5": { inputUsdPerMillion: 3, outputUsdPerMillion: 15, cacheReadMultiplier: 0.1 },
|
|
24
25
|
"claude-sonnet-4-6": { inputUsdPerMillion: 3, outputUsdPerMillion: 15, cacheReadMultiplier: 0.1 },
|
|
25
26
|
"claude-sonnet-5": { inputUsdPerMillion: 3, outputUsdPerMillion: 15, cacheReadMultiplier: 0.1 },
|
|
26
27
|
"deepseek/deepseek-v4-flash": { inputUsdPerMillion: 0.1134, outputUsdPerMillion: 0.2791, cacheReadMultiplier: 0.2 },
|
|
27
28
|
"deepseek/deepseek-v4-pro": { inputUsdPerMillion: 1.74, outputUsdPerMillion: 3.48, cacheReadMultiplier: 0.11494252873563218 },
|
|
28
29
|
"deepseek/deepseek-v4-pro-0813": { inputUsdPerMillion: 1.74, outputUsdPerMillion: 3.48, cacheReadMultiplier: 0.11494252873563218 },
|
|
30
|
+
"deepseek/deepseek-v4.1-flash": { inputUsdPerMillion: 0.22, outputUsdPerMillion: 0.66, cacheReadMultiplier: 0.031818181818181815 },
|
|
29
31
|
"gemini-2.0-flash": { inputUsdPerMillion: 0.1, outputUsdPerMillion: 0.4, cacheReadMultiplier: 0.25 },
|
|
30
32
|
"gemini-2.0-flash-lite": { inputUsdPerMillion: 0.075, outputUsdPerMillion: 0.3, cacheReadMultiplier: 0.25 },
|
|
31
33
|
"gemini-2.5-flash": { inputUsdPerMillion: 0.3, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.1 },
|
|
@@ -64,9 +66,12 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
|
|
|
64
66
|
"gpt-5.6-sol-pro": { inputUsdPerMillion: 4, outputUsdPerMillion: 20, cacheReadMultiplier: 0.1 },
|
|
65
67
|
"gpt-5.6-terra": { inputUsdPerMillion: 2, outputUsdPerMillion: 12, cacheReadMultiplier: 0.1 },
|
|
66
68
|
"gpt-6-astra": { inputUsdPerMillion: 10, outputUsdPerMillion: 50, cacheReadMultiplier: 0.1 },
|
|
69
|
+
"gpt-6-luna": { inputUsdPerMillion: 0.1, outputUsdPerMillion: 0.5, cacheReadMultiplier: 0.1 },
|
|
70
|
+
"gpt-6-sol": { inputUsdPerMillion: 2, outputUsdPerMillion: 10, cacheReadMultiplier: 0.1 },
|
|
67
71
|
"grok-4.5": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
|
|
68
72
|
"grok-4.6": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
|
|
69
73
|
"grok-4.7": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
|
|
74
|
+
"inclusionai/ling-3.0-flash": { inputUsdPerMillion: 0.06, outputUsdPerMillion: 0.18, cacheReadMultiplier: 0.2 },
|
|
70
75
|
"minimax/minimax-m2.7": { inputUsdPerMillion: 0.3, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.2 },
|
|
71
76
|
"minimax/minimax-m3": { inputUsdPerMillion: 0.3, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.2 },
|
|
72
77
|
"mistralai/mistral-small-2603": { inputUsdPerMillion: 0.2, outputUsdPerMillion: 0.6, cacheReadMultiplier: 0.1 },
|
|
@@ -85,6 +90,8 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
|
|
|
85
90
|
"qwen/qwen3.7-plus": { inputUsdPerMillion: 0.4, outputUsdPerMillion: 1.6, cacheReadMultiplier: 0.2 },
|
|
86
91
|
"qwen/qwen3.8-max": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.125 },
|
|
87
92
|
"xiaomi/mimo-v2.5-pro": { inputUsdPerMillion: 1, outputUsdPerMillion: 3, cacheReadMultiplier: 0.1 },
|
|
93
|
+
"xiaomi/mimo-v2.6-flash": { inputUsdPerMillion: 0.14, outputUsdPerMillion: 0.28, cacheReadMultiplier: 0.02 },
|
|
94
|
+
"xiaomi/mimo-v2.6-pro": { inputUsdPerMillion: 0.435, outputUsdPerMillion: 0.87, cacheReadMultiplier: 0.00827586 },
|
|
88
95
|
"z-ai/glm-5": { inputUsdPerMillion: 1, outputUsdPerMillion: 3.2, cacheReadMultiplier: 0.2 },
|
|
89
96
|
"z-ai/glm-5.1": { inputUsdPerMillion: 1.4, outputUsdPerMillion: 4.4, cacheReadMultiplier: 0.18571428571428572 },
|
|
90
97
|
"z-ai/glm-5.2": { inputUsdPerMillion: 1.4, outputUsdPerMillion: 4.4, cacheReadMultiplier: 0.18571428571428572 },
|
package/uninstall.sh
CHANGED
|
@@ -265,6 +265,171 @@ if { [ "$target" = "claude" ] || [ "$target" = "opencode" ] || [ "$target" = "pi
|
|
|
265
265
|
exit 1
|
|
266
266
|
fi
|
|
267
267
|
|
|
268
|
+
# ---------- lifecycle report ----------
|
|
269
|
+
#
|
|
270
|
+
# report_uninstall_event tells this install's router that the uninstall is
|
|
271
|
+
# happening, so it can log and export a lifecycle event. It runs before the
|
|
272
|
+
# key and config are removed (afterwards there is nothing left to
|
|
273
|
+
# authenticate with) and is strictly best-effort: the POST is detached with a
|
|
274
|
+
# short timeout, output discarded, and no failure changes the uninstall.
|
|
275
|
+
# uninstall.sh is served standalone, so the config readers install.sh already
|
|
276
|
+
# has are reduced here to the one field each: the endpoint and key of the
|
|
277
|
+
# managed provider block. A file git tracks is a checkout's, not this user's
|
|
278
|
+
# install, and never supplies a key; a checkout-supplied endpoint never
|
|
279
|
+
# receives one (same gates as install.sh's key_source_is_own and
|
|
280
|
+
# models_endpoint_is_trusted).
|
|
281
|
+
HOSTED_BASE_URL="https://router.workweave.ai"
|
|
282
|
+
ROUTER_KEY_HEADER="X-Weave-Router-Key"
|
|
283
|
+
|
|
284
|
+
uninstall_json_get() {
|
|
285
|
+
[ -f "$1" ] || return 0
|
|
286
|
+
jq -r "${2} // empty" "$1" 2>/dev/null || true
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
# uninstall_file_is_own mirrors key_source_is_own: only a project-scoped file
|
|
290
|
+
# is reachable by a repo, and one git tracks is not this user's install.
|
|
291
|
+
uninstall_file_is_own() {
|
|
292
|
+
local f="$1"
|
|
293
|
+
[ -f "$f" ] || return 1
|
|
294
|
+
[ -L "$f" ] && return 1
|
|
295
|
+
[ "$scope" = "project" ] && [ -z "$install_dir" ] || return 0
|
|
296
|
+
command -v git >/dev/null 2>&1 || return 1
|
|
297
|
+
git -C "$(dirname "$f")" ls-files --error-unmatch -- "$f" >/dev/null 2>&1 && return 1
|
|
298
|
+
return 0
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
uninstall_file_is_tracked() {
|
|
302
|
+
command -v git >/dev/null 2>&1 || return 1
|
|
303
|
+
git -C "$(dirname "$1")" ls-files --error-unmatch -- "$1" >/dev/null 2>&1
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
# uninstall_claude_key_from FILE prints the router key header value out of a
|
|
307
|
+
# Claude Code settings-shaped file ({"env":{"ANTHROPIC_CUSTOM_HEADERS":…}}).
|
|
308
|
+
uninstall_claude_key_from() {
|
|
309
|
+
uninstall_json_get "$1" '.env.ANTHROPIC_CUSTOM_HEADERS' \
|
|
310
|
+
| sed -n "s/^[[:space:]]*${ROUTER_KEY_HEADER}:[[:space:]]*//p" | head -n 1 | tr -d '[:space:]'
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
# report_uninstall_event HARNESS ENDPOINT KEY — fire the detached POST. The
|
|
314
|
+
# whole body runs in a subshell with errexit off so no setup failure can
|
|
315
|
+
# escape into the uninstall that still has files to remove.
|
|
316
|
+
report_uninstall_event() {
|
|
317
|
+
local harness="$1" endpoint="${2%/}" key="$3"
|
|
318
|
+
(
|
|
319
|
+
set +e
|
|
320
|
+
headers="" body=""
|
|
321
|
+
[ -n "$endpoint" ] && [ -n "$key" ] || exit 0
|
|
322
|
+
command -v curl >/dev/null 2>&1 || exit 0
|
|
323
|
+
headers="$(mktemp)" || exit 0
|
|
324
|
+
chmod 600 "$headers" || { rm -f "$headers"; exit 0; }
|
|
325
|
+
printf '%s: %s\n' "$ROUTER_KEY_HEADER" "$key" >"$headers" || { rm -f "$headers"; exit 0; }
|
|
326
|
+
body="$(printf '{"action":"uninstall","harness":"%s"}' "$harness")"
|
|
327
|
+
(
|
|
328
|
+
trap 'rm -f "$headers"' EXIT
|
|
329
|
+
curl -sS --max-time 2 -X POST -H 'Content-Type: application/json' \
|
|
330
|
+
--header "@$headers" --data-binary "$body" -o /dev/null \
|
|
331
|
+
"$endpoint/v1/client-events"
|
|
332
|
+
) >/dev/null 2>&1 </dev/null &
|
|
333
|
+
) >/dev/null 2>&1 || true
|
|
334
|
+
return 0
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
# report_claude_uninstall_event reads the endpoint and key the way install.sh's
|
|
338
|
+
# resolve_installed_endpoint / read_installed_key do for Claude Code: the
|
|
339
|
+
# parked sidecar first (while toggled off it holds both), then the settings
|
|
340
|
+
# files. Endpoint and key from the same file are self-consistent; otherwise the
|
|
341
|
+
# endpoint must be the hosted default, vouched for by the private
|
|
342
|
+
# WEAVE_ROUTER_BASE_URL marker beside the key, or live in a file git does not
|
|
343
|
+
# track.
|
|
344
|
+
report_claude_uninstall_event() {
|
|
345
|
+
local parked candidate endpoint="" base_src="" key="" key_src="" found marked
|
|
346
|
+
parked="$(dirname "$settings_file")/.weave-parked.json"
|
|
347
|
+
for candidate in "$parked" "$settings_file" "$local_settings_file"; do
|
|
348
|
+
if [ -z "$candidate" ] || [ ! -f "$candidate" ] || [ -L "$candidate" ]; then continue; fi
|
|
349
|
+
found="$(uninstall_json_get "$candidate" '.env.ANTHROPIC_BASE_URL')"
|
|
350
|
+
case "$found" in ""|https://api.anthropic.com*|http://api.anthropic.com*) continue ;; esac
|
|
351
|
+
endpoint="${found%/}"; base_src="$candidate"
|
|
352
|
+
break
|
|
353
|
+
done
|
|
354
|
+
[ -n "$endpoint" ] || return 0
|
|
355
|
+
for candidate in "$local_settings_file" "$settings_file" "$parked"; do
|
|
356
|
+
if [ -z "$candidate" ] || [ ! -f "$candidate" ] || [ -L "$candidate" ]; then continue; fi
|
|
357
|
+
key="$(uninstall_claude_key_from "$candidate")"
|
|
358
|
+
[ -n "$key" ] && { key_src="$candidate"; break; }
|
|
359
|
+
done
|
|
360
|
+
[ -n "$key" ] || return 0
|
|
361
|
+
local trusted="false"
|
|
362
|
+
if [ "$endpoint" = "${HOSTED_BASE_URL%/}" ] || [ "$base_src" = "$key_src" ]; then
|
|
363
|
+
trusted="true"
|
|
364
|
+
elif [ -n "$local_settings_file" ] && [ -f "$local_settings_file" ] && [ ! -L "$local_settings_file" ]; then
|
|
365
|
+
marked="$(uninstall_json_get "$local_settings_file" '.env.WEAVE_ROUTER_BASE_URL')"
|
|
366
|
+
if [ "${marked%/}" = "$endpoint" ]; then
|
|
367
|
+
uninstall_file_is_tracked "$local_settings_file" || trusted="true"
|
|
368
|
+
fi
|
|
369
|
+
fi
|
|
370
|
+
if [ "$trusted" != "true" ]; then
|
|
371
|
+
command -v git >/dev/null 2>&1 || return 0
|
|
372
|
+
uninstall_file_is_tracked "$base_src" && return 0
|
|
373
|
+
fi
|
|
374
|
+
report_uninstall_event claude_code "$endpoint" "$key"
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
# report_codex_uninstall_event reads base_url and the key header out of the
|
|
378
|
+
# [model_providers.weave] table wherever it sits (Codex's serializer drops the
|
|
379
|
+
# managed markers and may move the header into a subtable).
|
|
380
|
+
report_codex_uninstall_event() {
|
|
381
|
+
local f="$1" endpoint key
|
|
382
|
+
uninstall_file_is_own "$f" || return 0
|
|
383
|
+
endpoint="$(awk '
|
|
384
|
+
/^[[:space:]]*\[/ {
|
|
385
|
+
in_provider = ($0 ~ /^[[:space:]]*\[[[:space:]]*model_providers[[:space:]]*\.[[:space:]]*weave[[:space:]]*\][[:space:]]*(#.*)?$/)
|
|
386
|
+
next
|
|
387
|
+
}
|
|
388
|
+
in_provider && match($0, /^[[:space:]]*base_url[[:space:]]*=[[:space:]]*"[^"]*"/) {
|
|
389
|
+
line = substr($0, RSTART, RLENGTH)
|
|
390
|
+
sub(/^.*=[[:space:]]*"/, "", line)
|
|
391
|
+
sub(/"$/, "", line)
|
|
392
|
+
print line
|
|
393
|
+
exit
|
|
394
|
+
}
|
|
395
|
+
' "$f" 2>/dev/null || true)"
|
|
396
|
+
endpoint="${endpoint%/}"; endpoint="${endpoint%/v1}"
|
|
397
|
+
key="$(awk '
|
|
398
|
+
/^[[:space:]]*\[/ {
|
|
399
|
+
in_provider = ($0 ~ /^[[:space:]]*\[[[:space:]]*model_providers[[:space:]]*\.[[:space:]]*weave[[:space:]]*(\.[^]]*)?\][[:space:]]*(#.*)?$/)
|
|
400
|
+
next
|
|
401
|
+
}
|
|
402
|
+
in_provider && match($0, /"?X-Weave-Router-Key"?[[:space:]]*=[[:space:]]*"[^"]*"/) {
|
|
403
|
+
hdr = substr($0, RSTART, RLENGTH)
|
|
404
|
+
sub(/^.*=[[:space:]]*"/, "", hdr)
|
|
405
|
+
sub(/"$/, "", hdr)
|
|
406
|
+
print hdr
|
|
407
|
+
exit
|
|
408
|
+
}
|
|
409
|
+
' "$f" 2>/dev/null || true)"
|
|
410
|
+
report_uninstall_event codex "$endpoint" "$key"
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
report_opencode_uninstall_event() {
|
|
414
|
+
local f="$1" endpoint key
|
|
415
|
+
uninstall_file_is_own "$f" || return 0
|
|
416
|
+
endpoint="$(uninstall_json_get "$f" '.provider.weave.options.baseURL')"
|
|
417
|
+
endpoint="${endpoint%/}"; endpoint="${endpoint%/v1}"
|
|
418
|
+
key="$(uninstall_json_get "$f" '.provider.weave.options.headers["X-Weave-Router-Key"]')"
|
|
419
|
+
report_uninstall_event opencode "$endpoint" "$key"
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
report_pi_uninstall_event() {
|
|
423
|
+
local models="$1" key_file="$2" endpoint key=""
|
|
424
|
+
uninstall_file_is_own "$models" || return 0
|
|
425
|
+
endpoint="$(uninstall_json_get "$models" '.providers.weave.baseUrl')"
|
|
426
|
+
if uninstall_file_is_own "$key_file"; then
|
|
427
|
+
key="$(tr -d '[:space:]' <"$key_file" 2>/dev/null || true)"
|
|
428
|
+
fi
|
|
429
|
+
[ -n "$key" ] || key="$(uninstall_json_get "$models" '.providers.weave.headers["X-Weave-Router-Key"]')"
|
|
430
|
+
report_uninstall_event pi "$endpoint" "$key"
|
|
431
|
+
}
|
|
432
|
+
|
|
268
433
|
# Markers must stay in sync with install.sh. Keep verbatim.
|
|
269
434
|
WEAVE_CODEX_BEGIN_MARKER="# >>> weave-router managed (do not edit between markers) >>>"
|
|
270
435
|
WEAVE_CODEX_END_MARKER="# <<< weave-router managed <<<"
|
|
@@ -430,7 +595,10 @@ strip_codex_block() {
|
|
|
430
595
|
in_weave_provider = 0
|
|
431
596
|
}
|
|
432
597
|
in_weave_provider { next }
|
|
598
|
+
!in_section && /^[[:space:]]*#[[:space:]]*model_provider[[:space:]]*=[[:space:]]*"weave".*weave-router: off/ { next }
|
|
599
|
+
!in_section && /^[[:space:]]*#[[:space:]]*model[[:space:]]*=[[:space:]]*"weave-auto".*weave-router: off/ { next }
|
|
433
600
|
!in_section && /^[[:space:]]*model_provider[[:space:]]*=[[:space:]]*"weave"[[:space:]]*$/ { next }
|
|
601
|
+
!in_section && /^[[:space:]]*model[[:space:]]*=[[:space:]]*"weave-auto"[[:space:]]*$/ { next }
|
|
434
602
|
{ print }
|
|
435
603
|
' "$config_file" >"$tmp"
|
|
436
604
|
mv "$tmp" "$config_file"
|
|
@@ -496,18 +664,19 @@ if [ "$target" = "opencode" ]; then
|
|
|
496
664
|
opencode_direct_model="$(jq -r '.direct_model // empty' "$opencode_parked" 2>/dev/null || true)"
|
|
497
665
|
fi
|
|
498
666
|
|
|
499
|
-
#
|
|
500
|
-
#
|
|
501
|
-
# can differ (symlinks, trailing slash) and leave the entry behind.
|
|
667
|
+
# Remove the legacy plugin left by older installers. New installs no longer
|
|
668
|
+
# create it, but uninstall should clean it up when present.
|
|
502
669
|
if [ -d "$opencode_dir" ]; then
|
|
503
670
|
opencode_plugin="$(cd "$opencode_dir" && pwd)/.weave/opencode-weave.ts"
|
|
504
671
|
else
|
|
505
672
|
opencode_plugin="$opencode_dir/.weave/opencode-weave.ts"
|
|
506
673
|
fi
|
|
674
|
+
|
|
675
|
+
report_opencode_uninstall_event "$opencode_config_file" || true
|
|
507
676
|
if [ -f "$opencode_config_file" ]; then
|
|
508
|
-
# Strip every managed provider (`weave`,
|
|
509
|
-
#
|
|
510
|
-
# entry
|
|
677
|
+
# Strip every managed provider (`weave`, `weave-claude`, and the legacy
|
|
678
|
+
# `weave-codex` from pre-upgrade installs), remove the stale legacy plugin
|
|
679
|
+
# entry, and restore the direct model parked during
|
|
511
680
|
# install. Other providers, direct models selected while routing was off,
|
|
512
681
|
# other plugins, and unrelated keys are preserved.
|
|
513
682
|
cleaned="$(jq --arg plugin "$opencode_plugin" --arg direct_model "$opencode_direct_model" '
|
|
@@ -536,9 +705,6 @@ if [ "$target" = "opencode" ]; then
|
|
|
536
705
|
info "No opencode config at $opencode_config_file (already uninstalled?)"
|
|
537
706
|
fi
|
|
538
707
|
|
|
539
|
-
# Drop the bundled subscription plugin (no secrets; the config holds the key,
|
|
540
|
-
# opencode's own auth store holds the ChatGPT/Claude tokens). Remove the
|
|
541
|
-
# .weave/ dir only if it's left empty so we don't clobber an unrelated user dir.
|
|
542
708
|
if [ -f "$opencode_plugin" ]; then
|
|
543
709
|
refuse_if_symlink "$opencode_plugin"
|
|
544
710
|
rm -f "$opencode_plugin"
|
|
@@ -547,8 +713,13 @@ if [ "$target" = "opencode" ]; then
|
|
|
547
713
|
refuse_if_symlink "$opencode_directives"
|
|
548
714
|
rm -f "$opencode_directives"
|
|
549
715
|
fi
|
|
716
|
+
opencode_classifier="$(dirname "$opencode_plugin")/classifier-thread.ts"
|
|
717
|
+
if [ -f "$opencode_classifier" ]; then
|
|
718
|
+
refuse_if_symlink "$opencode_classifier"
|
|
719
|
+
rm -f "$opencode_classifier"
|
|
720
|
+
fi
|
|
550
721
|
rmdir "$opencode_dir/.weave" 2>/dev/null || true
|
|
551
|
-
ok "Removed
|
|
722
|
+
ok "Removed legacy opencode plugin"
|
|
552
723
|
fi
|
|
553
724
|
|
|
554
725
|
# Drop the toggle parked sidecar after its prior model has been restored.
|
|
@@ -657,6 +828,7 @@ if [ "$target" = "pi" ]; then
|
|
|
657
828
|
refuse_if_symlink "$pi_settings_file"
|
|
658
829
|
refuse_if_symlink "$pi_key_file"
|
|
659
830
|
|
|
831
|
+
report_pi_uninstall_event "$pi_models_file" "$pi_key_file" || true
|
|
660
832
|
# models.json: drop provider.weave; remove the file if nothing else remains.
|
|
661
833
|
# Other providers/models the user added are preserved.
|
|
662
834
|
if [ -f "$pi_models_file" ]; then
|
|
@@ -773,6 +945,7 @@ if [ "$target" = "codex" ]; then
|
|
|
773
945
|
# exits before strip_codex_block, so one symlinked helper left the config
|
|
774
946
|
# wired to a router the uninstall had just been asked to remove.
|
|
775
947
|
|
|
948
|
+
report_codex_uninstall_event "$codex_config_file" || true
|
|
776
949
|
if [ -f "$codex_config_file" ]; then
|
|
777
950
|
strip_codex_block "$codex_config_file"
|
|
778
951
|
# If the file now contains only whitespace/comments, leave it: the user
|
|
@@ -992,6 +1165,8 @@ if claude_statusline_router_owned \
|
|
|
992
1165
|
statusline_file_owned="true"
|
|
993
1166
|
fi
|
|
994
1167
|
|
|
1168
|
+
report_claude_uninstall_event || true
|
|
1169
|
+
|
|
995
1170
|
if [ -f "$settings_file" ]; then
|
|
996
1171
|
# Only remove keys we actually installed: scrub our env vars, and only
|
|
997
1172
|
# delete `statusLine` / `apiKeyHelper` when they point at scripts this
|
|
@@ -1005,7 +1180,8 @@ if [ -f "$settings_file" ]; then
|
|
|
1005
1180
|
| (if $statusline_setting_owned == "true" then del(.statusLine) else . end)
|
|
1006
1181
|
| (if (.apiKeyHelper // "" | tostring | endswith("weave-key.sh"))
|
|
1007
1182
|
then del(.apiKeyHelper) else . end)
|
|
1008
|
-
| (if ((.attribution.commit == "Co-Authored-By: Weave Router <router@
|
|
1183
|
+
| (if ((.attribution.commit == "Co-Authored-By: Weave Router <router@weaveos.com>"
|
|
1184
|
+
or .attribution.commit == "Co-Authored-By: Weave Router <router@workweave.ai>"
|
|
1009
1185
|
or .attribution.commit == "Co-Authored-By: Weave Router <noreply@workweave.ai>")
|
|
1010
1186
|
and .attribution.pr == "🤖 Generated with [Weave Router](https://router.workweave.ai)")
|
|
1011
1187
|
then del(.attribution) else . end)
|