The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
// Rasterize the reviewed logo sources for Flutter and the native tab bar.
// --check validates the recorded source/output hashes without browser dependencies.
import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
import { readFile, writeFile, mkdir, copyFile } from 'node:fs/promises';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { resolve } from 'node:path';
import { tmpdir } from 'node:os';
import { execFileSync } from 'node:child_process';
assert.ok(process.argv.slice(2).every(arg => ['--check', '--appkit'].includes(arg) || arg.startsWith('--only=')), 'usage: harness_marks.mjs [--check | --appkit] [--only=id,id]');
const only = process.argv.find(arg => arg.startsWith('--only='))?.slice(7).split(',');
assert.ok(!only || (!process.argv.includes('--check') && only.every(id => /^[a-z0-9-]+$/.test(id))), '--only selects packages to render');
const root = fileURLToPath(new URL('../../', import.meta.url));
const sourceDir = resolve(root, 'store/branding');
const outputDir = resolve(root, 'desktop/assets/engine-icons');
const receiptPath = resolve(sourceDir, 'rendered.json');
const noticePath = resolve(outputDir, 'NOTICE.txt');
const marks = JSON.parse(await readFile(resolve(sourceDir, 'marks.json'), 'utf8'));
const sha = bytes => createHash('sha256').update(bytes).digest('hex');
const pngSize = bytes => {
assert.equal(bytes.subarray(0, 8).toString('hex'), '89504e470d0a1a0a', 'not a PNG');
return [bytes.readUInt32BE(16), bytes.readUInt32BE(20)];
};
const known = new Set();
for (const mark of marks) {
assert.match(mark.id, /^autonomous\/[a-z0-9-]+$/);
assert.match(mark.file, /^[a-z0-9-]+\.(svg|png)$/);
assert.equal(known.has(mark.id), false, 'duplicate icon id');
known.add(mark.id);
assert.match(mark.color, /^#[a-f0-9]{6}$/);
assert.match(mark.licenseFile, /^licenses\/[a-z0-9-]+\.txt$/);
assert.ok(['original', 'upstream'].includes(mark.kind));
assert.ok(mark.credit && mark.license);
if (mark.kind === 'upstream') assert.match(mark.source, /^https:\/\//);
}
const output = mark => resolve(outputDir, mark.id.split('/')[1] + '.png');
const sourceUrl = 'https://github.com/autonomous-ai/openharness/tree/main/store/branding';
const noticeParts = [
'OpenHarness: artwork notices for harness package marks',
'Generated by desktop/tool/harness_marks.mjs; do not edit directly.',
`Logo sources, provenance and modifications: ${sourceUrl}`,
'Original wrapper marks are MIT-licensed. Third-party artwork retains its own license.',
'Upstream SVGs are rasterized with their colors, shapes and aspect ratio preserved.\n'
+ 'The OpenSCAD PNG is copied unchanged. Project names and marks identify the tools;\n'
+ 'they do not imply sponsorship or endorsement. Habitat is an original wrapper mark,\n'
+ 'not the Home Assistant logo or a mark of the Open Home Foundation.',
];
for (const mark of marks) {
noticeParts.push([
mark.id,
mark.credit,
`License: ${mark.license}`,
`Source: ${mark.source ?? `${sourceUrl.replace('/tree/', '/blob/')}/${mark.file}`}`,
].join('\n'));
}
for (const file of new Set(marks.map(mark => mark.licenseFile))) {
noticeParts.push(`${file}\n\n${(await readFile(resolve(sourceDir, file), 'utf8')).trim()}`);
}
const notice = noticeParts.join('\n\n') + '\n';
if (process.argv.includes('--check')) {
const receipt = JSON.parse(await readFile(receiptPath, 'utf8'));
assert.equal(receipt.length, marks.length);
for (const mark of marks) {
const record = receipt.find(row => row.id === mark.id);
assert.ok(record, 'missing render receipt: ' + mark.id);
const source = await readFile(resolve(sourceDir, mark.file));
const png = await readFile(output(mark));
assert.equal(sha(source), record.sourceSha256, mark.id + ': source changed; regenerate');
assert.equal(sha(png), record.pngSha256, mark.id + ': PNG changed; regenerate');
assert.deepEqual(pngSize(png), [256, 256], mark.id + ': icon dimensions');
assert.ok(png.length < 100 * 1024, mark.id + ': icon too large');
}
assert.equal(await readFile(noticePath, 'utf8'), notice, 'artwork notices changed; regenerate');
console.log(`Verified ${marks.length} logo sources, 256 px bundled icons and artwork notices.`);
} else if (process.argv.includes('--appkit')) {
const selected = only ? marks.filter(mark => only.includes(mark.id.split('/')[1])) : marks;
assert.equal(selected.length, only?.length ?? marks.length, 'unknown --only package');
const receipt = only ? JSON.parse(await readFile(receiptPath, 'utf8')) : [];
await mkdir(outputDir, { recursive: true });
for (const mark of selected) {
const sourcePath = resolve(sourceDir, mark.file);
if (mark.file.endsWith('.png')) await copyFile(sourcePath, output(mark));
else execFileSync('swift', [
'-module-cache-path', resolve(tmpdir(), 'harness-svg-module-cache'),
resolve(root, 'desktop/tool/render_svg.swift'), sourcePath, output(mark),
], { stdio: 'inherit' });
const png = await readFile(output(mark));
assert.deepEqual(pngSize(png), [256, 256]);
assert.ok(png.length < 100 * 1024, mark.id + ': icon too large');
const record = { id: mark.id, sourceSha256: sha(await readFile(sourcePath)), pngSha256: sha(png), renderer: 'AppKit' };
const index = receipt.findIndex(row => row.id === mark.id);
if (index < 0) receipt.push(record); else receipt[index] = record;
console.log(mark.id + ': ' + png.length + ' bytes');
}
await writeFile(receiptPath, JSON.stringify(receipt, null, 2) + '\n');
await writeFile(noticePath, notice);
} else {
assert.ok(!only, '--only currently requires --appkit');
const { chromium } = await import(process.env.PLAYWRIGHT_MODULE
? pathToFileURL(resolve(process.env.PLAYWRIGHT_MODULE)).href : 'playwright');
const browser = await chromium.launch({ headless: true });
const receipt = [];
await mkdir(outputDir, { recursive: true });
try {
const page = await browser.newPage({ viewport: { width: 256, height: 256 }, deviceScaleFactor: 1 });
// SVG is decoded as an image, never inserted as executable markup.
await page.route('**/*', route => route.abort());
for (const mark of marks) {
const source = await readFile(resolve(sourceDir, mark.file));
if (mark.file.endsWith('.png')) {
assert.deepEqual(pngSize(source), [256, 256]);
await copyFile(resolve(sourceDir, mark.file), output(mark));
} else {
const svg = source.toString('utf8');
assert.match(svg, /<svg\b/);
assert.doesNotMatch(svg, /<(?:script|foreignObject)\b|\bon\w+\s*=|(?:href|url)\s*[=(]\s*["']?https?:/i);
await page.setContent('<style>html,body{margin:0;background:transparent}img{width:256px;height:256px;object-fit:contain;display:block}</style><img alt="" src="data:image/svg+xml;base64,' + source.toString('base64') + '">');
await page.locator('img').evaluate(image => image.decode());
await page.screenshot({ path: output(mark), omitBackground: true });
}
const png = await readFile(output(mark));
assert.deepEqual(pngSize(png), [256, 256]);
receipt.push({ id: mark.id, sourceSha256: sha(source), pngSha256: sha(png) });
console.log(mark.id + ': ' + png.length + ' bytes');
}
await writeFile(receiptPath, JSON.stringify(receipt, null, 2) + '\n');
await writeFile(noticePath, notice);
} finally { await browser.close(); }
}