protoagent 0.1.1 → 0.1.2
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/App.js +22 -2
- package/dist/config.js +5 -1
- package/dist/providers.js +36 -0
- package/package.json +1 -1
package/dist/App.js
CHANGED
|
@@ -137,8 +137,28 @@ function buildClient(config) {
|
|
|
137
137
|
const clientOptions = {
|
|
138
138
|
apiKey,
|
|
139
139
|
};
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
// baseURL: env var override takes precedence over provider default
|
|
141
|
+
const baseURLOverride = process.env.PROTOAGENT_BASE_URL?.trim();
|
|
142
|
+
const baseURL = baseURLOverride || provider?.baseURL;
|
|
143
|
+
if (baseURL) {
|
|
144
|
+
clientOptions.baseURL = baseURL;
|
|
145
|
+
}
|
|
146
|
+
// Custom headers: parse PROTOAGENT_CUSTOM_HEADERS (newline-separated "Key: Value" pairs)
|
|
147
|
+
const rawHeaders = process.env.PROTOAGENT_CUSTOM_HEADERS?.trim();
|
|
148
|
+
if (rawHeaders) {
|
|
149
|
+
const defaultHeaders = {};
|
|
150
|
+
for (const line of rawHeaders.split('\n')) {
|
|
151
|
+
const sep = line.indexOf(': ');
|
|
152
|
+
if (sep === -1)
|
|
153
|
+
continue;
|
|
154
|
+
const key = line.slice(0, sep).trim();
|
|
155
|
+
const value = line.slice(sep + 2).trim();
|
|
156
|
+
if (key && value)
|
|
157
|
+
defaultHeaders[key] = value;
|
|
158
|
+
}
|
|
159
|
+
if (Object.keys(defaultHeaders).length > 0) {
|
|
160
|
+
clientOptions.defaultHeaders = defaultHeaders;
|
|
161
|
+
}
|
|
142
162
|
}
|
|
143
163
|
return new OpenAI(clientOptions);
|
|
144
164
|
}
|
package/dist/config.js
CHANGED
|
@@ -18,6 +18,10 @@ export function resolveApiKey(config) {
|
|
|
18
18
|
if (directApiKey) {
|
|
19
19
|
return directApiKey;
|
|
20
20
|
}
|
|
21
|
+
// Fallback for Cloudflare Gateway or other custom header setups
|
|
22
|
+
if (process.env.PROTOAGENT_CUSTOM_HEADERS) {
|
|
23
|
+
return 'none';
|
|
24
|
+
}
|
|
21
25
|
const provider = getProvider(config.provider);
|
|
22
26
|
if (!provider?.apiKeyEnvVar) {
|
|
23
27
|
return null;
|
|
@@ -143,7 +147,7 @@ export const ApiKeyInput = ({ selectedProviderId, selectedModelId, setStep, setC
|
|
|
143
147
|
setConfigWritten(true);
|
|
144
148
|
setStep(4);
|
|
145
149
|
};
|
|
146
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: ["Enter API Key for ", provider?.name || selectedProviderId, ":"] }), errorMessage && _jsx(Text, { color: "red", children: errorMessage }), _jsx(PasswordInput, { placeholder: `Enter your ${provider?.apiKeyEnvVar || 'API'} key`, onSubmit: handleApiKeySubmit })] }));
|
|
150
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: ["Enter API Key for ", provider?.name || selectedProviderId, ":"] }), selectedProviderId === 'cloudflare-gateway' && (_jsx(Text, { dimColor: true, children: "For Cloudflare AI Gateway, enter any placeholder (e.g. 'none'). Auth is handled via PROTOAGENT_CUSTOM_HEADERS." })), errorMessage && _jsx(Text, { color: "red", children: errorMessage }), _jsx(PasswordInput, { placeholder: `Enter your ${provider?.apiKeyEnvVar || 'API'} key`, onSubmit: handleApiKeySubmit })] }));
|
|
147
151
|
};
|
|
148
152
|
export const ConfigResult = ({ configWritten }) => {
|
|
149
153
|
return (_jsxs(Box, { flexDirection: "column", children: [configWritten ? (_jsx(Text, { color: "green", children: "Configuration saved successfully!" })) : (_jsx(Text, { color: "yellow", children: "Configuration not changed." })), _jsx(Text, { children: "You can now run ProtoAgent." })] }));
|
package/dist/providers.js
CHANGED
|
@@ -114,6 +114,42 @@ export const SUPPORTED_MODELS = [
|
|
|
114
114
|
},
|
|
115
115
|
],
|
|
116
116
|
},
|
|
117
|
+
{
|
|
118
|
+
id: 'cloudflare-gateway',
|
|
119
|
+
name: 'Cloudflare AI Gateway',
|
|
120
|
+
baseURL: undefined, // Overridden by PROTOAGENT_BASE_URL at runtime
|
|
121
|
+
apiKeyEnvVar: 'PROTOAGENT_API_KEY',
|
|
122
|
+
models: [
|
|
123
|
+
{
|
|
124
|
+
id: 'claude-opus-4-6',
|
|
125
|
+
name: 'Claude Opus 4.6 (via CF Gateway)',
|
|
126
|
+
contextWindow: 200_000,
|
|
127
|
+
pricingPerMillionInput: 5.00,
|
|
128
|
+
pricingPerMillionOutput: 25.00,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: 'claude-sonnet-4-6',
|
|
132
|
+
name: 'Claude Sonnet 4.6 (via CF Gateway)',
|
|
133
|
+
contextWindow: 200_000,
|
|
134
|
+
pricingPerMillionInput: 3.00,
|
|
135
|
+
pricingPerMillionOutput: 15.00,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: 'gpt-4o',
|
|
139
|
+
name: 'GPT-4o (via CF Gateway)',
|
|
140
|
+
contextWindow: 128_000,
|
|
141
|
+
pricingPerMillionInput: 2.50,
|
|
142
|
+
pricingPerMillionOutput: 10.00,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: 'gemini-2.5-flash',
|
|
146
|
+
name: 'Gemini 2.5 Flash (via CF Gateway)',
|
|
147
|
+
contextWindow: 1_000_000,
|
|
148
|
+
pricingPerMillionInput: 0.075,
|
|
149
|
+
pricingPerMillionOutput: 0.30,
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
},
|
|
117
153
|
];
|
|
118
154
|
/** Find a provider by ID. */
|
|
119
155
|
export function getProvider(providerId) {
|