apteva 0.2.9 → 0.2.10

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/index.html CHANGED
@@ -11,6 +11,6 @@
11
11
  </head>
12
12
  <body>
13
13
  <div id="root"></div>
14
- <script type="module" src="/App.m4hg4bxq.js"></script>
14
+ <script type="module" src="/App.44ge5b89.js"></script>
15
15
  </body>
16
16
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apteva",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
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",
package/src/binary.ts CHANGED
@@ -96,26 +96,26 @@ function getDownloadUrl(): string {
96
96
  return `${BINARY_BASE_URL}/${filename}`;
97
97
  }
98
98
 
99
- // Check if binary exists (either from npm or downloaded)
99
+ // Check if binary exists (downloaded or npm)
100
100
  export function binaryExists(binDir: string): boolean {
101
- // First check npm package
102
- const npmBinary = findNpmBinary();
103
- if (npmBinary) return true;
101
+ // Check downloaded binary first
102
+ if (existsSync(getBinaryPath(binDir))) return true;
104
103
 
105
- // Then check downloaded binary
106
- return existsSync(getBinaryPath(binDir));
104
+ // Then check npm package
105
+ const npmBinary = findNpmBinary();
106
+ return !!npmBinary;
107
107
  }
108
108
 
109
- // Get the actual binary path (npm or downloaded)
109
+ // Get the actual binary path (downloaded takes priority over npm)
110
110
  export function getActualBinaryPath(binDir: string): string | null {
111
- // First check npm package
112
- const npmBinary = findNpmBinary();
113
- if (npmBinary) return npmBinary;
114
-
115
- // Then check downloaded binary
111
+ // First check downloaded binary (takes priority - allows updates)
116
112
  const downloadedPath = getBinaryPath(binDir);
117
113
  if (existsSync(downloadedPath)) return downloadedPath;
118
114
 
115
+ // Fall back to npm package (initial install)
116
+ const npmBinary = findNpmBinary();
117
+ if (npmBinary) return npmBinary;
118
+
119
119
  return null;
120
120
  }
121
121
 
@@ -149,7 +149,7 @@ async function downloadWithTimeout(url: string): Promise<ArrayBuffer> {
149
149
  }
150
150
  }
151
151
 
