diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ca7fec1..fe1e7416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ ### 바뀜 +- **브라우저 작업 중 기다릴 때 「이 페이지에서 저절로 진행되는 것이 있는가」를 묻는 판정이 페이지 글의 끝과 기다리는 말이 있는 줄까지 봅니다. 판정이 거절한 기다림은 작업마다 8번까지 동작 수에 포함하지 않습니다.** NotebookLM에서 슬라이드를 만드는 동안 가운데의 긴 요약 때문에 오른쪽 칸의 「슬라이드 자료 생성 중…」이 판정에 전달되지 않아, 기다리기 31번이 거절되고 동작 40번 한도에 걸려 멈췄습니다. NotebookLM 스킬에는 그 표시를 gone_text로 지정하고 5분쯤 기다리라고 적었습니다. 근거: 2026-12-03 사용자 「맨날하던 생성된 슬라이드 다운받아주는 버튼클릭이 40회 실패했다」(D-1203-02). 스펙 `openspec/specs/browser-handoff`, 설계 `docs/browser-handoff/design.md`, 시험 WB-U-01…03 · WB-I-01…05 · F-AB-12. 칸에 쓴 값은 판정에 보내지 않습니다. + - **프로젝트 계획의 「쓰는 도구」에 적힌 브라우저 스킬(예: NotebookLM)은 사람이 말한 사이트로 셉니다. 링크만 보내도 그 스킬의 작업은 내 계정으로 하고 계획의 사이트에 머뭅니다. 읽기만 하던 에이전트 작업을 「다시해봐」 · 「이어서 해」로 이어 가면 처음 말과 이번 말, 계획으로 사이트를 다시 정합니다.** 앞 카드의 빈 사이트 목록을 그대로 물려받지 않습니다. 회사 가드레일이 막아 읽기만 한 작업이 이어 가면서 내 계정을 쓰던 결함도 고쳤습니다. 동작 판정이 오지 않으면 두 번째는 앞단 모델에 묻고, 승인 카드는 누를 대상의 이름 첫 줄을 씁니다(드라이브 파일 행이 「… 미리보기」로 보이던 것). 근거: 2026-12-03 사용자 「승인된 프로젝트 계획에 노트북엘엠 사이트가 이미 있으므로 이것은 사용자가 언급한 사이트와 같지」(D-1203-01). 스펙 `openspec/specs/agent-browser`, ADR `openspec/adr/2026-12-03-plan-sites-and-carry-on.md`, 설계 `docs/agent-browser/design.md`, 카탈로그 §108(PS-U-01…08 · AB-I-33 · BQ-R-14i · F-AB-10 · 11). - **브라우저 작업에서 어느 호스트를 같은 서비스로 볼지는 브라우저 스킬이 정합니다. YouTube(스튜디오) · Google 드라이브 · Gemini 스킬을 더했습니다. 「유튜브에 올려줘」라고 하면 `studio.youtube.com`과 `youtube.com`이, 「드라이브에 넣어줘」라고 하면 `drive.google.com`과 `docs.google.com`이 사람이 말한 사이트가 되고, Gmail · 캘린더처럼 같은 회사의 다른 서비스는 포함되지 않습니다. 스킬이 없는 사이트는 사이트 읽기가 「그 일이 실제로 일어나는 호스트」를 답합니다** (스펙 `agent-browser` 「같은 서비스의 다른 호스트」 · 「같은 회사의 다른 서비스」, ADR `openspec/adr/2026-12-02-service-boundary-in-skills.md`, 설계 `docs/agent-browser/design.md`, 스킬 `skills/youtube-studio` · `skills/google-drive` · `skills/gemini`, 서버 `lib/agentBrowser.js` 사이트 읽기, 시험 `browserSkillHosts.test.js` SH-U-01…04 · F-AB-09 · 실제 모델 `site-reading.live.mjs`(바꾸기 전 11/11 · 바꾼 뒤 33/33), 카탈로그 §107, 영상 데모 https://youtu.be/ozIO602Y4Io · 구현 설명 https://youtu.be/AGO0YMyahp0, 2026-12-02 사용자 — 「여러 서비스이지만 다른 서비스로 보이는 것과 같은 서비스 내인 거는 어떻게 구분할까요? … 브라우저 스킬 안에 뭔가 그런 매핑 관계를 둘 거니?」 → 「그렇게 하고」): 등록 도메인(`*.google.com`)으로 묶으면 드라이브라고 말했을 때 Gmail까지 열립니다. 그래서 경계는 사람이 검토해 저장소에 둔 스킬의 데이터로 정하고, 시험으로 스킬끼리 호스트가 겹치지 않는지 확인합니다. 실제 모델은 바꾸기 전에도 업로드 호스트를 맞게 읽었습니다. 이번 변경으로 모델이 바뀌어도 그 경계가 그대로 유지되도록 데이터로 고정하고, 사이트별 요령을 함께 담습니다. 독립 검토 반영: 규칙이 있는 방에서 문서 · youtu.be 링크가 그 서비스 전체를 사람이 말한 사이트로 만들지 않게 했고, 여러 스킬의 호스트를 셋으로 줄이지 않으며, 다른 사람의 문서 · 설문이 열리는 `docs.google.com`에는 파일을 하나씩 묻고 올립니다. YouTube 업로드는 채널이 여럿이거나 아동용 여부를 말하지 않았으면 묻습니다. diff --git a/desktop/src/browser/pageScripts.js b/desktop/src/browser/pageScripts.js index cfc9e612..06195c01 100644 --- a/desktop/src/browser/pageScripts.js +++ b/desktop/src/browser/pageScripts.js @@ -37,7 +37,9 @@ const PAGE_WORDS_JS = () => { if (!b) return '' const fields = [...document.querySelectorAll('input:not([type=hidden]):not([type=password]):not([data-pro-secret]):not([autocomplete^="cc-"]):not([autocomplete="one-time-code"]),textarea:not([data-pro-secret]),select')].slice(0, 300) .map((e) => [e.tagName === 'SELECT' ? e.options[e.selectedIndex]?.text : e.value, e.placeholder, e.getAttribute('aria-label')].filter(Boolean).join(' ')) - return `${b.innerText}\n${fields.join('\n')}` + // (a fixed line of ours between the page's own text and the fields' words: the busy check reads only what comes before it — a value typed + // into a field never goes to the judge — lib/browser.js busyState, WORDS_FIELDS) + return `${b.innerText}\n\u2063pgl-fields\u2063\n${fields.join('\n')}` } const SNAPSHOT_JS = (opts) => { const { maxEls = 120, maxText = 3000, budgetMs = 1500, below = 1, base = 0 } = opts || {} diff --git a/docs/browser-handoff/design.md b/docs/browser-handoff/design.md new file mode 100644 index 00000000..10db4af5 --- /dev/null +++ b/docs/browser-handoff/design.md @@ -0,0 +1,39 @@ +# 브라우저 작업의 기다리기 — 설계 노트 + +스펙 `openspec/specs/browser-handoff` · 서버 `server/lib/browser.js`(`waitForPage` · `pageIsIdle` · `busyState`) · 스킬 `skills/notebooklm` + +이 노트에는 날짜별로 바뀐 내용을 적는다. + +## 2026-12-03 기다림 판정은 페이지 글의 끝과 기다리는 말이 있는 줄까지 본다 · 거절된 기다림은 동작 수에 포함하지 않는다 + +결정 기록 D-1203-02. + +### 무엇이 있었나 +사용자가 휴대폰 화면을 보내며 물었다. 「맨날하던 생성된 슬라이드 다운받아주는 버튼클릭이 40회 실패했다. 이것도 아까와 같은 문제인가?」 운영 작업 기록(2026-12-02 15:39~15:45 UTC, 「슬라이드 도 하나」 — 사람이 직접 시킨 작업이라 승인 카드와는 상관없음)을 보면 다음과 같았다. + +| 동작 | 기록 | +|---|---| +| 4~6 | 「슬라이드 자료」 → 「생성」 → 「슬라이드 자료」 — NotebookLM이 초안을 쓰기 시작(「청사진 초안 작성 중...」, 스튜디오 칸에 「슬라이드 자료 생성 중...」) | +| 9~40 중 31번 | `wait_for_page` → `refused: nothing on this page is working by itself (checked)` — 한 번에 2~3초(판정 한 번) | +| 그 사이 | 짧은 기다림(14~22초) 몇 번 — 0.5분보다 짧게 기다리면 판정을 묻지 않는다 | +| 40 | `need: limit` — 「동작 40번 안에 작업을 끝내지 못해 멈췄어요」. 그때도 슬라이드는 만들어지는 중 | + +판정은 벽 판정과 같은 상태(`wallState`)를 읽었다. 그 상태에는 화면 글의 앞 800자와 단추 30개만 들어간다. NotebookLM에서는 가운데 칸의 긴 소스 요약이 앞 800자를 다 채우고, 오른쪽 스튜디오 칸의 진행 표시는 글의 끝에 온다. 그래서 판정은 아무것도 진행되지 않는다고 판단했다. 거절된 기다림도 동작 하나로 셌다. + +### 바꾼 것 +- 기다림 판정이 읽는 상태(`busyState`)를 따로 만들었다. 보이는 글의 앞(800자)과 끝(1,200자), 그리고 페이지 전체에서 기다리는 말(until_text · gone_text)이 있는 줄(6줄까지, 줄마다 그 말 주변 240자)을 넣는다. 줄은 에이전트가 준 말 그대로 찾는다(구조). 그 줄이 진행 중임을 나타내는지는 판정이 판단한다. 벽 판정의 상태는 그대로 둔다. +- 판정이 거절한 기다림은 페이지에 아무 동작도 하지 않았으므로 작업의 동작 수에 포함하지 않는다. 작업마다 8번까지는 세지 않고, 그 뒤로는 다시 센다. 그래서 기다림만 되풀이하는 작업도 한도에 이르면 끝난다. +- NotebookLM 스킬에 다음과 같이 적었다: 만드는 중인 항목은 그 표시를 화면에 보이는 그대로 gone_text로 주고(끝의 점은 빼고 「슬라이드 자료 생성 중」), 5분쯤 기다린다. 짧게 여러 번 기다리지 않는다. + +### 시험 +- 단위 WB-U-01 · 02 — 판정이 읽는 상태(800자 뒤의 표시 줄, 화면 글이 잘려도 페이지 전체의 글에서 찾음, 긴 줄은 그 말 주변만) +- 통합(실제 Chromium, 시험용 스튜디오의 `/panels` — 가운데 2,090자 요약 + 오른쪽 칸 끝의 진행 표시) WB-I-01 · 02 — gone_text · until_text로 기다리다가 표시가 사라지면 끝남. 판정 대역은 상태에 그 표시 줄이 있을 때만 「하는 중」이라고 답한다. 고치기 전 코드에서는 두 기다림이 모두 거절되었다 +- WB-I-03 · 04 — 거절된 기다림은 8번까지 동작 수에 포함하지 않고, 넘으면 다시 세어 한도에 이르면 멈춤 + +### 독립 검토 반영(같은 날) +진행을 막는 문제는 없었고, 중간 수준의 문제 둘을 고쳤다. 첫째, 기다리는 말이 있는 줄을 찾던 「페이지의 말」에는 칸의 값도 들어 있었다. 사람이 직접 입력한 카드 번호가 판정에 전달될 수 있었다(칸의 값은 판정에 보내지 않는다는 규칙이 있다). 페이지 글을 만드는 스크립트가 페이지 글과 칸의 줄 사이에 구분 줄(`WORDS_FIELDS`)을 넣고, 판정은 그 앞만 읽는다. 데스크톱 앱의 같은 스크립트도 바꿨다. 다음 데스크톱 배포 전까지 PC에서는 그 줄이 없으므로 스냅숏의 글만 읽는다. 둘째, 「글의 끝」이 스냅숏(3,000자에서 멈춤)의 끝이라 그보다 긴 페이지에서는 until_text로 기다릴 때 여전히 표시를 보지 못했다. 이제 끝은 페이지 전체 글의 끝이다. 낮음: 기다리는 말이 있는 줄이 6개를 넘으면 처음 셋과 마지막 셋을 남긴다. 「하는 중」의 판단 범위는 「에이전트가 기다리는 그것이 진행 중」으로 좁혔다. 한도 문구와 작업 기록에서는 세지 않은 기다림을 빼고 센다(작업 기록 `act` 행의 `free`, 끝 행의 `waits_free` · `waits_refused` · `waits_reworded`). 시험 WB-U-03(칸의 값) · WB-I-05(3,000자 넘는 페이지)를 더했고, F-AB-12는 기다림의 시계가 돌 때만 통과한다. + +### 남은 것 +- 실제 모델(회사 게이트웨이의 빠른 모델)로 고치기 전 · 후의 판정 확률은 측정하지 못했다(시험 환경의 키). 운영 배포 뒤 같은 일을 시켜 작업 기록의 `wall_checks`(`wait:idle`)로 확인한다. +- 바뀌지 않는 글(예: 단추 이름)을 gone_text로 주면 그 줄이 「지금 페이지에 있는 말」로 판정에 전달된다. 판정이 그것을 진행 표시로 읽으면 그 기다림은 정한 시간만큼 이어진다(한 번 30분 · 작업 60분 한도는 그대로). +- 거절된 기다림을 세지 않는 동안 모델 호출은 늘어난다(작업마다 8번까지). diff --git a/e2e/README.md b/e2e/README.md index 3d6508cd..3f2b1689 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -550,9 +550,9 @@ ProcessGPT 포털의 설정 › 테마 설정 「휴대폰 화면」에서 「 | 단계 | 파일 | 시험 수 | |---|---|---| | smoke | `tests/smoke/*.spec.js` (6개) | 74 | -| feature | `tests/feature/*.spec.js` (111개) | 812 (프로젝트 계획의 도구 · 읽기만 하던 작업을 「다시해봐」로 이어 가기 F-AB-10 · 11 PC · 휴대폰, 같은 서비스의 범위 — 스킬의 두 호스트 F-AB-09 PC · 휴대폰, 사이트 읽기 결과가 오지 않을 때 앞단 모델 · 시작 전 카드 F-AB-08 PC 승인 · 휴대폰 취소, 메일 칩만 넣어도 첨부가 파일로 F-MA-11, 서버 브라우저 고르기 F-BW-01…05, 브라우저 에이전트 가드레일 F-GR-01…04, 산출물 더미의 계획 · 공유 메뉴 F-SPL-01…07의 10개, 브라우저 작업 카드의 「PC 화면을 받지 못하고 있어요」 F-LB-05, 방 규칙이 있는 방에 링크만 F-AB-07 PC · 휴대폰, 「이 영상」 서버 시험 F-UT-09, 실행 카드 「전체 화면」 · 오래된 PC 앱 안내 F-CA-14 · 15, 채팅의 프로세스 시작 F-CPM-01 · 02, 내 PC CLI 「멈추기」 F-LV-11, 작업 기록 F-RJ-01…07, 정식 프로세스 F-PO-24…36과 검토 반영 F-PO-25b · 26b · 28a · 30b 17개, 내 PC CLI 시작 대기 F-LA-01…05, 「프로세스」 화면 제목 F-NAV-04 포함 · 프로세스 지도 F-PO-01…23, 방 규칙 F-RR-01…04, 후행 습관 F-FU-01…10, 서버 단위 시험 4묶음, 회의 F-MT-01…08, 팀 맥락 공유 F-TC-01…10, 포털에서 넘어온 휴대폰 F-PT-01…03, 대화 속 그림 · 소리 · 영상 F-MP-01…08, … 에이전트가 호출하는 내장 브라우저 F-AB-01…06의 8개 포함) | +| feature | `tests/feature/*.spec.js` (111개) | 814 (기다림 판정이 여러 칸으로 된 페이지 끝의 진행 표시를 봄 F-AB-12 PC · 휴대폰, 프로젝트 계획의 도구 · 읽기만 하던 작업을 「다시해봐」로 이어 가기 F-AB-10 · 11 PC · 휴대폰, 같은 서비스의 범위 — 스킬의 두 호스트 F-AB-09 PC · 휴대폰, 사이트 읽기 결과가 오지 않을 때 앞단 모델 · 시작 전 카드 F-AB-08 PC 승인 · 휴대폰 취소, 메일 칩만 넣어도 첨부가 파일로 F-MA-11, 서버 브라우저 고르기 F-BW-01…05, 브라우저 에이전트 가드레일 F-GR-01…04, 산출물 더미의 계획 · 공유 메뉴 F-SPL-01…07의 10개, 브라우저 작업 카드의 「PC 화면을 받지 못하고 있어요」 F-LB-05, 방 규칙이 있는 방에 링크만 F-AB-07 PC · 휴대폰, 「이 영상」 서버 시험 F-UT-09, 실행 카드 「전체 화면」 · 오래된 PC 앱 안내 F-CA-14 · 15, 채팅의 프로세스 시작 F-CPM-01 · 02, 내 PC CLI 「멈추기」 F-LV-11, 작업 기록 F-RJ-01…07, 정식 프로세스 F-PO-24…36과 검토 반영 F-PO-25b · 26b · 28a · 30b 17개, 내 PC CLI 시작 대기 F-LA-01…05, 「프로세스」 화면 제목 F-NAV-04 포함 · 프로세스 지도 F-PO-01…23, 방 규칙 F-RR-01…04, 후행 습관 F-FU-01…10, 서버 단위 시험 4묶음, 회의 F-MT-01…08, 팀 맥락 공유 F-TC-01…10, 포털에서 넘어온 휴대폰 F-PT-01…03, 대화 속 그림 · 소리 · 영상 F-MP-01…08, … 에이전트가 호출하는 내장 브라우저 F-AB-01…06의 8개 포함) | | agent | `tests/agent/*.spec.js` (14개) | 33 (회의 A-14, 후행 습관 A-FU-01) | -| 합계 | | 919 (2026-11-28에 `npx playwright test --list`로 집계한 846에 2026-11-29 F-AB-06의 2개, F-PO-24…32 · 25b · 26b · 28a · 30b의 13개, F-LA-01…05의 5개, 2026-11-30 F-NAV-04의 1개 · F-PO-33 · 34 · 35의 3개, 2026-12-01 F-CA-13의 1개 · F-RS-05의 2개 · F-RS-06의 1개 · F-PO-36의 1개 · F-RJ-01…07의 7개 · F-LV-11의 1개 · F-CPM-01 · 02의 2개, 2026-12-02 F-CA-14 · 15의 2개 · F-AB-07의 2개 · F-UT-09의 1개 · F-LB-05의 1개 · F-SPL-01…07의 10개 · F-GR-01…04의 4개 · F-BW-01…05의 5개 · F-MA-11의 1개 · F-AB-08의 2개 · F-AB-09의 2개, 2026-12-03 F-AB-10의 2개 · F-AB-11의 2개를 더한 값 — 데스크톱 단계의 LB-04는 이 표에서 세지 않음) | +| 합계 | | 921 (2026-11-28에 `npx playwright test --list`로 집계한 846에 2026-11-29 F-AB-06의 2개, F-PO-24…32 · 25b · 26b · 28a · 30b의 13개, F-LA-01…05의 5개, 2026-11-30 F-NAV-04의 1개 · F-PO-33 · 34 · 35의 3개, 2026-12-01 F-CA-13의 1개 · F-RS-05의 2개 · F-RS-06의 1개 · F-PO-36의 1개 · F-RJ-01…07의 7개 · F-LV-11의 1개 · F-CPM-01 · 02의 2개, 2026-12-02 F-CA-14 · 15의 2개 · F-AB-07의 2개 · F-UT-09의 1개 · F-LB-05의 1개 · F-SPL-01…07의 10개 · F-GR-01…04의 4개 · F-BW-01…05의 5개 · F-MA-11의 1개 · F-AB-08의 2개 · F-AB-09의 2개, 2026-12-03 F-AB-10의 2개 · F-AB-11의 2개 · F-AB-12의 2개를 더한 값 — 데스크톱 단계의 LB-04는 이 표에서 세지 않음) | openspec 명세 13개의 요구사항 112개: 덮음 73 · 일부 20 · 공백 19. 명세 밖의 기능 요건(영상·최근 추가 기능: 대화 목록·산출물 스택·로봇 버튼·끊김 복구·유휴 타임아웃·DB 풀·멘션·예약·설치 번들 등) 31개: 덮음 27 · 일부 1 · 공백 3. @@ -3085,3 +3085,22 @@ cd e2e && ~/.claude/tools/lite/reclock.sh run plansites -- npx playwright test - | 계획을 적을 때 「사람:」은 그 사람의 말만(루틴이 적은 말 · 넘겨받은 말은 빼고) | 독립 검토 | PS-U-11 | 단위 | ✅ | | 운영에서 그 방의 「다시해봐」 · NotebookLM 드라이브 소스 고르기 | — | — | — | ✗(배포 뒤 운영 확인) | +### 109. 기다림 판정은 페이지 글의 끝과 기다리는 말이 있는 줄까지 본다 · 거절된 기다림은 동작 수에 포함하지 않는다 (스펙 `browser-handoff`, 설계 `docs/browser-handoff/design.md`) + +근거: 2026-12-03 사용자 — 「맨날하던 생성된 슬라이드 다운받아주는 버튼클릭이 40회 실패했다. 이것도 아까와 같은 문제인가?」(D-1203-02). 운영 기록: 「슬라이드 도 하나」 작업에서 기다리기 31번이 「저절로 진행되는 것이 없다」로 거절되었고, 그것도 동작으로 세어 40번 한도에서 멈췄다. 판정이 읽는 앞 800자를 가운데의 긴 요약이 채워, 오른쪽 칸의 「슬라이드 자료 생성 중…」이 판정에 전달되지 않았다. + +```bash +cd server && node --test --test-concurrency=1 test/browser-wait-busy.test.js # WB-U-01…03 · WB-I-01…05 (진짜 Chromium) +cd e2e && ~/.claude/tools/lite/reclock.sh run waitbusy -- npx playwright test --project=feature tests/feature/agent-browser.spec.js -g "F-AB-12" --workers=1 +``` + +| 요건 | 근거 | 시험 | 단계 | 상태 | +|---|---|---|---|---| +| 기다림 판정이 읽는 상태에 보이는 글의 앞 · 끝과 페이지 전체에서 기다리는 말이 있는 줄이 들어감(그 말 그대로 찾음 — 뜻은 판정이 판단) | 운영 12-02 | WB-U-01 · 02 | 단위 | ✅ | +| 오른쪽 칸 끝의 진행 표시를 gone_text · until_text로 기다리면 거절되지 않고, 표시가 사라지면 끝남 — 고치기 전 코드에서는 둘 다 거절 | 운영 12-02 | WB-I-01 · 02 · F-AB-12(PC · 휴대폰 390 — 고치기 전 코드에서 실패 확인) | 통합 · feature | ✅ | +| 칸에 쓴 값은 기다림 판정에 전달되지 않음 — 페이지 글과 칸의 줄 사이에 넣은 구분 줄 앞만 읽음, 그 줄이 없는 예전 PC 앱은 스냅숏의 글만 읽음 | 독립 검토 | WB-U-03 | 단위 | ✅ | +| 3,000자가 넘는 페이지: 페이지 전체 글의 끝에서 진행 표시를 봄(until_text) | 독립 검토 | WB-I-05 | 통합 | ✅ | +| 판정이 거절한 기다림은 작업마다 8번까지 동작 수에 포함하지 않고, 넘으면 다시 세어 한도에 이르면 멈춤 | 운영 12-02 | WB-I-03 · 04 | 통합 | ✅ | +| NotebookLM 스킬: 진행 표시를 gone_text로 주고 5분쯤 기다림 | 설계 | — (스킬 글) | — | ✅ | +| 실제 모델(빠른 모델)의 판정 확률, 운영에서 슬라이드 받기 | — | — | — | ✗(배포 뒤 운영 확인) | + diff --git a/e2e/tests/feature/agent-browser.spec.js b/e2e/tests/feature/agent-browser.spec.js index 3a0af640..44aabbf6 100644 --- a/e2e/tests/feature/agent-browser.spec.js +++ b/e2e/tests/feature/agent-browser.spec.js @@ -25,6 +25,8 @@ // 언급한 사이트와 같지」) // F-AB-11 PC · 휴대폰 390: 계획도 규칙도 없는 방에서 링크만 보내 읽기만 한 작업에 「스튜디오에서 다시해봐」 — 처음 말과 이 말로 다시 정해 내 // 계정으로 이어서 만든다(2026-12-02 운영: 「다시해봐」가 읽기만 하던 작업을 사이트 없이 이어 받았다) +// F-AB-12 PC · 휴대폰 390: 슬라이드를 만드는 여러 칸 페이지(가운데 긴 요약, 오른쪽 칸 끝의 「슬라이드 자료 생성 중...」)에서 기다리기 — +// 기다림 판정이 그 표시를 보고 기다리며, 표시가 사라지면 끝난다(2026-12-02 운영: 기다리기 31번이 거절되어 동작 40번 한도에서 멈춤) // 자기 스택(lib/localStack.js: 회사 agentbrowser-ui 의 BFF + Vite, 9061 · 5461 부터 빈 포트)을 띄우고 지운다. 가짜 모델 · 판정(9066)과 // 가짜 deepagents(9067)는 이 파일이 띄운다 — 가짜 deepagents 는 스트림 도중에 Lite 의 /mcp/browser 를 사람의 토큰과 X-Conversation-Id 로 // 부른다. 사이트는 server/test/fixtures/studio.mjs(생성을 누르면 몇 초 뒤 다운로드). 브라우저 작업은 그 BFF 의 진짜 Chromium 이 한다. @@ -64,10 +66,11 @@ const ASK = { tube: '튜브 스튜디오에서 오디오 보고서를 만들어서 받아 줘', tubeone: '튜브원 스튜디오에서 오디오 보고서를 만들어서 받아 줘', again: '스튜디오에서 다시해봐', + panels: '노트 스튜디오에서 슬라이드 자료를 만들어 줘', } // (the person's room rule for F-AB-07 — their own words, as the room's notice message keeps them) const RULE_SAID = '앞으로 이 방에 올리는 링크는 스튜디오에서 오디오 보고서로 만들어 줘' -const caseOf = (t) => (t.includes('튜브원 스튜디오') ? 'tubeone' : t.includes('튜브 스튜디오') ? 'tube' : t.includes('판단이 느린 날') ? 'slow' : t.includes('판단이 오지 않는 날') ? 'unread' : t.includes('목소리') ? 'ask' : t.includes('끝나면 이어서') ? 'handback' : t.includes('다른 사람 대화') ? 'other' : t.includes('목록을 보기 좋게') ? 'tidy' : t.includes(ASK.link) ? 'link' : 'audio') +const caseOf = (t) => (t.includes('노트 스튜디오') ? 'panels' : t.includes('튜브원 스튜디오') ? 'tubeone' : t.includes('튜브 스튜디오') ? 'tube' : t.includes('판단이 느린 날') ? 'slow' : t.includes('판단이 오지 않는 날') ? 'unread' : t.includes('목소리') ? 'ask' : t.includes('끝나면 이어서') ? 'handback' : t.includes('다른 사람 대화') ? 'other' : t.includes('목록을 보기 좋게') ? 'tidy' : t.includes(ASK.link) ? 'link' : 'audio') const GOAL = { audio: '스튜디오에서 오디오 보고서를 생성하고 다운로드한다', ask: '스튜디오에서 어느 목소리로 할지 사람에게 물어 정한 뒤 오디오를 만든다', @@ -78,6 +81,7 @@ const GOAL = { unread: '스튜디오에서 오디오 보고서를 만들어 받는다(판단이 오지 않는 날)', tube: '튜브 스튜디오에서 오디오 보고서를 만들어 받는다', tubeone: '튜브원 스튜디오에서 오디오 보고서를 만들어 받는다', + panels: '노트 스튜디오에서 슬라이드 자료가 다 만들어질 때까지 기다린다', } const WAIT_MS = { audio: 7000, ask: 1000, handback: 9000, link: 2000, slow: 2000, unread: 2000, tube: 2000, tubeone: 2000 } const readings = [] // the site readings the fake model got: {model, said: 'slow' | 'unread' | …} (F-AB-08) @@ -105,6 +109,11 @@ function browserMove(goal, b) { if (!s.noted) { s.noted = chose || '(답 없음)'; return ['note', { text: `고른 목소리: ${s.noted}` }] } return ['finish', { summary: `${s.noted}로 오디오를 만들었어요.` }] } + // (F-AB-12: the slides are being made on a page of panels — wait for its own status to go, as the NotebookLM skill says) + if (kase === 'panels') { + if (!b.messages.some((m) => m.role === 'tool')) return ['wait_for_page', { minutes: 2, gone_text: '생성 중' }] + return ['finish', { summary: /^refused/.test(lastTool(b)) ? '기다리지 못했어요.' : '슬라이드 자료가 다 만들어졌어요.' }] + } // (F-AB-09: type a title first — typing on a site the person did not name asks; on one they named it goes on) if ((kase === 'tube' || kase === 'tubeone') && !s.typed && el(b, '제목')) { s.typed = true; return ['type', { i: el(b, '제목').i, text: '시연 보고서' }] } if ((kase === 'tube' || kase === 'tubeone') && s.typed && !s.afterType) { s.afterType = true; if (/^not done/.test(lastTool(b))) return ['finish', { summary: '제목을 입력하지 못했어요.' }] } @@ -158,7 +167,10 @@ function answerLlm(b) { // (the effect gate — server lib/browser.js EFFECT_OPTIONS: removing cannot be undone, generating stays in the person's own workspace) const effectOf = (state) => { const c = /Control: "([^"]*)"/.exec(state)?.[1] || /Web address: "([^"]*)"/.exec(state)?.[1] || ''; return /삭제|delete/i.test(c) ? { irreversible: 0.92 } : /생성|제목/.test(c) ? { own: 0.9 } : { look: 0.9 } } // (F-AB-11: 「스튜디오에서 다시해봐」 goes on with the task that just ended — lib/browserQueue.js resume, more0) -const judgeOf = (keys, state = '') => (keys.includes('irreversible') ? effectOf(state) : keys.includes('login_needed') ? { ok: 1 } : keys.includes('idle') ? { busy: 1 } +// (F-AB-12: on the made-up notebook of panels the busy check says 「at work」 only when what it reads holds the status line itself — +// 「슬라이드 자료 생성 중...」, after the long summary — a stand-in for a judge that sees the status; elsewhere it says busy as before) +const busyOf = (state) => (!state.includes('가상 노트북') ? { busy: 1 } : state.includes('슬라이드 자료 생성 중...') ? { busy: 0.95, idle: 0.05 } : { idle: 0.95, busy: 0.05 }) +const judgeOf = (keys, state = '') => (keys.includes('irreversible') ? effectOf(state) : keys.includes('login_needed') ? { ok: 1 } : keys.includes('idle') ? busyOf(state) : keys.includes('more0') && state.includes(ASK.again) ? { more0: 0.95, none: 0.05 } : keys.includes('none') ? { none: 1 } : keys.includes('new') ? { new: 1 } : { other: 1 }) // ---- the fake deepagents: to-dos, then Lite's /mcp/browser in the middle of its stream, then the answer from the result ---- @@ -200,6 +212,7 @@ async function runAgent(body, res) { } const args = c === 'tidy' ? { goal: GOAL.tidy, start_url: `${notes.url}/notebooks?n=3` } // (F-AB-09: the agent starts on the skill's other host — the same service) + : c === 'panels' ? { goal: GOAL.panels, start_url: `${site.url}panels?ms=8000`, skill: 'fake-studio' } : c === 'tube' || c === 'tubeone' ? { goal: GOAL[c], start_url: `${site.url.replace('127.0.0.1', 'tube.localhost')}?ms=${WAIT_MS[c]}`, skill: c === 'tube' ? 'fake-tube' : 'fake-tube-one' } : { goal: GOAL[c], start_url: `${site.url}?ms=${WAIT_MS[c]}`, skill: 'fake-studio' } say({ type: 'token', content: '스튜디오 사이트에서 직접 만들게요.' }) @@ -738,3 +751,27 @@ for (const [label, opts] of [['PC', DESK], ['휴대폰 390', PHONE]]) { await p.context().close() }) } + +for (const [label, opts] of [['PC', DESK], ['휴대폰 390', PHONE]]) { + test(`F-AB-12 ${label}: 슬라이드를 만드는 여러 칸 페이지에서 기다린다 — 오른쪽 칸 끝의 진행 표시를 판정이 보고, 표시가 사라지면 끝난다`, async ({ browser }) => { + test.setTimeout(120_000) + const phone = opts === PHONE + delete runs[GOAL.panels] + const tid = await clearMain(A) + const p = await open(browser, A, opts) + await send(p, ASK.panels) + const row = taskRow(p) + await expect(row).toBeVisible({ timeout: 60_000 }) + // waiting — not turned down: the card's line runs its clock (it shows only once the busy check let the wait go on — independent review) + await expect(p.getByText(/「생성 중」 사라지기를 기다리는 중 · 0:\d\d/).first()).toBeVisible({ timeout: 30_000 }) + if (phone) expect(await noOverflow(p)).toBe(true) + await row.scrollIntoViewIfNeeded() + await shot(p, `f-ab-12-${phone ? 'phone' : 'pc'}-wait-panels`) + await expect(answers(p).last().locator('.bubble')).toContainText('슬라이드 자료가 다 만들어졌어요.', { timeout: 60_000 }) + const [task] = (await tasksOf(A.id)).filter((t) => t.thread_id === tid) + expect(task.content.state).toBe('done') + expect(p.errors).toEqual([]) + await p.context().close() + }) +} + diff --git a/openspec/specs/agent-browser/e2e/results/f-ab-12-pc-wait-panels.png b/openspec/specs/agent-browser/e2e/results/f-ab-12-pc-wait-panels.png new file mode 100644 index 00000000..fa838d48 Binary files /dev/null and b/openspec/specs/agent-browser/e2e/results/f-ab-12-pc-wait-panels.png differ diff --git a/openspec/specs/agent-browser/e2e/results/f-ab-12-phone-wait-panels.png b/openspec/specs/agent-browser/e2e/results/f-ab-12-phone-wait-panels.png new file mode 100644 index 00000000..fea63a06 Binary files /dev/null and b/openspec/specs/agent-browser/e2e/results/f-ab-12-phone-wait-panels.png differ diff --git a/openspec/specs/browser-handoff/spec.md b/openspec/specs/browser-handoff/spec.md index 48ae852e..5ca6bc7e 100644 --- a/openspec/specs/browser-handoff/spec.md +++ b/openspec/specs/browser-handoff/spec.md @@ -122,7 +122,7 @@ - 감시: 20초 동안 다음 걸음으로 넘어가지 않으면 작업 카드 내용에 `stall { what, since, after }`를 넣는다. 화면은 카드 아래에 「기다리는 중 · <무엇>」, 몇 초째인지, 한 줄 설명, 「다시 시도」 · 「그만두기」를 보여 준다. 입력창 옆 독은 호박색 테두리가 된다. 다음 걸음이 시작되거나 작업이 끝나면 `stall`을 비운다. 사람의 답을 기다리는 동안(`needs_input`)은 멈춤이 아니다. - 「다시 시도」(`POST /api/browser/retry {taskId}`): 하던 걸음(모델 호출, 이동, 기다리기)을 버리고 그 턴을 새로 본 페이지에서 다시 한다. 에이전트의 턴 수에는 세지 않는다. - 「그만두기」 · 「작업 취소」(`POST /api/browser/cancel`): 하던 걸음이 무엇이든 그 자리에서 끝내고, 페이지가 불러오던 것을 멈추고, 브라우저를 줄 서 있는 다음 작업에 넘긴다. -- 기다리기(`wait_for_page`): 찾는 글자는 페이지 글자와 입력 칸의 값 · 자리 표시 글자까지 본다. 바로 없으면 판정(벽 판정과 같은 판정, 0.7)으로 페이지가 스스로 하는 일이 있는지 한 번 묻고, 확실히 없으면 기다리지 않고 「직접 하라」고 모델에게 돌려준다. 문구 패턴으로 가리지 않는다(MUST NOT). 처음 30초는 2초마다, 그 뒤에는 15초마다 본다. +- 기다리기(`wait_for_page`): 찾는 글자가 있는지 페이지 글자와 입력 칸의 값 · 자리 표시 글자까지 확인한다. 바로 찾을 수 없으면 판정(벽 판정과 같은 판정, 0.7)으로 페이지에서 저절로 진행되는 일이 있는지 한 번 묻고, 확실히 없으면 기다리지 않고 「직접 하라」고 모델에게 돌려준다. 문구 패턴으로 가리지 않는다(MUST NOT). 판정은 보이는 글의 앞부분, 페이지 전체 글의 끝부분, 그리고 페이지 글에서 기다리는 말(until_text · gone_text)이 있는 줄을 읽는다(앞 800자만 읽으면 여러 칸으로 된 페이지 끝의 진행 표시가 빠진다). 칸에 쓴 값은 판정에 보내지 않는다(SHALL). 판정이 거절한 기다림은 작업마다 8번까지 동작 수에 포함하지 않고, 그 뒤로는 다시 센다. 처음 30초는 2초마다, 그 뒤에는 15초마다 확인한다. - 읽기: 번호는 화면에 있는 요소에만, 120개까지(넘으면 입력 칸 · 단추를 링크보다 먼저), 글은 화면과 그 아래 한 화면에서 3000자까지, 페이지 안에서 1.5초 넘게 훑지 않는다. 지난번에 붙인 번호는 지운다. 화면 안의 iframe(다른 출처 포함, 120×60 이상)도 읽고, 번호는 이어서 붙이며, 그 번호의 동작은 그 프레임에서 한다. - 실시간 화면: 1초에 3장까지(`PRO_BROWSER_LIVE_FPS`), 1024×640 · JPEG 품질 50. 보내지 못한 데이터가 256KB 넘게 쌓인 연결에는 새 프레임을 보내지 않는다(메시지와 카드 변화는 보낸다). 긴 폴링 버퍼에는 작업마다 마지막 프레임만 남긴다. - 되풀이: 같은 화면으로 돌아와 같은 동작을 최근 12번 안에 세 번 하면(그 사이 화면은 바뀜) `need: stuck`으로 사람에게 넘긴다. 바뀌지 않는 화면에서의 시도는 위 「같은 화면에서 헛돌지 않는다」가 센다. @@ -158,6 +158,24 @@ - **AND** 이름 · 제목 · 파일 이름 · 에이전트가 입력한 글은 어떤 언어로든 나올 수 있어 이 경우가 아니다 - **AND** 같은 작업에서 같은 말을 다시 기다리면 「나오지 않을 말」은 다시 묻지 않고, 기다릴 말 없이 기다릴 때도 묻지 않는다 +#### Scenario: 여러 칸으로 된 페이지의 끝에 있는 진행 표시를 기다리기 +- **GIVEN** 가운데 칸의 긴 요약(2,000자 넘게)이 글의 앞부분을 채우고, 오른쪽 칸 끝에 「슬라이드 자료 생성 중...」이 있는 노트북 페이지(시험 사이트, 2026-12-02 운영의 NotebookLM) +- **WHEN** 에이전트가 gone_text 「생성 중」 또는 아직 없는 until_text로 1분 기다린다 +- **THEN** 판정이 읽는 상태에 그 표시 줄이 있고(gone_text는 그 말이 있는 줄, until_text는 글의 끝), 기다림이 거절되지 않으며 표시가 사라지면 끝난다 + +#### Scenario: 칸에 쓴 값은 기다림 판정에 전달되지 않는다 +- **WHEN** 사람이 「직접 제어」로 카드 번호를 칸에 직접 입력했고, 에이전트가 gone_text 「카드 번호」로 기다린다 +- **THEN** 판정이 읽는 상태에 그 칸의 값은 없다. 기다리는 말이 있는 줄은 페이지 글에서만 찾는다(칸의 값 · 자리 표시 글자는 기다림이 끝났는지를 확인할 때만 쓴다) + +#### Scenario: 3,000자가 넘는 페이지 끝의 진행 표시 +- **GIVEN** 가운데 칸의 글이 3,000자를 넘어 에이전트가 받은 페이지 글(스냅숏)이 진행 표시 앞에서 끝난다 +- **WHEN** 아직 없는 until_text로 기다린다 +- **THEN** 판정은 페이지 전체 글의 끝을 읽어 그 표시를 본다 + +#### Scenario: 거절된 기다림은 동작 수에 포함하지 않는다 +- **WHEN** 판정이 기다림을 거절한다 +- **THEN** 그 기다림은 작업의 동작 한도(40)에 포함하지 않는다. 작업마다 8번까지는 세지 않고, 그 뒤의 거절은 다시 세어 기다림만 되풀이하는 작업도 한도에 이르면 끝난다 + #### Scenario: 칸에 쓴 값을 기다린다 - **WHEN** 에이전트가 칸에 쓴 값이나 칸의 자리 표시 글자를 기다린다 - **THEN** 바로 끝난다(전에는 1분을 다 채웠다) diff --git a/server/lib/browser.js b/server/lib/browser.js index a49cdbc1..6b9c76b6 100644 --- a/server/lib/browser.js +++ b/server/lib/browser.js @@ -30,7 +30,7 @@ import * as BP from './browserProfiles.js' import { every } from './every.js' import { browserSkill, browserSkills, readBrowserSkill, browserSkillCatalog } from './browserSkills.js' import { judge } from './judge.js' -import { STEP, StepError, isStop, bounded, pause, watchdog, lockHolder, profilesRunning } from './browserSteps.js' +import { STEP, StepError, isStop, bounded, pause, watchdog, lockHolder, profilesRunning, WORDS_FIELDS } from './browserSteps.js' import { ServerDriver, within, blankOf, lookAt } from './browserServer.js' import { RemoteDriver, routeFor, routeOf, privateAddress, browsesHere } from './browserRemote.js' import { personWhere } from './browserWhere.js' @@ -1361,7 +1361,8 @@ async function runBrowserTaskNow({ userId, threadId, goal, startUrl, onAction, u else if (result.state === 'done' && !ended) { // the budget ran out (lib/browserProgress.js: more blocks only while the rounds made progress): never 「같은 화면에서 멈춤」 — // how much it did, and that 다시 시도 goes on from here - const n = task.stats.turns, count = task.progressCount || 0 + // (the actions that counted: a refused wait that was free is not one — REFUSED_WAITS) + const n = task.stats.turns - (task.stats.waits_free || 0), count = task.progressCount || 0 const done = count ? L(`동작 ${n}번 동안 ${count}개를 처리했지만 다 끝내지 못해 멈췄어요.`, `I handled ${count} in ${n} actions but couldn't finish, so I stopped.`) : L(`동작 ${n}번 안에 작업을 끝내지 못해 멈췄어요.`, `I stopped: the task wasn't finished within ${n} actions.`) const next = byHandOnPc(task) @@ -1409,7 +1410,7 @@ async function runBrowserTaskNow({ userId, threadId, goal, startUrl, onAction, u console.log(`[browser] task ${task.id} ${result.state} in ${Math.round(result.stats.ms / 1000)}s on ${task.where?.kind === 'local' ? `the PC (${task.where.device})` : 'this server'} · ${task.stats.turns} turns${task.stats.extended ? ` (budget extended ${task.stats.extended}× — ${task.progressCount} rounds of progress)` : ''} · plan ${task.stats.plan_ms}ms · per turn ${Object.entries(result.stats.avg_ms).map(([k, v]) => `${k} ${v}ms`).join(', ')}${task.stats.stalls ? ` · ${task.stats.stalls} stalls` : ''}${task.stats.retries ? ` · ${task.stats.retries} retried` : ''}`) result.where = task.where jot(task, 'end', { state: result.state, ...(result.need ? { need: result.need } : {}), ...(why.reason ? { reason: String(why.reason).slice(0, 240) } : {}), ms: result.stats.ms, turns: task.stats.turns, - avg_ms: result.stats.avg_ms, llm: task.stats.llm, ...['stalls', 'retries', 'model_retries', 'step_timeouts', 'stuck', 'loops', 'offline', 'extended', 'walls'].reduce((o, k) => (task.stats[k] ? { ...o, [k]: task.stats[k] } : o), {}), + avg_ms: result.stats.avg_ms, llm: task.stats.llm, ...['stalls', 'retries', 'model_retries', 'step_timeouts', 'stuck', 'loops', 'offline', 'extended', 'walls', 'waits_free', 'waits_refused', 'waits_reworded'].reduce((o, k) => (task.stats[k] ? { ...o, [k]: task.stats[k] } : o), {}), ...(task.progressCount ? { progress: task.progressCount } : {}), url: result.url || null }) result.pageText = task.cancelled ? '' : hide(task, await ln.driver.text()) return result @@ -1650,8 +1651,15 @@ async function drive(s, task, { messages, onAction, stop = () => false }) { } tm.act = Date.now() - t timing(task, tm, name) + // a wait the busy check turned down did nothing on the page: not one of the task's actions, up to REFUSED_WAITS.free a task + // (its own `refused:` — the server's fixed start of that answer; the journal row says it was free, and the end row counts them) + const free = name === 'wait_for_page' && /^refused:/.test(String(out)) && (task.stats.waits_free || 0) < REFUSED_WAITS.free jot(task, 'act', { n: task.stats.turns, tool: name, ...(task.target?.name ? { target: String(task.target.name).slice(0, 80) } : {}), host: hostOf(snap.url), ...(task.page?.name ? { page: String(task.page.name).slice(0, 80) } : {}), - ...(name === 'goto' && args.url ? { url: shown(String(args.url)) } : {}), ms: tm, ...(/^(error|refused|not pressed|stopped)/.test(String(out)) ? { out: J.firstLine(out) } : {}) }) + ...(name === 'goto' && args.url ? { url: shown(String(args.url)) } : {}), ms: tm, ...(/^(error|refused|not pressed|stopped)/.test(String(out)) ? { out: J.firstLine(out) } : {}), ...(free ? { free: true } : {}) }) + if (free) { + task.stats.waits_free = (task.stats.waits_free || 0) + 1 + turn-- + } const lastKey = task.prev?.key task.prev = { key, acted: ACTING.has(name) || /^error/.test(String(out)), progress: ['note', 'step_done'].includes(name) } // the trail of actions and the pages they were taken on: repetitive work that keeps changing the page is progress (the budget @@ -2589,21 +2597,72 @@ const pageWords = (s) => s.driver.words() // judge as walls) once per wait, never by wording; only a sure "nothing is in progress" (WALL_BAR) turns the wait down. const BUSY_QUESTION = 'A browser agent wants to wait, without acting, until the page changes as said above. Is the page doing slow work by itself that it should wait for?' const BUSY_OPTIONS = [ - { key: 'busy', label: 'Yes: the page is working on something by itself right now (being generated, processed, uploaded or loaded — a progress bar, a spinner, a "generating" or "in progress" message), so waiting makes sense' }, - { key: 'idle', label: 'No: nothing on the page is in progress; what the agent waits for would only come after it acts (types, picks a suggestion, presses a button, scrolls)' }, + // (「what the agent waits for」: a page's end now reaches the judge — a loading mark that never goes, a chat widget — so busy is about the + // work waited for, not anything at all on the page: independent review of #197) + { key: 'busy', label: 'Yes: the page is working by itself right now on what the agent waits for (it is being generated, processed, uploaded or loaded — a progress bar, a spinner, a "generating" or "in progress" message for it), so waiting makes sense' }, + { key: 'idle', label: 'No: nothing the agent waits for is in progress on the page; it would only come after the agent acts (types, picks a suggestion, presses a button, scrolls)' }, ] // (with words to wait for: they may be words this page never writes — another language than the page's, a label of another site — so the // wait could only run out; 2026-11-29 production: NotebookLM in Korean, the agent waiting for an English 「Relate」) // (names, titles, file names and text the agent itself entered may show in any language — only words this page would never write count) const UNSEEN_OPTION = { key: 'unseen', label: 'Whatever the page is doing, the words the agent waits for would never appear on it as written: they are a label or status in another language than the page\'s own (a name, a title, a file name or text the agent entered may appear in any language — those are not this case)' } +// A wait this check turns down did nothing on the page, so it does not use up one of the task's actions (drive) — up to `free` of them +// a task; after that they count again, so an agent that keeps asking to wait still comes to the end of its budget (2026-12-02 +// production: 31 refused waits used up 31 of the 40 actions while NotebookLM was still making the slides) +export const REFUSED_WAITS = { free: 8 } + +// What the busy check reads. The wall check's view (wallState: the first 800 characters of the text) is not enough here: on a page of +// panels the status of the work waited for may come last (2026-12-02 production, NotebookLM: the long source summary in the middle +// filled those 800 characters and the studio panel's 「슬라이드 자료 생성 중...」 came after them, so the judge saw nothing in progress). +// So: the start of the text the agent was shown, the end of the page's own text (the whole page — the snapshot stops at 3,000 characters +// in page order, so its end is not the page's end), and the lines of the page's own text that hold the words waited for (gone_text is on +// the page now — its line is the status the page shows) — found by those words as written, never by what any words mean. +// words: the page's words as the wait reads them (pageWords — lib/browserSteps.js PAGE_WORDS_JS): only what comes before its fields' line +// (WORDS_FIELDS) is read here — a value typed into a field never goes to the judge (independent review of #197: a card number typed by +// hand). A PC app that does not write that line yet (an older desktop app): the snapshot's text only. +export const BUSY_TEXT = { head: 800, tail: 1200, lines: 6, width: 240 } +export function busyState(snap, goal = '', { until = '', gone = '', words = null } = {}) { + const buttons = (snap.els || []).filter((e) => ['a', 'button'].includes(e.tag) || /^(submit|button)$/.test(e.type || '')).map((e) => e.text).filter(Boolean) + const text = String(snap.text || '').replace(/\n{2,}/g, '\n') + const at = typeof words === 'string' ? words.indexOf(WORDS_FIELDS) : -1 + const page = at >= 0 ? words.slice(0, at).replace(/\n{2,}/g, '\n') : text + const { head, tail } = BUSY_TEXT + const end = page.length > head ? page.slice(-tail) : '' + const shownText = text.length <= head && !end ? [`Visible text:\n${text || '(none)'}`] + : [`Visible text (start):\n${text.slice(0, head)}`, `Page text (end):\n${end || text.slice(-tail)}`] + const lines = linesWith(page, [gone, until]) + return [`Page title: ${snap.title || '(none)'}`, `Task: ${String(goal || '(not given)').replace(/\s+/g, ' ').slice(0, 300)}`, `Site address: ${hostOf(snap.url)}`, + `Buttons and links: ${[...new Set(buttons)].slice(0, 30).join(' | ') || '(none)'}`, ...shownText, + ...(lines.length ? [`Where the words waited for are on the page now:\n${lines.join('\n')}`] : []), + `The agent waits until: ${until ? `"${until}" appears on the page` : gone ? `"${gone}" is no longer on the page` : 'the page changes'}`].join('\n') +} +// the lines of text holding any of the words as written (spaces evened out), each cut to BUSY_TEXT.width around the word; more than +// BUSY_TEXT.lines of them: the first half and the last half by page order (a page of panels puts the status of the work last — an +// answer or a source name that holds the same words may come many times before it) +function linesWith(text, words) { + const ws = words.map((w) => String(w || '').replace(/\s+/g, ' ').trim()).filter(Boolean) + if (!ws.length) return [] + const found = [] + const { lines, width } = BUSY_TEXT + for (const raw of String(text || '').split('\n')) { + const line = raw.replace(/\s+/g, ' ').trim() + const w = ws.find((x) => line.includes(x)) + if (!w) continue + const from = line.length <= width ? 0 : Math.max(0, Math.min(line.indexOf(w) - Math.floor((width - w.length) / 2), line.length - width)) + const cut = `${from > 0 ? '…' : ''}${line.slice(from, from + width)}${from + width < line.length ? '…' : ''}` + if (!found.includes(cut)) found.push(cut) + } + return found.length <= lines ? found : [...found.slice(0, Math.floor(lines / 2)), ...found.slice(-Math.ceil(lines / 2))] +} + // → 'idle' (nothing to wait for), 'unseen' (the words waited for would never show on this page as written) or '' (wait). Both mean // "do not wait": they are refused together when their sum is sure (a judge that spreads its answer over three options would otherwise let // an idle page wait for foreign words), and the larger one says why. Words already refused as unseen in this task are not asked about // again (the agent insisting on them: they may be right — only busy or idle is asked) -async function pageIsIdle(s, task, { until, gone }) { +async function pageIsIdle(s, task, { until, gone, words = null }) { const snap = await look(s) if (snap.more?.unread) return '' - const state = `${wallState(snap, task.goal)}\nThe agent waits until: ${until ? `"${until}" appears on the page` : gone ? `"${gone}" is no longer on the page` : 'the page changes'}` + const state = busyState(snap, task.goal, { until, gone, words }) const askUnseen = !!until && !(task.unseenWords ||= new Set()).has(until) let r = null try { r = await judge({ state: hide(task, state), question: BUSY_QUESTION, options: askUnseen ? [...BUSY_OPTIONS, UNSEEN_OPTION] : BUSY_OPTIONS }) } catch (e) { console.warn('[browser] busy check', e.message) } @@ -2637,7 +2696,7 @@ async function waitForPage(s, task, a) { if (text !== null && until && text.includes(until)) return `done: "${until}" is on the page now` if (text !== null && gone && !text.includes(gone)) return `done: "${gone}" is no longer on the page` // not there at once: a wait of more than a few seconds is first checked against the page itself - const idle = n === 0 && minutes >= 0.5 ? await pageIsIdle(s, task, { until, gone }) : '' + const idle = n === 0 && minutes >= 0.5 ? await pageIsIdle(s, task, { until, gone, words: text }) : '' if (idle === 'unseen') { task.stats.waits_reworded = (task.stats.waits_reworded || 0) + 1 return `refused: "${until}" is not something this page will show as written (checked) — it may be in another language than the page. Wait again with until_text in this page's own words (from the page or the site's skill), or with gone_text set to words on the page now that will go` diff --git a/server/lib/browserSteps.js b/server/lib/browserSteps.js index 826d8dbb..ccdb9d01 100644 --- a/server/lib/browserSteps.js +++ b/server/lib/browserSteps.js @@ -215,6 +215,9 @@ export const DESCRIBE_JS = (e) => { return { name: name.length > 30 ? `${name.slice(0, 29)}…` : name, field: !!field && !button, secret, what, ...(to ? { to: String(to).slice(0, 2000) } : {}) } } +// the line PAGE_WORDS_JS puts between the page's own text and the fields' words (it is written into the function's source, which runs in +// the page: kept the same by test/browserDriver.test.js) +export const WORDS_FIELDS = '\u2063pgl-fields\u2063' // The words on the page a wait looks for: its text, and what fields hold or show (a value typed in, a placeholder) — // the model picks until_text from the snapshot, where a field shows itself by those (2026-11-24: waits for the // placeholder 「어디로 떠나시나요?」 and for 「계룡시」 typed into a field each ran their full minute). A secret field's value is @@ -224,7 +227,9 @@ export const PAGE_WORDS_JS = () => { if (!b) return '' const fields = [...document.querySelectorAll('input:not([type=hidden]):not([type=password]):not([data-pro-secret]):not([autocomplete^="cc-"]):not([autocomplete="one-time-code"]),textarea:not([data-pro-secret]),select')].slice(0, 300) .map((e) => [e.tagName === 'SELECT' ? e.options[e.selectedIndex]?.text : e.value, e.placeholder, e.getAttribute('aria-label')].filter(Boolean).join(' ')) - return `${b.innerText}\n${fields.join('\n')}` + // (a fixed line of ours between the page's own text and the fields' words: the busy check reads only what comes before it — a value typed + // into a field never goes to the judge — lib/browser.js busyState, WORDS_FIELDS) + return `${b.innerText}\n\u2063pgl-fields\u2063\n${fields.join('\n')}` } // The agent's view of a page and of the frames on its screen (a map's result list, a booking form, a sign-in box are diff --git a/server/test/browser-wait-busy.test.js b/server/test/browser-wait-busy.test.js new file mode 100644 index 00000000..3c6569d6 --- /dev/null +++ b/server/test/browser-wait-busy.test.js @@ -0,0 +1,238 @@ +// 「페이지가 스스로 일하는 중인가」 판정이 기다림이 무엇에 대한 것인지 본다(2026-12-02 운영: NotebookLM 에서 「슬라이드 도 하나」 — +// 가운데의 긴 소스 요약이 판정이 읽는 앞 800자를 채워, 오른쪽 스튜디오 칸 끝의 「슬라이드 자료 생성 중...」이 판정에 가지 않았다. 기다림 31번이 +// 「하는 일 없음」으로 거절되고, 거절마다 동작 40개 중 하나를 써서 슬라이드가 만들어지는 중에 한도로 멈췄다). +// - 판정이 읽는 상태: 글의 앞과 끝, 그리고 페이지 전체에서 기다리는 말이 든 줄(gone_text 는 지금 화면에 있는 그 표시) +// - 판정이 거절한 기다림은 동작 수를 쓰지 않는다 — 작업마다 REFUSED_WAITS.free 번까지, 그 뒤로는 다시 센다 +// WB-U-01 · 02 판정이 읽는 상태(글의 앞 · 끝, 기다리는 말이 든 줄 — 긴 줄은 그 말 둘레만) +// WB-I-01 · 02 진짜 Chromium: 스튜디오 칸 끝의 진행 표시를 gone_text · until_text 로 기다린다 +// WB-I-03 · 04 판정이 거절한 기다림은 동작 수를 쓰지 않는다 · 한도를 넘으면 다시 센다 +// WB-U-03 칸에 쓴 값은 판정에 가지 않는다(페이지 글과 칸의 줄 사이의 우리 줄) · WB-I-05 3,000자가 넘는 페이지의 끝(독립 검토) +// 진짜 Chromium, 이 폴더의 지어낸 스튜디오 사이트(fixtures/studio.mjs /panels), 대본대로 움직이는 모델, 받은 상태를 적어 두는 판정 서버. +// 판정 서버는 상태 글에 그 표시 줄이 있을 때만 「하는 중」이라고 답한다(표시를 본 판정의 대역). 인터넷 없음. +// cd server && node --test --test-concurrency=1 test/browser-wait-busy.test.js +import test, { before, after } from 'node:test' +import assert from 'node:assert/strict' +import crypto from 'node:crypto' +import http from 'node:http' +import path from 'node:path' +import fs from 'node:fs' +import { startStudio, SUMMARY } from './fixtures/studio.mjs' +import { WORDS_FIELDS, PAGE_WORDS_JS } from '../lib/browserSteps.js' +// (this test's made-up sites run on this machine: the server's browser may open them — lib/privateNet.js) +process.env.PRO_BROWSER_PRIVATE_ALLOW ??= '127.0.0.1,localhost' + +const STATUS = '슬라이드 자료 생성 중...' + +// ---- scripted model: the plan, then per goal a list of moves (a tool call, or a function of the request) ---- +const scripts = {} +const lastTool = (b) => b.messages.filter((m) => m.role === 'tool').at(-1)?.content || '' +const llm = http.createServer((req, res) => { + let raw = '' + req.on('data', (c) => { raw += c }) + req.on('end', () => { + const body = JSON.parse(raw) + let message + if (body.response_format) message = { role: 'assistant', content: JSON.stringify({ title: '가상 노트북 슬라이드', steps: ['만들기', '기다리기'] }) } + else { + const goal = /Goal: (.*)/.exec(body.messages[0].content)?.[1] || '' + const s = scripts[goal] + const move = s.moves[Math.min(s.i++, s.moves.length - 1)] + const [name, args] = typeof move === 'function' ? move(body) : move + message = { role: 'assistant', content: null, tool_calls: [{ id: 'call_' + crypto.randomUUID().slice(0, 8), type: 'function', function: { name, arguments: JSON.stringify(args) } }] } + } + res.writeHead(200, { 'Content-Type': 'application/json' }) + res.end(JSON.stringify({ choices: [{ message }] })) + }) +}) +// ---- recording judge: pages are no walls; the page is busy only when the state it is given shows the status line ---- +const busyAsked = [] +const judgeServer = http.createServer((req, res) => { + let raw = '' + req.on('data', (c) => { raw += c }) + req.on('end', () => { + const { state, options } = JSON.parse(raw) + const keys = options.map((o) => o.key) + let probabilities + if (keys.includes('idle')) { + busyAsked.push(state) + const seen = state.includes(STATUS) + probabilities = { busy: seen ? 0.95 : 0.08, idle: seen ? 0.03 : 0.92, ...(keys.includes('unseen') ? { unseen: 0 } : {}) } + } else probabilities = Object.fromEntries(keys.map((k) => [k, k === 'ok' ? 0.96 : 0.01])) + res.writeHead(200, { 'Content-Type': 'application/json' }) + res.end(JSON.stringify({ probabilities, model: 'scripted' })) + }) +}) +await new Promise((r) => llm.listen(0, '127.0.0.1', r)) +await new Promise((r) => judgeServer.listen(0, '127.0.0.1', r)) +Object.assign(process.env, { PRO_LLM_BASE_URL: `http://127.0.0.1:${llm.address().port}`, PRO_LLM_API_KEY: 'test', PRO_JUDGE_URL: `http://127.0.0.1:${judgeServer.address().port}/judge`, PRO_CONTEXT_ROUTER_URL: '' }) + +const browser = await import('../lib/browser.js') +const { q, pool } = await import('../lib/supa.js') + +const user = crypto.randomUUID() +let site, threadId +const keepWait = { ...browser.WAIT }, keepFree = browser.REFUSED_WAITS.free +const run = (goal, moves, startUrl) => { scripts[goal] = { i: 0, moves }; return browser.runBrowserTask({ userId: user, threadId, goal, startUrl, gates: false }) } + +before(async () => { + browser.WAIT.everyMs = 150 + site = await startStudio() + ;[{ id: threadId }] = await q(`insert into pro_threads(user_id,kind,title) values ($1,'project','browser wait busy test') returning id`, [user]) +}) +after(async () => { + Object.assign(browser.WAIT, keepWait) + browser.REFUSED_WAITS.free = keepFree + await browser.close(user) + await site.close() + llm.close(); llm.closeAllConnections?.() + judgeServer.close() + await q('delete from pro_threads where user_id=$1', [user]) + await pool.end() + fs.rmSync(path.join(browser.PROFILES, user), { recursive: true, force: true }) +}) + +// ---- the state the busy check reads (no browser) ---- + +// the NotebookLM page as the agent reads it: sources, the long summary in the middle, the studio panel last +const panelText = `출처\n소스 추가\n분기 회의록 메모.pdf\n가상 분기 회의 노트북\n${SUMMARY}\n저장된 메모\n스튜디오\nAI 오디오 오버뷰 마인드맵 슬라이드 자료\n${STATUS}` +const panelSnap = (text = panelText) => ({ url: 'https://notes.example/notebook/1', title: '가상 노트북 - 노트 스튜디오', text, + els: ['소스 추가', '저장된 메모', 'AI 오디오 오버뷰', '마인드맵', '슬라이드 자료'].map((t, i) => ({ i, tag: 'button', type: 'submit', text: t })) }) + +// the page's words as the wait reads them (lib/browserSteps.js PAGE_WORDS_JS): its own text, our fields' line, then each field's value · +// placeholder · label +const withFields = (text, fields = ['1234 5678 9012 3456 카드 번호']) => `${text}\n${WORDS_FIELDS}\n${fields.join('\n')}` + +test('WB-U-01 상태가 800자 뒤에 있는 긴 페이지: 벽 판정의 상태에는 없지만(원인) 기다림 판정의 상태에는 그 표시 줄이 있다', () => { + assert.ok(panelText.indexOf(STATUS) > 2000, '표시는 2000자 뒤에 있다') + // the cause: the wall check's view stops at the first 800 characters + assert.ok(!browser.wallState(panelSnap(), '슬라이드 만들기').includes(STATUS)) + // gone_text: the line of the page that holds it — the status the page shows + const gone = browser.busyState(panelSnap(), '슬라이드 만들기', { gone: '생성 중' }) + assert.match(gone, /Where the words waited for are on the page now:\n슬라이드 자료 생성 중\.\.\./) + assert.match(gone, /The agent waits until: "생성 중" is no longer on the page$/) + // without words (or words not on the page yet): the end of the text carries it + for (const o of [{}, { until: '소스 1개' }]) { + const st = browser.busyState(panelSnap(), '슬라이드 만들기', o) + assert.match(st, /Page text \(end\):\n[^]*슬라이드 자료 생성 중\.\.\./, JSON.stringify(o)) + assert.ok(!/Where the words waited for/.test(st), JSON.stringify(o)) + } + // the start of the text is still there, as long as the wall check's + assert.ok(browser.busyState(panelSnap(), '', {}).includes(`Visible text (start):\n${panelText.slice(0, 800)}`)) +}) + +test('WB-U-02 화면 글이 잘려 상태가 없어도: 기다리는 말이 든 줄은 페이지 전체의 말에서 찾는다 · 긴 줄은 그 말 둘레만', () => { + // the snapshot was cut before the studio panel; the wait's own words (pageWords) are the whole page + const cut = panelSnap(panelText.slice(0, panelText.indexOf('스튜디오'))) + assert.ok(!browser.busyState(cut, '', { gone: '생성 중' }).includes(STATUS)) + const st = browser.busyState(cut, '', { gone: '생성 중', words: withFields(panelText) }) + assert.match(st, /Where the words waited for are on the page now:\n슬라이드 자료 생성 중\.\.\./) + // (the page's end too — not the snapshot's, which was cut) + assert.match(st, /Page text \(end\):\n[^]*슬라이드 자료 생성 중\.\.\./) + // one long line holding the words: only the part around them, at most BUSY_TEXT.width (and the … marks) + const long = `${'가'.repeat(900)} 보고서 생성 중 ${'나'.repeat(900)}` + const line = browser.busyState(panelSnap('짧은 글'), '', { gone: '보고서 생성 중', words: withFields(long) }).split('Where the words waited for are on the page now:\n')[1].split('\n')[0] + assert.ok(line.includes('보고서 생성 중')) + assert.ok(line.length <= browser.BUSY_TEXT.width + 2, `${line.length}`) + assert.ok(line.startsWith('…') && line.endsWith('…')) + // at most BUSY_TEXT.lines lines, the same line once — the first half and the last half by page order (the status of a page of panels is + // usually last: an answer or a source name with the same words may come many times before it — independent review of #197) + const many = Array.from({ length: 20 }, (_, i) => `항목 ${i % 10} 생성 중`).join('\n') + const lines = browser.busyState(panelSnap('짧은 글'), '', { gone: '생성 중', words: withFields(many) }).split('Where the words waited for are on the page now:\n')[1].split('\nThe agent waits until')[0].split('\n') + assert.equal(lines.length, browser.BUSY_TEXT.lines) + assert.equal(new Set(lines).size, lines.length) + assert.deepEqual([lines[0], lines.at(-1)], ['항목 0 생성 중', '항목 9 생성 중']) +}) + +// ---- real Chromium: the wait on the studio panel's status ---- + +test('WB-I-01 스튜디오 칸 끝의 「슬라이드 자료 생성 중...」(gone_text 「생성 중」): 판정이 그 줄을 보고 기다리며, 표시가 사라지면 끝난다', async () => { + busyAsked.length = 0 + let told = '' + const t0 = Date.now() + const r = await run('슬라이드 기다리기', [ + ['wait_for_page', { minutes: 1, gone_text: '생성 중' }], + (b) => { told = lastTool(b); return ['finish', { summary: '슬라이드가 만들어졌어요.' }] }, + ], `${site.url}panels?ms=6000`) + assert.equal(r.state, 'done', JSON.stringify(r).slice(0, 400)) + assert.match(told, /^done: "생성 중" is no longer on the page/, told) + assert.equal(busyAsked.length, 1) + assert.ok(busyAsked[0].includes(`Where the words waited for are on the page now:\n${STATUS}`), busyAsked[0]) + assert.equal(r.stats.waits_refused, 0) + assert.ok(Date.now() - t0 < 30_000, `${Date.now() - t0}ms`) +}) + +test('WB-I-02 나타날 말(until_text)을 기다릴 때: 그 말은 아직 없어도 글의 끝에 있는 표시를 판정이 본다', async () => { + busyAsked.length = 0 + let told = '' + const r = await run('슬라이드 항목 기다리기', [ + ['wait_for_page', { minutes: 1, until_text: '소스 1개' }], + (b) => { told = lastTool(b); return ['finish', { summary: '슬라이드 항목이 생겼어요.' }] }, + ], `${site.url}panels?ms=6000`) + assert.equal(r.state, 'done', JSON.stringify(r).slice(0, 400)) + assert.match(told, /^done: "소스 1개" is on the page now/, told) + assert.equal(busyAsked.length, 1) + assert.match(busyAsked[0], /Page text \(end\):\n[^]*슬라이드 자료 생성 중\.\.\./) + assert.equal(r.stats.waits_refused, 0) +}) + +// ---- refused waits and the budget of actions (BLOCK = 40) ---- + +const refusedThenNotes = (waits, notes) => [ + ...Array.from({ length: waits }, () => ['wait_for_page', { minutes: 1 }]), + ...Array.from({ length: notes }, (_, i) => ['note', { text: `메모 ${i + 1}` }]), + ['finish', { summary: '끝냈어요.' }], +] + +test('WB-I-03 판정이 거절한 기다림은 동작 수를 쓰지 않는다 — 작업마다 REFUSED_WAITS.free 번까지', async () => { + browser.REFUSED_WAITS.free = 3 + try { + // 5 refused waits (3 free, 2 counted) + 37 notes + finish = 40 counted actions: within the budget + const r = await run('거절된 기다림은 세지 않음', refusedThenNotes(5, 37), `${site.url}panels?idle=1`) + assert.equal(r.state, 'done', JSON.stringify(r).slice(0, 300)) + assert.equal(r.stats.waits_refused, 5) + assert.equal(r.stats.waits_free, 3) + assert.equal(r.stats.turns, 43) + } finally { browser.REFUSED_WAITS.free = keepFree } +}) + +test('WB-I-04 거절된 기다림이 한도를 넘으면 다시 센다: 동작 한도로 멈춘다', async () => { + browser.REFUSED_WAITS.free = 3 + try { + // 5 refused waits (3 free, 2 counted) + 38 notes + finish = 41 counted: the budget runs out before finish + const r = await run('거절된 기다림 한도', refusedThenNotes(5, 38), `${site.url}panels?idle=1`) + assert.equal(r.state, 'needs_review', JSON.stringify(r).slice(0, 300)) + assert.equal(r.need, 'limit') + assert.equal(r.stats.waits_refused, 5) + assert.equal(r.stats.waits_free, 3) + assert.equal(r.stats.turns, 43, '3 free + 40 counted') + } finally { browser.REFUSED_WAITS.free = keepFree } +}) + +test('WB-U-03 칸에 쓴 값은 판정에 가지 않는다 — 기다리는 말이 칸의 이름이어도, 그 줄은 페이지의 글에서만 찾는다 · 칸의 줄이 없는 예전 PC 앱은 스냅숏의 글만', () => { + // the person typed a card number by hand into a field named 「카드 번호」 (not a vault value — not marked secret); the agent waits for it to go + const words = withFields('결제 정보\n카드 번호를 넣어 주세요\n다음', ['1234 5678 9012 3456 카드 번호']) + const st = browser.busyState(panelSnap('결제 정보\n카드 번호를 넣어 주세요\n다음'), '결제하기', { gone: '카드 번호', words }) + assert.ok(!st.includes('1234'), st) + assert.match(st, /Where the words waited for are on the page now:\n카드 번호를 넣어 주세요/) + // the words of a PC app that does not write the fields' line yet: none of them — the snapshot's text only + const old = browser.busyState(panelSnap('결제 정보'), '', { gone: '카드 번호', words: '결제 정보\n1234 5678 9012 3456 카드 번호' }) + assert.ok(!old.includes('1234'), old) + // the line is the page script's own (written into its source — the desktop app's copy is checked against it: browserDriver.test.js) + assert.ok(String(PAGE_WORDS_JS).includes('\\u2063pgl-fields\\u2063')) + assert.equal(WORDS_FIELDS, '\u2063pgl-fields\u2063') +}) + +test('WB-I-05 3,000자가 넘는 페이지: 스냅숏이 멈춘 뒤에 있는 진행 표시도 페이지 글의 끝으로 판정이 본다(나타날 말을 기다릴 때)', async () => { + busyAsked.length = 0 + let told = '' + const r = await run('긴 노트북 슬라이드 기다리기', [ + ['wait_for_page', { minutes: 1, until_text: '소스 1개' }], + (b) => { told = lastTool(b); return ['finish', { summary: '슬라이드 항목이 생겼어요.' }] }, + ], `${site.url}panels?ms=6000&long=1`) + assert.equal(r.state, 'done', JSON.stringify(r).slice(0, 400)) + assert.match(told, /^done: "소스 1개" is on the page now/, told) + assert.equal(busyAsked.length, 1) + assert.match(busyAsked[0], /Page text \(end\):\n[^]*슬라이드 자료 생성 중\.\.\./) + assert.equal(r.stats.waits_refused, 0) +}) + diff --git a/server/test/fixtures/studio.mjs b/server/test/fixtures/studio.mjs index 82c251d7..c37fcea4 100644 --- a/server/test/fixtures/studio.mjs +++ b/server/test/fixtures/studio.mjs @@ -25,9 +25,25 @@ function start(){ const s=document.getElementById('state'); s.textContent='생 setTimeout(()=>{ s.textContent='완료'; document.getElementById('done').innerHTML='다운로드' }, wait) } ` +// /panels?ms=…: a notebook of three panels like NotebookLM's (made up — no real service, no real names): sources on the left, a long +// summary in the middle (more than 2,000 characters: the summary fills the start of the page text), the studio panel last. Its status +// 「슬라이드 자료 생성 중...」 goes after ms and the slides show as an item 「슬라이드 자료 · 소스 1개」 (2026-12-02 production: the +// status after the long summary never reached the busy check). /panels?idle=1: the same notebook with nothing being made. /panels?long=1: +// the summary three times over (more than 3,000 characters — past where the agent's snapshot of the page stops). +export const SUMMARY = Array.from({ length: 28 }, (_, i) => `요약 ${i + 1}. 가상의 분기 회의록을 바탕으로 일정과 예산, 맡은 팀의 역할을 차례로 정리했습니다. 이 글은 시험용으로 지어낸 것입니다.`).join(' ') +const PANELS = (idle, long = false) => `가상 노트북 - 노트 스튜디오 + +

