apteva 0.4.7 → 0.4.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apteva",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "Run AI agents locally. Multi-provider support for Claude, GPT, Gemini, Llama, and more.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -50,7 +50,9 @@ export async function handleIntegrationRoutes(
50
50
  return json({ error: `Unknown provider: ${providerId}` }, 404);
51
51
  }
52
52
 
53
- const apiKey = ProviderKeys.getDecrypted(providerId);
53
+ const url = new URL(req.url);
54
+ const projectId = url.searchParams.get("project_id") || null;
55
+ const apiKey = ProviderKeys.getDecryptedForProject(providerId, projectId);
54
56
  if (!apiKey) {
55
57
  return json({ error: `${provider.name} API key not configured`, apps: [] }, 200);
56
58
  }
@@ -73,7 +75,9 @@ export async function handleIntegrationRoutes(
73
75
  return json({ error: `Unknown provider: ${providerId}` }, 404);
74
76
  }
75
77
 
76
- const apiKey = ProviderKeys.getDecrypted(providerId);
78
+ const url = new URL(req.url);
79
+ const projectId = url.searchParams.get("project_id") || null;
80
+ const apiKey = ProviderKeys.getDecryptedForProject(providerId, projectId);
77
81
  if (!apiKey) {
78
82
  return json({ error: `${provider.name} API key not configured`, accounts: [] }, 200);
79
83
  }
@@ -99,14 +103,13 @@ export async function handleIntegrationRoutes(
99
103
  return json({ error: `Unknown provider: ${providerId}` }, 404);
100
104
  }
101
105
 
102
- const apiKey = ProviderKeys.getDecrypted(providerId);
103
- if (!apiKey) {
104
- return json({ error: `${provider.name} API key not configured` }, 401);
105
- }
106
-
107
106
  try {
108
107
  const body = await req.json();
109
- const { appSlug, redirectUrl, credentials } = body;
108
+ const { appSlug, redirectUrl, credentials, project_id } = body;
109
+ const apiKey = ProviderKeys.getDecryptedForProject(providerId, project_id || null);
110
+ if (!apiKey) {
111
+ return json({ error: `${provider.name} API key not configured` }, 401);
112
+ }
110
113
 
111
114
  if (!appSlug) {
112
115
  return json({ error: "appSlug is required" }, 400);
@@ -136,7 +139,9 @@ export async function handleIntegrationRoutes(
136
139
  return json({ error: `Unknown provider: ${providerId}` }, 404);
137
140
  }
138
141
 
139
- const apiKey = ProviderKeys.getDecrypted(providerId);
142
+ const url = new URL(req.url);
143
+ const projectId = url.searchParams.get("project_id") || null;
144
+ const apiKey = ProviderKeys.getDecryptedForProject(providerId, projectId);
140
145
  if (!apiKey) {
141
146
  return json({ error: `${provider.name} API key not configured` }, 401);
142
147
  }
@@ -162,7 +167,9 @@ export async function handleIntegrationRoutes(
162
167
  return json({ error: `Unknown provider: ${providerId}` }, 404);
163
168
  }
164
169
 
165
- const apiKey = ProviderKeys.getDecrypted(providerId);
170
+ const url = new URL(req.url);
171
+ const projectId = url.searchParams.get("project_id") || null;
172
+ const apiKey = ProviderKeys.getDecryptedForProject(providerId, projectId);
166
173
  if (!apiKey) {
167
174
  return json({ error: `${provider.name} API key not configured` }, 401);
168
175
  }