152
- // Ensure binary exists - check npm first, then download
152
+ // Ensure binary exists - check downloaded first (for updates), then npm
153
153
  export async function ensureBinary(binDir: string, silent = false): Promise<{
154
154
  success: boolean;
155
155
  path: string;
@@ -157,17 +157,6 @@ export async function ensureBinary(binDir: string, silent = false): Promise<{
157
157
  downloaded?: boolean;
158
158
  source?: "npm" | "download" | "cached";
159
159
  }> {
160
- // First, check if binary is available from npm package
161
- const npmBinary = findNpmBinary();
162
- if (npmBinary) {
163
- return {
164
- success: true,
165
- path: npmBinary,
166
- downloaded: false,
167
- source: "npm"
168
- };
169
- }
170
-
171
160
  const binaryPath = getBinaryPath(binDir);
172
161
 
173
162
  // Ensure bin directory exists
@@ -175,7 +164,7 @@ export async function ensureBinary(binDir: string, silent = false): Promise<{
175
164
  mkdirSync(binDir, { recursive: true });
176
165
  }
177
166
 
178
- // Check if already downloaded
167
+ // First check downloaded binary (takes priority - allows updates)
179
168
  if (existsSync(binaryPath)) {
180
169
  return {
181
170
  success: true,
@@ -185,7 +174,18 @@ export async function ensureBinary(binDir: string, silent = false): Promise<{
185
174
  };
186
175
  }
187
176
 
188
- // No npm package and no cached binary - show error
177
+ // Fall back to npm package (initial install)
178
+ const npmBinary = findNpmBinary();
179
+ if (npmBinary) {
180
+ return {
181
+ success: true,
182
+ path: npmBinary,
183
+ downloaded: false,
184
+ source: "npm"
185
+ };
186
+ }
187
+
188
+ // No cached binary and no npm package - show error
189
189
  if (!silent) {
190
190
  console.log(`${c.red}not found${c.reset}`);
191
191
  console.log(`\n Install the agent binary: npm install @apteva/agent-linux-x64`);
@@ -210,31 +210,31 @@ export function getBinaryStatus(binDir: string): {
210
210
  } {
211
211
  const { platform, arch } = getPlatformInfo();
212
212
 
213
- // Check npm first
214
- const npmBinary = findNpmBinary();
215
- if (npmBinary) {
213
+ // Check downloaded first (takes priority - allows updates)
214
+ const downloadedPath = getBinaryPath(binDir);
215
+ if (existsSync(downloadedPath)) {
216
216
  return {
217
217
  exists: true,
218
- path: npmBinary,
218
+ path: downloadedPath,
219
219
  filename: getBinaryFilename(),
220
220
  downloadUrl: getDownloadUrl(),
221
221
  platform,
222
222
  arch,
223
- source: "npm",
223
+ source: "download",
224
224
  };
225
225
  }
226
226
 
227
- // Check downloaded
228
- const downloadedPath = getBinaryPath(binDir);
229
- if (existsSync(downloadedPath)) {
227
+ // Fall back to npm package
228
+ const npmBinary = findNpmBinary();
229
+ if (npmBinary) {
230
230
  return {
231
231
  exists: true,
232
- path: downloadedPath,
232
+ path: npmBinary,
233
233
  filename: getBinaryFilename(),
234
234
  downloadUrl: getDownloadUrl(),
235
235
  platform,
236
236
  arch,
237
- source: "download",
237
+ source: "npm",
238
238
  };
239
239
  }
240
240
 
package/src/server.ts CHANGED
@@ -160,8 +160,13 @@ export function getBinaryPathForAgent(): string {
160
160
  if (process.env.AGENT_BINARY_PATH) {
161
161
  return process.env.AGENT_BINARY_PATH;
162
162
  }
163
- // Otherwise use npm package or downloaded binary
164
- return getActualBinaryPath(BIN_DIR) || getBinaryPath(BIN_DIR);
163
+ // Otherwise use downloaded or npm binary (getActualBinaryPath checks both)
164
+ const actualPath = getActualBinaryPath(BIN_DIR);
165
+ if (actualPath) {
166
+ return actualPath;
167
+ }
168
+ // No binary found - return expected path for error messages
169
+ return getBinaryPath(BIN_DIR);
165
170
  }
166
171
 
167
172
  // Export for legacy compatibility
@@ -290,7 +290,28 @@ function ThreadsTab({ agent }: { agent: Agent }) {
290
290
  : "bg-[#1a1a1a] text-[#e0e0e0]"
291
291
  }`}
292
292
  >
293
- <p className="text-sm whitespace-pre-wrap">{msg.content}</p>
293
+ <div className="text-sm whitespace-pre-wrap">
294
+ {typeof msg.content === "string"
295
+ ? msg.content
296
+ : Array.isArray(msg.content)
297
+ ? msg.content.map((block: any, j: number) => (
298
+ <div key={j}>
299
+ {block.type === "text" && block.text}
300
+ {block.type === "tool_use" && (
301
+ <div className="bg-[#222] p-2 rounded mt-1 text-xs text-[#888]">
302
+ 🔧 Tool: {block.name}
303
+ </div>
304
+ )}
305
+ {block.type === "tool_result" && (
306
+ <div className="bg-[#222] p-2 rounded mt-1 text-xs text-[#888]">
307
+ 📋 Result: {typeof block.content === "string" ? block.content.slice(0, 200) : "..."}
308
+ </div>
309
+ )}
310
+ </div>
311
+ ))
312
+ : JSON.stringify(msg.content)
313
+ }
314
+ </div>
294
315
  <p className="text-xs text-[#666] mt-1">
295
316
  {new Date(msg.created_at).toLocaleTimeString()}
296
317
  </p>