-
Input schema
-
{JSON.stringify(selectedSkill?.input_schema || {}, null, 2)}
+
+
+
+
+
+
+ Required fields: vendor, unit_price, quantity, delivery_days, warranty_months. The fixture recommends Beta Industrial.
+
+
+
+
+ Browser bridge limit: {Math.round(maxUploadBytes / 1024)}KB per file, 4 files.
-
-
Result
-
{error || JSON.stringify(result, null, 2) || "No run yet."}
+
+ {needsSignIn ?
Sign in with your A2A Cloud session to run tools and persist results.
: null}
+ {notice ?
{notice}
: null}
+ {error ?
{error}
: null}
+
+
+
+
+
+
Persistence
+
Saved comparisons
+
+
+ {history.length ? (
+
+ {history.map((item) => (
+ -
+
+
+ ))}
+
+ ) : (
+ No saved comparisons loaded yet. Run the fixture or refresh after signing in.
+ )}
+
+
);
}
+
+function ResultPanel({ result }) {
+ if (!result) {
+ return
Results will appear here after a comparison or reload call.
;
+ }
+ if (!result.ok) {
+ return (
+
+ Validation
+ {result.code}
+ {result.message}
+ {JSON.stringify(result.validation_errors || [], null, 2)}
+
+ );
+ }
+ return (
+
+
+
Recommendation
+
{result.recommendation.vendor}
+
{result.recommendation.reason}
+ {result.receipt?.persisted ?
Receipt persisted: {result.receipt.receipt_id} : null}
+
+
+
+
+
+ | Vendor | Total | Unit | Delivery | Warranty | Score |
+
+
+
+ {(result.comparison_table || []).map((row) => (
+
+ | {row.vendor} |
+ {formatCurrency(row.total_price)} |
+ {formatCurrency(row.unit_price)} |
+ {row.delivery_days} days |
+ {row.warranty_months} months |
+ {row.scores.weighted_total} |
+
+ ))}
+
+
+
+
+ );
+}
+
+async function fileToBrowserDocument(file) {
+ if (file.size > maxUploadBytes) throw new Error(`${file.name} is larger than ${Math.round(maxUploadBytes / 1024)}KB.`);
+ const mediaType = file.type || guessMediaType(file.name);
+ if (!acceptedTypes.includes(mediaType)) throw new Error(`${file.name} must be JSON, CSV, or plain text.`);
+ const dataUrl = await new Promise((resolve, reject) => {
+ const reader = new FileReader();
+ reader.onload = () => resolve(String(reader.result));
+ reader.onerror = () => reject(new Error(`Could not read ${file.name}`));
+ reader.readAsDataURL(file);
+ });
+ return { filename: file.name, media_type: mediaType, data_base64: dataUrl.split(",")[1] || "" };
+}
+
+function guessMediaType(filename) {
+ const lower = filename.toLowerCase();
+ if (lower.endsWith(".json")) return "application/json";
+ if (lower.endsWith(".csv")) return "text/csv";
+ return "text/plain";
+}
+
+function formatCurrency(value) {
+ return new Intl.NumberFormat(undefined, { style: "currency", currency: "BRL" }).format(Number(value || 0));
+}