출처

분기 회의록 메모.pdf
+

가상 분기 회의 노트북

${long ? [SUMMARY, SUMMARY, SUMMARY].join(' ') : SUMMARY}

+ + +` + export async function startStudio() { const server = http.createServer((req, res) => { if (req.url.startsWith('/report.pdf')) { res.writeHead(200, { 'Content-Type': 'application/pdf', 'Content-Disposition': 'attachment' }); return res.end('%PDF-1.4 studio test') } + if (req.url.startsWith('/panels')) { res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' }); return res.end(PANELS(/[?&]idle=1/.test(req.url), /[?&]long=1/.test(req.url))) } res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' }); res.end(PAGE) }) await new Promise((r) => server.listen(0, '127.0.0.1', r)) diff --git a/skills/notebooklm/SKILL.md b/skills/notebooklm/SKILL.md index a07fbece..71c86cee 100644 --- a/skills/notebooklm/SKILL.md +++ b/skills/notebooklm/SKILL.md @@ -38,7 +38,7 @@ metadata: - 하나에 몇 분씩 걸린다. tell_user 로 무엇을 시작했고 시간이 걸린다는 것을 알린 뒤, 필요하면 여러 번 wait_for_page 로 기다린다. 둘 다 끝나기 전에는 떠나지 않고, 느리다고 다시 시작하지 않는다. ## 받기 -- 다 되면 스튜디오 칸의 만들기 단추들 아래에 항목으로 보인다(슬라이드 자료, 오디오 오버뷰 — 오디오는 길이와 「딥 다이브」 같은 형식이 함께 적혀 있다). 아직 만드는 중인 항목은 「생성 중」 같은 표시가 있으니 wait_for_page 로 기다린다. +- 다 되면 스튜디오 칸의 만들기 단추들 아래에 항목으로 보인다(슬라이드 자료, 오디오 오버뷰 — 오디오는 길이와 「딥 다이브」 같은 형식이 함께 적혀 있다). 아직 만드는 중인 항목은 「슬라이드 자료 생성 중...」처럼 「… 생성 중」 표시가 있으니 wait_for_page로 기다린다. gone_text에는 그 항목에 보이는 표시를 화면에 보이는 그대로 주고(끝의 점은 빼고 「슬라이드 자료 생성 중」), minutes는 5쯤으로 한다. 짧게 여러 번 기다리지 않는다. - 항목마다 오른쪽 끝에 메뉴 단추(⋮)가 있다. 요소 목록에는 아이콘 이름 more_vert(또는 「더보기」)로 보인다. 그 단추를 누르면 공유 · 이름 바꾸기 · 다운로드 · … 메뉴가 열리고, 거기서 「다운로드」를 누른다. 받은 파일은 저절로 사람에게 간다. - 항목 이름을 누르면 그 자료가 열리거나(슬라이드) 아래에 재생기가 나올(오디오) 뿐 받아지지 않는다. 다운로드 단추는 화면을 내려도 나오지 않는다 — 내리지 말고 그 항목의 메뉴 단추(more_vert)를 누른다. - 슬라이드와 오디오를 하나씩 따로 받는다. 둘 다 받은 뒤 끝낸다. 하나만 받고 끝내면 사람은 나머지를 받지 못한다.