바이브 코딩 활동 기록기 설치 안내
디지털 교육 · 데스크톱 Chrome 또는 Edge에서, Google 계정에 로그인한 상태로 진행하세요.
단계별 화면
Google 문서와 Google AI Studio 탭에서 각각 똑같이 진행합니다.
콘솔 코드
(function browserRecorder() {
"use strict";
if (window !== window.top) {
alert("Console 실행 대상을 top으로 선택하세요.");
return;
}
const docs = location.hostname === "docs.google.com";
if (!docs && location.hostname !== "aistudio.google.com") {
alert("Google 문서 또는 AI Studio에서 실행하세요.");
return;
}
if (!window.showOpenFilePicker) {
alert("데스크톱 Chrome·Edge에서 실행하세요.");
return;
}
if (window.researchRecorder) {
window.researchRecorder.show();
return;
}
const cols = [
"run_id", "tab_name", "time_utc", "epoch_ms",
"elapsed_ms", "event", "url", "visibility",
"focused", "active", "details_json"
];
const header = "\uFEFF" + cols.join(",") + "\r\n";
const run = crypto.randomUUID();
const start = performance.now();
const service = docs ? "GoogleDocs" : "AIStudio";
const filename =
service + "_" +
new Date().toISOString().replace(/[:.]/g, "-") + "_" +
run.slice(0, 6) + ".csv";
const rows = [];
const pending = [];
const off = [];
const typingFlushers = new Set();
const seen = new WeakSet();
const before = new WeakMap();
let handle;
let chain = Promise.resolve();
let saved = 0;
let live = true;
let selecting = false;
let suspended = false;
let error = "";
let note = "";
let lastURL = location.href;
let lastMouse = 0;
let lastWheel = 0;
const box = document.createElement("div");
box.id = "__study_recorder__";
Object.assign(box.style, {
position: "fixed",
right: "12px",
bottom: "12px",
zIndex: "2147483647",
background: "#17243b",
color: "white",
padding: "12px",
borderRadius: "9px",
font: "13px/1.7 sans-serif",
maxWidth: "390px"
});
const label = document.createElement("div");
const detail = document.createElement("div");
box.append(label, detail);
const mini = document.createElement("button");
mini.textContent = "기록기";
Object.assign(mini.style, {
position: "fixed",
right: "12px",
bottom: "12px",
zIndex: "2147483647",
padding: "9px",
display: "none"
});
function show() {
box.style.display = "block";
mini.style.display = "none";
}
mini.onclick = show;
function button(text, fn) {
const b = document.createElement("button");
b.textContent = text;
b.style.cssText =
"margin:8px 5px 0 0;padding:6px;cursor:pointer";
b.onclick = fn;
box.append(b);
return b;
}
function ui() {
label.textContent = error
? "저장 오류: " + error
: (live ? "기록 중" : "기록 종료") +
" · 저장 " + saved + "건 · 대기 " + pending.length + "건";
detail.textContent =
note || (handle ? handle.name : "다운로드한 빈 CSV를 선택하세요.");
pick.disabled = selecting || Boolean(handle);
mini.textContent = "기록기 · " + rows.length + "건";
}
function cell(v) {
let s = String(v ?? "");
if (/^[=+@\-\t\r]/.test(s)) s = "'" + s;
return '"' + s.replaceAll('"', '""') + '"';
}
function line(e) {
return cols.map(k => cell(e[k])).join(",") + "\r\n";
}
function backup() {
try {
localStorage.setItem(
"__study_recorder__:" + run,
JSON.stringify({ filename, rows, saved })
);
} catch {
note = "로컬 백업 사용 불가";
}
}
function download(name, text) {
const u = URL.createObjectURL(
new Blob([text], { type: "text/csv;charset=utf-8" })
);
const a = document.createElement("a");
a.href = u;
a.download = name;
document.documentElement.append(a);
a.click();
a.remove();
setTimeout(() => URL.revokeObjectURL(u), 10000);
}
function write() {
chain = chain.then(async () => {
if (!handle || !pending.length) return;
const n = pending.length;
const text = pending.slice(0, n).join("");
let w;
try {
const f = await handle.getFile();
w = await handle.createWritable({ keepExistingData: true });
await w.seek(f.size);
await w.write(text);
await w.close();
pending.splice(0, n);
saved += n;
error = "";
backup();
} catch (e) {
try {
if (w) await w.abort();
} catch {}
error = e.message || String(e);
}
ui();
});
return chain;
}
function log(event, data = {}, focus) {
if (!live) return;
const focused = focus ?? document.hasFocus();
const e = {
run_id: run,
tab_name: service,
time_utc: new Date().toISOString(),
epoch_ms: Date.now(),
elapsed_ms: (performance.now() - start).toFixed(3),
event,
url: location.href,
visibility: document.visibilityState,
focused,
active:
!suspended &&
event !== "stop" &&
document.visibilityState === "visible" &&
focused,
details_json: JSON.stringify(data)
};
rows.push(e);
pending.push(line(e));
if (event !== "mousemove") backup();
ui();
if (handle) void write();
}
function on(t, n, f, o = false) {
t.addEventListener(n, f, o);
off.push(() => t.removeEventListener(n, f, o));
}
function flushTyping() {
typingFlushers.forEach(f => f());
}
async function select() {
if (handle || selecting) return;
selecting = true;
error = "";
ui();
try {
const [h] = await showOpenFilePicker({
multiple: false,
types: [{
description: "다운로드한 빈 CSV",
accept: { "text/csv": [".csv"] }
}]
});
const f = await h.getFile();
if (!/\.csv$/i.test(f.name) || f.size > 4096) {
throw Error("새로 다운로드한 빈 CSV를 선택하세요.");
}
const text = (await f.text())
.replace(/^\uFEFF/, "")
.trim();
if (text && text !== cols.join(",")) {
throw Error("이미 기록이 있거나 다른 형식의 CSV입니다.");
}
const w = await h.createWritable();
await w.write(header);
await w.close();
handle = h;
flushTyping();
log("file_connected");
await write();
} catch (e) {
if (e.name !== "AbortError") {
error = e.message || String(e);
}
} finally {
selecting = false;
ui();
}
}
async function save() {
flushTyping();
backup();
if (handle) {
await write();
if (!error) note = "현재까지 저장 완료";
} else {
download(
filename.replace(".csv", "_records.csv"),
header + rows.map(line).join("")
);
note = "현재 기록 CSV 다운로드 요청됨";
}
ui();
}
const pick = button("다운로드한 파일 선택", select);
button("저장", save);
button("최소화", () => {
box.style.display = "none";
mini.style.display = "block";
});
document.documentElement.append(box, mini);
function element(e) {
return (e.composedPath?.() || [])
.find(x => x?.nodeType === 1) ||
(e.target?.nodeType === 1 ? e.target : null);
}
function scope(el, d) {
if (
!el ||
el === mini ||
el.closest(
"#__study_recorder__,input[type=password]," +
"[autocomplete=current-password]," +
"[autocomplete=new-password]," +
"[autocomplete=one-time-code]"
)
) return null;
const edit = el.closest(
"textarea,input,[contenteditable=true],[role=textbox]"
);
if (docs) {
let frame = false;
try {
frame = Boolean(
d.defaultView.frameElement?.matches(
".docs-texteventtarget-iframe"
)
);
} catch {}
const area = el.closest(
".kix-appview-editor,.kix-page,.kix-canvas-tile-content," +
".kix-lineview,.kix-paragraphrenderer"
);
return frame
? (edit || el)
: area
? (edit || area)
: null;
}
if (
!edit ||
edit.tagName === "INPUT" ||
edit.closest(".monaco-editor,.cm-editor,.CodeMirror")
) return null;
const text = [
"aria-label", "placeholder", "data-placeholder"
].map(k => edit.getAttribute(k) || "").join(" ");
return /search|검색|filter|필터|rename|이름 변경/i.test(text)
? null
: edit;
}
function info(el, d) {
if (!el) return {};
const r = el.getBoundingClientRect();
let frame = "top";
try {
const f = d.defaultView.frameElement;
if (f) frame = f.tagName + " " + f.id + " " + f.className;
} catch {}
return {
tag: el.tagName,
id: el.id || "",
role: el.getAttribute("role") || "",
frame,
x: Math.round(r.x),
y: Math.round(r.y),
width: Math.round(r.width),
height: Math.round(r.height),
coordinate_space: "frame_viewport_css_pixels"
};
}
function value(el) {
return typeof el.value === "string"
? el.value
: el.isContentEditable
? (el.textContent || "")
: null;
}
function selected(el) {
try {
return typeof el.selectionStart === "number"
? { start: el.selectionStart, end: el.selectionEnd }
: null;
} catch {
return null;
}
}
function text(s) {
return typeof s === "string"
? {
text: s.slice(0, 20000),
length: s.length,
truncated: s.length > 20000
}
: null;
}
function diff(a, b) {
let p = 0;
let x = a.length;
let y = b.length;
while (p < x && p < y && a[p] === b[p]) p++;
while (x > p && y > p && a[x - 1] === b[y - 1]) {
x--;
y--;
}
return {
offset_utf16: p,
inserted: text(b.slice(p, y)),
removed: text(a.slice(p, x))
};
}
function attach(d) {
if (!d || seen.has(d)) return;
seen.add(d);
const batches = new Map();
function target(e) {
return scope(element(e), d);
}
function common(el) {
return {
element: info(el, d),
selection: selected(el),
scope: docs
? "docs_editor_candidate"
: "ai_prompt_candidate"
};
}
function finish(el) {
const b = batches.get(el);
if (!b) return;
clearTimeout(b.timer);
batches.delete(el);
log("typing_batch", {
...common(el),
started_at: b.start,
ended_at: b.end,
input_event_count: b.changes.length,
changes: b.changes
});
}
function all() {
[...batches.keys()].forEach(finish);
}
typingFlushers.add(all);
on(d, "beforeinput", e => {
const el = target(e);
if (!el) return;
const v = value(el);
if (v !== null) before.set(el, v);
}, true);
on(d, "input", e => {
const el = target(e);
if (!el) return;
const a = before.get(el);
const b = value(el);
let batch = batches.get(el);
if (!batch) {
batch = {
start: new Date().toISOString(),
changes: []
};
batches.set(el, batch);
}
batch.end = new Date().toISOString();
batch.changes.push({
time_utc: batch.end,
input_type: e.inputType || "",
data: text(e.data),
composing: Boolean(e.isComposing),
change:
typeof a === "string" && typeof b === "string"
? diff(a, b)
: null
});
if (b !== null) before.set(el, b);
clearTimeout(batch.timer);
batch.timer = setTimeout(
() => finish(el),
e.isComposing ? 3000 : 1000
);
}, true);
on(d, "compositionend", e => {
const el = target(e);
const b = el && batches.get(el);
if (b) {
clearTimeout(b.timer);
b.timer = setTimeout(() => finish(el), 1000);
}
}, true);
on(d, "focusout", all, true);
for (const name of ["copy", "cut", "paste"]) {
on(d, name, e => {
const el = target(e);
if (!el) return;
all();
let s = null;
let source = "unavailable";
if (name === "paste") {
try {
if (
Array.from(e.clipboardData?.types || [])
.includes("text/plain")
) {
s = e.clipboardData.getData("text/plain");
source = "paste_event_clipboard_data";
}
} catch {}
} else {
try {
const v = value(el);
const sel = selected(el);
if (v !== null && sel) {
s = v.slice(sel.start, sel.end);
source = "input_selection_candidate";
} else {
const t = d.getSelection()?.toString();
if (t) {
s = t;
source = "dom_selection_candidate";
}
}
} catch {}
}
log(name, {
...common(el),
action: name,
text: text(s),
text_source: source
});
}, true);
}
for (const name of [
"mousedown", "mouseup", "click", "dblclick", "mousemove"
]) {
on(d, name, e => {
const el = target(e);
if (!el) return;
if (name === "mousemove") {
const t = performance.now();
if (t - lastMouse < 250) return;
lastMouse = t;
}
log(name, {
...common(el),
target: info(element(e), d),
client_x: e.clientX,
client_y: e.clientY,
page_x: e.pageX,
page_y: e.pageY,
button: e.button,
buttons: e.buttons
});
}, true);
}
on(d, "wheel", e => {
const el = target(e);
if (!el) return;
const t = performance.now();
if (t - lastWheel < 200) return;
lastWheel = t;
log("wheel", {
...common(el),
delta_x: e.deltaX,
delta_y: e.deltaY,
delta_mode: e.deltaMode
});
}, { capture: true, passive: true });
function frame(f) {
try {
if (f.contentDocument) attach(f.contentDocument);
} catch {}
}
on(d, "load", e => {
if (e.target?.tagName === "IFRAME") frame(e.target);
}, true);
d.querySelectorAll("iframe").forEach(frame);
}
function url() {
if (location.href !== lastURL) {
flushTyping();
lastURL = location.href;
log("url_change");
}
}
on(document, "visibilitychange", () => {
flushTyping();
url();
log("visibilitychange");
});
on(window, "focus", e => {
if (e.target === window) log("focus", {}, true);
});
on(window, "blur", e => {
if (e.target === window) {
flushTyping();
log("blur", {}, false);
}
});
on(window, "pagehide", () => {
flushTyping();
suspended = true;
log("pagehide");
});
on(window, "pageshow", () => {
suspended = false;
log("pageshow");
});
on(window, "popstate", url);
on(window, "hashchange", url);
if (window.navigation) {
on(window.navigation, "navigatesuccess", url);
}
on(window, "beforeunload", e => {
flushTyping();
if (pending.length) {
e.preventDefault();
e.returnValue = "";
}
});
const timer = setInterval(url, 1000);
async function stop() {
if (live) {
flushTyping();
log("stop");
live = false;
clearInterval(timer);
off.forEach(f => {
try {
f();
} catch {}
});
}
await write();
backup();
ui();
}
window.researchRecorder = Object.freeze({
show,
save,
stop,
status: () => ({
recording: live,
total: rows.length,
saved,
pending: pending.length,
file: handle?.name || null,
error: error || null
})
});
attach(document);
log("start");
download(filename, header);
ui();
console.info(
"기록 시작. 다운로드한 빈 CSV를 선택하고 DevTools를 닫으세요."
);
})();
기록되는 것 / 기록되지 않는 것
기록되는 것
- 시각, 탭 이름(Google 문서 / AI Studio), 페이지 주소
- 탭을 보고 있는지, 다른 창·탭으로 옮겼는지
- 문서 본문·프롬프트 입력창에 입력하거나 지운 글자
- 복사·잘라내기·붙여넣기한 텍스트
- 마우스 클릭·이동·스크롤 위치
기록되지 않는 것
- 비밀번호·인증 코드 입력란
- 다른 탭·다른 사이트의 활동
- Google 문서 본문 밖(메뉴·도구 모음), AI Studio의 검색창·코드 편집기
- 화면 캡처
기록은 내 컴퓨터의 CSV 파일(과 브라우저 백업)에만 저장되며 서버로 전송되지 않습니다. 제출은 직접 구글 폼으로 합니다.
문제가 생기면
- “Console 실행 대상을 top으로 선택하세요.” → Console 위쪽 드롭다운에서
top을 고르고 다시 실행 - 새로고침했거나 다른 페이지로 이동했다면 → 코드를 다시 실행하고 새 CSV 연결. 이전 CSV도 함께 제출
- 패널이 안 보이면 → 오른쪽 아래 ‘기록기’ 버튼을 누르기
Google 문서 탭 설정이 끝났으면 Google AI Studio 탭에서도 똑같이 진행합니다.
제출
Google 문서 CSV(GoogleDocs_….csv)와 AI Studio CSV(AIStudio_….csv)를 모두 첨부해 제출하세요. 파일이 더 있으면 함께 제출합니다.