@madgagarin/pi-agentrouter 1.0.4 → 1.1.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/index.ts +22 -0
- package/package.json +12 -4
package/index.ts
CHANGED
|
@@ -110,8 +110,30 @@ export default function (pi: ExtensionAPI) {
|
|
|
110
110
|
|
|
111
111
|
registerAgentRouterProviders(currentApiKey);
|
|
112
112
|
|
|
113
|
+
function updatePromptRewriteEnvForModel(model?: any): void {
|
|
114
|
+
if (isAgentRouter(model?.provider, model?.baseUrl)) {
|
|
115
|
+
process.env.PI_CACHE_OPTIMIZER_NO_PROMPT_REWRITE = "1";
|
|
116
|
+
} else {
|
|
117
|
+
delete process.env.PI_CACHE_OPTIMIZER_NO_PROMPT_REWRITE;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
122
|
+
updatePromptRewriteEnvForModel(ctx.model);
|
|
123
|
+
lastRequestTime = Date.now();
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
pi.on("model_select", async (event) => {
|
|
127
|
+
updatePromptRewriteEnvForModel(event.model);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
pi.on("before_agent_start", async (_event, ctx) => {
|
|
131
|
+
updatePromptRewriteEnvForModel(ctx.model);
|
|
132
|
+
});
|
|
133
|
+
|
|
113
134
|
pi.on("turn_start", async (_event, ctx) => {
|
|
114
135
|
const model = ctx.model;
|
|
136
|
+
updatePromptRewriteEnvForModel(model);
|
|
115
137
|
if (!isAgentRouter(model?.provider, (model as any)?.baseUrl)) {
|
|
116
138
|
return;
|
|
117
139
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madgagarin/pi-agentrouter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Pi coding agent extension for AgentRouter (GPT-5.6 Sol & Claude Opus 5) with rate-limit pacing and caching.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"keywords": [
|
|
9
9
|
"pi-package",
|
|
10
|
+
"pi-extension",
|
|
11
|
+
"pi-coding-agent",
|
|
10
12
|
"pi",
|
|
11
13
|
"agentrouter",
|
|
14
|
+
"agentrouter-org",
|
|
15
|
+
"agentrouter.org",
|
|
16
|
+
"agent-router",
|
|
17
|
+
"gpt-5.6-sol",
|
|
18
|
+
"claude-opus-5",
|
|
19
|
+
"claude-opus-4-8",
|
|
20
|
+
"prompt-caching",
|
|
12
21
|
"openai",
|
|
13
22
|
"claude",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"extension"
|
|
23
|
+
"llm-gateway",
|
|
24
|
+
"ai-coding"
|
|
17
25
|
],
|
|
18
26
|
"author": "madgagarin (https://github.com/madgagarin)",
|
|
19
27
|
"license": "MIT",
|