apteva 0.2.9 → 0.2.11
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.m4hg4bxq.js → App.44ge5b89.js} +59 -59
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/binary.ts +43 -41
- package/src/server.ts +7 -2
- package/src/web/components/agents/AgentPanel.tsx +22 -1
package/dist/index.html
CHANGED
package/package.json
CHANGED
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 (
|
|
99
|
+
// Check if binary exists (downloaded or npm)
|
|
100
100
|
export function binaryExists(binDir: string): boolean {
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
if (npmBinary) return true;
|
|
101
|
+
// Check downloaded binary first
|
|
102
|
+
if (existsSync(getBinaryPath(binDir))) return true;
|
|
104
103
|
|
|
105
|
-
// Then check
|
|
106
|
-
|
|
104
|
+
// Then check npm package
|
|
105
|
+
const npmBinary = findNpmBinary();
|
|
106
|
+
return !!npmBinary;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
// Get the actual binary path (
|
|
109
|
+
// Get the actual binary path (downloaded takes priority over npm)
|
|
110
110
|
export function getActualBinaryPath(binDir: string): string | null {
|
|
111
|
-
// First check
|
|
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
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
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:
|
|
218
|
+
path: downloadedPath,
|
|
219
219
|
filename: getBinaryFilename(),
|
|
220
220
|
downloadUrl: getDownloadUrl(),
|
|
221
221
|
platform,
|
|
222
222
|
arch,
|
|
223
|
-
source: "
|
|
223
|
+
source: "download",
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
//
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
227
|
+
// Fall back to npm package
|
|
228
|
+
const npmBinary = findNpmBinary();
|
|
229
|
+
if (npmBinary) {
|
|
230
230
|
return {
|
|
231
231
|
exists: true,
|
|
232
|
-
path:
|
|
232
|
+
path: npmBinary,
|
|
233
233
|
filename: getBinaryFilename(),
|
|
234
234
|
downloadUrl: getDownloadUrl(),
|
|
235
235
|
platform,
|
|
236
236
|
arch,
|
|
237
|
-
source: "
|
|
237
|
+
source: "npm",
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -489,7 +489,7 @@ export async function downloadLatestBinary(binDir: string): Promise<{
|
|
|
489
489
|
};
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
// Install via npm (
|
|
492
|
+
// Install/update via npm (locally in project)
|
|
493
493
|
export async function installViaNpm(): Promise<{
|
|
494
494
|
success: boolean;
|
|
495
495
|
version?: string;
|
|
@@ -497,12 +497,14 @@ export async function installViaNpm(): Promise<{
|
|
|
497
497
|
}> {
|
|
498
498
|
const packageName = getNpmPackageName();
|
|
499
499
|
|
|
500
|
-
console.log(`${c.gray}
|
|
500
|
+
console.log(`${c.gray}Updating ${packageName}...${c.reset}`);
|
|
501
501
|
|
|
502
502
|
try {
|
|
503
|
-
|
|
503
|
+
// Install locally (not globally) - updates the package in node_modules
|
|
504
|
+
const proc = Bun.spawn(["npm", "update", packageName], {
|
|
504
505
|
stdout: "pipe",
|
|
505
506
|
stderr: "pipe",
|
|
507
|
+
cwd: join(import.meta.dir, ".."), // Run in package root
|
|
506
508
|
});
|
|
507
509
|
|
|
508
510
|
const exitCode = await proc.exited;
|
|
@@ -511,7 +513,7 @@ export async function installViaNpm(): Promise<{
|
|
|
511
513
|
const stderr = await new Response(proc.stderr).text();
|
|
512
514
|
return {
|
|
513
515
|
success: false,
|
|
514
|
-
error: stderr || `npm
|
|
516
|
+
error: stderr || `npm update failed with code ${exitCode}`,
|
|
515
517
|
};
|
|
516
518
|
}
|
|
517
519
|
|
|
@@ -519,7 +521,7 @@ export async function installViaNpm(): Promise<{
|
|
|
519
521
|
if (version) {
|
|
520
522
|
saveVersion(version);
|
|
521
523
|
}
|
|
522
|
-
console.log(`${c.green}
|
|
524
|
+
console.log(`${c.green}Updated agent to v${version || "latest"}${c.reset}`);
|
|
523
525
|
|
|
524
526
|
return {
|
|
525
527
|
success: true,
|
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
|
|
164
|
-
|
|
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
|
-
<
|
|
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>
|