@nostop/page 0.0.0-stage → 0.1.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Alibaba Group Holding Limited
4
+ Copyright (c) 2026 nostop
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,140 @@
1
- # Temporary Holding Version
1
+ # Page Agent (fork local)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Agente de IA que opera a página em que está instalado: lê o texto e os elementos clicáveis, decide uma ação e executa, passo a passo, até concluir a tarefa. Este README resume **todas as camadas de customização** disponíveis, do mais simples ao mais avançado.
4
+
5
+ > Documentação original do projeto: https://alibaba.github.io/page-agent/ (o repositório original foi removido deste fork; os nomes abaixo são os da versão atual do código).
6
+
7
+ ## Mapa do projeto
8
+
9
+ | Pasta | O que faz | Quando mexer |
10
+ | -------------------------------------------- | --------------------------------------------------------------------- | ----------------------------------------- |
11
+ | `packages/core` | Ciclo do agente: passos, histórico, ferramentas, prompts | Quase nunca. Só com autorização explícita |
12
+ | `packages/core/src/prompts/system_prompt.md` | Prompt de sistema padrão (regras gerais do agente) | Preferir `instructions.system` |
13
+ | `packages/llms` | Cliente LLM compatível com OpenAI, com retentativas | Raramente |
14
+ | `packages/page-controller` | Leitura da página (DOM simplificado) e ações (clicar, digitar, rolar) | Para regras de extração e de bloqueio |
15
+ | `packages/page-controller/src/mask` | Overlay visual: brilho de borda e cursor do agente | Para aparência |
16
+ | `packages/ui` | Painel (conversa, ferramentas, voz, trilho, cartão de prévia) | Para interface |
17
+ | `packages/page-agent` | Classe `PageAgent` (núcleo + painel) e o bundle da demo | Ponto de entrada para integrar |
18
+ | `packages/website` | Site de documentação do projeto original | Opcional |
19
+ | `packages/extension` | Extensão do Chrome | Opcional |
20
+ | `packages/mcp` | Ponte MCP para a extensão | Opcional |
21
+
22
+ ## Uso básico
23
+
24
+ ```ts
25
+ import { PageAgent } from 'page-agent'
26
+
27
+ const agent = new PageAgent({
28
+ model: 'gpt-4o-mini',
29
+ baseURL: 'https://api.openai.com/v1', // ou o seu proxy
30
+ apiKey: 'sk-...', // em produção, use um proxy; nunca exponha a chave
31
+ language: 'pt-BR', // 'pt-BR' ou 'en-US'
32
+ })
33
+
34
+ agent.panel.show()
35
+ await agent.execute('Vá até o rodapé e pare quando não houver mais conteúdo abaixo.')
36
+ ```
37
+
38
+ Na demo, a mesma configuração vem dos parâmetros da URL do script (`model`, `baseURL`, `apiKey`, `lang`, `showPanel`).
39
+
40
+ ## Camadas de customização
41
+
42
+ Cada camada abaixo pode ser usada sozinha. Elas vão de "configurar" a "substituir".
43
+
44
+ ### Camada 1: configuração básica
45
+
46
+ | Opção | Efeito |
47
+ | ---------------------------- | ------------------------------------------------------------------------------------ |
48
+ | `model`, `baseURL`, `apiKey` | Modelo e endpoint compatível com OpenAI |
49
+ | `language` | Idioma da interface e do prompt de trabalho (`pt-BR` ou `en-US`; outros usam inglês) |
50
+ | `maxSteps` | Limite de passos por tarefa. Evita loops longos |
51
+
52
+ ### Camada 2: instruções (a forma recomendada de guiar o agente)
53
+
54
+ - **`instructions.system`**: regras aplicadas a todas as tarefas. Entra no prompt sem substituir o prompt padrão.
55
+ - **`instructions.getPageInstructions(url)`**: regras que mudam conforme a página (retorna texto ou `null`).
56
+
57
+ Exemplo usado no Aferis: regras de critério de parada, proibição de afirmar verificação visual (o agente lê texto, não imagem) e idioma da memória. Arquivo: `frontend/src/dev/page-agent/instructions.ts`.
58
+
59
+ ### Camada 3: privacidade e conteúdo
60
+
61
+ - **`transformPageContent(content)`**: transforma o texto da página antes de ir ao modelo. Use para mascarar CPF, CNPJ, e-mail e telefone.
62
+
63
+ ### Camada 4: ferramentas
64
+
65
+ - **`customTools`**: adiciona ferramentas próprias ou substitui as existentes. Definir uma chave como `null` remove a ferramenta correspondente (por exemplo, `ask_user`).
66
+ - Ferramenta de script (`execute_javascript`): ligada por padrão, executa JavaScript gerado pelo agente na página. Para remover, use `experimentalScriptExecutionTool: false`. É experimental e pode ter efeitos colaterais.
67
+
68
+ ### Camada 5: controle de ações e extração da página
69
+
70
+ - **`interactiveBlacklist` / `interactiveWhitelist`** (controlador de página): impedem o agente de mexer em certos elementos, ou limitam a uma lista fixa.
71
+ - **`includeAttributes`**: inclui atributos HTML extras na leitura (aceita curingas, como `data-*`).
72
+ - **`keepSemanticTags`**: mantém `nav`, `main`, `footer` etc. na leitura, mesmo sem serem clicáveis.
73
+ - **`experimentalLlmsTxt`**: envia o `/llms.txt` do site como contexto (experimental).
74
+ - **`enableMask`** e `hideMask()`: liga ou desliga o overlay visual durante a execução.
75
+
76
+ ### Camada 6: prompt completo (use com cuidado)
77
+
78
+ - **`customSystemPrompt`**: texto somado ao fim do prompt de sistema interno, que é mantido inteiro.
79
+ - **`overrideSystemPrompt: true`** (padrão `false`): faz o `customSystemPrompt` substituir o prompt interno. Perde as regras padrão de fábrica; é experimental.
80
+ - Na voz vale a mesma regra: `voice.systemPrompt` é somado ao prompt padrão da voz, e só o substitui com `voice.overrideSystemPrompt: true`.
81
+
82
+ ### Camada 7: ciclo de vida (hooks)
83
+
84
+ - `onBeforeTask`, `onAfterTask`, `onBeforeStep`, `onAfterStep`, `onDispose`.
85
+ - São experimentais. **Um erro dentro de um hook faz a tarefa falhar**: capture erros dentro do hook quando não quiser esse efeito.
86
+
87
+ ### Camada 8: perguntas ao usuário
88
+
89
+ - **`agent.onAskUser(question, { signal })`**: o agente pede uma resposta. Quando `signal` é abortado (parada ou fechamento), a promessa deve ser rejeitada.
90
+
91
+ ### Camada 9: interface
92
+
93
+ - **Painel** (`PanelConfig`): `name` (padrão `NoStop`), `language`, `promptForNextTask`.
94
+ - **Recursos já prontos:** arrastar pelo cabeçalho (posição guardada), recolher, botão do cursor (◎), botão flutuante quando fechado, troca para voz com controle de microfone (pede permissão e libera o microfone ao silenciar), trilho com marcas por tarefa, cartão de prévia com trecho e marcador de fixar, histórico de tarefas anteriores na tela e **Exportar log** (texto compacto por passo).
95
+ - **Logo:** usa o favicon do próprio site; se não houver, usa o símbolo padrão.
96
+ - **Sem painel:** use `PageAgentCore` com a sua própria interface, ouvindo os eventos `statuschange`, `historychange` e `activity`.
97
+
98
+ ### Camada 10: rede e provedor
99
+
100
+ - **`customFetch`**: função `fetch` própria, para cabeçalhos, credenciais, proxy.
101
+ - **`disableNamedToolChoice`**: para provedores que não aceitam o formato de escolha de ferramenta por nome.
102
+
103
+ ### Camada 11: ambiente sem navegador
104
+
105
+ - **`PageController` próprio**: para rodar com Puppeteer ou Playwright, implementando os métodos que o agente usa (leitura do estado, clicar, digitar, selecionar, rolar).
106
+
107
+ ## Eventos úteis
108
+
109
+ | Evento | Quando | Persistência |
110
+ | --------------- | --------------------------------------------------------- | ------------------------------ |
111
+ | `statuschange` | Muda `idle`, `running`, `completed`, `error` ou `stopped` | — |
112
+ | `historychange` | Um passo, observação ou erro entrou no histórico | Persistido em `agent.history` |
113
+ | `activity` | `thinking`, `executing`, `executed`, `retrying`, `error` | Transitório; não vai ao modelo |
114
+ | `dispose` | O agente foi destruído | — |
115
+
116
+ ## Segurança
117
+
118
+ - A chave `apiKey` no navegador fica exposta a quem abre a página. Em produção, use um proxy no servidor.
119
+ - Para dados sensíveis, use `transformPageContent` antes de chegar ao modelo.
120
+ - Liste operações de alto risco nas instruções: proíba-as ou exija confirmação do usuário.
121
+ - Pedidos com critério de parada explícito terminam antes e custam menos. Pedidos vagos (como "desce mais") podem percorrer a página inteira.
122
+
123
+ ## Testes e build
124
+
125
+ ```bash
126
+ npm run ci # lint, formatação, tipos, testes e build
127
+ npm test # testes unitários
128
+ npm run build:demo --workspace=@nostop/page # bundle da demo (dist/iife)
129
+ ```
130
+
131
+ ## Pontos de atenção deste fork
132
+
133
+ - A pasta `website` e a extensão são produtos separados; o agente não depende deles.
134
+ - O prompt padrão está em inglês; a memória do agente pode misturar idiomas se o pedido não for claro. Use `instructions.system` para fixar o idioma da memória.
135
+ - Cada tarefa começa do zero para o modelo: o histórico de tarefas anteriores é só visual no painel.
136
+ - Recursos de voz dependem de um motor de voz que não está incluído neste repositório.
137
+
138
+ ## Licença
139
+
140
+ Este fork não inclui arquivo de licença. A licença do projeto original deve ser conferida na origem antes de qualquer distribuição.
@@ -0,0 +1,39 @@
1
+ import { AccessibilityConfig } from '@page-agent/page-controller';
2
+ import { AccessibilityController } from '@page-agent/page-controller';
3
+ import { AgentConfig } from '@page-agent/core';
4
+ import { AxError } from '@page-agent/page-controller';
5
+ import { AxErrorCode } from '@page-agent/page-controller';
6
+ import { PageAgentCore } from '@page-agent/core';
7
+ import { PageControllerConfig } from '@page-agent/page-controller';
8
+ import { Panel } from '@page-agent/ui';
9
+ import { PanelConfig } from '@page-agent/ui';
10
+
11
+ export { AccessibilityConfig }
12
+
13
+ export { AccessibilityController }
14
+
15
+ export { AxError }
16
+
17
+ export { AxErrorCode }
18
+
19
+ export declare class PageAgent extends PageAgentCore {
20
+ #private;
21
+ panel: Panel;
22
+ constructor(config: PageAgentConfig);
23
+ }
24
+
25
+ export declare type PageAgentConfig = AgentConfig & PageControllerConfig & Omit<PanelConfig, 'language'>;
26
+
27
+
28
+ export * from "@page-agent/core";
29
+
30
+ export { }
31
+
32
+
33
+
34
+ declare global {
35
+ interface Window {
36
+ pageAgent?: PageAgent
37
+ PageAgent: typeof PageAgent
38
+ }
39
+ }
@@ -0,0 +1,330 @@
1
+ (function() { try { if (typeof document != "undefined") { var elementStyle = document.createElement("style"); elementStyle.appendChild(document.createTextNode("._wrapper_1nr74_1 {\n position: fixed;\n inset: 0;\n z-index: 2147483641; /* 确保在所有元素之上,除了 panel */\n cursor: wait;\n overflow: hidden;\n\n display: none;\n}\n\n._wrapper_1nr74_1._visible_1nr74_11 {\n display: block;\n}\n\n/* The site's strongest colour, with the previous accent as the fallback for a site without one. */\n._wrapper_1nr74_1 {\n --pa-glow: var(--pa-accent, #fa8d45);\n --pa-glow-ring: 50%;\n --pa-glow-near: 16%;\n --pa-glow-far: 6%;\n}\n\n/* A colour shows more against a dark page, so it needs less. */\n._wrapper_1nr74_1[data-theme='dark'] {\n --pa-glow-ring: 42%;\n --pa-glow-near: 13%;\n --pa-glow-far: 5%;\n}\n\n._glow_1nr74_30 {\n position: absolute;\n inset: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.4s ease;\n /* Same shape as before; the colour comes from the site (set by SimulatorMask) and is kept faint,\n so the glow reads as a focus ring of the site itself rather than as a foreign frame. */\n box-shadow:\n inset 0 0 0 2px color-mix(in srgb, var(--pa-glow) var(--pa-glow-ring), transparent),\n inset 0 0 42px 8px color-mix(in srgb, var(--pa-glow) var(--pa-glow-near), transparent),\n inset 0 0 100px 22px color-mix(in srgb, var(--pa-glow) var(--pa-glow-far), transparent);\n}\n\n._glowVisible_1nr74_44 {\n opacity: 1;\n}\n\n/* Progress bar shown while the page is being read. Reading blocks the page's main thread, so the bar\n moves with transform only: the browser's compositor keeps it going while scripts cannot run. */\n._progress_1nr74_50 {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 3px;\n overflow: hidden;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.3s ease;\n background: color-mix(in srgb, var(--pa-glow) 14%, transparent);\n}\n\n._progressActive_1nr74_63 {\n opacity: 1;\n transition-duration: 0.12s;\n}\n\n._progressBar_1nr74_68 {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 45%;\n border-radius: 3px;\n transform: translateX(-110%);\n will-change: transform;\n background: linear-gradient(\n 90deg,\n transparent,\n color-mix(in srgb, var(--pa-glow) 85%, transparent) 35%,\n color-mix(in srgb, var(--pa-glow) 60%, white) 65%,\n transparent\n );\n filter: drop-shadow(0 0 6px color-mix(in srgb, var(--pa-glow) 70%, transparent));\n}\n\n._progressBarLate_1nr74_87 {\n width: 25%;\n}\n\n._progressActive_1nr74_63 ._progressBar_1nr74_68 {\n animation: _progressSlide_1nr74_1 1.25s cubic-bezier(0.45, 0, 0.25, 1) infinite;\n}\n\n._progressActive_1nr74_63 ._progressBarLate_1nr74_87 {\n animation-duration: 1.25s;\n animation-delay: 0.5s;\n animation-timing-function: cubic-bezier(0.3, 0, 0.6, 1);\n}\n\n@keyframes _progressSlide_1nr74_1 {\n from {\n transform: translateX(-110%);\n }\n to {\n transform: translateX(330%);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n ._glow_1nr74_30 {\n transition: none;\n }\n\n /* A steady bar instead of a moving one. */\n ._progressActive_1nr74_63 ._progressBar_1nr74_68 {\n animation: none;\n width: 100%;\n transform: none;\n opacity: 0.6;\n }\n\n ._progressActive_1nr74_63 ._progressBarLate_1nr74_87 {\n display: none;\n }\n}\n/* AI 光标样式 */\n._cursor_20vi4_2 {\n position: absolute;\n width: var(--cursor-size, 21px);\n height: var(--cursor-size, 25px);\n pointer-events: none;\n z-index: 10000;\n background: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 28'%3E%3Cpath d='M3 2v20l5.5-5 3.9 8 3-1.5-4-7.8L19 15z' fill='%23f28a46' stroke='%23171715' stroke-width='1.7' stroke-linejoin='round'/%3E%3C/svg%3E\")\n center / contain no-repeat;\n filter: drop-shadow(0 2px 2px #0005);\n}\n\n._cursorFilling_20vi4_13,\n._cursorBorder_20vi4_14 {\n display: none;\n}\n\n._cursorBorder_20vi4_14 {\n position: absolute;\n width: 100%;\n height: 100%;\n background: linear-gradient(45deg, rgb(57, 182, 255), rgb(189, 69, 251));\n mask-image: url(\"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20fill='none'%3e%3cg%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='none'%20stroke='%23000000'%20stroke-width='6'%20stroke-miterlimit='10'%20style='stroke:%20light-dark(rgb(0,%200,%200),%20rgb(255,%20255,%20255));'/%3e%3c/g%3e%3c/svg%3e\");\n mask-size: 100% 100%;\n mask-repeat: no-repeat;\n\n transform-origin: center;\n transform: rotate(-135deg) scale(1.2);\n margin-left: -10px;\n margin-top: -18px;\n}\n\n._cursorFilling_20vi4_13 {\n position: absolute;\n width: 100%;\n height: 100%;\n background: url(\"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%3e%3cdefs%3e%3c/defs%3e%3cg%20xmlns='http://www.w3.org/2000/svg'%20style='filter:%20drop-shadow(light-dark(rgba(0,%200,%200,%200.4),%20rgba(237,%20237,%20237,%200.4))%203px%204px%204px);'%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='%23ffffff'%20stroke='none'%20style='fill:%20%23ffffff;'/%3e%3c/g%3e%3c/svg%3e\");\n background-size: 100% 100%;\n background-repeat: no-repeat;\n\n transform-origin: center;\n transform: rotate(-135deg) scale(1.2);\n margin-left: -10px;\n margin-top: -18px;\n}\n\n._cursorRipple_20vi4_47 {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n margin-left: -50%;\n margin-top: -50%;\n\n &::after {\n content: '';\n opacity: 0;\n position: absolute;\n inset: 0;\n border: 4px solid rgba(57, 182, 255, 1);\n border-radius: 50%;\n }\n}\n\n._cursor_20vi4_2._clicking_20vi4_65 ._cursorRipple_20vi4_47::after {\n animation: _cursor-ripple_20vi4_1 300ms ease-out forwards;\n}\n\n@keyframes _cursor-ripple_20vi4_1 {\n 0% {\n transform: scale(0);\n opacity: 1;\n }\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n\n/* Panel button \"Hide agent cursor\": only the drawing disappears; the run continues. */\nhtml[data-pa-cursor-hidden] ._cursor_20vi4_2 {\n display: none !important;\n}")); document.head.appendChild(elementStyle); } } catch (e) { console.error("vite-plugin-css-injected-by-js", e); }})();
2
+ //#region ../page-controller/src/mask/siteColor.ts
3
+ /** How vivid a colour is, 0 (grey) to 255 (pure hue). */
4
+ function chroma({ r, g, b }) {
5
+ return Math.max(r, g, b) - Math.min(r, g, b);
6
+ }
7
+ /** Relative luminance, 0 (black) to 1 (white). */
8
+ function luminance({ r, g, b }) {
9
+ const channel = (value) => {
10
+ const c = value / 255;
11
+ return c <= .03928 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4;
12
+ };
13
+ return .2126 * channel(r) + .7152 * channel(g) + .0722 * channel(b);
14
+ }
15
+ var MIN_CHROMA = 48;
16
+ var MIN_ALPHA = .5;
17
+ /**
18
+ * The strongest colour among the samples: similar colours are pooled, and the pool with the most
19
+ * weighted vividness wins. Greys and mostly transparent colours never win. Null when the page has
20
+ * no colour to speak of.
21
+ */
22
+ function pickStrongestColor(samples) {
23
+ const pools = /* @__PURE__ */ new Map();
24
+ for (const { color, weight } of samples) {
25
+ if (weight <= 0 || color.a < MIN_ALPHA || chroma(color) < MIN_CHROMA) continue;
26
+ const key = color.r >> 5 << 6 | color.g >> 5 << 3 | color.b >> 5;
27
+ const pool = pools.get(key) ?? {
28
+ score: 0,
29
+ weight: 0,
30
+ r: 0,
31
+ g: 0,
32
+ b: 0
33
+ };
34
+ pool.score += weight * (chroma(color) / 255);
35
+ pool.weight += weight;
36
+ pool.r += color.r * weight;
37
+ pool.g += color.g * weight;
38
+ pool.b += color.b * weight;
39
+ pools.set(key, pool);
40
+ }
41
+ let best = null;
42
+ for (const pool of pools.values()) if (!best || pool.score > best.score) best = pool;
43
+ if (!best) return null;
44
+ return {
45
+ r: Math.round(best.r / best.weight),
46
+ g: Math.round(best.g / best.weight),
47
+ b: Math.round(best.b / best.weight),
48
+ a: 1
49
+ };
50
+ }
51
+ var CANDIDATES = "a[href], button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"], h1, h2, [aria-current], [aria-selected=\"true\"]";
52
+ var MAX_CANDIDATES = 200;
53
+ var ROOT_VARIABLES = [
54
+ "--primary",
55
+ "--color-primary",
56
+ "--accent",
57
+ "--color-accent",
58
+ "--brand"
59
+ ];
60
+ /** Reads any CSS colour the browser understands (`oklch()`, `color-mix()`, names) as sRGB. */
61
+ function createColorReader(doc) {
62
+ const context = doc.createElement("canvas").getContext("2d", { willReadFrequently: true });
63
+ return (css) => {
64
+ if (!context || !css || css === "transparent") return null;
65
+ context.clearRect(0, 0, 1, 1);
66
+ context.fillStyle = "#000";
67
+ context.fillStyle = css;
68
+ context.fillRect(0, 0, 1, 1);
69
+ const [r, g, b, a] = context.getImageData(0, 0, 1, 1).data;
70
+ return {
71
+ r,
72
+ g,
73
+ b,
74
+ a: a / 255
75
+ };
76
+ };
77
+ }
78
+ /**
79
+ * Samples the colours of the page's links, buttons and headings, its `accent-color`, its theme
80
+ * colour and common theme variables. It reads computed styles of at most a couple of hundred
81
+ * elements and changes nothing.
82
+ */
83
+ function detectSiteAppearance(doc = document) {
84
+ const view = doc.defaultView;
85
+ if (!view) return {
86
+ accent: null,
87
+ dark: false
88
+ };
89
+ const read = createColorReader(doc);
90
+ const samples = [];
91
+ const add = (css, weight) => {
92
+ const color = css ? read(css) : null;
93
+ if (color) samples.push({
94
+ color,
95
+ weight
96
+ });
97
+ };
98
+ const rootStyle = view.getComputedStyle(doc.documentElement);
99
+ if (rootStyle.accentColor && rootStyle.accentColor !== "auto") add(rootStyle.accentColor, 8);
100
+ add(doc.querySelector("meta[name=\"theme-color\"]")?.content, 6);
101
+ for (const name of ROOT_VARIABLES) add(rootStyle.getPropertyValue(name).trim(), 6);
102
+ let seen = 0;
103
+ for (const element of doc.querySelectorAll(CANDIDATES)) {
104
+ if (seen >= MAX_CANDIDATES) break;
105
+ if (element.closest("[data-page-agent-ignore]")) continue;
106
+ const rect = element.getBoundingClientRect();
107
+ if (rect.width === 0 || rect.height === 0) continue;
108
+ seen++;
109
+ const style = view.getComputedStyle(element);
110
+ add(style.backgroundColor, Math.min(12, Math.max(1, rect.width * rect.height / 2e3)));
111
+ add(style.color, element.localName === "a" ? 2 : 1);
112
+ if (style.borderTopWidth !== "0px") add(style.borderTopColor, .5);
113
+ }
114
+ let background = null;
115
+ for (const element of [doc.body, doc.documentElement]) {
116
+ const color = element ? read(view.getComputedStyle(element).backgroundColor) : null;
117
+ if (color && color.a > .5) {
118
+ background = color;
119
+ break;
120
+ }
121
+ }
122
+ const accent = pickStrongestColor(samples);
123
+ return {
124
+ accent: accent ? `rgb(${accent.r} ${accent.g} ${accent.b})` : null,
125
+ dark: background ? luminance(background) < .35 : false
126
+ };
127
+ }
128
+ var SimulatorMask_module_default = {
129
+ wrapper: "_wrapper_1nr74_1",
130
+ visible: "_visible_1nr74_11",
131
+ glow: "_glow_1nr74_30",
132
+ glowVisible: "_glowVisible_1nr74_44",
133
+ progress: "_progress_1nr74_50",
134
+ progressActive: "_progressActive_1nr74_63",
135
+ progressBar: "_progressBar_1nr74_68",
136
+ progressBarLate: "_progressBarLate_1nr74_87",
137
+ progressSlide: "_progressSlide_1nr74_1"
138
+ };
139
+ var cursor_module_default = {
140
+ cursor: "_cursor_20vi4_2",
141
+ cursorFilling: "_cursorFilling_20vi4_13",
142
+ cursorBorder: "_cursorBorder_20vi4_14",
143
+ cursorRipple: "_cursorRipple_20vi4_47",
144
+ clicking: "_clicking_20vi4_65",
145
+ "cursor-ripple": "_cursor-ripple_20vi4_1"
146
+ };
147
+ //#endregion
148
+ //#region ../page-controller/src/mask/SimulatorMask.ts
149
+ var SimulatorMask = class extends EventTarget {
150
+ shown = false;
151
+ wrapper = document.createElement("div");
152
+ glow = document.createElement("div");
153
+ /** Bar at the top edge, moving while the page is being read. */
154
+ progress = document.createElement("div");
155
+ #disposed = false;
156
+ #cursor = document.createElement("div");
157
+ #currentCursorX = 0;
158
+ #currentCursorY = 0;
159
+ #targetCursorX = 0;
160
+ #targetCursorY = 0;
161
+ constructor() {
162
+ super();
163
+ this.wrapper.id = "page-agent-runtime_simulator-mask";
164
+ this.wrapper.className = SimulatorMask_module_default.wrapper;
165
+ this.wrapper.setAttribute("data-browser-use-ignore", "true");
166
+ this.wrapper.setAttribute("data-page-agent-ignore", "true");
167
+ this.glow.className = SimulatorMask_module_default.glow;
168
+ this.wrapper.appendChild(this.glow);
169
+ this.progress.className = SimulatorMask_module_default.progress;
170
+ for (const className of [SimulatorMask_module_default.progressBar, `${SimulatorMask_module_default.progressBar} ${SimulatorMask_module_default.progressBarLate}`]) {
171
+ const bar = document.createElement("div");
172
+ bar.className = className;
173
+ this.progress.appendChild(bar);
174
+ }
175
+ this.wrapper.appendChild(this.progress);
176
+ this.wrapper.addEventListener("click", (e) => {
177
+ e.stopPropagation();
178
+ e.preventDefault();
179
+ });
180
+ this.wrapper.addEventListener("mousedown", (e) => {
181
+ e.stopPropagation();
182
+ e.preventDefault();
183
+ });
184
+ this.wrapper.addEventListener("mouseup", (e) => {
185
+ e.stopPropagation();
186
+ e.preventDefault();
187
+ });
188
+ this.wrapper.addEventListener("mousemove", (e) => {
189
+ e.stopPropagation();
190
+ e.preventDefault();
191
+ });
192
+ this.wrapper.addEventListener("wheel", (e) => {
193
+ e.stopPropagation();
194
+ e.preventDefault();
195
+ });
196
+ this.wrapper.addEventListener("keydown", (e) => {
197
+ e.stopPropagation();
198
+ e.preventDefault();
199
+ });
200
+ this.wrapper.addEventListener("keyup", (e) => {
201
+ e.stopPropagation();
202
+ e.preventDefault();
203
+ });
204
+ this.#createCursor();
205
+ document.body.appendChild(this.wrapper);
206
+ this.#moveCursorToTarget();
207
+ const movePointerToListener = (event) => {
208
+ const { x, y } = event.detail;
209
+ this.setCursorPosition(x, y);
210
+ };
211
+ const clickPointerListener = () => {
212
+ this.triggerClickAnimation();
213
+ };
214
+ const enablePassThroughListener = () => {
215
+ this.wrapper.style.pointerEvents = "none";
216
+ };
217
+ const disablePassThroughListener = () => {
218
+ this.wrapper.style.pointerEvents = "auto";
219
+ };
220
+ window.addEventListener("PageAgent::MovePointerTo", movePointerToListener);
221
+ window.addEventListener("PageAgent::ClickPointer", clickPointerListener);
222
+ window.addEventListener("PageAgent::EnablePassThrough", enablePassThroughListener);
223
+ window.addEventListener("PageAgent::DisablePassThrough", disablePassThroughListener);
224
+ this.addEventListener("dispose", () => {
225
+ window.removeEventListener("PageAgent::MovePointerTo", movePointerToListener);
226
+ window.removeEventListener("PageAgent::ClickPointer", clickPointerListener);
227
+ window.removeEventListener("PageAgent::EnablePassThrough", enablePassThroughListener);
228
+ window.removeEventListener("PageAgent::DisablePassThrough", disablePassThroughListener);
229
+ });
230
+ }
231
+ #createCursor() {
232
+ this.#cursor.className = cursor_module_default.cursor;
233
+ const rippleContainer = document.createElement("div");
234
+ rippleContainer.className = cursor_module_default.cursorRipple;
235
+ this.#cursor.appendChild(rippleContainer);
236
+ const fillingLayer = document.createElement("div");
237
+ fillingLayer.className = cursor_module_default.cursorFilling;
238
+ this.#cursor.appendChild(fillingLayer);
239
+ const borderLayer = document.createElement("div");
240
+ borderLayer.className = cursor_module_default.cursorBorder;
241
+ this.#cursor.appendChild(borderLayer);
242
+ this.wrapper.appendChild(this.#cursor);
243
+ }
244
+ #moveCursorToTarget() {
245
+ if (this.#disposed) return;
246
+ const newX = this.#currentCursorX + (this.#targetCursorX - this.#currentCursorX) * .2;
247
+ const newY = this.#currentCursorY + (this.#targetCursorY - this.#currentCursorY) * .2;
248
+ const xDistance = Math.abs(newX - this.#targetCursorX);
249
+ if (xDistance > 0) {
250
+ if (xDistance < 2) this.#currentCursorX = this.#targetCursorX;
251
+ else this.#currentCursorX = newX;
252
+ this.#cursor.style.left = `${this.#currentCursorX}px`;
253
+ }
254
+ const yDistance = Math.abs(newY - this.#targetCursorY);
255
+ if (yDistance > 0) {
256
+ if (yDistance < 2) this.#currentCursorY = this.#targetCursorY;
257
+ else this.#currentCursorY = newY;
258
+ this.#cursor.style.top = `${this.#currentCursorY}px`;
259
+ }
260
+ requestAnimationFrame(() => this.#moveCursorToTarget());
261
+ }
262
+ setCursorPosition(x, y) {
263
+ if (this.#disposed) return;
264
+ this.#targetCursorX = x;
265
+ this.#targetCursorY = y;
266
+ }
267
+ triggerClickAnimation() {
268
+ if (this.#disposed) return;
269
+ this.#cursor.classList.remove(cursor_module_default.clicking);
270
+ this.#cursor.getBoundingClientRect();
271
+ this.#cursor.classList.add(cursor_module_default.clicking);
272
+ }
273
+ /**
274
+ * Takes the glow and progress colour from the site: its strongest colour, fainter on a dark page.
275
+ * Read again on every show, because a site can change theme between tasks.
276
+ */
277
+ #adaptToSite() {
278
+ try {
279
+ const { accent, dark } = detectSiteAppearance();
280
+ if (accent) this.wrapper.style.setProperty("--pa-glow", accent);
281
+ else this.wrapper.style.removeProperty("--pa-glow");
282
+ this.wrapper.dataset.theme = dark ? "dark" : "light";
283
+ } catch (error) {
284
+ console.warn("[SimulatorMask] could not read the site colours", error);
285
+ }
286
+ }
287
+ /**
288
+ * Starts the progress bar and resolves once the browser has drawn it. Call it right before work
289
+ * that blocks the page: from then on the bar keeps moving on its own.
290
+ */
291
+ async startProgress() {
292
+ if (!this.shown || this.#disposed) return;
293
+ this.progress.classList.add(SimulatorMask_module_default.progressActive);
294
+ await Promise.race([new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(() => resolve()))), new Promise((resolve) => setTimeout(resolve, 80))]);
295
+ }
296
+ stopProgress() {
297
+ this.progress.classList.remove(SimulatorMask_module_default.progressActive);
298
+ }
299
+ show() {
300
+ if (this.shown || this.#disposed) return;
301
+ this.#adaptToSite();
302
+ this.shown = true;
303
+ this.glow.classList.add(SimulatorMask_module_default.glowVisible);
304
+ this.wrapper.classList.add(SimulatorMask_module_default.visible);
305
+ this.#currentCursorX = window.innerWidth / 2;
306
+ this.#currentCursorY = window.innerHeight / 2;
307
+ this.#targetCursorX = this.#currentCursorX;
308
+ this.#targetCursorY = this.#currentCursorY;
309
+ this.#cursor.style.left = `${this.#currentCursorX}px`;
310
+ this.#cursor.style.top = `${this.#currentCursorY}px`;
311
+ }
312
+ hide() {
313
+ if (!this.shown || this.#disposed) return;
314
+ this.shown = false;
315
+ this.glow.classList.remove(SimulatorMask_module_default.glowVisible);
316
+ this.#cursor.classList.remove(cursor_module_default.clicking);
317
+ setTimeout(() => {
318
+ this.wrapper.classList.remove(SimulatorMask_module_default.visible);
319
+ }, 800);
320
+ }
321
+ dispose() {
322
+ this.#disposed = true;
323
+ this.wrapper.remove();
324
+ this.dispatchEvent(new Event("dispose"));
325
+ }
326
+ };
327
+ //#endregion
328
+ export { SimulatorMask };
329
+
330
+ //# sourceMappingURL=SimulatorMask-A9fOKtEZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimulatorMask-A9fOKtEZ.js","names":[],"sources":["../../../page-controller/src/mask/siteColor.ts","../../../page-controller/src/mask/SimulatorMask.module.css","../../../page-controller/src/mask/cursor.module.css","../../../page-controller/src/mask/SimulatorMask.ts"],"sourcesContent":["/**\n * Finds the colour a site itself uses most strongly, so the agent's own visual cues (the edge glow,\n * the progress bar) blend with the site instead of bringing a colour of their own.\n */\n\nexport interface Rgba {\n\tr: number\n\tg: number\n\tb: number\n\t/** 0 to 1. */\n\ta: number\n}\n\n/** A colour seen on the page and how much it counts: larger and more prominent uses weigh more. */\nexport interface ColorSample {\n\tcolor: Rgba\n\tweight: number\n}\n\n/** How vivid a colour is, 0 (grey) to 255 (pure hue). */\nexport function chroma({ r, g, b }: Rgba): number {\n\treturn Math.max(r, g, b) - Math.min(r, g, b)\n}\n\n/** Relative luminance, 0 (black) to 1 (white). */\nexport function luminance({ r, g, b }: Rgba): number {\n\tconst channel = (value: number) => {\n\t\tconst c = value / 255\n\t\treturn c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4\n\t}\n\treturn 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b)\n}\n\nconst MIN_CHROMA = 48\nconst MIN_ALPHA = 0.5\n\n/**\n * The strongest colour among the samples: similar colours are pooled, and the pool with the most\n * weighted vividness wins. Greys and mostly transparent colours never win. Null when the page has\n * no colour to speak of.\n */\nexport function pickStrongestColor(samples: ColorSample[]): Rgba | null {\n\tconst pools = new Map<\n\t\tnumber,\n\t\t{ score: number; weight: number; r: number; g: number; b: number }\n\t>()\n\tfor (const { color, weight } of samples) {\n\t\tif (weight <= 0 || color.a < MIN_ALPHA || chroma(color) < MIN_CHROMA) continue\n\t\tconst key = ((color.r >> 5) << 6) | ((color.g >> 5) << 3) | (color.b >> 5)\n\t\tconst pool = pools.get(key) ?? { score: 0, weight: 0, r: 0, g: 0, b: 0 }\n\t\tpool.score += weight * (chroma(color) / 255)\n\t\tpool.weight += weight\n\t\tpool.r += color.r * weight\n\t\tpool.g += color.g * weight\n\t\tpool.b += color.b * weight\n\t\tpools.set(key, pool)\n\t}\n\tlet best: { score: number; weight: number; r: number; g: number; b: number } | null = null\n\tfor (const pool of pools.values()) if (!best || pool.score > best.score) best = pool\n\tif (!best) return null\n\treturn {\n\t\tr: Math.round(best.r / best.weight),\n\t\tg: Math.round(best.g / best.weight),\n\t\tb: Math.round(best.b / best.weight),\n\t\ta: 1,\n\t}\n}\n\nconst CANDIDATES =\n\t'a[href], button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"], h1, h2, [aria-current], [aria-selected=\"true\"]'\nconst MAX_CANDIDATES = 200\nconst ROOT_VARIABLES = ['--primary', '--color-primary', '--accent', '--color-accent', '--brand']\n\n/** Reads any CSS colour the browser understands (`oklch()`, `color-mix()`, names) as sRGB. */\nfunction createColorReader(doc: Document): (css: string) => Rgba | null {\n\tconst context = doc.createElement('canvas').getContext('2d', { willReadFrequently: true })\n\treturn (css) => {\n\t\tif (!context || !css || css === 'transparent') return null\n\t\tcontext.clearRect(0, 0, 1, 1)\n\t\t// An invalid colour leaves the previous fill style, so set a known one first.\n\t\tcontext.fillStyle = '#000'\n\t\tcontext.fillStyle = css\n\t\tcontext.fillRect(0, 0, 1, 1)\n\t\tconst [r, g, b, a] = context.getImageData(0, 0, 1, 1).data\n\t\treturn { r, g, b, a: a / 255 }\n\t}\n}\n\nexport interface SiteAppearance {\n\t/** The site's strongest colour as a CSS colour, or null when it has none. */\n\taccent: string | null\n\t/** Whether the page background is dark. */\n\tdark: boolean\n}\n\n/**\n * Samples the colours of the page's links, buttons and headings, its `accent-color`, its theme\n * colour and common theme variables. It reads computed styles of at most a couple of hundred\n * elements and changes nothing.\n */\nexport function detectSiteAppearance(doc: Document = document): SiteAppearance {\n\tconst view = doc.defaultView\n\tif (!view) return { accent: null, dark: false }\n\tconst read = createColorReader(doc)\n\tconst samples: ColorSample[] = []\n\tconst add = (css: string | null | undefined, weight: number) => {\n\t\tconst color = css ? read(css) : null\n\t\tif (color) samples.push({ color, weight })\n\t}\n\n\tconst rootStyle = view.getComputedStyle(doc.documentElement)\n\tif (rootStyle.accentColor && rootStyle.accentColor !== 'auto') add(rootStyle.accentColor, 8)\n\tadd(doc.querySelector<HTMLMetaElement>('meta[name=\"theme-color\"]')?.content, 6)\n\tfor (const name of ROOT_VARIABLES) add(rootStyle.getPropertyValue(name).trim(), 6)\n\n\tlet seen = 0\n\tfor (const element of doc.querySelectorAll(CANDIDATES)) {\n\t\tif (seen >= MAX_CANDIDATES) break\n\t\t// The agent's own interface is not the site.\n\t\tif (element.closest('[data-page-agent-ignore]')) continue\n\t\tconst rect = element.getBoundingClientRect()\n\t\tif (rect.width === 0 || rect.height === 0) continue\n\t\tseen++\n\t\tconst style = view.getComputedStyle(element)\n\t\tadd(style.backgroundColor, Math.min(12, Math.max(1, (rect.width * rect.height) / 2000)))\n\t\tadd(style.color, element.localName === 'a' ? 2 : 1)\n\t\tif (style.borderTopWidth !== '0px') add(style.borderTopColor, 0.5)\n\t}\n\n\tlet background: Rgba | null = null\n\tfor (const element of [doc.body, doc.documentElement]) {\n\t\tconst color = element ? read(view.getComputedStyle(element).backgroundColor) : null\n\t\tif (color && color.a > 0.5) {\n\t\t\tbackground = color\n\t\t\tbreak\n\t\t}\n\t}\n\n\tconst accent = pickStrongestColor(samples)\n\treturn {\n\t\taccent: accent ? `rgb(${accent.r} ${accent.g} ${accent.b})` : null,\n\t\tdark: background ? luminance(background) < 0.35 : false,\n\t}\n}\n",".wrapper {\n\tposition: fixed;\n\tinset: 0;\n\tz-index: 2147483641; /* 确保在所有元素之上,除了 panel */\n\tcursor: wait;\n\toverflow: hidden;\n\n\tdisplay: none;\n}\n\n.wrapper.visible {\n\tdisplay: block;\n}\n\n/* The site's strongest colour, with the previous accent as the fallback for a site without one. */\n.wrapper {\n\t--pa-glow: var(--pa-accent, #fa8d45);\n\t--pa-glow-ring: 50%;\n\t--pa-glow-near: 16%;\n\t--pa-glow-far: 6%;\n}\n\n/* A colour shows more against a dark page, so it needs less. */\n.wrapper[data-theme='dark'] {\n\t--pa-glow-ring: 42%;\n\t--pa-glow-near: 13%;\n\t--pa-glow-far: 5%;\n}\n\n.glow {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.4s ease;\n\t/* Same shape as before; the colour comes from the site (set by SimulatorMask) and is kept faint,\n\t so the glow reads as a focus ring of the site itself rather than as a foreign frame. */\n\tbox-shadow:\n\t\tinset 0 0 0 2px color-mix(in srgb, var(--pa-glow) var(--pa-glow-ring), transparent),\n\t\tinset 0 0 42px 8px color-mix(in srgb, var(--pa-glow) var(--pa-glow-near), transparent),\n\t\tinset 0 0 100px 22px color-mix(in srgb, var(--pa-glow) var(--pa-glow-far), transparent);\n}\n\n.glowVisible {\n\topacity: 1;\n}\n\n/* Progress bar shown while the page is being read. Reading blocks the page's main thread, so the bar\n moves with transform only: the browser's compositor keeps it going while scripts cannot run. */\n.progress {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\tright: 0;\n\theight: 3px;\n\toverflow: hidden;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.3s ease;\n\tbackground: color-mix(in srgb, var(--pa-glow) 14%, transparent);\n}\n\n.progressActive {\n\topacity: 1;\n\ttransition-duration: 0.12s;\n}\n\n.progressBar {\n\tposition: absolute;\n\ttop: 0;\n\tbottom: 0;\n\tleft: 0;\n\twidth: 45%;\n\tborder-radius: 3px;\n\ttransform: translateX(-110%);\n\twill-change: transform;\n\tbackground: linear-gradient(\n\t\t90deg,\n\t\ttransparent,\n\t\tcolor-mix(in srgb, var(--pa-glow) 85%, transparent) 35%,\n\t\tcolor-mix(in srgb, var(--pa-glow) 60%, white) 65%,\n\t\ttransparent\n\t);\n\tfilter: drop-shadow(0 0 6px color-mix(in srgb, var(--pa-glow) 70%, transparent));\n}\n\n.progressBarLate {\n\twidth: 25%;\n}\n\n.progressActive .progressBar {\n\tanimation: progressSlide 1.25s cubic-bezier(0.45, 0, 0.25, 1) infinite;\n}\n\n.progressActive .progressBarLate {\n\tanimation-duration: 1.25s;\n\tanimation-delay: 0.5s;\n\tanimation-timing-function: cubic-bezier(0.3, 0, 0.6, 1);\n}\n\n@keyframes progressSlide {\n\tfrom {\n\t\ttransform: translateX(-110%);\n\t}\n\tto {\n\t\ttransform: translateX(330%);\n\t}\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t.glow {\n\t\ttransition: none;\n\t}\n\n\t/* A steady bar instead of a moving one. */\n\t.progressActive .progressBar {\n\t\tanimation: none;\n\t\twidth: 100%;\n\t\ttransform: none;\n\t\topacity: 0.6;\n\t}\n\n\t.progressActive .progressBarLate {\n\t\tdisplay: none;\n\t}\n}\n","/* AI 光标样式 */\n.cursor {\n\tposition: absolute;\n\twidth: var(--cursor-size, 21px);\n\theight: var(--cursor-size, 25px);\n\tpointer-events: none;\n\tz-index: 10000;\n\tbackground: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 28'%3E%3Cpath d='M3 2v20l5.5-5 3.9 8 3-1.5-4-7.8L19 15z' fill='%23f28a46' stroke='%23171715' stroke-width='1.7' stroke-linejoin='round'/%3E%3C/svg%3E\")\n\t\tcenter / contain no-repeat;\n\tfilter: drop-shadow(0 2px 2px #0005);\n}\n\n.cursorFilling,\n.cursorBorder {\n\tdisplay: none;\n}\n\n.cursorBorder {\n\tposition: absolute;\n\twidth: 100%;\n\theight: 100%;\n\tbackground: linear-gradient(45deg, rgb(57, 182, 255), rgb(189, 69, 251));\n\tmask-image: url(./cursor-border.svg);\n\tmask-size: 100% 100%;\n\tmask-repeat: no-repeat;\n\n\ttransform-origin: center;\n\ttransform: rotate(-135deg) scale(1.2);\n\tmargin-left: -10px;\n\tmargin-top: -18px;\n}\n\n.cursorFilling {\n\tposition: absolute;\n\twidth: 100%;\n\theight: 100%;\n\tbackground: url(./cursor-fill.svg);\n\tbackground-size: 100% 100%;\n\tbackground-repeat: no-repeat;\n\n\ttransform-origin: center;\n\ttransform: rotate(-135deg) scale(1.2);\n\tmargin-left: -10px;\n\tmargin-top: -18px;\n}\n\n.cursorRipple {\n\tposition: absolute;\n\twidth: 100%;\n\theight: 100%;\n\tpointer-events: none;\n\tmargin-left: -50%;\n\tmargin-top: -50%;\n\n\t&::after {\n\t\tcontent: '';\n\t\topacity: 0;\n\t\tposition: absolute;\n\t\tinset: 0;\n\t\tborder: 4px solid rgba(57, 182, 255, 1);\n\t\tborder-radius: 50%;\n\t}\n}\n\n.cursor.clicking .cursorRipple::after {\n\tanimation: cursor-ripple 300ms ease-out forwards;\n}\n\n@keyframes cursor-ripple {\n\t0% {\n\t\ttransform: scale(0);\n\t\topacity: 1;\n\t}\n\t100% {\n\t\ttransform: scale(2);\n\t\topacity: 0;\n\t}\n}\n\n/* Panel button \"Hide agent cursor\": only the drawing disappears; the run continues. */\n:global(html[data-pa-cursor-hidden]) .cursor {\n\tdisplay: none !important;\n}\n","import { detectSiteAppearance } from './siteColor'\n\nimport styles from './SimulatorMask.module.css'\nimport cursorStyles from './cursor.module.css'\n\nexport class SimulatorMask extends EventTarget {\n\tshown: boolean = false\n\twrapper = document.createElement('div')\n\tglow = document.createElement('div')\n\t/** Bar at the top edge, moving while the page is being read. */\n\tprogress = document.createElement('div')\n\n\t#disposed = false\n\n\t#cursor = document.createElement('div')\n\n\t#currentCursorX = 0\n\t#currentCursorY = 0\n\n\t#targetCursorX = 0\n\t#targetCursorY = 0\n\n\tconstructor() {\n\t\tsuper()\n\n\t\tthis.wrapper.id = 'page-agent-runtime_simulator-mask'\n\t\tthis.wrapper.className = styles.wrapper\n\t\tthis.wrapper.setAttribute('data-browser-use-ignore', 'true')\n\t\tthis.wrapper.setAttribute('data-page-agent-ignore', 'true')\n\n\t\t// Transparent edge glow marking the page under agent control. No fill; it never blocks pointer events.\n\t\tthis.glow.className = styles.glow\n\t\tthis.wrapper.appendChild(this.glow)\n\n\t\tthis.progress.className = styles.progress\n\t\tfor (const className of [\n\t\t\tstyles.progressBar,\n\t\t\t`${styles.progressBar} ${styles.progressBarLate}`,\n\t\t]) {\n\t\t\tconst bar = document.createElement('div')\n\t\t\tbar.className = className\n\t\t\tthis.progress.appendChild(bar)\n\t\t}\n\t\tthis.wrapper.appendChild(this.progress)\n\n\t\t// Capture all mouse, keyboard, and wheel events\n\t\tthis.wrapper.addEventListener('click', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('mousedown', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('mouseup', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('mousemove', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('wheel', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('keydown', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('keyup', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\n\t\t// Create AI cursor\n\t\tthis.#createCursor()\n\t\t// this.show()\n\n\t\tdocument.body.appendChild(this.wrapper)\n\n\t\tthis.#moveCursorToTarget()\n\n\t\t// global events\n\t\t// @note Mask should be isolated from the rest of the code.\n\t\t// Global events are easier to manage and cleanup.\n\n\t\tconst movePointerToListener = (event: Event) => {\n\t\t\tconst { x, y } = (event as CustomEvent).detail\n\t\t\tthis.setCursorPosition(x, y)\n\t\t}\n\t\tconst clickPointerListener = () => {\n\t\t\tthis.triggerClickAnimation()\n\t\t}\n\t\tconst enablePassThroughListener = () => {\n\t\t\tthis.wrapper.style.pointerEvents = 'none'\n\t\t}\n\t\tconst disablePassThroughListener = () => {\n\t\t\tthis.wrapper.style.pointerEvents = 'auto'\n\t\t}\n\n\t\twindow.addEventListener('PageAgent::MovePointerTo', movePointerToListener)\n\t\twindow.addEventListener('PageAgent::ClickPointer', clickPointerListener)\n\t\twindow.addEventListener('PageAgent::EnablePassThrough', enablePassThroughListener)\n\t\twindow.addEventListener('PageAgent::DisablePassThrough', disablePassThroughListener)\n\n\t\tthis.addEventListener('dispose', () => {\n\t\t\twindow.removeEventListener('PageAgent::MovePointerTo', movePointerToListener)\n\t\t\twindow.removeEventListener('PageAgent::ClickPointer', clickPointerListener)\n\t\t\twindow.removeEventListener('PageAgent::EnablePassThrough', enablePassThroughListener)\n\t\t\twindow.removeEventListener('PageAgent::DisablePassThrough', disablePassThroughListener)\n\t\t})\n\t}\n\n\t#createCursor() {\n\t\tthis.#cursor.className = cursorStyles.cursor\n\n\t\t// Create ripple effect container\n\t\tconst rippleContainer = document.createElement('div')\n\t\trippleContainer.className = cursorStyles.cursorRipple\n\t\tthis.#cursor.appendChild(rippleContainer)\n\n\t\t// Create filling layer\n\t\tconst fillingLayer = document.createElement('div')\n\t\tfillingLayer.className = cursorStyles.cursorFilling\n\t\tthis.#cursor.appendChild(fillingLayer)\n\n\t\t// Create border layer\n\t\tconst borderLayer = document.createElement('div')\n\t\tborderLayer.className = cursorStyles.cursorBorder\n\t\tthis.#cursor.appendChild(borderLayer)\n\n\t\tthis.wrapper.appendChild(this.#cursor)\n\t}\n\n\t#moveCursorToTarget() {\n\t\tif (this.#disposed) return\n\n\t\tconst newX = this.#currentCursorX + (this.#targetCursorX - this.#currentCursorX) * 0.2\n\t\tconst newY = this.#currentCursorY + (this.#targetCursorY - this.#currentCursorY) * 0.2\n\n\t\tconst xDistance = Math.abs(newX - this.#targetCursorX)\n\t\tif (xDistance > 0) {\n\t\t\tif (xDistance < 2) {\n\t\t\t\tthis.#currentCursorX = this.#targetCursorX\n\t\t\t} else {\n\t\t\t\tthis.#currentCursorX = newX\n\t\t\t}\n\t\t\tthis.#cursor.style.left = `${this.#currentCursorX}px`\n\t\t}\n\n\t\tconst yDistance = Math.abs(newY - this.#targetCursorY)\n\t\tif (yDistance > 0) {\n\t\t\tif (yDistance < 2) {\n\t\t\t\tthis.#currentCursorY = this.#targetCursorY\n\t\t\t} else {\n\t\t\t\tthis.#currentCursorY = newY\n\t\t\t}\n\t\t\tthis.#cursor.style.top = `${this.#currentCursorY}px`\n\t\t}\n\n\t\trequestAnimationFrame(() => this.#moveCursorToTarget())\n\t}\n\n\tsetCursorPosition(x: number, y: number) {\n\t\tif (this.#disposed) return\n\n\t\tthis.#targetCursorX = x\n\t\tthis.#targetCursorY = y\n\t}\n\n\ttriggerClickAnimation() {\n\t\tif (this.#disposed) return\n\n\t\tthis.#cursor.classList.remove(cursorStyles.clicking)\n\t\t// Force reflow to restart animation\n\t\tthis.#cursor.getBoundingClientRect()\n\t\tthis.#cursor.classList.add(cursorStyles.clicking)\n\t}\n\n\t/**\n\t * Takes the glow and progress colour from the site: its strongest colour, fainter on a dark page.\n\t * Read again on every show, because a site can change theme between tasks.\n\t */\n\t#adaptToSite() {\n\t\ttry {\n\t\t\tconst { accent, dark } = detectSiteAppearance()\n\t\t\tif (accent) this.wrapper.style.setProperty('--pa-glow', accent)\n\t\t\telse this.wrapper.style.removeProperty('--pa-glow')\n\t\t\tthis.wrapper.dataset.theme = dark ? 'dark' : 'light'\n\t\t} catch (error) {\n\t\t\t// The default colour stays. A cosmetic reading must never stop a task.\n\t\t\tconsole.warn('[SimulatorMask] could not read the site colours', error)\n\t\t}\n\t}\n\n\t/**\n\t * Starts the progress bar and resolves once the browser has drawn it. Call it right before work\n\t * that blocks the page: from then on the bar keeps moving on its own.\n\t */\n\tasync startProgress(): Promise<void> {\n\t\tif (!this.shown || this.#disposed) return\n\t\tthis.progress.classList.add(styles.progressActive)\n\t\t// Two frames: one to apply the style, one for the animation to reach the compositor. The timer\n\t\t// is for a tab in the background, where frames are not produced.\n\t\tawait Promise.race([\n\t\t\tnew Promise<void>((resolve) =>\n\t\t\t\trequestAnimationFrame(() => requestAnimationFrame(() => resolve()))\n\t\t\t),\n\t\t\tnew Promise<void>((resolve) => setTimeout(resolve, 80)),\n\t\t])\n\t}\n\n\tstopProgress(): void {\n\t\tthis.progress.classList.remove(styles.progressActive)\n\t}\n\n\tshow() {\n\t\tif (this.shown || this.#disposed) return\n\n\t\tthis.#adaptToSite()\n\t\tthis.shown = true\n\t\tthis.glow.classList.add(styles.glowVisible)\n\n\t\tthis.wrapper.classList.add(styles.visible)\n\n\t\t// Initialize cursor position\n\t\tthis.#currentCursorX = window.innerWidth / 2\n\t\tthis.#currentCursorY = window.innerHeight / 2\n\t\tthis.#targetCursorX = this.#currentCursorX\n\t\tthis.#targetCursorY = this.#currentCursorY\n\t\tthis.#cursor.style.left = `${this.#currentCursorX}px`\n\t\tthis.#cursor.style.top = `${this.#currentCursorY}px`\n\t}\n\n\thide() {\n\t\tif (!this.shown || this.#disposed) return\n\n\t\tthis.shown = false\n\t\tthis.glow.classList.remove(styles.glowVisible)\n\n\t\tthis.#cursor.classList.remove(cursorStyles.clicking)\n\n\t\tsetTimeout(() => {\n\t\t\tthis.wrapper.classList.remove(styles.visible)\n\t\t}, 800) // Match the animation duration\n\t}\n\n\tdispose() {\n\t\tthis.#disposed = true\n\t\tthis.wrapper.remove()\n\t\tthis.dispatchEvent(new Event('dispose'))\n\t}\n}\n"],"mappings":";;;AAoBA,SAAgB,OAAO,EAAE,GAAG,GAAG,KAAmB;CACjD,OAAO,KAAK,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,IAAI,GAAG,GAAG,CAAC;AAC5C;;AAGA,SA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