@tekmidian/pai 0.39.0 → 0.39.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/dist/{chain-CTtHligI.mjs → chain-CqlgL7uH.mjs} +40 -10
- package/dist/chain-CqlgL7uH.mjs.map +1 -0
- package/dist/cli/index.mjs +3 -3
- package/dist/cli/program.mjs +3 -3
- package/dist/daemon-mcp/index.mjs +53 -2
- package/dist/daemon-mcp/index.mjs.map +1 -1
- package/dist/{providers-FYkZjn_C.mjs → fallback-DqYhiACU.mjs} +276 -6
- package/dist/fallback-DqYhiACU.mjs.map +1 -0
- package/dist/hooks/route-agents-to-worker.mjs +39 -4
- package/dist/hooks/route-agents-to-worker.mjs.map +2 -2
- package/dist/hooks/worker-proxy.mjs +39 -4
- package/dist/hooks/worker-proxy.mjs.map +2 -2
- package/dist/hooks/worker-status-line.mjs +39 -4
- package/dist/hooks/worker-status-line.mjs.map +2 -2
- package/dist/{planner-BDI7bE9B.mjs → planner-DGV8VFib.mjs} +2 -2
- package/dist/{planner-BDI7bE9B.mjs.map → planner-DGV8VFib.mjs.map} +1 -1
- package/dist/{program-DXBwJV7h.mjs → program-B-QJXCRb.mjs} +28 -3
- package/dist/{program-DXBwJV7h.mjs.map → program-B-QJXCRb.mjs.map} +1 -1
- package/dist/skills/Worker/SKILL.md +13 -0
- package/docs/commands/README.md +1 -0
- package/docs/commands/worker.md +18 -0
- package/docs/worker.md +43 -0
- package/package.json +1 -1
- package/dist/chain-CTtHligI.mjs.map +0 -1
- package/dist/providers-FYkZjn_C.mjs.map +0 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -7,15 +7,15 @@ import "../helpers-IjZkXBhj.mjs";
|
|
|
7
7
|
import "../sync-BWbe8JTg.mjs";
|
|
8
8
|
import "../embeddings-DOLZnT1X.mjs";
|
|
9
9
|
import "../search-Rpk1cSBC.mjs";
|
|
10
|
-
import { n as drainStdio, t as buildProgram } from "../program-
|
|
10
|
+
import { n as drainStdio, t as buildProgram } from "../program-B-QJXCRb.mjs";
|
|
11
11
|
import "../context-handover-cache-BpUojjsi.mjs";
|
|
12
12
|
import "../indexer-D7MvSQPY.mjs";
|
|
13
13
|
import "../ipc-client-BmypMNYk.mjs";
|
|
14
14
|
import "../config-B64vFg14.mjs";
|
|
15
15
|
import "../factory-A9x-T2Kg.mjs";
|
|
16
|
-
import "../chain-
|
|
16
|
+
import "../chain-CqlgL7uH.mjs";
|
|
17
17
|
import "../main-resolver-DlaLOFBA.mjs";
|
|
18
|
-
import "../
|
|
18
|
+
import "../fallback-DqYhiACU.mjs";
|
|
19
19
|
import { CommanderError } from "commander";
|
|
20
20
|
|
|
21
21
|
//#region src/cli/index.ts
|
package/dist/cli/program.mjs
CHANGED
|
@@ -6,14 +6,14 @@ import "../helpers-IjZkXBhj.mjs";
|
|
|
6
6
|
import "../sync-BWbe8JTg.mjs";
|
|
7
7
|
import "../embeddings-DOLZnT1X.mjs";
|
|
8
8
|
import "../search-Rpk1cSBC.mjs";
|
|
9
|
-
import { t as buildProgram } from "../program-
|
|
9
|
+
import { t as buildProgram } from "../program-B-QJXCRb.mjs";
|
|
10
10
|
import "../context-handover-cache-BpUojjsi.mjs";
|
|
11
11
|
import "../indexer-D7MvSQPY.mjs";
|
|
12
12
|
import "../ipc-client-BmypMNYk.mjs";
|
|
13
13
|
import "../config-B64vFg14.mjs";
|
|
14
14
|
import "../factory-A9x-T2Kg.mjs";
|
|
15
|
-
import "../chain-
|
|
15
|
+
import "../chain-CqlgL7uH.mjs";
|
|
16
16
|
import "../main-resolver-DlaLOFBA.mjs";
|
|
17
|
-
import "../
|
|
17
|
+
import "../fallback-DqYhiACU.mjs";
|
|
18
18
|
|
|
19
19
|
export { buildProgram };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as PaiClient } from "../ipc-client-BmypMNYk.mjs";
|
|
3
3
|
import { o as loadConfig } from "../config-B64vFg14.mjs";
|
|
4
|
-
import { B as
|
|
5
|
-
import { a as
|
|
4
|
+
import { A as alive, B as ledgerPath, I as ledgerSummary, M as loadStatus, N as loadStatuses, V as workersLogDir, X as readWorkersSection, a as testProvider, g as sayToWorker, h as readInbox, i as runWorker, m as handoffFromInside, t as runChain } from "../chain-CqlgL7uH.mjs";
|
|
5
|
+
import { _ as replayOutput, a as addProvider, c as removeProvider, d as setWorkersEnabled, f as unsetClass, g as psOutput, i as fallbackStatusText, l as setClass, m as useProvider, n as fallbackOn, o as classTargetText, p as updateProvider, r as fallbackStatus, s as describeProviders, t as fallbackOff, u as setProviderEnabled } from "../fallback-DqYhiACU.mjs";
|
|
6
6
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
7
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
8
8
|
|
|
@@ -4586,6 +4586,11 @@ pai worker run --label "short task label" --class research \\
|
|
|
4586
4586
|
only (max_cost_tier, require_tags) so auto-routing picks a qualifying provider.
|
|
4587
4587
|
- \`worker_run\` — start a worker or chain from chat; returns the id immediately.
|
|
4588
4588
|
- \`worker_toggle\` — off makes Agent subagents run on Anthropic again.
|
|
4589
|
+
- \`worker_fallback\` — machine-wide switch: every NEW Claude Code process
|
|
4590
|
+
(interactive, task-bus, daemon summarizer) runs on a worker provider until
|
|
4591
|
+
switched back. on writes the provider env + model pin into the Claude
|
|
4592
|
+
settings file (the token sits there until off), off restores it exactly,
|
|
4593
|
+
status lists running sessions and the note. Subagent routing is unchanged.
|
|
4589
4594
|
|
|
4590
4595
|
### Preferences from chat (map the phrase, use the tool, never mention files)
|
|
4591
4596
|
|
|
@@ -4597,6 +4602,14 @@ pai worker run --label "short task label" --class research \\
|
|
|
4597
4602
|
require_tags ["reasoning"] (drop the pin if one exists). One line.
|
|
4598
4603
|
- "what handles reviews" / "show the routing table" → worker_classes list
|
|
4599
4604
|
(plus worker_status for providers). One or two lines.
|
|
4605
|
+
- "switch everything to <provider>" / "fallback on" (plan exhausted, every
|
|
4606
|
+
new session must run on the worker provider) → worker_fallback on. Confirm
|
|
4607
|
+
with one line: provider, that running sessions keep their provider until
|
|
4608
|
+
restarted, and how to switch back.
|
|
4609
|
+
- "back to anthropic" / "fallback off" → worker_fallback off. One line: what
|
|
4610
|
+
was restored.
|
|
4611
|
+
- "is fallback on" / "are we on <provider>" → worker_fallback status. One or
|
|
4612
|
+
two lines.
|
|
4600
4613
|
- Never tell the user to edit a config file — the tools do it.`
|
|
4601
4614
|
};
|
|
4602
4615
|
|
|
@@ -5888,6 +5901,44 @@ async function startShim() {
|
|
|
5888
5901
|
return workerError(e);
|
|
5889
5902
|
}
|
|
5890
5903
|
});
|
|
5904
|
+
server.tool("worker_fallback", [
|
|
5905
|
+
"Machine-wide fallback: switch every NEW Claude Code process on this",
|
|
5906
|
+
"machine (interactive, task-bus, daemon summarizer) to a worker provider,",
|
|
5907
|
+
"or back to the Anthropic login.",
|
|
5908
|
+
"",
|
|
5909
|
+
"action=on switches (provider optional, default: active) by writing the",
|
|
5910
|
+
"provider's env into ~/.claude/settings.json — the token is read from its",
|
|
5911
|
+
"key file and then sits in settings.json until off. action=off restores",
|
|
5912
|
+
"settings.json exactly. action=status (default) shows on/off, provider,",
|
|
5913
|
+
"running sessions and the FALLBACK-ACTIVE.md note. Running sessions keep",
|
|
5914
|
+
"their provider until restarted. CLAUDE_SETTINGS_PATH retargets settings",
|
|
5915
|
+
"for dry runs. Subagent routing is unchanged while on."
|
|
5916
|
+
].join("\n"), {
|
|
5917
|
+
action: _enum([
|
|
5918
|
+
"on",
|
|
5919
|
+
"off",
|
|
5920
|
+
"status"
|
|
5921
|
+
]).optional().describe("Default: status."),
|
|
5922
|
+
provider: string().optional().describe("Provider to switch to (on). Default: active.")
|
|
5923
|
+
}, async (args) => {
|
|
5924
|
+
try {
|
|
5925
|
+
const action = args.action ?? "status";
|
|
5926
|
+
if (action === "status") return workerText(fallbackStatusText(fallbackStatus()).join("\n"));
|
|
5927
|
+
if (action === "on") {
|
|
5928
|
+
const r = fallbackOn(args.provider);
|
|
5929
|
+
return workerText([
|
|
5930
|
+
r.alreadyOn ? `fallback already on — provider ${r.provider}, env re-applied` : `fallback on — provider ${r.provider}; every new Claude Code process uses it`,
|
|
5931
|
+
`settings.json env: ${r.envKeys.join(", ")}`,
|
|
5932
|
+
`model pin: ${r.model}`,
|
|
5933
|
+
"running sessions keep their current provider until restarted"
|
|
5934
|
+
].join("\n"));
|
|
5935
|
+
}
|
|
5936
|
+
const r = fallbackOff();
|
|
5937
|
+
return workerText(`fallback off — provider ${r.provider} released, settings.json restored (${r.envKeys.join(", ")})`);
|
|
5938
|
+
} catch (e) {
|
|
5939
|
+
return workerError(e);
|
|
5940
|
+
}
|
|
5941
|
+
});
|
|
5891
5942
|
server.tool("worker_classes", [
|
|
5892
5943
|
"Manage worker classes (list, set, unset).",
|
|
5893
5944
|
"",
|