Forked from vadimfedenko/analyze-images
Forked from vadimfedenko/analyze-images
scripts / strata-analysis-live.cjs
// Smoke test using a generated solid-color fixture, never a user image.
const assert = require('node:assert/strict');
const { mkdtemp, writeFile } = require('node:fs/promises');
const { join } = require('node:path');
const { tmpdir } = require('node:os');
const sharp = require('sharp');
const { toolsProvider } = require('../dist/toolsProvider');
(async () => {
const root = await mkdtemp(join(tmpdir(), 'aia-strata-live-'));
const bytes = await sharp({ create: { width: 256, height: 256, channels: 3, background: { r: 255, g: 0, b: 0 } } }).png().toBuffer();
await writeFile(join(root, 'synthetic-red.png'), bytes);
await writeFile(join(root, 'synthetic-red.json'), JSON.stringify({ caption: 'Synthetic integration-test fixture' }));
const ctl = {
getWorkingDirectory: () => root,
getPluginConfig: () => ({ get: key => ({ analysisBackend: 'strata', strataModel: 'strata' })[key] }),
getGlobalPluginConfig: () => ({ get: key => ({ strataBaseUrl: 'http://127.0.0.1:8080/v1', strataApiKey: '' })[key] }),
client: { llm: { model() { throw new Error('The helper/local model must not be selected'); } } },
};
const analyze = (await toolsProvider(ctl))[2];
const result = await analyze.implementation({ imageName: 'synthetic-red.png', prompt: 'In one short sentence, state the color of this uniform test image.', context: '' }, {
status: text => console.log(text), warn: text => console.warn(text), signal: AbortSignal.timeout(90000), callId: 1,
});
assert.equal(typeof result.analysis, 'string');
assert.ok(result.analysis.trim().length > 0);
assert.equal(result.analysisDeferred, undefined);
assert.equal(result._aiaStrataAnalysis, undefined);
console.log(`PASS: real Strata returned completed analysis as the tool result (${result.analysis.length} characters); no helper inference or deferred result.`);
})().catch(error => { console.error(error.message); process.exitCode = 1; });
scripts / strata-analysis-live.cjs
// Smoke test using a generated solid-color fixture, never a user image.
const assert = require('node:assert/strict');
const { mkdtemp, writeFile } = require('node:fs/promises');
const { join } = require('node:path');
const { tmpdir } = require('node:os');
const sharp = require('sharp');
const { toolsProvider } = require('../dist/toolsProvider');
(async () => {
const root = await mkdtemp(join(tmpdir(), 'aia-strata-live-'));
const bytes = await sharp({ create: { width: 256, height: 256, channels: 3, background: { r: 255, g: 0, b: 0 } } }).png().toBuffer();
await writeFile(join(root, 'synthetic-red.png'), bytes);
await writeFile(join(root, 'synthetic-red.json'), JSON.stringify({ caption: 'Synthetic integration-test fixture' }));
const ctl = {
getWorkingDirectory: () => root,
getPluginConfig: () => ({ get: key => ({ analysisBackend: 'strata', strataModel: 'strata' })[key] }),
getGlobalPluginConfig: () => ({ get: key => ({ strataBaseUrl: 'http://127.0.0.1:8080/v1', strataApiKey: '' })[key] }),
client: { llm: { model() { throw new Error('The helper/local model must not be selected'); } } },
};
const analyze = (await toolsProvider(ctl))[2];
const result = await analyze.implementation({ imageName: 'synthetic-red.png', prompt: 'In one short sentence, state the color of this uniform test image.', context: '' }, {
status: text => console.log(text), warn: text => console.warn(text), signal: AbortSignal.timeout(90000), callId: 1,
});
assert.equal(typeof result.analysis, 'string');
assert.ok(result.analysis.trim().length > 0);
assert.equal(result.analysisDeferred, undefined);
assert.equal(result._aiaStrataAnalysis, undefined);
console.log(`PASS: real Strata returned completed analysis as the tool result (${result.analysis.length} characters); no helper inference or deferred result.`);
})().catch(error => { console.error(error.message); process.exitCode = 1; });