pi-smart-router 0.12.1 → 0.12.2

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
- AuthStorage,
3
2
  ModelRegistry,
3
+ ModelRuntime,
4
4
  type ExtensionAPI,
5
5
  } from '@earendil-works/pi-coding-agent';
6
6
 
@@ -35,8 +35,9 @@ export async function createSmartRouterRuntime(cwd: string): Promise<{
35
35
  runtime: SmartRouterRuntime;
36
36
  datasetNotify: DatasetNotify;
37
37
  }> {
38
- const authStorage = AuthStorage.create();
39
- const modelRegistry = ModelRegistry.inMemory(authStorage);
38
+ // Placeholder until session_start / commands bind ctx.modelRegistry (SP-087).
39
+ const modelRuntime = await ModelRuntime.create();
40
+ const modelRegistry = new ModelRegistry(modelRuntime);
40
41
  const hydraMatcher = await initHydraMatcher();
41
42
  const store = createExtensionStore(cwd);
42
43
  const operatorConfig = resolveOperatorConfigFromEnv();
package/README.md CHANGED
@@ -127,24 +127,43 @@ After auth or model list changes, restart pi or run `/reload`.
127
127
 
128
128
  ### Develop from clone
129
129
 
130
- Project-local extensions under `.pi/extensions/` load only after the project is trusted. Without trust, the smart-router provider is never registered `smart-router` will not appear in `/scoped-models` or `/model`, and `/smart-router` commands will not exist.
130
+ Requires **Pi 0.80.8** (`pi.minPiVersion`). The extension loads TypeScript from this repo via pi’s loaderno `npm run build` needed for dogfooding.
131
+
132
+ **Recommended (works from any cwd):** install the clone as a **path package** and remove any published npm copy. npm and path packages have different identities; leaving both installed can double-load and you may keep running a stale npm tarball.
133
+
134
+ ```bash
135
+ # From anywhere — remove published package if present
136
+ pi remove npm:pi-smart-router
137
+
138
+ # Prefer an absolute path (relative paths are resolved from the install cwd first).
139
+ # Pi stores a path relative to ~/.pi/agent/ in settings (same pattern as other local packages).
140
+ pi install /path/to/pi-smart-router
141
+
142
+ # Pi does not run npm install for path packages
143
+ cd /path/to/pi-smart-router && npm install
144
+
145
+ pi list # must show this clone path, not ~/.pi/agent/npm/.../pi-smart-router
146
+ pi --list-models | grep smart-router
147
+ ```
148
+
149
+ **Alternative (repo-root discovery only):** with the npm package removed, start `pi` with cwd at this repo root. Project-local extensions under `.pi/extensions/` load only after the project is trusted — without trust, `smart-router` never appears in `/scoped-models` or `/model`.
131
150
 
132
151
  **On first run**, pi prompts you to trust the project when it detects `.pi/extensions/`. Accept the prompt.
133
152
 
134
153
  **Later or missed prompt:** run `/trust` inside pi to save a trust decision for this directory (or its parent) to `~/.pi/agent/trust.json`. Trust on a **parent folder** (for example `~/Documents/github`) applies to this repo as well. After `/trust`, **restart pi** — the current session is not reloaded automatically.
135
154
 
136
- **Verify the extension loaded** (from the repo root):
155
+ **Verify the extension loaded:**
137
156
 
138
157
  ```bash
139
- cd pi-smart-router
140
158
  pi --list-models | grep smart-router
141
159
  ```
142
160
 
143
161
  You should see `smart-router auto`. If the line is missing:
144
162
 
145
- 1. Confirm `pi` was started with cwd at this repo root (not a parent directory).
146
- 2. Confirm the project is trusted (`/trust`, or check `~/.pi/agent/trust.json`).
147
- 3. Restart pi or run `/reload` after trusting.
163
+ 1. Confirm `pi list` points at this clone (path package) or that cwd is the repo root (discovery mode).
164
+ 2. Confirm no `npm:pi-smart-router` entry remains in settings while developing from clone.
165
+ 3. Confirm the project is trusted if relying on `.pi/extensions/` discovery (`/trust`, or check `~/.pi/agent/trust.json`).
166
+ 4. Restart pi or run `/reload` after trusting or changing packages.
148
167
 
149
168
  Non-interactive one-shot checks can pass `--approve` to trust project-local resources for that run only.
150
169
 
@@ -1150,10 +1169,11 @@ npm run release:check
1150
1169
  npm pack --dry-run
1151
1170
  ```
1152
1171
 
1153
- **Post-publish smoke (manual, macOS):** CI does not run `pi install`. After publish:
1172
+ **Post-publish smoke (manual, macOS):** CI does not run `pi install`. After publish (use the version just published; remove any path-package clone entry first if dogfooding):
1154
1173
 
1155
1174
  ```bash
1156
- pi install npm:pi-smart-router@0.1.1
1175
+ pi remove ../../Documents/github/pi-smart-router # if path dogfood was installed
1176
+ pi install npm:pi-smart-router@<published-version>
1157
1177
  pi --list-models | grep smart-router
1158
1178
  # in pi: /model smart-router/auto, /smart-router status
1159
1179
  ```
@@ -7,8 +7,8 @@
7
7
  "livecodebench": "https://livecodebench.github.io/leaderboard.html",
8
8
  "bfcl": "https://gorilla.cs.berkeley.edu/leaderboard.html"
9
9
  },
10
- "scrape_date": "2026-07-14",
11
- "catalog_freeze_date": "2026-07-14"
10
+ "scrape_date": "2026-07-16",
11
+ "catalog_freeze_date": "2026-07-16"
12
12
  },
13
13
  "aliases": {
14
14
  "claude-3-5-sonnet": "claude-sonnet-4-6",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-smart-router",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "description": "Auto-model router middleware for the pi.dev coding agent",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -88,6 +88,9 @@
88
88
  "routing:test-projection": "npm run build && node --experimental-strip-types scripts/test-hydra-projection.ts",
89
89
  "benchmark:encoder": "tsx scripts/benchmark-encoder-latency.ts",
90
90
  "qa:shadow-dogfood": "bash scripts/qa/shadow-dogfood-session.sh",
91
+ "qa:count-labeled-econ": "tsx scripts/qa/count-labeled-econ.ts",
92
+ "qa:export-dogfood-snapshot": "tsx scripts/qa/export-dogfood-snapshot.ts",
93
+ "qa:dogfood-gather": "bash scripts/qa/dogfood-gather.sh",
91
94
  "verify:ci": "npm run build && npm run typecheck && npm run lint && npm test && npm run coverage:check"
92
95
  },
93
96
  "peerDependencies": {
@@ -103,7 +106,7 @@
103
106
  }
104
107
  },
105
108
  "devDependencies": {
106
- "@earendil-works/pi-coding-agent": "^0.80.3",
109
+ "@earendil-works/pi-coding-agent": "^0.80.10",
107
110
  "@types/better-sqlite3": "^7.6.13",
108
111
  "@types/node": "^22.15.21",
109
112
  "@typescript-eslint/eslint-plugin": "^8.62.1",
@@ -117,7 +120,7 @@
117
120
  "vitest": "^3.2.3"
118
121
  },
119
122
  "dependencies": {
120
- "@earendil-works/pi-ai": "*",
123
+ "@earendil-works/pi-ai": "^0.80.10",
121
124
  "@huggingface/transformers": "^4.2.0",
122
125
  "better-sqlite3": "^12.11.1",
123
126
  "yaml": "^2.9.0",
@@ -133,6 +136,6 @@
133
136
  "skills": [
134
137
  "./skills"
135
138
  ],
136
- "minPiVersion": "0.80.0"
139
+ "minPiVersion": "0.80.8"
137
140
  }
138
141
  }