pi-freeflow 1.11.0 → 1.11.1
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/CHANGELOG.md +209 -200
- package/README.md +1 -1
- package/package.json +61 -61
- package/src/client.ts +17 -0
- package/src/daemon.ts +6 -0
- package/src/index.ts +9 -2
- package/src/lease.ts +116 -116
- package/src/logger.ts +10 -2
- package/src/proxy.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,200 +1,209 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 1.11.
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- **
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
-
|
|
178
|
-
-
|
|
179
|
-
|
|
180
|
-
## 1.
|
|
181
|
-
|
|
182
|
-
-
|
|
183
|
-
|
|
184
|
-
## 1.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
-
|
|
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 address — no 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.
|
package/README.md
CHANGED
|
@@ -250,7 +250,7 @@ cat ~/.pi/agent/pi-freeflow.log | tail -n 20
|
|
|
250
250
|
/freeflow logs
|
|
251
251
|
cat ~/.pi/agent/pi-freeflow.log | tail -n 50
|
|
252
252
|
|
|
253
|
-
# debug toggle
|
|
253
|
+
# debug toggle (full debug is on by default for complete error reports; `off` restores info)
|
|
254
254
|
/freeflow debug on
|
|
255
255
|
```
|
|
256
256
|
|
package/package.json
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pi-freeflow",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "1.11.
|
|
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.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
|
+
}
|
package/src/client.ts
CHANGED
|
@@ -349,6 +349,14 @@ export async function watchdogCheck(port: number): Promise<void> {
|
|
|
349
349
|
} catch {
|
|
350
350
|
return;
|
|
351
351
|
}
|
|
352
|
+
if (health === null) {
|
|
353
|
+
await new Promise<void>((r) => setTimeout(r, 200));
|
|
354
|
+
try {
|
|
355
|
+
health = await getDaemonHealth(port);
|
|
356
|
+
} catch {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
352
360
|
if (health && (health.activeRequests ?? 0) > 0) {
|
|
353
361
|
trackBusyEdge(health.activeRequests ?? 0, health.lastBytesAt ?? 0);
|
|
354
362
|
} else {
|
|
@@ -566,6 +574,15 @@ export function getClientId(): string {
|
|
|
566
574
|
return CLIENT_ID;
|
|
567
575
|
}
|
|
568
576
|
|
|
577
|
+
export function hasFallbackServer(): boolean {
|
|
578
|
+
return fallbackServer !== null;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/** Test seam: true when client heartbeat timer is active. */
|
|
582
|
+
export function isHeartbeatActive(): boolean {
|
|
583
|
+
return heartbeatTimer !== null;
|
|
584
|
+
}
|
|
585
|
+
|
|
569
586
|
export function _resetClientForTest(): void {
|
|
570
587
|
stopHeartbeatInternal();
|
|
571
588
|
heartbeatPort = 0;
|
package/src/daemon.ts
CHANGED
|
@@ -98,6 +98,12 @@ export async function runDaemon(): Promise<void> {
|
|
|
98
98
|
};
|
|
99
99
|
process.on("SIGTERM", () => retire("SIGTERM"));
|
|
100
100
|
process.on("SIGINT", () => retire("SIGINT"));
|
|
101
|
+
process.on("uncaughtException", (err) => {
|
|
102
|
+
log("error", "daemon uncaughtException", { error: String(err), stack: (err as Error)?.stack });
|
|
103
|
+
});
|
|
104
|
+
process.on("unhandledRejection", (reason) => {
|
|
105
|
+
log("error", "daemon unhandledRejection", { error: String(reason) });
|
|
106
|
+
});
|
|
101
107
|
setShutdownShouldExit(true);
|
|
102
108
|
try {
|
|
103
109
|
const r = await startProxy();
|
package/src/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
refreshCatalog,
|
|
17
17
|
setAliveCatalog,
|
|
18
18
|
} from "./catalog.ts";
|
|
19
|
-
import { ensureDaemon as ensureClientDaemon, getClientPort, stopHeartbeat } from "./client.ts";
|
|
19
|
+
import { ensureDaemon as ensureClientDaemon, getClientPort, hasFallbackServer, stopHeartbeat } from "./client.ts";
|
|
20
20
|
import { createCommandSpec, stopLogsFollow, updateStatusBar } from "./commands.ts";
|
|
21
21
|
import { HOST, ONBOARDED_FLAG_FILE, PORT } from "./config.ts";
|
|
22
22
|
import { logInfo, logWarn } from "./logger.ts";
|
|
@@ -328,7 +328,14 @@ export default async function (pi: ExtensionAPI): Promise<void> {
|
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
330
|
pi.on?.("session_shutdown", () => {
|
|
331
|
-
stopHeartbeat();
|
|
332
331
|
stopLogsFollow();
|
|
332
|
+
if (hasFallbackServer()) {
|
|
333
|
+
stopHeartbeat();
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
process.once("exit", () => {
|
|
337
|
+
try {
|
|
338
|
+
stopHeartbeat();
|
|
339
|
+
} catch {}
|
|
333
340
|
});
|
|
334
341
|
}
|
package/src/lease.ts
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client lease registry for the detached pi-freeflow proxy daemon.
|
|
3
|
-
*
|
|
4
|
-
* Each OMP/Pi session is a client that registers a lease and renews it with a
|
|
5
|
-
* heartbeat while alive. The daemon drops expired leases and retires itself
|
|
6
|
-
* once NO client holds a live lease: the empty state must persist for the
|
|
7
|
-
* grace window (a fresh spawn's clients re-attach within seconds) with
|
|
8
|
-
* nothing in flight. Request-idleness alone NEVER retires the daemon.
|
|
9
|
-
*
|
|
10
|
-
* The request-touch (`lastActivityAt`) is still recorded and surfaced in
|
|
11
|
-
* /_health for observability, but it no longer gates retirement.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export interface LeaseOptions {
|
|
15
|
-
/** Lease lifetime (ms); a client that misses ~3 beats is dropped. */
|
|
16
|
-
ttlMs: number;
|
|
17
|
-
/** GC sweep interval (ms). */
|
|
18
|
-
gcMs: number;
|
|
19
|
-
/** Zero-lease persistence window (ms): how long leases must stay empty before a lease-less daemon exits. */
|
|
20
|
-
graceMs: number;
|
|
21
|
-
/** Current in-flight proxied requests — daemon never exits mid-stream. */
|
|
22
|
-
getActiveRequests: () => number;
|
|
23
|
-
/** Called once when the daemon should retire (close server + exit). */
|
|
24
|
-
onIdle: () => void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const leases = new Map<string, number>();
|
|
28
|
-
let lastActivityAt =
|
|
29
|
-
let gcTimer: ReturnType<typeof setInterval> | null = null;
|
|
30
|
-
/** First sweep timestamp at which leases were observed empty; null while any lease exists. */
|
|
31
|
-
let emptySince: number | null = null;
|
|
32
|
-
|
|
33
|
-
/** Register or refresh a client lease. */
|
|
34
|
-
export function registerClient(clientId: string): void {
|
|
35
|
-
leases.set(clientId, Date.now());
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** Renew an existing client lease. Returns false when the id is unknown (daemon restarted). */
|
|
39
|
-
export function renewClient(clientId: string): boolean {
|
|
40
|
-
if (leases.has(clientId)) {
|
|
41
|
-
leases.set(clientId, Date.now());
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Remove a client lease (graceful detach on session end). */
|
|
48
|
-
export function unregisterClient(clientId: string): void {
|
|
49
|
-
leases.delete(clientId);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** Number of clients holding a live lease. */
|
|
53
|
-
export function getLeaseCount(): number {
|
|
54
|
-
return leases.size;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Snapshot of live client leases (id -> lastSeenAt) for health/debugging. */
|
|
58
|
-
export function getLeaseSnapshot(): Record<string, number> {
|
|
59
|
-
return Object.fromEntries(leases);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** Record proxy activity — any proxied request counts as a live user. */
|
|
63
|
-
export function touchActivity(): void {
|
|
64
|
-
lastActivityAt = Date.now();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** Timestamp of the last proxied request (0 = never; daemon inits at bind). */
|
|
68
|
-
export function getLastActivityAt(): number {
|
|
69
|
-
return lastActivityAt;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Start the lease GC sweep. Prunes expired leases and, when no client holds a
|
|
74
|
-
* lease, nothing is in flight, and the lease-less state has persisted for the
|
|
75
|
-
* grace window, invokes `onIdle` (the daemon retires). Idempotent — a second
|
|
76
|
-
* call is a no-op.
|
|
77
|
-
*/
|
|
78
|
-
export function startLeaseGC(opts: LeaseOptions): void {
|
|
79
|
-
if (gcTimer !== null) return;
|
|
80
|
-
gcTimer = setInterval(() => {
|
|
81
|
-
const now = Date.now();
|
|
82
|
-
for (const [id, seenAt] of leases) {
|
|
83
|
-
if (now - seenAt > opts.ttlMs) {
|
|
84
|
-
leases.delete(id);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (leases.size > 0) {
|
|
88
|
-
emptySince = null;
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (emptySince === null) {
|
|
92
|
-
emptySince = now;
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (opts.getActiveRequests() === 0 && now - emptySince >= opts.graceMs) {
|
|
96
|
-
stopLeaseGC();
|
|
97
|
-
opts.onIdle();
|
|
98
|
-
}
|
|
99
|
-
}, opts.gcMs);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** Stop the GC sweep (test teardown / daemon shutdown). */
|
|
103
|
-
export function stopLeaseGC(): void {
|
|
104
|
-
if (gcTimer !== null) {
|
|
105
|
-
clearInterval(gcTimer);
|
|
106
|
-
gcTimer = null;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/** Test-only: reset all lease state. */
|
|
111
|
-
export function _resetLeaseStateForTest(): void {
|
|
112
|
-
leases.clear();
|
|
113
|
-
lastActivityAt =
|
|
114
|
-
emptySince = null;
|
|
115
|
-
stopLeaseGC();
|
|
116
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Client lease registry for the detached pi-freeflow proxy daemon.
|
|
3
|
+
*
|
|
4
|
+
* Each OMP/Pi session is a client that registers a lease and renews it with a
|
|
5
|
+
* heartbeat while alive. The daemon drops expired leases and retires itself
|
|
6
|
+
* once NO client holds a live lease: the empty state must persist for the
|
|
7
|
+
* grace window (a fresh spawn's clients re-attach within seconds) with
|
|
8
|
+
* nothing in flight. Request-idleness alone NEVER retires the daemon.
|
|
9
|
+
*
|
|
10
|
+
* The request-touch (`lastActivityAt`) is still recorded and surfaced in
|
|
11
|
+
* /_health for observability, but it no longer gates retirement.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export interface LeaseOptions {
|
|
15
|
+
/** Lease lifetime (ms); a client that misses ~3 beats is dropped. */
|
|
16
|
+
ttlMs: number;
|
|
17
|
+
/** GC sweep interval (ms). */
|
|
18
|
+
gcMs: number;
|
|
19
|
+
/** Zero-lease persistence window (ms): how long leases must stay empty before a lease-less daemon exits. */
|
|
20
|
+
graceMs: number;
|
|
21
|
+
/** Current in-flight proxied requests — daemon never exits mid-stream. */
|
|
22
|
+
getActiveRequests: () => number;
|
|
23
|
+
/** Called once when the daemon should retire (close server + exit). */
|
|
24
|
+
onIdle: () => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const leases = new Map<string, number>();
|
|
28
|
+
let lastActivityAt = 0;
|
|
29
|
+
let gcTimer: ReturnType<typeof setInterval> | null = null;
|
|
30
|
+
/** First sweep timestamp at which leases were observed empty; null while any lease exists. */
|
|
31
|
+
let emptySince: number | null = null;
|
|
32
|
+
|
|
33
|
+
/** Register or refresh a client lease. */
|
|
34
|
+
export function registerClient(clientId: string): void {
|
|
35
|
+
leases.set(clientId, Date.now());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Renew an existing client lease. Returns false when the id is unknown (daemon restarted). */
|
|
39
|
+
export function renewClient(clientId: string): boolean {
|
|
40
|
+
if (leases.has(clientId)) {
|
|
41
|
+
leases.set(clientId, Date.now());
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Remove a client lease (graceful detach on session end). */
|
|
48
|
+
export function unregisterClient(clientId: string): void {
|
|
49
|
+
leases.delete(clientId);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Number of clients holding a live lease. */
|
|
53
|
+
export function getLeaseCount(): number {
|
|
54
|
+
return leases.size;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Snapshot of live client leases (id -> lastSeenAt) for health/debugging. */
|
|
58
|
+
export function getLeaseSnapshot(): Record<string, number> {
|
|
59
|
+
return Object.fromEntries(leases);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Record proxy activity — any proxied request counts as a live user. */
|
|
63
|
+
export function touchActivity(): void {
|
|
64
|
+
lastActivityAt = Date.now();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Timestamp of the last proxied request (0 = never; daemon inits at bind). */
|
|
68
|
+
export function getLastActivityAt(): number {
|
|
69
|
+
return lastActivityAt;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Start the lease GC sweep. Prunes expired leases and, when no client holds a
|
|
74
|
+
* lease, nothing is in flight, and the lease-less state has persisted for the
|
|
75
|
+
* grace window, invokes `onIdle` (the daemon retires). Idempotent — a second
|
|
76
|
+
* call is a no-op.
|
|
77
|
+
*/
|
|
78
|
+
export function startLeaseGC(opts: LeaseOptions): void {
|
|
79
|
+
if (gcTimer !== null) return;
|
|
80
|
+
gcTimer = setInterval(() => {
|
|
81
|
+
const now = Date.now();
|
|
82
|
+
for (const [id, seenAt] of leases) {
|
|
83
|
+
if (now - seenAt > opts.ttlMs) {
|
|
84
|
+
leases.delete(id);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (leases.size > 0) {
|
|
88
|
+
emptySince = null;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (emptySince === null) {
|
|
92
|
+
emptySince = now;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (opts.getActiveRequests() === 0 && now - emptySince >= opts.graceMs) {
|
|
96
|
+
stopLeaseGC();
|
|
97
|
+
opts.onIdle();
|
|
98
|
+
}
|
|
99
|
+
}, opts.gcMs);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Stop the GC sweep (test teardown / daemon shutdown). */
|
|
103
|
+
export function stopLeaseGC(): void {
|
|
104
|
+
if (gcTimer !== null) {
|
|
105
|
+
clearInterval(gcTimer);
|
|
106
|
+
gcTimer = null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Test-only: reset all lease state. */
|
|
111
|
+
export function _resetLeaseStateForTest(): void {
|
|
112
|
+
leases.clear();
|
|
113
|
+
lastActivityAt = 0;
|
|
114
|
+
emptySince = null;
|
|
115
|
+
stopLeaseGC();
|
|
116
|
+
}
|
package/src/logger.ts
CHANGED
|
@@ -128,7 +128,8 @@ export function getMinLogLevel(): number {
|
|
|
128
128
|
return LOG_LEVEL_ORDER[dbg.level];
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
const
|
|
131
|
+
const rawEnv = process.env.FREEFLOW_LOG_LEVEL;
|
|
132
|
+
const raw = (typeof rawEnv === "string" ? rawEnv : "").toLowerCase();
|
|
132
133
|
|
|
133
134
|
if (isEmittedLogLevel(raw)) {
|
|
134
135
|
return LOG_LEVEL_ORDER[raw as LogLevel];
|
|
@@ -142,7 +143,14 @@ export function getMinLogLevel(): number {
|
|
|
142
143
|
return LOG_LEVEL_ORDER.debug;
|
|
143
144
|
}
|
|
144
145
|
|
|
145
|
-
|
|
146
|
+
// Fresh installs default to full debug so users can attach complete
|
|
147
|
+
// request lifecycles when reporting errors (10MB rotation bounds volume).
|
|
148
|
+
// An explicit persisted off state or env level above still wins, so
|
|
149
|
+
// /freeflow debug off keeps working on every platform.
|
|
150
|
+
if (dbg !== null) {
|
|
151
|
+
return LOG_LEVEL_ORDER.info;
|
|
152
|
+
}
|
|
153
|
+
return LOG_LEVEL_ORDER.debug;
|
|
146
154
|
}
|
|
147
155
|
|
|
148
156
|
export function shouldLog(level: LogLevel): boolean {
|
package/src/proxy.ts
CHANGED
|
@@ -147,7 +147,7 @@ export async function isProxyAlive(port: number): Promise<boolean> {
|
|
|
147
147
|
if (!Number.isInteger(port) || port < 1 || port > 65535) return false;
|
|
148
148
|
try {
|
|
149
149
|
const res = await fetch(`http://${HOST}:${port}/v1/models`, {
|
|
150
|
-
signal: AbortSignal.timeout(
|
|
150
|
+
signal: AbortSignal.timeout(1500),
|
|
151
151
|
});
|
|
152
152
|
const ct = res.headers.get("content-type") || "";
|
|
153
153
|
return res.ok && ct.includes("application/json");
|
|
@@ -182,7 +182,7 @@ export async function getDaemonHealth(
|
|
|
182
182
|
if (!Number.isInteger(port) || port < 1 || port > 65535) return null;
|
|
183
183
|
try {
|
|
184
184
|
const res = await fetch(`http://${HOST}:${port}/_health`, {
|
|
185
|
-
signal: AbortSignal.timeout(
|
|
185
|
+
signal: AbortSignal.timeout(2500),
|
|
186
186
|
});
|
|
187
187
|
if (!res.ok) return null;
|
|
188
188
|
const data: unknown = await res.json();
|