agent-Specialization/website-design/v3-terminal/js/main.js
JOJO 39a7a5fc6f chore(website): 归档官网文档内容与设计素材
- website-content/:官网 10 篇文档内容 + README
- website-design/:官网设计稿、动画实验、预览图与资源
- 根目录官网截图两张
- .gitignore 忽略 website-design/exp/static/dist 构建产物(7.1MB)
2026-09-02 14:38:51 +08:00

70 lines
2.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* Astrion 官网 · 版本三交互 */
// ---- 复制命令 ----
document.querySelectorAll('[data-copy]').forEach((btn) => {
btn.addEventListener('click', async () => {
const text = btn.getAttribute('data-copy');
try { await navigator.clipboard.writeText(text); } catch {}
btn.classList.add('copied');
const old = btn.textContent;
btn.textContent = 'copied ✓';
setTimeout(() => { btn.classList.remove('copied'); btn.textContent = old; }, 1500);
});
});
// ---- 安装 tab ----
document.querySelectorAll('.it').forEach((tab) => {
tab.addEventListener('click', () => {
document.querySelectorAll('.it').forEach((t) => t.classList.remove('active'));
tab.classList.add('active');
const target = tab.getAttribute('data-tab');
document.getElementById('qsHost').classList.toggle('hidden', target !== 'host');
document.getElementById('qsDocker').classList.toggle('hidden', target !== 'docker');
});
});
// ---- 四组模式演示 ----
const modeState = { deploy: 'host', permission: 'approval', exec: 'sandbox', work: 'plan' };
const verdictText = () => {
const work = {
plan: 'AI 只制定计划并与你讨论,批准后自动转入执行',
ask: 'AI 先与你确认方案细节,再动手',
execute: 'AI 自行补全细节,直接开工'
}[modeState.work];
const perm = {
readonly: '只能读取与检索,一切写入被直接拒绝',
approval: '命令先在只读沙箱试跑,写入需你逐次点头',
auto: '写入由自动审批智能体替你把关,你可随时接管',
unrestricted: '工具不做拦截,直接执行'
}[modeState.permission];
const exec = modeState.exec === 'sandbox'
? '命令约束在 OS 沙箱内,读写边界由路径授权限定'
: '命令直接在宿主机执行,无沙箱兜底(高风险)';
const deploy = modeState.deploy === 'host'
? '数据存在本机 ~/.astrion命令跑在宿主机'
: '数据存在服务器,每个用户一个独立容器';
let extra = '';
if (modeState.work === 'plan') extra = ' ;; 注意:计划模式下权限与执行环境已锁定为只读+沙箱';
if (modeState.exec === 'direct' && modeState.permission === 'unrestricted') extra = ' ;; 警告:无限制+直连 = 裸奔';
return `$ astrion --explain\n=> ${deploy}${exec}${work}${perm}${extra}`;
};
const verdictEl = document.getElementById('modeVerdict');
const renderVerdict = () => { verdictEl.textContent = verdictText(); };
document.querySelectorAll('.mode-group').forEach((group) => {
const key = group.getAttribute('data-group');
group.querySelectorAll('.mg-opt').forEach((opt) => {
opt.addEventListener('click', () => {
group.querySelectorAll('.mg-opt').forEach((o) => o.classList.remove('active'));
opt.classList.add('active');
modeState[key] = opt.getAttribute('data-v');
renderVerdict();
});
});
});
renderVerdict();