pi-freeflow 1.11.1 → 1.11.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +215 -209
  2. package/package.json +61 -61
  3. package/src/relay.ts +22 -0
package/CHANGELOG.md CHANGED
@@ -1,209 +1,215 @@
1
- # Changelog
2
-
3
- ## 1.11.1
4
-
5
- ### Patch Changes
6
-
7
- - Apologies for the daemon disconnect bug introduced in v1.11.0: in multi-agent workflows or when subagents, evaluations, and background tasks completed, the extension prematurely detached from the local proxy daemon, causing the proxy to shut down while your main session remained active. The heartbeat connection now persists throughout your active terminal session.
8
- - Increased local health check and liveness probe timeouts from 800ms and 500ms to 2500ms and 1500ms, with an automatic probe retry to avoid false-alarm daemon restarts during heavy concurrent streaming.
9
- - Added unhandled error logging inside the daemon to prevent silent process exits.
10
- - Fresh installs now log full HTTP lifecycle debug output by default so diagnostic reports contain complete request context; turn it off anytime with `/freeflow debug off`.
11
-
12
- ## 1.11.0
13
-
14
- ### Minor Changes
15
-
16
- - Proxy daemon now stays up while any session uses it, even when idle. It shuts down only after the last session leaves, instead of retiring after a short quiet window.
17
-
18
- ## 1.10.0
19
-
20
- ### Minor Changes
21
-
22
- - cf48598: Hands-free proxy recovery plus catalog refresh: the proxy now watches its own health, restarts with backoff instead of leaving a dead port, and can start on login. Removed two discontinued free models from the picker.
23
-
24
- All notable changes to pi-freeflow. Public, user-visible behavior only.
25
-
26
- ## 1.9.9 - 2026-09-06
27
-
28
- ### Fixes
29
-
30
- - **Removed our own request cap — sorry, that one was on us.** The proxy used to enforce a built-in request limit and could answer 429 before upstream quota was actually exhausted. That was a bug, not your quota. From this version the proxy never rejects on quota itself: a 429 only surfaces when the upstream — and every relay in your pool — genuinely is rate-limited, and that response now points you at `/freeflow deploy` to add relay egress.
31
-
32
- ## 1.9.8 - 2026-09-06
33
-
34
- ### Fixes
35
-
36
- - **Stale model list heals itself (follow-up to #6).** If your saved model list predates a newly added model, the background refresh now repairs the entry (correct endpoint and details) instead of sending requests to the wrong addressno manual `/freeflow refresh` or cache deletion needed.
37
- - **Paid models stay out of the picker even from old saved lists.** Every read of the saved model list now drops non-free entries, so models requiring an API key cannot linger after an upgrade.
38
- - **Old saved lists without a sync marker now re-sync once.** A saved list that could never trigger a network check now performs one plain revalidation (then syncs normally), so newly added free models appear without manual intervention. Missing or corrupt lists still fall back silently with no network call.
39
- - **Upstream errors are now visible in the proxy log.** Failed upstream responses log their status code and model, and a model routed to the wrong endpoint logs the mismatch with the fix (restart Pi/OMP after upgrade).
40
-
41
- ### Validation
42
-
43
- - TypeScript typecheck passed cleanly (`tsc --noEmit`).
44
- - Full test suite passed on Windows (304 tests) and Ubuntu Linux (`acerblue`, 305/305 tests passed), including new regressions for the stale-cache shape from #6.
45
- - Live sweep of all 26 models through a fresh install on `acerblue`: 23/26 answered on first try (both Muse Spark models via the Responses endpoint); the 3 misses are upstream per-model daily quotas (429), zero server errors.
46
-
47
- ## 1.9.7 - 2026-09-06
48
-
49
- ### Fixes
50
-
51
- - **Model picker only shows verified free models (fixes #6).** Background catalog refresh now filters out non-free models from upstream endpoints so paid models requiring an API key no longer leak into your picker.
52
- - **Relay pool automatically recovers from dead deployments (fixes #5).** If a relay URL in your pool returns an infrastructure 404 (such as a missing or deleted Vercel deployment), the proxy marks it as failed and immediately rolls over to your next healthy relay or direct mode instead of getting trapped in a 404 loop.
53
-
54
- ### Changes
55
-
56
- - **Updated model catalog (26 verified free models: 7 OpenCode Zen + 19 KiloCode Gateway).**
57
- - Added `inclusionai/ling-3.0-flash-sante:free` (Ling 3.0 Flash Sante, 262K context, 32K output, reasoning supported). Clean CLI alias `ling-3.0-flash-sante` supported.
58
- - Removed `laguna-s-2.1-free` (OpenCode Zen) after upstream dropped free-tier access. `poolside/laguna-s-2.1:free` on Kilo remains active.
59
- - **Public by default for new relay deployments.** Relays deployed via `/freeflow deploy` are now public by default with no mandatory authentication tokens. This enables seamless copy-paste migration across proxy tools (such as 9router) while maintaining safety guards for allowed AI upstreams.
60
-
61
- ### Validation
62
-
63
- - TypeScript typecheck passed cleanly (`tsc --noEmit`).
64
- - Full test suite passed across Windows (299 tests) and Ubuntu Linux (`acerblue-local`, 300/300 tests passed).
65
- - End-to-end concurrency and failover stress testing verified (100 parallel requests, 20 subagent leases, burst failover).
66
-
67
- ## 1.9.6 - 2026-09-03
68
-
69
- ### Fixes
70
-
71
- - **Hiding the status widget now sticks.** `/freeflow hide` survives restarts, new sessions, and background update notices — previously the widget could reappear on the next session.
72
- - **Calmer startup with many sessions.** Sessions starting at the same time now converge on a single background proxy instead of each spawning its own; a spawn that never becomes ready falls back to in-process mode instead of running untracked.
73
- - **Survives daemon restarts mid-session.** If the background proxy is replaced while sessions run, connected sessions re-register automatically instead of silently losing their lease (which could retire the daemon mid-use).
74
- - **Stale-version cleanup targets the right process.** Windows port matching is now exact, and Linux without `lsof`/`fuser` resolves the holder via `/proc` instead of giving up.
75
- - **`/freeflow logs --follow` no longer runs forever.** The live tail stops when the session ends and caps burst output; the update/install subprocess now has a 2-minute timeout.
76
-
77
- ### Validation
78
-
79
- - `npx tsc --noEmit` clean, `npm test` 299 (298 pass + 1 Linux-only skip) + smoke green on Windows; stress harness 7/7 on Windows and Linux `acerblue-local`. **`macOS not tested`** this cycle.
80
-
81
- ## 1.9.5 - 2026-09-03
82
-
83
- ### Changes
84
-
85
- - **Catalog refreshed against live upstream model lists (26 models: 8 OpenCode Zen + 18 KiloCode Gateway).** Re-checked both upstreams against their live endpoints and live inference probes:
86
- - **Added** `muse-spark-1.3-contributor-free` (OpenCode Zen, Responses API, 1M context, 131K output, vision) — verified live: completes with reasoning, accepts effort levels, and answers vision queries.
87
- - **Removed** `hy3-free` (OpenCode Zen) — upstream no longer serves it (`Model hy3-free is not supported`).
88
- - **Removed** `tencent/hy3:free` and `meituan/longcat-2.0-free` (KiloCode Gateway) — upstream free tier dropped them (model unavailable / sign-in required).
89
- - Pruned IDs added to the dead-model filter so a stale disk cache cannot resurrect them.
90
-
91
- ### Validation
92
-
93
- - `npx tsc --noEmit` clean, `npm test` full suite green on Windows.
94
-
95
- ## 1.9.4 - 2026-09-02
96
-
97
- ### Dependencies
98
-
99
- - **Zero runtime dependencies.** Removed `undici@8.10.0` `pi` (`0.84.4`) and `omp` (`18.1.3`) already bundle `undici` 6.x/7.x and expose `global fetch` with keep-alive pooling. `relayFetch` and proxy now use `global fetch` directly (`src/relay.ts` `Agent` + `canUseCustomDispatcher` + `dispatcher: agent` removed; `src/proxy.ts` dispatcher removed). Keeps thin `11.3k` + `298 tests` + `0 deps` compatible directly with `reference/pi` + `reference/oh-my-pi`.
100
-
101
- ### Validation
102
-
103
- - `npx tsc --noEmit` clean, `npm test 298/298` on **Windows** (`omp/18.1.3`, `pi 0.84.4`) and **Linux `acerblue-local`** (`Ubuntu 6.8.0-138`, `node v22.23.2`, `pi 0.84.4`) via `/tmp/pi-freeflow-validation`. **`macOS not tested`** this cycle.
104
-
105
- ## 1.9.3 - 2026-09-02
106
-
107
- ### Fixes
108
-
109
- - **Windows console flood fixed.** Two Windows-only helpers flashed a visible `conhost`/`cmd` window on every daemon probe: `netstat -ano | findstr :28180` / `taskkill` in the stale-daemon replace path and `spawn(omp|npm, shell:true)` for `/freeflow update`. Both now use `windowsHide: true` (no-op on Linux/macOS) and `spawnWithProgress` was refactored to `Promise.withResolvers` to satisfy `ts-promise-with-resolvers`. Idle `pi` no longer spawns many visible consoles even after closing the terminal (detached daemon at `127.0.0.1:28180` survives by design; `beatOnce` 10s heartbeat now throttled 2s via `lastSpawnAt`).
110
- - Daemon spawn now throttled per-process (2s) as a storm guard when `28180` is contended or blocked; the `ensuring` guard + `waitForReady 5s` already prevented tight loops.
111
-
112
- ### Validation
113
-
114
- - `npx tsc --noEmit` clean, `npm test 279/279` on **Windows** (`omp/18.1.3`, `pi 0.84.4`) and **Linux `acerblue-local`** (`Ubuntu 6.8.0-138`, `node v22.23.2`, `pi 0.84.4`) via `/tmp/pi-freeflow-validation`. **`macOS not tested`** this cycle.
115
- - Reporter `LOYINuts` issue #3 (`pi idle creates many sessions force reboot`) `grep -r rtk src` confirms `rtk` is an external global skill (`~/.agents/skills/rtk` `Command::new("cmd")` without `CREATE_NO_WINDOW`), not `pi-freeflow`. After this fix, closing the terminal no longer leaves flashing zombies; kill via `netstat -ano | findstr :28180` `taskkill /F /PID` or `/freeflow kill`.
116
-
117
- ## 1.9.2 - 2026-08-31
118
-
119
- ### Fixes
120
-
121
- - **Closing one session no longer stops the shared local proxy.** The proxy daemon
122
- is now a fully detached background process: it outlives any single OMP/Pi session
123
- (previously, closing the session that owned the daemon could shut it down even
124
- while other sessions were still using it). It retires by itself only when no
125
- session is connected, no request is in flight, and it has been idle for a grace
126
- period. The next use starts it again automatically.
127
- - New command: `/freeflow kill` (aliases `stop`, `shutdown`) stops the background
128
- daemon on demand. The next freeflow use restarts it.
129
-
130
- ### Improvements
131
-
132
- - The proxy tracks connected sessions and last request time; `/freeflow status`
133
- and the health endpoint now report active session leases, so you can see when
134
- other sessions are keeping the daemon alive.
135
- - Docs: the command reference now lists `kill`, and the FAQ explains the shared
136
- daemon lifecycle (survives session close; self-retires when unused).
137
-
138
- ## 1.9.1 - 2026-08-30
139
-
140
- ### Fixes
141
-
142
- - Stale-daemon guard completed: a pre-1.9.0 daemon cannot report its in-flight requests, and usage cannot be verified — so it is now left running instead of being replaced. Previously such a daemon could still be killed mid-stream while busy (a one-time window when upgrading from 1.8.x). The guarantee now holds in every case: only older, verified-idle daemons are replaced.
143
- - The stale-daemon kill ritual was consolidated into one path (it was duplicated at five call sites); behavior unchanged.
144
- - Tests: new coverage for the pre-1.9 daemon case; shared sandbox helpers extracted.
145
-
146
- ## 1.9.0 - 2026-08-30
147
-
148
- ### Development hardening
149
-
150
- - Test suite now runs fully sandboxed: every test uses a temporary data directory, so no test can ever write to your real `~/.pi/agent/` files or interfere with a running local proxy. A single env override (`PI_*_DATA_DIR`) re-roots all data files for tests/CI.
151
- - Added a complete mocked user-flow e2e suite: fresh install → onboarding → proxy health → direct chat → relay add/roll/fallback → guided deploy → update check → command surface — all deterministic, zero network.
152
- - Docs: test counts no longer hardcoded in README (they drifted with releases); release history tracked here.
153
-
154
- ### Fixes
155
-
156
- - **Stale-daemon replacement no longer interrupts running sessions.** The shared local proxy can be held by another OMP/Pi session; the old upgrade logic killed that holder on version mismatch, which could terminate the session that owned the proxy mid-stream. Replacement now only happens when the running daemon is strictly older AND idle (0 in-flight requests, reported via `/_health`); newer or busy daemons are reused with a log note instead. Optional opt-out: set the no-kill env to `1` (see README FAQ for upgrades).
157
-
158
- ## 1.8.2 - 2026-08-30
159
-
160
- ### Fixes & polish
161
-
162
- - Deploy: compare-and-swap on concurrent deployments (no duplicate relays when two sessions deploy at once).
163
- - Proxy: URL-encoding edge cases (`%` in paths), startup timeout and kill handling, port conflict fallback.
164
- - Logs: sanitized sensitive headers in debug output.
165
- - Kilo gateway models: compatibility pass for all 25 models.
166
- - Docs site build included; README per-host usage guide (Oh My Pi & Pi install + pick + manage).
167
-
168
- ## 1.8.1 - 2026-08-29
169
-
170
- - Fix: stale-daemon auto-heal is now shipped in the published package (previously only in the repo).
171
-
172
- ## 1.8.0 - 2026-08-29
173
-
174
- ### Automatic upgrades
175
-
176
- - On version upgrade, the extension detects a stale local proxy daemon and replaces it automatically users get fixes without manual restarts or killing sessions.
177
- - Fix: client auth key stripped before reaching the opencode.ai/zen upstream (failed with 401 for some clients).
178
- - 3 new free models (28 total).
179
-
180
- ## 1.7.1 - 2026-08-29
181
-
182
- - Docs: clarified npm is the distribution channel (the package is an extension loaded by OMP/Pi, not a standalone CLI).
183
-
184
- ## 1.7.0 - 2026-08-29
185
-
186
- - 4 new free models (25 total) with live-verified specs (context/output limits, vision, thinking levels).
187
- - New alias map aligned with host model selectors.
188
-
189
- ## 1.6.1 - 2026-08-29
190
-
191
- - Catalog: thinking-level map locked per model; docs sync.
192
-
193
- ## 1.6.0 - 2026-08-29
194
-
195
- ### Onboarding & UX
196
-
197
- - First-run onboarding message; 429 guidance hint (add your own relay egress).
198
- - `/freeflow test` to probe a relay; relay latency tracking with health badges in `/freeflow list`.
199
- - Guided deploy with context picker + confirmation; post-deploy health check.
200
- - Status clarity: current mode + state file path; log text filter; per-relay usage counters; throttled roll notifications.
201
-
202
- ### Reliability
203
-
204
- - Relay state write-protection: before every save, the current state is snapshotted to `.bak`; if the main file is corrupted or missing, the backup is recovered automatically.
205
- - New-user flow never seeds a fake relay; starts in direct mode with an empty pool.
206
-
207
- ## 1.5.1 - 2026-08-28
208
-
209
- - Edge-sweep fixes: port 28180 with legacy 18080 dual-probe auto-migration, OMP/Pi compatibility.
1
+ # Changelog
2
+
3
+ ## 1.11.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 549b66e: Oversized requests no longer fail at the relay hop: when a relay answers 413 payload limit, the proxy transparently tries the next relay and then the direct route, keeping the stream alive. Long sessions that outgrow the relay payload cap now complete instead of surfacing a function payload error.
8
+
9
+ ## 1.11.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Apologies for the daemon disconnect bug introduced in v1.11.0: in multi-agent workflows or when subagents, evaluations, and background tasks completed, the extension prematurely detached from the local proxy daemon, causing the proxy to shut down while your main session remained active. The heartbeat connection now persists throughout your active terminal session.
14
+ - Increased local health check and liveness probe timeouts from 800ms and 500ms to 2500ms and 1500ms, with an automatic probe retry to avoid false-alarm daemon restarts during heavy concurrent streaming.
15
+ - Added unhandled error logging inside the daemon to prevent silent process exits.
16
+ - Fresh installs now log full HTTP lifecycle debug output by default so diagnostic reports contain complete request context; turn it off anytime with `/freeflow debug off`.
17
+
18
+ ## 1.11.0
19
+
20
+ ### Minor Changes
21
+
22
+ - Proxy daemon now stays up while any session uses it, even when idle. It shuts down only after the last session leaves, instead of retiring after a short quiet window.
23
+
24
+ ## 1.10.0
25
+
26
+ ### Minor Changes
27
+
28
+ - cf48598: Hands-free proxy recovery plus catalog refresh: the proxy now watches its own health, restarts with backoff instead of leaving a dead port, and can start on login. Removed two discontinued free models from the picker.
29
+
30
+ All notable changes to pi-freeflow. Public, user-visible behavior only.
31
+
32
+ ## 1.9.9 - 2026-09-06
33
+
34
+ ### Fixes
35
+
36
+ - **Removed our own request cap sorry, that one was on us.** The proxy used to enforce a built-in request limit and could answer 429 before upstream quota was actually exhausted. That was a bug, not your quota. From this version the proxy never rejects on quota itself: a 429 only surfaces when the upstream and every relay in your pool genuinely is rate-limited, and that response now points you at `/freeflow deploy` to add relay egress.
37
+
38
+ ## 1.9.8 - 2026-09-06
39
+
40
+ ### Fixes
41
+
42
+ - **Stale model list heals itself (follow-up to #6).** If your saved model list predates a newly added model, the background refresh now repairs the entry (correct endpoint and details) instead of sending requests to the wrong address — no manual `/freeflow refresh` or cache deletion needed.
43
+ - **Paid models stay out of the picker even from old saved lists.** Every read of the saved model list now drops non-free entries, so models requiring an API key cannot linger after an upgrade.
44
+ - **Old saved lists without a sync marker now re-sync once.** A saved list that could never trigger a network check now performs one plain revalidation (then syncs normally), so newly added free models appear without manual intervention. Missing or corrupt lists still fall back silently with no network call.
45
+ - **Upstream errors are now visible in the proxy log.** Failed upstream responses log their status code and model, and a model routed to the wrong endpoint logs the mismatch with the fix (restart Pi/OMP after upgrade).
46
+
47
+ ### Validation
48
+
49
+ - TypeScript typecheck passed cleanly (`tsc --noEmit`).
50
+ - Full test suite passed on Windows (304 tests) and Ubuntu Linux (`acerblue`, 305/305 tests passed), including new regressions for the stale-cache shape from #6.
51
+ - Live sweep of all 26 models through a fresh install on `acerblue`: 23/26 answered on first try (both Muse Spark models via the Responses endpoint); the 3 misses are upstream per-model daily quotas (429), zero server errors.
52
+
53
+ ## 1.9.7 - 2026-09-06
54
+
55
+ ### Fixes
56
+
57
+ - **Model picker only shows verified free models (fixes #6).** Background catalog refresh now filters out non-free models from upstream endpoints so paid models requiring an API key no longer leak into your picker.
58
+ - **Relay pool automatically recovers from dead deployments (fixes #5).** If a relay URL in your pool returns an infrastructure 404 (such as a missing or deleted Vercel deployment), the proxy marks it as failed and immediately rolls over to your next healthy relay or direct mode instead of getting trapped in a 404 loop.
59
+
60
+ ### Changes
61
+
62
+ - **Updated model catalog (26 verified free models: 7 OpenCode Zen + 19 KiloCode Gateway).**
63
+ - Added `inclusionai/ling-3.0-flash-sante:free` (Ling 3.0 Flash Sante, 262K context, 32K output, reasoning supported). Clean CLI alias `ling-3.0-flash-sante` supported.
64
+ - Removed `laguna-s-2.1-free` (OpenCode Zen) after upstream dropped free-tier access. `poolside/laguna-s-2.1:free` on Kilo remains active.
65
+ - **Public by default for new relay deployments.** Relays deployed via `/freeflow deploy` are now public by default with no mandatory authentication tokens. This enables seamless copy-paste migration across proxy tools (such as 9router) while maintaining safety guards for allowed AI upstreams.
66
+
67
+ ### Validation
68
+
69
+ - TypeScript typecheck passed cleanly (`tsc --noEmit`).
70
+ - Full test suite passed across Windows (299 tests) and Ubuntu Linux (`acerblue-local`, 300/300 tests passed).
71
+ - End-to-end concurrency and failover stress testing verified (100 parallel requests, 20 subagent leases, burst failover).
72
+
73
+ ## 1.9.6 - 2026-09-03
74
+
75
+ ### Fixes
76
+
77
+ - **Hiding the status widget now sticks.** `/freeflow hide` survives restarts, new sessions, and background update notices — previously the widget could reappear on the next session.
78
+ - **Calmer startup with many sessions.** Sessions starting at the same time now converge on a single background proxy instead of each spawning its own; a spawn that never becomes ready falls back to in-process mode instead of running untracked.
79
+ - **Survives daemon restarts mid-session.** If the background proxy is replaced while sessions run, connected sessions re-register automatically instead of silently losing their lease (which could retire the daemon mid-use).
80
+ - **Stale-version cleanup targets the right process.** Windows port matching is now exact, and Linux without `lsof`/`fuser` resolves the holder via `/proc` instead of giving up.
81
+ - **`/freeflow logs --follow` no longer runs forever.** The live tail stops when the session ends and caps burst output; the update/install subprocess now has a 2-minute timeout.
82
+
83
+ ### Validation
84
+
85
+ - `npx tsc --noEmit` clean, `npm test` 299 (298 pass + 1 Linux-only skip) + smoke green on Windows; stress harness 7/7 on Windows and Linux `acerblue-local`. **`macOS not tested`** this cycle.
86
+
87
+ ## 1.9.5 - 2026-09-03
88
+
89
+ ### Changes
90
+
91
+ - **Catalog refreshed against live upstream model lists (26 models: 8 OpenCode Zen + 18 KiloCode Gateway).** Re-checked both upstreams against their live endpoints and live inference probes:
92
+ - **Added** `muse-spark-1.3-contributor-free` (OpenCode Zen, Responses API, 1M context, 131K output, vision) — verified live: completes with reasoning, accepts effort levels, and answers vision queries.
93
+ - **Removed** `hy3-free` (OpenCode Zen) upstream no longer serves it (`Model hy3-free is not supported`).
94
+ - **Removed** `tencent/hy3:free` and `meituan/longcat-2.0-free` (KiloCode Gateway) — upstream free tier dropped them (model unavailable / sign-in required).
95
+ - Pruned IDs added to the dead-model filter so a stale disk cache cannot resurrect them.
96
+
97
+ ### Validation
98
+
99
+ - `npx tsc --noEmit` clean, `npm test` full suite green on Windows.
100
+
101
+ ## 1.9.4 - 2026-09-02
102
+
103
+ ### Dependencies
104
+
105
+ - **Zero runtime dependencies.** Removed `undici@8.10.0` — `pi` (`0.84.4`) and `omp` (`18.1.3`) already bundle `undici` 6.x/7.x and expose `global fetch` with keep-alive pooling. `relayFetch` and proxy now use `global fetch` directly (`src/relay.ts` `Agent` + `canUseCustomDispatcher` + `dispatcher: agent` removed; `src/proxy.ts` dispatcher removed). Keeps thin `11.3k` + `298 tests` + `0 deps` compatible directly with `reference/pi` + `reference/oh-my-pi`.
106
+
107
+ ### Validation
108
+
109
+ - `npx tsc --noEmit` clean, `npm test 298/298` on **Windows** (`omp/18.1.3`, `pi 0.84.4`) and **Linux `acerblue-local`** (`Ubuntu 6.8.0-138`, `node v22.23.2`, `pi 0.84.4`) via `/tmp/pi-freeflow-validation`. **`macOS not tested`** this cycle.
110
+
111
+ ## 1.9.3 - 2026-09-02
112
+
113
+ ### Fixes
114
+
115
+ - **Windows console flood fixed.** Two Windows-only helpers flashed a visible `conhost`/`cmd` window on every daemon probe: `netstat -ano | findstr :28180` / `taskkill` in the stale-daemon replace path and `spawn(omp|npm, shell:true)` for `/freeflow update`. Both now use `windowsHide: true` (no-op on Linux/macOS) and `spawnWithProgress` was refactored to `Promise.withResolvers` to satisfy `ts-promise-with-resolvers`. Idle `pi` no longer spawns many visible consoles even after closing the terminal (detached daemon at `127.0.0.1:28180` survives by design; `beatOnce` 10s heartbeat now throttled 2s via `lastSpawnAt`).
116
+ - Daemon spawn now throttled per-process (2s) as a storm guard when `28180` is contended or blocked; the `ensuring` guard + `waitForReady 5s` already prevented tight loops.
117
+
118
+ ### Validation
119
+
120
+ - `npx tsc --noEmit` clean, `npm test 279/279` on **Windows** (`omp/18.1.3`, `pi 0.84.4`) and **Linux `acerblue-local`** (`Ubuntu 6.8.0-138`, `node v22.23.2`, `pi 0.84.4`) via `/tmp/pi-freeflow-validation`. **`macOS not tested`** this cycle.
121
+ - Reporter `LOYINuts` issue #3 (`pi idle creates many sessions → force reboot`) — `grep -r rtk src` ∅ confirms `rtk` is an external global skill (`~/.agents/skills/rtk` → `Command::new("cmd")` without `CREATE_NO_WINDOW`), not `pi-freeflow`. After this fix, closing the terminal no longer leaves flashing zombies; kill via `netstat -ano | findstr :28180` → `taskkill /F /PID` or `/freeflow kill`.
122
+
123
+ ## 1.9.2 - 2026-08-31
124
+
125
+ ### Fixes
126
+
127
+ - **Closing one session no longer stops the shared local proxy.** The proxy daemon
128
+ is now a fully detached background process: it outlives any single OMP/Pi session
129
+ (previously, closing the session that owned the daemon could shut it down even
130
+ while other sessions were still using it). It retires by itself only when no
131
+ session is connected, no request is in flight, and it has been idle for a grace
132
+ period. The next use starts it again automatically.
133
+ - New command: `/freeflow kill` (aliases `stop`, `shutdown`) stops the background
134
+ daemon on demand. The next freeflow use restarts it.
135
+
136
+ ### Improvements
137
+
138
+ - The proxy tracks connected sessions and last request time; `/freeflow status`
139
+ and the health endpoint now report active session leases, so you can see when
140
+ other sessions are keeping the daemon alive.
141
+ - Docs: the command reference now lists `kill`, and the FAQ explains the shared
142
+ daemon lifecycle (survives session close; self-retires when unused).
143
+
144
+ ## 1.9.1 - 2026-08-30
145
+
146
+ ### Fixes
147
+
148
+ - Stale-daemon guard completed: a pre-1.9.0 daemon cannot report its in-flight requests, and usage cannot be verified — so it is now left running instead of being replaced. Previously such a daemon could still be killed mid-stream while busy (a one-time window when upgrading from 1.8.x). The guarantee now holds in every case: only older, verified-idle daemons are replaced.
149
+ - The stale-daemon kill ritual was consolidated into one path (it was duplicated at five call sites); behavior unchanged.
150
+ - Tests: new coverage for the pre-1.9 daemon case; shared sandbox helpers extracted.
151
+
152
+ ## 1.9.0 - 2026-08-30
153
+
154
+ ### Development hardening
155
+
156
+ - Test suite now runs fully sandboxed: every test uses a temporary data directory, so no test can ever write to your real `~/.pi/agent/` files or interfere with a running local proxy. A single env override (`PI_*_DATA_DIR`) re-roots all data files for tests/CI.
157
+ - Added a complete mocked user-flow e2e suite: fresh install → onboarding → proxy health → direct chat → relay add/roll/fallback → guided deploy → update check → command surface — all deterministic, zero network.
158
+ - Docs: test counts no longer hardcoded in README (they drifted with releases); release history tracked here.
159
+
160
+ ### Fixes
161
+
162
+ - **Stale-daemon replacement no longer interrupts running sessions.** The shared local proxy can be held by another OMP/Pi session; the old upgrade logic killed that holder on version mismatch, which could terminate the session that owned the proxy mid-stream. Replacement now only happens when the running daemon is strictly older AND idle (0 in-flight requests, reported via `/_health`); newer or busy daemons are reused with a log note instead. Optional opt-out: set the no-kill env to `1` (see README FAQ for upgrades).
163
+
164
+ ## 1.8.2 - 2026-08-30
165
+
166
+ ### Fixes & polish
167
+
168
+ - Deploy: compare-and-swap on concurrent deployments (no duplicate relays when two sessions deploy at once).
169
+ - Proxy: URL-encoding edge cases (`%` in paths), startup timeout and kill handling, port conflict fallback.
170
+ - Logs: sanitized sensitive headers in debug output.
171
+ - Kilo gateway models: compatibility pass for all 25 models.
172
+ - Docs site build included; README per-host usage guide (Oh My Pi & Pi install + pick + manage).
173
+
174
+ ## 1.8.1 - 2026-08-29
175
+
176
+ - Fix: stale-daemon auto-heal is now shipped in the published package (previously only in the repo).
177
+
178
+ ## 1.8.0 - 2026-08-29
179
+
180
+ ### Automatic upgrades
181
+
182
+ - On version upgrade, the extension detects a stale local proxy daemon and replaces it automatically users get fixes without manual restarts or killing sessions.
183
+ - Fix: client auth key stripped before reaching the opencode.ai/zen upstream (failed with 401 for some clients).
184
+ - 3 new free models (28 total).
185
+
186
+ ## 1.7.1 - 2026-08-29
187
+
188
+ - Docs: clarified npm is the distribution channel (the package is an extension loaded by OMP/Pi, not a standalone CLI).
189
+
190
+ ## 1.7.0 - 2026-08-29
191
+
192
+ - 4 new free models (25 total) with live-verified specs (context/output limits, vision, thinking levels).
193
+ - New alias map aligned with host model selectors.
194
+
195
+ ## 1.6.1 - 2026-08-29
196
+
197
+ - Catalog: thinking-level map locked per model; docs sync.
198
+
199
+ ## 1.6.0 - 2026-08-29
200
+
201
+ ### Onboarding & UX
202
+
203
+ - First-run onboarding message; 429 guidance hint (add your own relay egress).
204
+ - `/freeflow test` to probe a relay; relay latency tracking with health badges in `/freeflow list`.
205
+ - Guided deploy with context picker + confirmation; post-deploy health check.
206
+ - Status clarity: current mode + state file path; log text filter; per-relay usage counters; throttled roll notifications.
207
+
208
+ ### Reliability
209
+
210
+ - Relay state write-protection: before every save, the current state is snapshotted to `.bak`; if the main file is corrupted or missing, the backup is recovered automatically.
211
+ - New-user flow never seeds a fake relay; starts in direct mode with an empty pool.
212
+
213
+ ## 1.5.1 - 2026-08-28
214
+
215
+ - Edge-sweep fixes: port 28180 with legacy 18080 dual-probe auto-migration, OMP/Pi compatibility.
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
- {
2
- "name": "pi-freeflow",
3
- "type": "module",
4
- "version": "1.11.1",
5
- "description": "Thin provider for OMP/Pi — model list + dumb relay proxy + log; host pi-ai owns thinking/normalization",
6
- "main": "extensions/index.ts",
7
- "types": "src/index.ts",
8
- "keywords": [
9
- "pi-package",
10
- "pi-extension",
11
- "oh-my-pi",
12
- "omp",
13
- "free-models",
14
- "opencode",
15
- "kilocode",
16
- "ai-models",
17
- "relay"
18
- ],
19
- "author": "trefeon",
20
- "license": "MIT",
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/trefeon/pi-freeflow.git"
24
- },
25
- "homepage": "https://github.com/trefeon/pi-freeflow#readme",
26
- "engines": {
27
- "node": ">=22.19.0"
28
- },
29
- "omp": {
30
- "extensions": [
31
- "./extensions"
32
- ]
33
- },
34
- "pi": {
35
- "extensions": [
36
- "./extensions"
37
- ]
38
- },
39
- "files": [
40
- "extensions",
41
- "src",
42
- "README.md",
43
- "CHANGELOG.md",
44
- "LICENSE"
45
- ],
46
- "scripts": {
47
- "test": "node --experimental-strip-types --import ./test/setup.mjs --test --test-concurrency=1 test/**/*.test.ts",
48
- "typecheck": "tsc --noEmit",
49
- "smoke": "node --experimental-strip-types -e \"import('./extensions/index.ts').then(() => console.log('✓ Smoke test passed: extensions/index.ts loaded successfully')).catch(err => { console.error(err); process.exit(1); })\"",
50
- "changeset": "changeset",
51
- "docs:dev": "vitepress dev docs",
52
- "docs:build": "vitepress build docs"
53
- },
54
- "devDependencies": {
55
- "@changesets/cli": "^2.27.0",
56
- "@types/node": "^22.13.9",
57
- "typescript": "^5.8.2",
58
- "vitepress": "^1.6.4"
59
- },
60
- "dependencies": {}
61
- }
1
+ {
2
+ "name": "pi-freeflow",
3
+ "type": "module",
4
+ "version": "1.11.2",
5
+ "description": "Thin provider for OMP/Pi — model list + dumb relay proxy + log; host pi-ai owns thinking/normalization",
6
+ "main": "extensions/index.ts",
7
+ "types": "src/index.ts",
8
+ "keywords": [
9
+ "pi-package",
10
+ "pi-extension",
11
+ "oh-my-pi",
12
+ "omp",
13
+ "free-models",
14
+ "opencode",
15
+ "kilocode",
16
+ "ai-models",
17
+ "relay"
18
+ ],
19
+ "author": "trefeon",
20
+ "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/trefeon/pi-freeflow.git"
24
+ },
25
+ "homepage": "https://github.com/trefeon/pi-freeflow#readme",
26
+ "engines": {
27
+ "node": ">=22.19.0"
28
+ },
29
+ "omp": {
30
+ "extensions": [
31
+ "./extensions"
32
+ ]
33
+ },
34
+ "pi": {
35
+ "extensions": [
36
+ "./extensions"
37
+ ]
38
+ },
39
+ "files": [
40
+ "extensions",
41
+ "src",
42
+ "README.md",
43
+ "CHANGELOG.md",
44
+ "LICENSE"
45
+ ],
46
+ "scripts": {
47
+ "test": "node --experimental-strip-types --import ./test/setup.mjs --test --test-concurrency=1 test/**/*.test.ts",
48
+ "typecheck": "tsc --noEmit",
49
+ "smoke": "node --experimental-strip-types -e \"import('./extensions/index.ts').then(() => console.log('✓ Smoke test passed: extensions/index.ts loaded successfully')).catch(err => { console.error(err); process.exit(1); })\"",
50
+ "changeset": "changeset",
51
+ "docs:dev": "vitepress dev docs",
52
+ "docs:build": "vitepress build docs"
53
+ },
54
+ "devDependencies": {
55
+ "@changesets/cli": "^2.27.0",
56
+ "@types/node": "^22.13.9",
57
+ "typescript": "^5.8.2",
58
+ "vitepress": "^1.6.4"
59
+ },
60
+ "dependencies": {}
61
+ }
package/src/relay.ts CHANGED
@@ -155,6 +155,28 @@ export async function relayFetch(
155
155
  }
156
156
  break;
157
157
  }
158
+ // Relay payload cap hit (413: request exceeds host payload limit):
159
+ // Not a relay health signal, so no failure marking — try the next
160
+ // relay (a different host may accept it), else the direct fallback.
161
+ if (res.status === 413) {
162
+ lastResponse?.body?.cancel().catch(() => {});
163
+ lastResponse = res;
164
+ log(
165
+ "warn",
166
+ `relay ${targetUrl} hit HTTP 413 payload limit in ${elapsed}s — trying next path`,
167
+ { upstream: url, sizeKB: bodySizeKB },
168
+ rid,
169
+ );
170
+ const now = Date.now();
171
+ if (now - lastRollNotify > ROLL_NOTIFY_MS) {
172
+ lastRollNotify = now;
173
+ const ui = getStatusUi();
174
+ if (ui?.notify) {
175
+ ui.notify(`relay ${shortRelayLabel(targetUrl)} hit payload limit — trying next path`, "warning");
176
+ }
177
+ }
178
+ continue;
179
+ }
158
180
 
159
181
  // Relay host infrastructure 404 (e.g. Vercel DEPLOYMENT_NOT_FOUND or non-JSON 404):
160
182
  // When a relay URL is deleted, misconfigured, or has no deployment, Vercel/Cloudflare