pi-cliproxyapi 0.4.2 → 0.5.0

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,109 +0,0 @@
1
- # ISSUE: taskflow child agents have zero usable models (pi-cliproxyapi not loaded in `piChild`)
2
-
3
- - **Status:** open (workaround applied at user-settings level; proper fix needed in this package)
4
- - **Package:** `pi-cliproxyapi` (this repo, v0.3.5)
5
- - **Interacts with:** `pi-taskflow` (`taskflow.piChild` spawn config), `@earendil-works/pi-coding-agent` runtime
6
- - **Severity:** high — blocks ALL taskflow subagents/subflows from running on any model
7
- - **Found:** 2026-07 while trying to run `designer` / `architect` subagents on `openai/gpt-5.6-sol`
8
-
9
- ## Symptom
10
-
11
- Every `taskflow action=run` (single agent or flow) fails immediately. The parent
12
- session works fine; only the spawned child process is broken. Representative output:
13
-
14
- ```
15
- Taskflow 'task' failed (0/1 done, 1 failed).
16
- Warning: No models match pattern "anthropic/claude-opus-4-8"
17
- Warning: No models match pattern "proxy/glm-5.2"
18
- Warning: No models match pattern "openai/gpt-5.6-sol"
19
- ... (every entry of settings.enabledModels)
20
- No API key found for openai. Use /login to log into a provider via OAuth or API key.
21
- ```
22
-
23
- i.e. in the child, **no model pattern resolves at all**, and the fallback to a
24
- direct provider (`openai`) fails because there is no API key (`~/.pi/agent/auth.json`
25
- is empty — auth is normally provided by this proxy extension, not by stored keys).
26
-
27
- ## Root cause
28
-
29
- The parent pi session gets its whole model catalog + auth from **this extension**
30
- (`pi-cliproxyapi`): it registers the proxied model list and routes calls through the
31
- local CLIProxyAPI. `settings.packages` loads it for the parent.
32
-
33
- But `pi-taskflow` spawns children with an **allowlisted** extension set:
34
-
35
- ```jsonc
36
- // settings.json
37
- "taskflow": {
38
- "piChild": {
39
- "resourceProfile": "allowlist",
40
- "extensions": [
41
- ".../taskflow-extensions/child-path-guard.ts",
42
- ".../node_modules/pi-mcp-adapter/index.ts"
43
- ]
44
- }
45
- }
46
- ```
47
-
48
- `pi-cliproxyapi` is **absent** from `piChild.extensions`, so the child never
49
- registers the proxied model catalog and starts with an empty model registry →
50
- every configured model (proxy/* and openai/*) is "not found", and the direct-provider
51
- fallback has no key. Net effect: subagents cannot run on any model.
52
-
53
- ## Workaround (applied at user settings level, reversible)
54
-
55
- Prepend this extension to the taskflow child allowlist so the child also loads the
56
- proxy and registers models. The child reads `settings.json` fresh on spawn, so no
57
- parent restart is needed.
58
-
59
- ```jsonc
60
- "taskflow": {
61
- "piChild": {
62
- "extensions": [
63
- ".../node_modules/pi-cliproxyapi/index.ts", // <-- added (first, so models
64
- ".../taskflow-extensions/child-path-guard.ts", // register before agents resolve)
65
- ".../node_modules/pi-mcp-adapter/index.ts"
66
- ]
67
- }
68
- }
69
- ```
70
-
71
- After this, child agents resolve e.g. `openai/gpt-5.6-sol` and run. Backup kept at
72
- `~/.pi/agent/settings.json.bak-notif`.
73
-
74
- ### Secondary note (expected, not this bug)
75
-
76
- `child-path-guard.ts` restricts child **writes** to the working directory. Run
77
- taskflow with `cwd` set to the repo root and use **relative** output paths; absolute
78
- paths like `/tmp/...` are rejected ("Taskflow запрещает дочернему агенту запись вне
79
- рабочего каталога").
80
-
81
- ## Proper fix (options for this package)
82
-
83
- The extension should be usable inside a taskflow child out of the box, cheaply.
84
-
85
- 1. **Docs-only (minimum):** document in README that `taskflow.piChild.extensions`
86
- must include `pi-cliproxyapi` for subagents to have models. Low effort, leaves
87
- every user to discover this the hard way.
88
- 2. **Slim child entrypoint (recommended):** export a lightweight "child mode" that
89
- only registers the model catalog + provider routing from the on-disk discovery
90
- cache (`~/.pi/agent/discovery-cache.json`) and skips parent-only concerns
91
- (interactive `/commands`, status/quota segments, live `fetchDiscovery`/`fetchUsage`).
92
- Cheap enough to load on every child spawn; avoids network under the child's
93
- `allowlist` resourceProfile (which may block discovery fetches → must rely on cache).
94
- 3. **Auto-detect child context:** when the extension detects it is running in a
95
- taskflow child (env/flag from pi-taskflow), self-limit to the slim registration
96
- path from (2) automatically, so no `piChild.extensions` edit is required.
97
-
98
- Preference: (3) if pi-taskflow exposes a detectable child signal, else (2) plus a
99
- short README note. Coordinate the child-detection signal with `pi-taskflow`.
100
-
101
- ## Acceptance criteria
102
-
103
- - [ ] `taskflow action=run` with an agent pinned to a proxied model succeeds on a
104
- clean setup (no manual `piChild.extensions` edit), OR README documents the
105
- required allowlist entry.
106
- - [ ] Child model registration does not perform blocking network fetches under
107
- `resourceProfile: allowlist` (uses discovery cache).
108
- - [ ] Child startup overhead from this extension is negligible per spawn.
109
- - [ ] Revert the user-level workaround once shipped.
Binary file
Binary file
Binary file
Binary file