pi-cliproxyapi 0.4.1 → 0.4.3
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/README.md +56 -48
- package/index.ts +2 -2
- package/package.json +1 -2
- package/src/status-quota.ts +80 -16
- package/docs/ISSUE-taskflow-child-model-access.md +0 -109
- package/docs/pi-cliproxyapi-1.png +0 -0
- package/docs/pi-cliproxyapi-2.png +0 -0
- package/docs/pi-cliproxyapi-3.png +0 -0
- package/docs/pi-cliproxyapi-4.png +0 -0
package/README.md
CHANGED
|
@@ -14,19 +14,69 @@
|
|
|
14
14
|
|
|
15
15
|
Pi extension for corporate management of model providers via a single [CliProxyAPI](https://github.com/router-for-me/CLIProxyAPI) endpoint.
|
|
16
16
|
|
|
17
|
-
One `(endpoint, apiKey)` pair — every provider and model inherits it
|
|
17
|
+
One `(endpoint, apiKey)` pair — every provider and model inherits it
|
|
18
|
+
automatically, including live quota.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
## Quota in the status line
|
|
21
|
+
|
|
22
|
+
The footer shows how much of each provider window is left for the model you are
|
|
23
|
+
currently using, so a limit is visible before it bites rather than after:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
claude-sonnet-5 5h ⣶ 69 7d ⣷ 81
|
|
27
|
+
claude-fable-5 5h ⣶ 69 7d ⣷ 81 Fable ⣾ 91
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Windows are read live, not guessed. Anthropic caps some models against a slice
|
|
31
|
+
of the weekly pool — Fable may draw down half of it, and draws faster than other
|
|
32
|
+
models — so that per-model window is shown **alongside** the weekly figure
|
|
33
|
+
rather than folded into it. Switching models switches the window on display.
|
|
34
|
+
Other models' windows never drag down the general figure.
|
|
35
|
+
|
|
36
|
+
Green ≥ 70%, yellow 30–69%, red < 30%. The **Usage** tab breaks the same data
|
|
37
|
+
down per account, with reset times.
|
|
38
|
+
|
|
39
|
+
## How the numbers get here
|
|
40
|
+
|
|
41
|
+
Quota and the model catalogue come from the
|
|
42
|
+
**[pi-bridge](https://github.com/abix5/pi-cliproxyapi-bridge)** plugin running
|
|
43
|
+
inside CliProxyAPI, authenticated with the same `apiKey` used for model calls
|
|
44
|
+
— no second credential, no extra container:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
Pi + extension ──▶ CliProxyAPI
|
|
48
|
+
/v1/models, /v1/chat/… model calls
|
|
49
|
+
/v0/resource/plugins/pi-bridge/
|
|
50
|
+
well-known → model catalogue
|
|
51
|
+
usage → per-account quota
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The plugin caches quota server-side, so every Pi instance shares one upstream
|
|
55
|
+
poll and provider rate limits stay comfortable. It also knows where each
|
|
56
|
+
provider keeps its numbers — a description that lives in configuration, so a
|
|
57
|
+
provider reshuffling its API is answered by an edit rather than a release.
|
|
58
|
+
|
|
59
|
+
Without the plugin the extension still works: it falls back to raw `/v1/models`
|
|
60
|
+
with local heuristics, and the quota display is simply absent.
|
|
61
|
+
|
|
62
|
+
| | With pi-bridge | Without |
|
|
63
|
+
| --- | --- | --- |
|
|
64
|
+
| Quota in status line + Usage tab | Live per-account windows | Unavailable |
|
|
65
|
+
| Model discovery | Enriched from [models.dev](https://models.dev) — real context windows, costs, reasoning flags | Defaults: `contextWindow=128k`, `maxTokens=16k`, `cost=0` |
|
|
66
|
+
| Classification | Server-side | Local heuristics by `owned_by` |
|
|
67
|
+
|
|
68
|
+
See the [plugin's README](https://github.com/abix5/pi-cliproxyapi-bridge) for
|
|
69
|
+
installing it into CliProxyAPI.
|
|
20
70
|
|
|
21
71
|
## Features
|
|
22
72
|
|
|
73
|
+
- **Live quota** — status-line windows for the model in use, per-account bars in the **Usage** tab, no LLM call
|
|
23
74
|
- **Unified hub** — one `/cliproxy` overlay with **Models / Usage / Diagnostics** tabs (number hotkeys `1` `2` `3`) plus global actions: `r` refresh, `e` setup, `s` save
|
|
24
75
|
- **Built-in provider routing** — whitelist which Anthropic / OpenAI / etc. models are available through the proxy
|
|
25
76
|
- **Custom provider groups** — create named groups (e.g. `corp-glm`, `corp-gemini`) for proxy-only models with automatic metadata from [models.dev](https://models.dev)
|
|
26
77
|
- **Exclusive model pool** — a model assigned to one group automatically disappears from others, grouped by `owned_by` with type-to-filter (`/`)
|
|
27
78
|
- **Live save state** — the header shows `● unsaved` while you edit and `✓ settings saved` after `s`, no console noise
|
|
28
|
-
- **
|
|
29
|
-
- **Setup wizard** — `/cliproxy-setup` configures endpoint, API key, provider prefix, and usage key interactively
|
|
79
|
+
- **Setup wizard** — `/cliproxy-setup` configures endpoint, API key, and provider prefix interactively
|
|
30
80
|
|
|
31
81
|
## Commands
|
|
32
82
|
|
|
@@ -35,7 +85,7 @@ Two commands; everything else lives inside the hub as tabs and actions.
|
|
|
35
85
|
| Command | Description |
|
|
36
86
|
| --- | --- |
|
|
37
87
|
| `/cliproxy` | Hub overlay — **Models** / **Usage** / **Diagnostics** tabs plus global actions |
|
|
38
|
-
| `/cliproxy-setup` | Configure endpoint, API key, provider prefix
|
|
88
|
+
| `/cliproxy-setup` | Configure endpoint, API key, provider prefix |
|
|
39
89
|
|
|
40
90
|
### The `/cliproxy` hub
|
|
41
91
|
|
|
@@ -53,25 +103,11 @@ Extra Models keys: `d` removes a custom group (with confirmation).
|
|
|
53
103
|
|
|
54
104
|
**Diagnostics tab** — connectivity, key resolution, and discovery shape.
|
|
55
105
|
|
|
56
|
-
## Screenshots
|
|
57
|
-
|
|
58
|
-
**Models — custom group, pool grouped by owner (`/` filters the pool)**
|
|
59
|
-
|
|
60
|
-

|
|
61
|
-
|
|
62
|
-
**Usage — per-account quota windows**
|
|
63
|
-
|
|
64
|
-

|
|
65
|
-
|
|
66
|
-
**Diagnostics — connectivity, keys, discovery shape**
|
|
67
|
-
|
|
68
|
-

|
|
69
|
-
|
|
70
106
|
## Prerequisites
|
|
71
107
|
|
|
72
108
|
You need a running [CliProxyAPI](https://github.com/router-for-me/CLIProxyAPI) instance — this is the corporate LLM proxy that aggregates multiple providers behind a single OpenAI-compatible endpoint.
|
|
73
109
|
|
|
74
|
-
For full functionality
|
|
110
|
+
For full functionality — quota windows and enriched model metadata — also install the **[pi-bridge](https://github.com/abix5/pi-cliproxyapi-bridge)** plugin into that instance. See [How the numbers get here](#how-the-numbers-get-here) above.
|
|
75
111
|
|
|
76
112
|
## Install
|
|
77
113
|
|
|
@@ -134,34 +170,6 @@ cache.
|
|
|
134
170
|
|
|
135
171
|
Values support `!command` (shell exec), `$ENV_VAR`, or literal strings. The `/cliproxy-setup` wizard also accepts bare `~/path` values and saves them as `!cat` commands; when editing the file by hand, write the `!cat ~/path` form explicitly.
|
|
136
172
|
|
|
137
|
-
## Discovery
|
|
138
|
-
|
|
139
|
-
The extension reads the model catalogue and provider quota from the
|
|
140
|
-
**[pi-bridge](https://github.com/abix5/pi-cliproxyapi-bridge)** plugin running
|
|
141
|
-
inside CliProxyAPI, authenticating with the same `apiKey` it uses for model
|
|
142
|
-
calls. No second credential and no extra container are involved.
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
┌──────────────┐ ┌────────────────────────────────────────┐
|
|
146
|
-
│ Pi + plugin │────▶│ CliProxyAPI │
|
|
147
|
-
│ │ │ /v1/models, /v1/chat/... │
|
|
148
|
-
│ │ │ /v0/resource/plugins/pi-bridge/… │
|
|
149
|
-
│ │ │ well-known → model catalogue │
|
|
150
|
-
│ │ │ usage → per-account quota │
|
|
151
|
-
└──────────────┘ └────────────────────────────────────────┘
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
Without the plugin the extension still works: it falls back to raw `/v1/models`
|
|
155
|
-
with local heuristics.
|
|
156
|
-
|
|
157
|
-
| | With pi-bridge | Without |
|
|
158
|
-
| --- | --- | --- |
|
|
159
|
-
| Model discovery | Enriched from [models.dev](https://models.dev) — real context windows, costs, reasoning flags | Defaults: `contextWindow=128k`, `maxTokens=16k`, `cost=0` |
|
|
160
|
-
| Usage tab | Per-account quota bars | Unavailable |
|
|
161
|
-
| Classification | Server-side | Local heuristics by `owned_by` |
|
|
162
|
-
|
|
163
|
-
See the plugin's README for installing it into CliProxyAPI.
|
|
164
|
-
|
|
165
173
|
## Setup
|
|
166
174
|
|
|
167
175
|
Run `/cliproxy-setup` in Pi and enter:
|
package/index.ts
CHANGED
|
@@ -168,7 +168,7 @@ async function refreshQuotaStatus(
|
|
|
168
168
|
};
|
|
169
169
|
setStatus(key: string, text: string | undefined): void;
|
|
170
170
|
},
|
|
171
|
-
model: { provider: string } | undefined,
|
|
171
|
+
model: { provider: string; id?: string } | undefined,
|
|
172
172
|
opts: { readOnly?: boolean } = {},
|
|
173
173
|
): Promise<void> {
|
|
174
174
|
if (!model) {
|
|
@@ -180,7 +180,7 @@ async function refreshQuotaStatus(
|
|
|
180
180
|
ui.setStatus(QUOTA_STATUS_KEY, undefined);
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
|
-
const rendered = renderQuotaSegment(doc, model.provider, ui.theme);
|
|
183
|
+
const rendered = renderQuotaSegment(doc, model.provider, ui.theme, model.id);
|
|
184
184
|
ui.setStatus(QUOTA_STATUS_KEY, rendered ?? undefined);
|
|
185
185
|
}
|
|
186
186
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-cliproxyapi",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pi extension for corporate management of model providers via a single CliProxyAPI endpoint",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"index.ts",
|
|
13
13
|
"src",
|
|
14
|
-
"docs",
|
|
15
14
|
"README.md"
|
|
16
15
|
],
|
|
17
16
|
"pi": {
|
package/src/status-quota.ts
CHANGED
|
@@ -58,6 +58,36 @@ function is7dGroup(g: UsageGroup): boolean {
|
|
|
58
58
|
return s.includes("7d") || s.includes("seven-day") || s.includes("seven day");
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* A model-scoped weekly window, e.g. `seven-day-fable`, as opposed to the
|
|
63
|
+
* account-wide `seven-day`.
|
|
64
|
+
*/
|
|
65
|
+
function scopedModelName(g: UsageGroup): string | null {
|
|
66
|
+
const id = g.id.toLowerCase();
|
|
67
|
+
const prefix = "seven-day-";
|
|
68
|
+
return id.startsWith(prefix) ? id.slice(prefix.length) || null : null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Does a scoped window belong to the model currently selected?
|
|
73
|
+
*
|
|
74
|
+
* Windows are named after the model family (`Fable` -> `seven-day-fable`) while
|
|
75
|
+
* model ids carry a version (`claude-fable-5`), so this looks for the family
|
|
76
|
+
* name as a delimited word inside the id rather than comparing the two
|
|
77
|
+
* directly. Done without a regex because the scope comes from the server.
|
|
78
|
+
*/
|
|
79
|
+
function scopeMatchesModel(scope: string, modelID: string): boolean {
|
|
80
|
+
const isWordChar = (c: string | undefined) =>
|
|
81
|
+
c !== undefined && /[a-z0-9]/.test(c);
|
|
82
|
+
const id = modelID.toLowerCase();
|
|
83
|
+
for (let i = id.indexOf(scope); i !== -1; i = id.indexOf(scope, i + 1)) {
|
|
84
|
+
const before = id[i - 1];
|
|
85
|
+
const after = id[i + scope.length];
|
|
86
|
+
if (!isWordChar(before) && !isWordChar(after)) return true;
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
61
91
|
interface WindowAggregate {
|
|
62
92
|
fraction: number;
|
|
63
93
|
}
|
|
@@ -66,10 +96,8 @@ interface WindowAggregate {
|
|
|
66
96
|
* Aggregate a window period across live accounts.
|
|
67
97
|
*
|
|
68
98
|
* Semantics: within each account, take the MIN remaining among matching
|
|
69
|
-
* windows (the account's bottleneck for that period
|
|
70
|
-
*
|
|
71
|
-
* one governs). Then take the MAX across accounts (the router will dispatch
|
|
72
|
-
* to the account with the most headroom).
|
|
99
|
+
* windows (the account's bottleneck for that period). Then take the MAX across
|
|
100
|
+
* accounts (the router will dispatch to the account with the most headroom).
|
|
73
101
|
*/
|
|
74
102
|
function aggregateWindow(
|
|
75
103
|
accounts: UsageAccount[],
|
|
@@ -124,6 +152,9 @@ function pct(fraction: number): number {
|
|
|
124
152
|
* @param doc - usage document from /api/usage
|
|
125
153
|
* @param piProvider - Pi provider name of the current model (e.g. "anthropic")
|
|
126
154
|
* @param theme - Pi theme for coloring (from ctx.ui.theme)
|
|
155
|
+
* @param modelID - id of the selected model (e.g. "claude-fable-5"). When the
|
|
156
|
+
* provider reports a weekly window scoped to that model, it is shown as its
|
|
157
|
+
* own segment and excluded from the account-wide figure.
|
|
127
158
|
*/
|
|
128
159
|
export function renderQuotaSegment(
|
|
129
160
|
doc: UsageDocument,
|
|
@@ -132,6 +163,7 @@ export function renderQuotaSegment(
|
|
|
132
163
|
theme: {
|
|
133
164
|
fg(color: "success" | "warning" | "error" | "dim", text: string): string;
|
|
134
165
|
},
|
|
166
|
+
modelID?: string,
|
|
135
167
|
): string | null {
|
|
136
168
|
const usageKey = providerToUsageKey(piProvider);
|
|
137
169
|
if (!usageKey) return null;
|
|
@@ -139,24 +171,56 @@ export function renderQuotaSegment(
|
|
|
139
171
|
const accounts = doc.accounts.filter((a) => a.provider === usageKey);
|
|
140
172
|
if (accounts.length === 0) return null;
|
|
141
173
|
|
|
174
|
+
// A weekly window scoped to the selected model, e.g. Fable. It is a sub-cap
|
|
175
|
+
// on the weekly pool rather than a separate allowance, so it is shown
|
|
176
|
+
// alongside the account-wide weekly figure, never instead of it.
|
|
177
|
+
const scopeOf = (g: UsageGroup) => (modelID ? scopedModelName(g) : null);
|
|
178
|
+
const isSelectedModelWindow = (g: UsageGroup) => {
|
|
179
|
+
const scope = scopeOf(g);
|
|
180
|
+
return scope !== null && scopeMatchesModel(scope, modelID as string);
|
|
181
|
+
};
|
|
182
|
+
|
|
142
183
|
const w5 = aggregateWindow(accounts, is5hGroup);
|
|
143
|
-
|
|
184
|
+
// Other models' scoped windows say nothing about the model in use, and
|
|
185
|
+
// including them used to drag the weekly figure down for no reason.
|
|
186
|
+
const w7 = aggregateWindow(
|
|
187
|
+
accounts,
|
|
188
|
+
(g) => is7dGroup(g) && scopeOf(g) === null,
|
|
189
|
+
);
|
|
190
|
+
const wModel = aggregateWindow(accounts, isSelectedModelWindow);
|
|
144
191
|
|
|
145
|
-
//
|
|
146
|
-
if (!w5 && !w7) return null;
|
|
192
|
+
// Nothing to show → hide the segment entirely
|
|
193
|
+
if (!w5 && !w7 && !wModel) return null;
|
|
147
194
|
|
|
148
195
|
const parts: string[] = [theme.fg("dim", GAUGE_ICON)];
|
|
149
|
-
|
|
150
|
-
|
|
196
|
+
const push = (label: string, fraction: number) => {
|
|
197
|
+
const color = colorForFraction(fraction);
|
|
151
198
|
parts.push(
|
|
152
|
-
`${theme.fg("dim",
|
|
199
|
+
`${theme.fg("dim", label)} ${theme.fg(color, brailleFor(fraction))} ${theme.fg(color, String(pct(fraction)))}`,
|
|
153
200
|
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
if (w5) push("5h", w5.fraction);
|
|
204
|
+
if (w7) push("7d", w7.fraction);
|
|
205
|
+
if (wModel)
|
|
206
|
+
push(modelWindowLabel(accounts, modelID as string), wModel.fraction);
|
|
160
207
|
|
|
161
208
|
return parts.join(" ");
|
|
162
209
|
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Label for the selected model's own weekly window, taken from the group so it
|
|
213
|
+
* reads the way the provider names it ("7d Fable" -> "Fable").
|
|
214
|
+
*/
|
|
215
|
+
function modelWindowLabel(accounts: UsageAccount[], modelID: string): string {
|
|
216
|
+
for (const a of accounts) {
|
|
217
|
+
for (const g of a.groups ?? []) {
|
|
218
|
+
const scope = scopedModelName(g);
|
|
219
|
+
if (scope && scopeMatchesModel(scope, modelID)) {
|
|
220
|
+
const label = (g.label ?? "").replace(/^7d\s+/i, "").trim();
|
|
221
|
+
return label || scope;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return "model";
|
|
226
|
+
}
|
|
@@ -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
|