I\'m your SnapKitty Copilot. I\'ll guide you through the system.
' +
'
' +
'' +
'' +
'' +
'' +
'' +
'
' +
'
COPILOT MODE: LOCAL GUIDE · VOICE: BROWSER SPEECH API · AI: SIMULATED
';
VoiceNarrator.speak('Welcome to Apple II Universal Machine, a GitHub-native universal terminal by SnapKitty Agents. This project lets you create agents, design digital twins, run simulated VM labs, transform messy data into verifiable substrates, and seal everything inside Woz Vault. Every command is audited. Every action can be exported. One cockpit. Many agents. No token tax.');
},
startTour: function() {
TourSteps.reset();
this.showStep(0);
},
showStep: function(idx) {
var step = TourSteps.getStep(idx);
if (!step) { this.showComplete(); return; }
this.currentStep = idx;
var body = document.getElementById('copilot-body');
if (!body) return;
body.innerHTML =
'
You\'re ready to explore on your own. Type any command or click buttons below.
' +
'
' +
'' +
'' +
'
';
VoiceNarrator.speak('Tour complete. You are ready to explore on your own. One cockpit. Many agents. No token tax.');
},
renderChecklist: function() {
var el = document.getElementById('copilot-checklist');
if (!el) return;
var steps = TourSteps.getAll();
var html = '
PROGRESS
';
steps.forEach(function(s, i) {
var done = TourSteps.isCompleted(i);
html += '
' + (done ? '✓' : '○') + ' ' + s.label + '
';
});
el.innerHTML = html;
},
createFirstAgent: function() {
var input = document.getElementById('cmd-input');
if (input) { input.value = 'SpawnAgent "MyFirstAgent"'; input.focus(); }
VoiceNarrator.speak('I\'ll create your first agent. The command is SpawnAgent MyFirstAgent.');
},
tryVMLab: function() {
var input = document.getElementById('cmd-input');
if (input) { input.value = 'VMTrace boot_agent'; input.focus(); }
VoiceNarrator.speak('Let\'s try the VM Lab. I\'ll run a full trace of the boot agent through all five layers.');
},
connectOllama: function() {
var input = document.getElementById('cmd-input');
if (input) { input.value = 'ConnectOllama'; input.focus(); }
VoiceNarrator.speak('Let\'s check if Ollama is running on your machine.');
},
openDashboard: function() {
TwinDashboard.show();
},
replayCurrent: function() {
var step = TourSteps.getStep(this.currentStep);
if (step) VoiceNarrator.speak(step.narration);
},
updateVoiceButton: function() {
var btn = document.getElementById('copilot-voice-toggle');
if (btn) btn.textContent = VoiceNarrator.enabled ? 'VOICE: ON' : 'VOICE: OFF';
var mute = document.getElementById('copilot-mute');
if (mute) mute.textContent = VoiceNarrator.muted ? 'UNMUTE' : 'MUTE';
},
suggestCommand: function(input) {
var commands = ['help','boot','status','trust','agents','vault','seal','debate','export','about','clear',
'adastatus','contracts','lisphelp','lispeval','fontanareact','asmstatus','registers','opcodes',
'reverseunicode','glyphseal','restoreunicode','prologask','macroexpand','bytecoderun','brainfuckrun',
'machineview','vmtrace','fontanadecode','lispexpand','lisptovm','spawnagent','listagents','runagent',
'inspectagent','deleteagent','createtwin','designtwin','listtwins','runtwin','inspecttwin','deletetwin',
'listmodes','switchmode','currentmode','ollamastatus','listmodels','connectollama','vacuumhelp',
'vacuumingest','extractmeaning','tolisp','compileenvelope','verifyenvelope','runenvelope','exportenvelope',
'screenshotterminal','exportproof','staplerepo','verifystaple','coldboot','staplestatus',
'capsulehelp','createcapsule','designcapsule','listcapsules','inspectcapsule','runcapsule',
'verifycapsule','staplecapsule','exportcapsule','generateagentcard','generatemodelcard','listarchitectures',
'githubhelp','githublogin','githublogout','githubstatus','createinvertedrepo','createrepofromtemplate',
'stapleremoterepo','verifyremoterepo','tour','copilot','missioncontrol','nextstep','replaynarration','mutevoice',
'createtwinfromwizard','twinhelp','twindashboard'];
var lower = input.toLowerCase().replace(/;$/,'');
var matches = commands.filter(function(c) {
return c.indexOf(lower) >= 0 || levenshtein(c, lower) <= 2;
}).slice(0, 3);
if (matches.length > 0) {
return 'Did you mean: ' + matches.map(function(m) { return m + ';'; }).join(' ') + '?';
}
return null;
},
toggleMinimize: function() {
var body = document.getElementById('copilot-body');
var controls = document.getElementById('copilot-controls');
if (body) body.style.display = body.style.display === 'none' ? 'block' : 'none';
if (controls) controls.style.display = controls.style.display === 'none' ? 'flex' : 'none';
},
close: function() {
if (this.panel) this.panel.style.display = 'none';
this.active = false;
VoiceNarrator.stop();
},
show: function() {
if (this.panel) this.panel.style.display = 'flex';
else this.init();
this.active = true;
}
};
function levenshtein(a, b) {
var m = a.length, n = b.length;
var dp = [];
for (var i = 0; i <= m; i++) { dp[i] = [i]; }
for (var j = 0; j <= n; j++) { dp[0][j] = j; }
for (var i = 1; i <= m; i++) {
for (var j = 1; j <= n; j++) {
dp[i][j] = a[i-1] === b[j-1] ? dp[i-1][j-1] :
Math.min(dp[i-1][j] + 1, dp[i][j-1] + 1, dp[i-1][j-1] + 1);
}
}
return dp[m][n];
}