@weave-os/router 0.2.35 → 0.2.37
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/README.md +1 -1
- package/bin.js +1 -1
- package/cc-statusline.sh +66 -17
- 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/directives.tsv +1 -0
- package/install.sh +335 -88
- package/package.json +9 -2
- 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 +55 -5
- package/windows.js +7 -3
|
@@ -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.
|
|
@@ -1092,15 +1140,15 @@ if [ "$target" = "pi" ]; then
|
|
|
1092
1140
|
# router. Leaving defaultProvider="weave" after removing the provider would
|
|
1093
1141
|
# break pi startup, so reverting is the correct reverse of the install.
|
|
1094
1142
|
# defaultModel is reverted ONLY when defaultProvider was "weave" (the state
|
|
1095
|
-
# install creates)
|
|
1096
|
-
#
|
|
1143
|
+
# install creates) and it names a model install wrote: "auto", or
|
|
1144
|
+
# claude-sonnet-4-6 from installs before weave/auto.
|
|
1097
1145
|
if [ -f "$pi_settings_file" ]; then
|
|
1098
1146
|
cleaned="$(jq '
|
|
1099
1147
|
(if .packages then .packages -= ["npm:@workweave/router", "npm:@weave-os/router", "npm:@workweave/pi-router"] else . end)
|
|
1100
1148
|
| (if (.packages // []) == [] then del(.packages) else . end)
|
|
1101
1149
|
| (if .defaultProvider == "weave"
|
|
1102
1150
|
then del(.defaultProvider)
|
|
1103
|
-
| (if .defaultModel == "claude-sonnet-4-6" then del(.defaultModel) else . end)
|
|
1151
|
+
| (if .defaultModel == "auto" or .defaultModel == "claude-sonnet-4-6" then del(.defaultModel) else . end)
|
|
1104
1152
|
else . end)
|
|
1105
1153
|
' "$pi_settings_file")"
|
|
1106
1154
|
printf '%s\n' "$cleaned" >"$pi_settings_file"
|
|
@@ -1292,6 +1340,7 @@ EOF
|
|
|
1292
1340
|
# Drop skills/ when nothing is left in it, matching how the prompts and
|
|
1293
1341
|
# Claude command paths clean up their now-empty directories. rmdir refuses
|
|
1294
1342
|
# a non-empty dir, so an unrelated user skill keeps it.
|
|
1343
|
+
uninstall_build_skill "$codex_dir/skills"
|
|
1295
1344
|
rmdir "$codex_dir/skills" 2>/dev/null || true
|
|
1296
1345
|
fi
|
|
1297
1346
|
|
|
@@ -1419,7 +1468,7 @@ if [ -f "$settings_file" ]; then
|
|
|
1419
1468
|
# statusLine or apiKeyHelper would be silently clobbered.
|
|
1420
1469
|
cleaned="$(jq --arg statusline_setting_owned "$statusline_setting_owned" "$CLAUDE_WEAVE_AUTO_STRIP_JQ"' |
|
|
1421
1470
|
if .env then
|
|
1422
|
-
.env |= (del(.ANTHROPIC_BASE_URL, .ANTHROPIC_AUTH_TOKEN, .ANTHROPIC_CUSTOM_HEADERS, .ENABLE_TOOL_SEARCH))
|
|
1471
|
+
.env |= (del(.ANTHROPIC_BASE_URL, .ANTHROPIC_AUTH_TOKEN, .ANTHROPIC_CUSTOM_HEADERS, .ENABLE_TOOL_SEARCH, .CLAUDE_CODE_AUTO_MODE_SERVER))
|
|
1423
1472
|
| (if (.env | length) == 0 then del(.env) else . end)
|
|
1424
1473
|
else . end
|
|
1425
1474
|
| (if $statusline_setting_owned == "true" then del(.statusLine) else . end)
|
|
@@ -1450,7 +1499,7 @@ if [ -n "$local_settings_file" ] && [ -f "$local_settings_file" ]; then
|
|
|
1450
1499
|
# router key; scrub both so uninstall fully reverts the local config.
|
|
1451
1500
|
cleaned="$(jq "$CLAUDE_WEAVE_AUTO_STRIP_JQ"' |
|
|
1452
1501
|
if .env then
|
|
1453
|
-
.env |= (del(.ANTHROPIC_BASE_URL, .ANTHROPIC_AUTH_TOKEN, .ANTHROPIC_CUSTOM_HEADERS, .ENABLE_TOOL_SEARCH, .WEAVE_ROUTER_BASE_URL))
|
|
1502
|
+
.env |= (del(.ANTHROPIC_BASE_URL, .ANTHROPIC_AUTH_TOKEN, .ANTHROPIC_CUSTOM_HEADERS, .ENABLE_TOOL_SEARCH, .CLAUDE_CODE_AUTO_MODE_SERVER, .WEAVE_ROUTER_BASE_URL))
|
|
1454
1503
|
| (if (.env | length) == 0 then del(.env) else . end)
|
|
1455
1504
|
else . end
|
|
1456
1505
|
| del(.apiKeyHelper)
|
|
@@ -1510,6 +1559,7 @@ EOF
|
|
|
1510
1559
|
# Clean up the dir only if we left nothing behind.
|
|
1511
1560
|
rmdir "$commands_dir" 2>/dev/null || true
|
|
1512
1561
|
fi
|
|
1562
|
+
uninstall_build_skill "$(dirname "$settings_file")/skills" "$(dirname "$settings_file")/agents"
|
|
1513
1563
|
|
|
1514
1564
|
if [ -n "$install_dir" ]; then
|
|
1515
1565
|
ok "Weave Router uninstalled from $install_dir."
|
package/windows.js
CHANGED
|
@@ -238,7 +238,8 @@ function installClaude(paths, baseUrl, key, email, attribution) {
|
|
|
238
238
|
const optedOutOfAttribution = Object.hasOwn(settings.env || {}, "ANTHROPIC_BASE_URL") && settings.attribution == null;
|
|
239
239
|
const localSettings = paths.localConfig ? readJson(paths.localConfig) : null;
|
|
240
240
|
const state = readJson(paths.state);
|
|
241
|
-
state.env ||=
|
|
241
|
+
state.env ||= {};
|
|
242
|
+
for (const field of ["ANTHROPIC_BASE_URL", "ENABLE_TOOL_SEARCH", "CLAUDE_CODE_AUTO_MODE_SERVER"]) state.env[field] ||= { exists: Object.hasOwn(settings.env || {}, field), value: settings.env?.[field] };
|
|
242
243
|
state.attribution ||= Object.fromEntries(Object.keys(claudeAttribution).map((field) => [field, { exists: Object.hasOwn(settings.attribution || {}, field), value: settings.attribution?.[field] }]));
|
|
243
244
|
state.originalAppHeaders ||= {
|
|
244
245
|
config: (settings.env?.ANTHROPIC_CUSTOM_HEADERS || "").split("\n").filter((header) => /^X-App:/i.test(header)),
|
|
@@ -266,6 +267,7 @@ function installClaude(paths, baseUrl, key, email, attribution) {
|
|
|
266
267
|
settings.env.ANTHROPIC_CUSTOM_HEADERS = [...previousHeaders, ...routerHeaders].filter(Boolean).join("\n");
|
|
267
268
|
}
|
|
268
269
|
settings.env.ENABLE_TOOL_SEARCH = "true";
|
|
270
|
+
settings.env.CLAUDE_CODE_AUTO_MODE_SERVER = "0";
|
|
269
271
|
const modelSettings = localSettings || settings;
|
|
270
272
|
const modelUnset = !process.env.ANTHROPIC_MODEL && [settings, localSettings, readJson(path.join(process.env.USERPROFILE || process.env.HOME, ".claude", "settings.json"))].every((layer) => !layer || (!Object.hasOwn(layer, "model") && !layer.env?.ANTHROPIC_MODEL));
|
|
271
273
|
modelSettings.modelPicker = { ...(modelSettings.modelPicker || {}) };
|
|
@@ -367,7 +369,7 @@ function installPi(paths, baseUrl, key, email) {
|
|
|
367
369
|
apiKey: key,
|
|
368
370
|
authHeader: false,
|
|
369
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 } : {}) },
|
|
370
|
-
models: [{ id: "
|
|
372
|
+
models: [{ id: "auto", name: "Weave Router", reasoning: true, input: ["text", "image"], contextWindow: 1000000, maxTokens: 64000 }],
|
|
371
373
|
};
|
|
372
374
|
const settings = readJson(paths.settings);
|
|
373
375
|
const state = readJson(paths.state);
|
|
@@ -375,7 +377,7 @@ function installPi(paths, baseUrl, key, email) {
|
|
|
375
377
|
if (!Object.hasOwn(state, "defaultModel")) state.defaultModel = { exists: Object.hasOwn(settings, "defaultModel"), value: settings.defaultModel };
|
|
376
378
|
settings.packages = [...new Set([...(settings.packages || []).filter((item) => !/^npm:@(?:workweave\/(?:pi-)?router|weave-os\/router)$/.test(item)), `npm:${packageName}`])];
|
|
377
379
|
settings.defaultProvider = "weave";
|
|
378
|
-
settings.defaultModel
|
|
380
|
+
settings.defaultModel = "auto";
|
|
379
381
|
writeJson(paths.config, models);
|
|
380
382
|
writeJson(paths.settings, settings);
|
|
381
383
|
writeJson(paths.state, state);
|
|
@@ -392,6 +394,7 @@ function uninstall(paths, target) {
|
|
|
392
394
|
if (!fs.existsSync(paths.state) && ![settings.env?.ANTHROPIC_CUSTOM_HEADERS, localSettings?.env?.ANTHROPIC_CUSTOM_HEADERS].some((headers) => /^X-Weave-Router-Key:/m.test(headers || ""))) return;
|
|
393
395
|
restoreField(settings.env, "ANTHROPIC_BASE_URL", state.env?.ANTHROPIC_BASE_URL, state.installedBaseUrl || settings.env?.ANTHROPIC_BASE_URL);
|
|
394
396
|
restoreField(settings.env, "ENABLE_TOOL_SEARCH", state.env?.ENABLE_TOOL_SEARCH, "true");
|
|
397
|
+
restoreField(settings.env, "CLAUDE_CODE_AUTO_MODE_SERVER", state.env?.CLAUDE_CODE_AUTO_MODE_SERVER, "0");
|
|
395
398
|
for (const layer of [settings, localSettings]) if (layer) stripClaudeWeaveAuto(layer);
|
|
396
399
|
const customHeaders = (headerBlock, originalAppHeaders) => {
|
|
397
400
|
const preservedHeaders = (headerBlock || "").split("\n").filter((header) => !/^X-Weave-(?:Router-Key|User-Email|User-Name|Model-Passthrough):/i.test(header) && !/^X-App:\s*claude-code\s*$/i.test(header));
|
|
@@ -464,6 +467,7 @@ function uninstall(paths, target) {
|
|
|
464
467
|
const state = readJson(paths.state);
|
|
465
468
|
settings.packages = (settings.packages || []).filter((item) => item !== `npm:${packageName}`);
|
|
466
469
|
restoreField(settings, "defaultProvider", state.defaultProvider, "weave");
|
|
470
|
+
restoreField(settings, "defaultModel", state.defaultModel, "auto");
|
|
467
471
|
restoreField(settings, "defaultModel", state.defaultModel, "claude-sonnet-4-6");
|
|
468
472
|
writeJson(paths.settings, settings);
|
|
469
473
|
}
|