@workweave/router 0.2.2 → 0.2.4
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 +3 -3
- package/cc-statusline.sh +51 -4
- package/commands/fm.md +1 -1
- package/commands/force-model.md +1 -1
- package/commands/rf.md +1 -1
- package/commands/router-feedback.md +1 -1
- package/commands/router-off.md +1 -1
- package/commands/router-on.md +1 -1
- package/commands/router-status.md +2 -2
- package/commands/ufm.md +1 -1
- package/commands/unforce-model.md +1 -1
- package/install.sh +218 -63
- package/opencode-weave/README.md +78 -0
- package/opencode-weave/package.json +9 -0
- package/opencode-weave/src/index.ts +655 -0
- package/package.json +2 -1
- package/pi-router/src/dispatch.ts +2 -2
- package/pi-router/src/index.ts +1 -1
- package/pi-router/src/provider.ts +1 -1
- package/pi-router/src/routed-model.ts +1 -1
- package/uninstall.sh +36 -10
|
@@ -301,7 +301,7 @@ export function registerDispatch(pi: ExtensionAPI, selfPath: string): void {
|
|
|
301
301
|
if (!key) {
|
|
302
302
|
return {
|
|
303
303
|
content: [
|
|
304
|
-
{ type: "text", text: "Weave dispatch unavailable: no router key (set WEAVE_ROUTER_KEY or run the --pi installer)." },
|
|
304
|
+
{ type: "text", text: "Weave Router dispatch unavailable: no router key (set WEAVE_ROUTER_KEY or run the --pi installer)." },
|
|
305
305
|
],
|
|
306
306
|
details: { results: [] as ChildResult[] },
|
|
307
307
|
isError: true,
|
|
@@ -337,7 +337,7 @@ export function registerDispatch(pi: ExtensionAPI, selfPath: string): void {
|
|
|
337
337
|
const preview = t.prompt.length > 60 ? `${t.prompt.slice(0, 60)}...` : t.prompt;
|
|
338
338
|
text += `\n ${theme.fg("dim", preview)}`;
|
|
339
339
|
}
|
|
340
|
-
if (tasks.length > 3) text += `\n ${theme.fg("muted",
|
|
340
|
+
if (tasks.length > 3) text += `\n ${theme.fg("muted", `… +${tasks.length - 3} more`)}`;
|
|
341
341
|
return new Text(text, 0, 0);
|
|
342
342
|
},
|
|
343
343
|
});
|
package/pi-router/src/index.ts
CHANGED
|
@@ -28,7 +28,7 @@ export function registerWeave(pi: ExtensionAPI): void {
|
|
|
28
28
|
// key there is fatal rather than silently routing on quality knobs.
|
|
29
29
|
if (isSubagent()) {
|
|
30
30
|
throw new Error(
|
|
31
|
-
"Weave: no router key found (set WEAVE_ROUTER_KEY or write ~/.pi/agent/.weave_router_key).",
|
|
31
|
+
"Weave Router: no router key found (set WEAVE_ROUTER_KEY or write ~/.pi/agent/.weave_router_key).",
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
return;
|
|
@@ -23,7 +23,7 @@ export function registerRoutedModel(pi: ExtensionAPI): void {
|
|
|
23
23
|
|
|
24
24
|
if (ctx.hasUI) {
|
|
25
25
|
ctx.ui.setStatus(STATUS_KEY, `routed: ${model}`);
|
|
26
|
-
ctx.ui.notify(`Weave routed to ${model}`, "info");
|
|
26
|
+
ctx.ui.notify(`Weave Router routed to ${model}`, "info");
|
|
27
27
|
} else {
|
|
28
28
|
process.stderr.write(`${ROUTED_MODEL_STDERR_PREFIX} ${model}\n`);
|
|
29
29
|
}
|
package/uninstall.sh
CHANGED
|
@@ -54,7 +54,7 @@ while [ $# -gt 0 ]; do
|
|
|
54
54
|
;;
|
|
55
55
|
--dir)
|
|
56
56
|
install_dir="${2:-}"; shift 2
|
|
57
|
-
[ -n "$install_dir" ] || { err "--dir requires a path"; exit 2; }
|
|
57
|
+
[ -n "$install_dir" ] || { err "--dir requires a path."; exit 2; }
|
|
58
58
|
;;
|
|
59
59
|
--codex)
|
|
60
60
|
target="codex"; shift
|
|
@@ -78,7 +78,7 @@ while [ $# -gt 0 ]; do
|
|
|
78
78
|
exit 0
|
|
79
79
|
;;
|
|
80
80
|
*)
|
|
81
|
-
err "
|
|
81
|
+
err "Unknown flag: $1. Run --help for usage."; exit 2
|
|
82
82
|
;;
|
|
83
83
|
esac
|
|
84
84
|
done
|
|
@@ -136,7 +136,7 @@ if [ "$target" = "opencode" ]; then
|
|
|
136
136
|
"~/"*) project_dir="$HOME/${project_dir#~/}" ;;
|
|
137
137
|
esac
|
|
138
138
|
if [ ! -d "$project_dir" ]; then
|
|
139
|
-
err "
|
|
139
|
+
err "Directory does not exist: $project_dir."
|
|
140
140
|
exit 1
|
|
141
141
|
fi
|
|
142
142
|
project_dir="$(cd "$project_dir" && pwd)"
|
|
@@ -155,14 +155,30 @@ if [ "$target" = "opencode" ]; then
|
|
|
155
155
|
opencode_config_file="$opencode_dir/opencode.json"
|
|
156
156
|
refuse_if_symlink "$opencode_config_file"
|
|
157
157
|
|
|
158
|
+
# Canonicalize the plugin path exactly as install.sh did (`cd … && pwd`) so
|
|
159
|
+
# the `plugin` array entry matches on removal — a raw "$opencode_dir/…" string
|
|
160
|
+
# can differ (symlinks, trailing slash) and leave the entry behind.
|
|
161
|
+
if [ -d "$opencode_dir" ]; then
|
|
162
|
+
opencode_plugin="$(cd "$opencode_dir" && pwd)/.weave/opencode-weave.ts"
|
|
163
|
+
else
|
|
164
|
+
opencode_plugin="$opencode_dir/.weave/opencode-weave.ts"
|
|
165
|
+
fi
|
|
158
166
|
if [ -f "$opencode_config_file" ]; then
|
|
159
|
-
# Strip `
|
|
160
|
-
#
|
|
167
|
+
# Strip every managed provider (`weave`, the login-only `weave-claude`, and
|
|
168
|
+
# the legacy `weave-codex` from pre-upgrade installs), the managed plugin
|
|
169
|
+
# entry from the `plugin` array, and any router-pointing top-level model
|
|
170
|
+
# (the `weave/`, `weave-claude/`, and `weave-codex/` prefixes — otherwise a
|
|
171
|
+
# default survives and points at a deleted provider). Other providers,
|
|
172
|
+
# user-set models that don't reference the router, other plugins, and any
|
|
161
173
|
# unrelated keys are preserved.
|
|
162
|
-
cleaned="$(jq '
|
|
174
|
+
cleaned="$(jq --arg plugin "$opencode_plugin" '
|
|
163
175
|
(if .provider.weave then del(.provider.weave) else . end)
|
|
176
|
+
| (if .provider["weave-claude"] then del(.provider["weave-claude"]) else . end)
|
|
177
|
+
| (if .provider["weave-codex"] then del(.provider["weave-codex"]) else . end)
|
|
164
178
|
| (if (.provider // {}) == {} then del(.provider) else . end)
|
|
165
|
-
| (if (.
|
|
179
|
+
| (if (.plugin | type) == "array" then .plugin -= [$plugin] else . end)
|
|
180
|
+
| (if (.plugin | type) == "array" and (.plugin | length) == 0 then del(.plugin) else . end)
|
|
181
|
+
| (if (.model // "" | tostring | (startswith("weave/") or startswith("weave-claude/") or startswith("weave-codex/"))) then del(.model) else . end)
|
|
166
182
|
' "$opencode_config_file")"
|
|
167
183
|
printf '%s\n' "$cleaned" >"$opencode_config_file"
|
|
168
184
|
|
|
@@ -179,6 +195,16 @@ if [ "$target" = "opencode" ]; then
|
|
|
179
195
|
info "No opencode config at $opencode_config_file (already uninstalled?)"
|
|
180
196
|
fi
|
|
181
197
|
|
|
198
|
+
# Drop the bundled subscription plugin (no secrets; the config holds the key,
|
|
199
|
+
# opencode's own auth store holds the ChatGPT/Claude tokens). Remove the
|
|
200
|
+
# .weave/ dir only if it's left empty so we don't clobber an unrelated user dir.
|
|
201
|
+
if [ -f "$opencode_plugin" ]; then
|
|
202
|
+
refuse_if_symlink "$opencode_plugin"
|
|
203
|
+
rm -f "$opencode_plugin"
|
|
204
|
+
rmdir "$opencode_dir/.weave" 2>/dev/null || true
|
|
205
|
+
ok "Removed $opencode_plugin"
|
|
206
|
+
fi
|
|
207
|
+
|
|
182
208
|
# Drop the toggle parked sidecar (holds the parked router model when off).
|
|
183
209
|
opencode_parked="$opencode_dir/.weave-parked.json"
|
|
184
210
|
if [ -f "$opencode_parked" ]; then
|
|
@@ -219,7 +245,7 @@ if [ "$target" = "pi" ]; then
|
|
|
219
245
|
"~/"*) project_dir="$HOME/${project_dir#~/}" ;;
|
|
220
246
|
esac
|
|
221
247
|
if [ ! -d "$project_dir" ]; then
|
|
222
|
-
err "
|
|
248
|
+
err "Directory does not exist: $project_dir."
|
|
223
249
|
exit 1
|
|
224
250
|
fi
|
|
225
251
|
project_dir="$(cd "$project_dir" && pwd)"
|
|
@@ -325,7 +351,7 @@ if [ "$target" = "codex" ]; then
|
|
|
325
351
|
"~/"*) project_dir="$HOME/${project_dir#~/}" ;;
|
|
326
352
|
esac
|
|
327
353
|
if [ ! -d "$project_dir" ]; then
|
|
328
|
-
err "
|
|
354
|
+
err "Directory does not exist: $project_dir."
|
|
329
355
|
exit 1
|
|
330
356
|
fi
|
|
331
357
|
project_dir="$(cd "$project_dir" && pwd)"
|
|
@@ -422,7 +448,7 @@ else
|
|
|
422
448
|
"~/"*) project_dir="$HOME/${project_dir#~/}" ;;
|
|
423
449
|
esac
|
|
424
450
|
if [ ! -d "$project_dir" ]; then
|
|
425
|
-
err "
|
|
451
|
+
err "Directory does not exist: $project_dir."
|
|
426
452
|
exit 1
|
|
427
453
|
fi
|
|
428
454
|
project_dir="$(cd "$project_dir" && pwd)"
|