gopherhole_openclaw_a2a 0.2.0 → 0.2.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/dist/index.js +1 -1
- package/index.ts +1 -1
- package/package.json +1 -1
- package/test-image.mjs +29 -0
- package/test-image2.mjs +37 -0
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ const plugin = {
|
|
|
81
81
|
'.svg': 'image/svg+xml',
|
|
82
82
|
};
|
|
83
83
|
const mimeType = mimeTypes[ext] || 'application/octet-stream';
|
|
84
|
-
parts.push({ kind: '
|
|
84
|
+
parts.push({ kind: 'data', data: base64Data, mimeType });
|
|
85
85
|
}
|
|
86
86
|
catch (imgErr) {
|
|
87
87
|
return { content: [{ type: 'text', text: JSON.stringify({ status: 'error', error: `Failed to read image: ${imgErr.message}` }) }] };
|
package/index.ts
CHANGED
|
@@ -102,7 +102,7 @@ const plugin = {
|
|
|
102
102
|
'.svg': 'image/svg+xml',
|
|
103
103
|
};
|
|
104
104
|
const mimeType = mimeTypes[ext] || 'application/octet-stream';
|
|
105
|
-
parts.push({ kind: '
|
|
105
|
+
parts.push({ kind: 'data', data: base64Data, mimeType });
|
|
106
106
|
} catch (imgErr) {
|
|
107
107
|
return { content: [{ type: 'text', text: JSON.stringify({ status: 'error', error: `Failed to read image: ${(imgErr as Error).message}` }) }] };
|
|
108
108
|
}
|
package/package.json
CHANGED
package/test-image.mjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GopherHole } from '@gopherhole/sdk';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
|
|
4
|
+
const gph = new GopherHole({
|
|
5
|
+
apiKey: 'gph_a3ed7c3f30e5415e9dc92b72c1c05b78',
|
|
6
|
+
hubUrl: 'wss://gopherhole.ai/ws',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
await gph.connect();
|
|
10
|
+
console.log('Connected, sending image...');
|
|
11
|
+
|
|
12
|
+
const imagePath = '/Users/brettwaterson/.marketclaw/images/1771822365256-A3kAAzoE.jpg';
|
|
13
|
+
const imageData = readFileSync(imagePath).toString('base64');
|
|
14
|
+
console.log('Image size:', imageData.length, 'chars');
|
|
15
|
+
|
|
16
|
+
const task = await gph.send('agent-70153299', {
|
|
17
|
+
role: 'agent',
|
|
18
|
+
parts: [
|
|
19
|
+
{ kind: 'text', text: 'What do you see in this image? Please describe it.' },
|
|
20
|
+
{ kind: 'data', mimeType: 'image/jpeg', data: imageData },
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
console.log('Task created:', task.id);
|
|
25
|
+
|
|
26
|
+
const completed = await gph.waitForTask(task.id, { maxWaitMs: 60000 });
|
|
27
|
+
console.log('Response:', completed.artifacts?.[0]?.parts?.[0]?.text || JSON.stringify(completed));
|
|
28
|
+
|
|
29
|
+
gph.disconnect();
|
package/test-image2.mjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { GopherHole } from '@gopherhole/sdk';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
|
|
4
|
+
const gph = new GopherHole({
|
|
5
|
+
apiKey: 'gph_a3ed7c3f30e5415e9dc92b72c1c05b78',
|
|
6
|
+
hubUrl: 'wss://gopherhole.ai/ws',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
await gph.connect();
|
|
10
|
+
console.log('Connected as:', gph.id);
|
|
11
|
+
|
|
12
|
+
const imagePath = '/Users/brettwaterson/.marketclaw/images/1771822365256-A3kAAzoE.jpg';
|
|
13
|
+
const imageData = readFileSync(imagePath).toString('base64');
|
|
14
|
+
console.log('Image size:', imageData.length, 'chars (base64)');
|
|
15
|
+
|
|
16
|
+
const payload = {
|
|
17
|
+
role: 'agent',
|
|
18
|
+
parts: [
|
|
19
|
+
{ kind: 'text', text: 'Describe this image please.' },
|
|
20
|
+
{ kind: 'data', mimeType: 'image/jpeg', data: imageData },
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
console.log('Sending payload with', payload.parts.length, 'parts');
|
|
25
|
+
console.log('Part 0:', { kind: payload.parts[0].kind, hasText: !!payload.parts[0].text });
|
|
26
|
+
console.log('Part 1:', { kind: payload.parts[1].kind, mimeType: payload.parts[1].mimeType, dataLen: payload.parts[1].data?.length });
|
|
27
|
+
|
|
28
|
+
const task = await gph.send('agent-70153299', payload);
|
|
29
|
+
console.log('Task:', task.id, 'Status:', task.status?.state);
|
|
30
|
+
|
|
31
|
+
const completed = await gph.waitForTask(task.id, { maxWaitMs: 60000 });
|
|
32
|
+
console.log('Final status:', completed.status?.state);
|
|
33
|
+
|
|
34
|
+
const response = completed.artifacts?.[0]?.parts?.[0]?.text;
|
|
35
|
+
console.log('Response:', response?.slice(0, 300) || 'No text in response');
|
|
36
|
+
|
|
37
|
+
gph.disconnect();
|