@weave-os/router 0.2.36 → 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.
Files changed (37) hide show
  1. package/bin.js +1 -1
  2. package/cc-statusline.sh +58 -11
  3. package/codex-skills/fm/SKILL.md +2 -1
  4. package/codex-skills/force-model/SKILL.md +2 -1
  5. package/codex-skills/list-models/SKILL.md +28 -0
  6. package/codex-skills/rf/SKILL.md +2 -1
  7. package/codex-skills/router-feedback/SKILL.md +2 -1
  8. package/codex-skills/router-models/SKILL.md +1 -1
  9. package/codex-skills/ufm/SKILL.md +2 -1
  10. package/codex-skills/unforce-model/SKILL.md +2 -1
  11. package/codex-status.sh +95 -3
  12. package/commands/list-models.md +5 -0
  13. package/commands/models.md +1 -1
  14. package/commands/router-models.md +1 -1
  15. package/directives.tsv +1 -0
  16. package/install.sh +317 -79
  17. package/package.json +2 -1
  18. package/pi-router/README.md +7 -2
  19. package/pi-router/src/auto-model.ts +118 -0
  20. package/pi-router/src/config.ts +34 -28
  21. package/pi-router/src/dispatch.ts +2 -2
  22. package/pi-router/src/index.ts +5 -1
  23. package/pi-router/src/pricing.generated.ts +7 -2
  24. package/pi-router/src/routed-model.ts +5 -4
  25. package/skills/build/SKILL.md +71 -0
  26. package/skills/build/agents/build-implementer.md +13 -0
  27. package/skills/build/agents/build-researcher.md +11 -0
  28. package/skills/build/agents/build-reviewer.md +13 -0
  29. package/skills/build/agents/build-verifier.md +13 -0
  30. package/skills/build/references/client-controls.md +34 -0
  31. package/skills/build/references/pr-loop.md +10 -0
  32. package/skills/build/references/research-and-interview.md +24 -0
  33. package/skills/build/references/verification-and-review.md +20 -0
  34. package/skills/build/references/worker-contracts.md +71 -0
  35. package/skills/build/scripts/pin-coordinator.sh +3 -0
  36. package/uninstall.sh +53 -3
  37. 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.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ printf ' /force-parent %s\n' "${WEAVE_BUILD_COORDINATOR_MODEL:-claude-opus-5-5}"
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): install sets defaultModel only when it was empty, so a user
1096
- # who independently picked claude-sonnet-4-6 with their own provider keeps it.
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
 
@@ -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
@@ -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: "claude-sonnet-4-6", name: "Claude Sonnet 4.6 (via Weave Router)", reasoning: true, input: ["text", "image"], contextWindow: 1000000, maxTokens: 64000 }],
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 ||= "claude-sonnet-4-6";
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
  }