briefcase-wasm 2.0.8

WebAssembly bindings for Briefcase AI
Documentation
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Briefcase AI WASM Test</title>
    <style>
        body { font-family: Arial, sans-serif; margin: 20px; }
        .success { color: green; }
        .error { color: red; }
        .info { color: blue; }
        pre { background: #f5f5f5; padding: 10px; border-radius: 5px; }
    </style>
</head>
<body>
    <h1>Briefcase AI WASM Test</h1>
    <div id="output"></div>

    <script type="module">
        import init, {
            init as briefcaseInit,
            version,
            test_functionality,
            JsDecisionSnapshot,
            JsMemoryStorage
        } from './pkg/briefcase_wasm.js';

        function log(message, type = 'info') {
            const div = document.createElement('div');
            div.className = type;
            div.innerHTML = message;
            document.getElementById('output').appendChild(div);
        }

        async function runTests() {
            try {
                // Initialize WASM module
                await init();
                log('✅ WASM module loaded successfully!', 'success');

                // Initialize Briefcase AI
                briefcaseInit();
                log('✅ Briefcase AI initialized!', 'success');

                // Test version
                const ver = version();
                log(` Version: ${ver}`, 'success');

                // Test creating a decision
                let decision = new JsDecisionSnapshot('test_function');
                decision = decision.with_module('test_module');
                decision = decision.add_tag('env', 'browser_test');
                log('✅ Decision creation successful!', 'success');

                // Test storage
                let storage = new JsMemoryStorage();
                const decisionId = storage.save_decision(decision);
                log(` Storage successful! Decision ID: ${decisionId}`, 'success');

                const loaded = storage.load_decision(decisionId);
                log('✅ Load successful!', 'success');

                // Test functionality
                const result = test_functionality();
                log('✅ Test functionality successful!', 'success');
                log(`<pre>Test result: ${JSON.stringify(result, null, 2)}</pre>`, 'info');

                log('<h2 style="color: green;">🎉 All WASM tests passed!</h2>', 'success');

            } catch (error) {
                log(` Test failed: ${error.message}`, 'error');
                console.error(error);
            }
        }

        runTests();
    </script>
</body>
</html>