ceulen 0.5.1 → 0.7.0
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/CHANGELOG.md +317 -12
- package/README.md +87 -91
- package/extensions/lib/advisor-marker.ts +33 -0
- package/extensions/lib/panel.ts +25 -2
- package/extensions/lib/rate.ts +24 -0
- package/extensions/lib/registry.ts +93 -7
- package/extensions/lib/tools.ts +47 -0
- package/extensions/lib/usage-store.ts +33 -0
- package/extensions/modules/advisor/commands/advisor.ts +244 -0
- package/extensions/modules/advisor/configPanel.ts +194 -0
- package/extensions/modules/advisor/index.ts +217 -0
- package/extensions/modules/advisor/lib/config.ts +248 -0
- package/extensions/modules/advisor/lib/emission-guard.ts +153 -0
- package/extensions/modules/advisor/lib/isolated-model.ts +160 -0
- package/extensions/modules/advisor/lib/model-picker.ts +47 -0
- package/extensions/modules/advisor/lib/watcher.ts +286 -0
- package/extensions/modules/advisor/test/compliance.test.ts +125 -0
- package/extensions/modules/advisor/test/config.test.ts +202 -0
- package/extensions/modules/advisor/test/configPanel.test.ts +223 -0
- package/extensions/modules/advisor/test/emission-guard.test.ts +201 -0
- package/extensions/modules/advisor/test/isolated-model.test.ts +311 -0
- package/extensions/modules/advisor/test/model-picker.test.ts +32 -0
- package/extensions/modules/advisor/test/module.test.ts +586 -0
- package/extensions/modules/advisor/test/watcher.test.ts +478 -0
- package/extensions/modules/classifier/configPanel.ts +104 -0
- package/extensions/modules/classifier/index.ts +297 -0
- package/extensions/modules/classifier/lib/settings.ts +95 -0
- package/extensions/modules/classifier/test/classifier.test.ts +475 -0
- package/extensions/modules/composer/index.ts +152 -3
- package/extensions/modules/composer/lib/footer.ts +119 -0
- package/extensions/modules/composer/lib/shapes.ts +265 -26
- package/extensions/modules/composer/test/editor.test.ts +1 -1
- package/extensions/modules/composer/test/footer.test.ts +96 -0
- package/extensions/modules/composer/test/module.test.ts +113 -11
- package/extensions/modules/composer/test/screen.test.ts +29 -1
- package/extensions/modules/composer/test/shapes.test.ts +224 -8
- package/extensions/modules/config/defaultTools.ts +96 -0
- package/extensions/modules/config/index.ts +147 -7
- package/extensions/modules/config/piSettings.ts +254 -69
- package/extensions/modules/config/test/defaultTools.test.ts +122 -0
- package/extensions/modules/config/test/menu.test.ts +64 -0
- package/extensions/modules/config/test/panel.test.ts +38 -23
- package/extensions/modules/config/test/piSettings.test.ts +130 -3
- package/extensions/modules/config/test/renderTools.test.ts +71 -0
- package/extensions/modules/config/test/tools.test.ts +146 -0
- package/extensions/modules/fff/index.ts +2094 -0
- package/extensions/modules/fff/lib/query.ts +129 -0
- package/extensions/modules/fff/test/index.test.ts +607 -0
- package/extensions/modules/fff/test/query.test.ts +71 -0
- package/extensions/modules/munin/configPanel.ts +105 -0
- package/extensions/modules/munin/index.ts +641 -0
- package/extensions/modules/munin/lib/helpers.ts +471 -0
- package/extensions/modules/munin/lib/retry.ts +20 -0
- package/extensions/modules/munin/lib/sdk.ts +218 -0
- package/extensions/modules/munin/test/config.test.ts +168 -0
- package/extensions/modules/munin/test/configPanel.test.ts +161 -0
- package/extensions/modules/munin/test/extension.test.ts +224 -0
- package/extensions/modules/munin/test/helpers.test.ts +523 -0
- package/extensions/modules/munin/test/retry.test.ts +145 -0
- package/extensions/modules/munin/test/stale-protocol.test.ts +554 -0
- package/extensions/modules/plan/configPanel.ts +152 -0
- package/extensions/modules/plan/index.ts +917 -0
- package/extensions/modules/plan/lib/plan-tools.ts +72 -0
- package/extensions/modules/plan/lib/prompt.ts +65 -0
- package/extensions/modules/plan/lib/settings.ts +166 -0
- package/extensions/modules/plan/lib/shell-gate.ts +200 -0
- package/extensions/modules/plan/test/configPanel.test.ts +96 -0
- package/extensions/modules/plan/test/harness.ts +133 -0
- package/extensions/modules/plan/test/module.test.ts +305 -0
- package/extensions/modules/plan/test/settings.test.ts +114 -0
- package/extensions/modules/plan/test/shell-gate.test.ts +103 -0
- package/extensions/modules/ponytail/index.ts +23 -73
- package/extensions/modules/ponytail/lib/config.ts +1 -6
- package/extensions/modules/ponytail/test/extension.test.ts +1 -85
- package/extensions/modules/repair/configPanel.ts +96 -0
- package/extensions/modules/repair/index.ts +414 -0
- package/extensions/modules/repair/lib/auto-bg.ts +333 -0
- package/extensions/modules/repair/lib/edit-repair.ts +155 -0
- package/extensions/modules/repair/lib/editor.ts +251 -0
- package/extensions/modules/repair/lib/guards.ts +34 -0
- package/extensions/modules/repair/lib/input-repair.ts +324 -0
- package/extensions/modules/repair/lib/patch.ts +481 -0
- package/extensions/modules/repair/lib/settings.ts +114 -0
- package/extensions/modules/repair/test/auto-bg.test.ts +405 -0
- package/extensions/modules/repair/test/edit-repair.test.ts +224 -0
- package/extensions/modules/repair/test/editor.test.ts +141 -0
- package/extensions/modules/repair/test/guards.test.ts +64 -0
- package/extensions/modules/repair/test/input-repair.test.ts +231 -0
- package/extensions/modules/repair/test/patch.test.ts +563 -0
- package/extensions/modules/repair/test/settings.test.ts +167 -0
- package/extensions/modules/repair/test/wrapper.test.ts +210 -0
- package/extensions/modules/router/commands/commands.ts +4 -0
- package/extensions/modules/router/lib/client.ts +61 -0
- package/extensions/modules/router/lib/provider.ts +34 -13
- package/extensions/modules/router/lib/systemone.ts +152 -0
- package/extensions/modules/router/test/unit.test.ts +179 -0
- package/extensions/modules/rtk/findFallback.js +68 -0
- package/extensions/modules/rtk/index.ts +248 -0
- package/extensions/modules/rtk/safe-rewrite.js +74 -0
- package/extensions/modules/rtk/test/findFallback.test.js +66 -0
- package/extensions/modules/rtk/test/index.test.js +131 -0
- package/extensions/modules/rtk/test/safe-rewrite.test.js +96 -0
- package/extensions/modules/rtk/version-gate.js +34 -0
- package/extensions/modules/serena/index.ts +629 -0
- package/extensions/modules/serena/lib/detect.ts +73 -0
- package/extensions/modules/serena/lib/env.ts +76 -0
- package/extensions/modules/serena/lib/guidance.ts +26 -0
- package/extensions/modules/serena/lib/normalize.ts +27 -0
- package/extensions/modules/serena/lib/symbol-key.ts +20 -0
- package/extensions/modules/serena/lib/truncate.ts +20 -0
- package/extensions/modules/serena/test/env.test.ts +122 -0
- package/extensions/modules/serena/test/index.test.ts +347 -0
- package/extensions/modules/serena/test/worker.test.ts +562 -0
- package/extensions/modules/serena/worker.ts +858 -0
- package/extensions/modules/steering/configPanel.ts +122 -0
- package/extensions/modules/steering/index.ts +616 -0
- package/extensions/modules/steering/lib/anchor.ts +175 -0
- package/extensions/modules/steering/lib/errors.ts +253 -0
- package/extensions/modules/steering/lib/family.ts +33 -0
- package/extensions/modules/steering/lib/guidance.ts +172 -0
- package/extensions/modules/steering/lib/history.ts +170 -0
- package/extensions/modules/steering/lib/settings.ts +127 -0
- package/extensions/modules/steering/test/anchor-regressions.test.ts +93 -0
- package/extensions/modules/steering/test/anchor-wiring.test.ts +99 -0
- package/extensions/modules/steering/test/anchor.test.ts +160 -0
- package/extensions/modules/steering/test/cache-stats.test.ts +43 -0
- package/extensions/modules/steering/test/errors.test.ts +309 -0
- package/extensions/modules/steering/test/family.test.ts +43 -0
- package/extensions/modules/steering/test/guidance.test.ts +357 -0
- package/extensions/modules/steering/test/harness.ts +93 -0
- package/extensions/modules/steering/test/history.test.ts +118 -0
- package/extensions/modules/steering/test/settings.test.ts +182 -0
- package/extensions/modules/steering/test/status.test.ts +71 -0
- package/extensions/modules/steering/test/toolCall.test.ts +99 -0
- package/extensions/modules/subagent/agents/planner.md +14 -0
- package/extensions/modules/subagent/agents/reviewer.md +42 -0
- package/extensions/modules/subagent/agents/scout.md +47 -0
- package/extensions/modules/subagent/agents/tester.md +12 -0
- package/extensions/modules/subagent/agents/worker.md +18 -0
- package/extensions/modules/subagent/configPanel.ts +219 -0
- package/extensions/modules/subagent/index.ts +2451 -0
- package/extensions/modules/subagent/lib/agents.ts +408 -0
- package/extensions/modules/subagent/lib/background.ts +383 -0
- package/extensions/modules/subagent/lib/herdr.ts +1019 -0
- package/extensions/modules/subagent/lib/history.ts +126 -0
- package/extensions/modules/subagent/lib/model.ts +156 -0
- package/extensions/modules/subagent/lib/render.ts +335 -0
- package/extensions/modules/subagent/lib/result.ts +110 -0
- package/extensions/modules/subagent/lib/roles.ts +296 -0
- package/extensions/modules/subagent/lib/routing.ts +223 -0
- package/extensions/modules/subagent/lib/runner.ts +559 -0
- package/extensions/modules/subagent/lib/schema.ts +21 -0
- package/extensions/modules/subagent/lib/security.ts +752 -0
- package/extensions/modules/subagent/lib/settings.ts +159 -0
- package/extensions/modules/subagent/lib/thread-viewer.ts +319 -0
- package/extensions/modules/subagent/lib/threads.ts +135 -0
- package/extensions/modules/subagent/lib/types.ts +18 -0
- package/extensions/modules/subagent/lib/widget.ts +475 -0
- package/extensions/modules/subagent/test/configPanel.test.ts +132 -0
- package/extensions/modules/subagent/test/herdr-advisor.test.ts +40 -0
- package/extensions/modules/subagent/test/routing.test.ts +350 -0
- package/extensions/modules/subagent/test/widget.test.ts +208 -0
- package/extensions/modules/usage/index.ts +59 -16
- package/extensions/modules/usage/test/genrate.test.ts +70 -0
- package/extensions/modules/usage/test/parsers.test.ts +13 -0
- package/extensions/modules/ux/UPSTREAM +24 -0
- package/extensions/modules/ux/index.ts +393 -0
- package/extensions/modules/ux/lib/audit.ts +562 -0
- package/extensions/modules/ux/lib/config.ts +136 -0
- package/extensions/modules/ux/lib/instructions.ts +77 -0
- package/extensions/modules/ux/test/audit.test.ts +756 -0
- package/extensions/modules/ux/test/extension.test.ts +394 -0
- package/extensions/modules/ux/test/instructions.test.ts +19 -0
- package/extensions/modules/web/configPanel.ts +193 -0
- package/extensions/modules/web/index.ts +978 -0
- package/extensions/modules/web/lib/agy.ts +209 -0
- package/extensions/modules/web/lib/brave.ts +42 -0
- package/extensions/modules/web/lib/cdp.ts +686 -0
- package/extensions/modules/web/lib/chatapi.ts +101 -0
- package/extensions/modules/web/lib/chatgpt.ts +796 -0
- package/extensions/modules/web/lib/chrome.ts +328 -0
- package/extensions/modules/web/lib/config.ts +136 -0
- package/extensions/modules/web/lib/content.ts +99 -0
- package/extensions/modules/web/lib/crawl4ai.ts +172 -0
- package/extensions/modules/web/lib/extract.ts +235 -0
- package/extensions/modules/web/lib/firecrawl.ts +56 -0
- package/extensions/modules/web/lib/format.ts +197 -0
- package/extensions/modules/web/lib/gemini-auth.ts +286 -0
- package/extensions/modules/web/lib/gemini-dr.ts +338 -0
- package/extensions/modules/web/lib/gemini.ts +551 -0
- package/extensions/modules/web/lib/imageapi.ts +559 -0
- package/extensions/modules/web/lib/retry.ts +71 -0
- package/extensions/modules/web/lib/search.ts +237 -0
- package/extensions/modules/web/lib/searxng.ts +69 -0
- package/extensions/modules/web/lib/settings.ts +148 -0
- package/extensions/modules/web/scripts/cdp-smoke.ts +77 -0
- package/extensions/modules/web/scripts/gemini-smoke.ts +107 -0
- package/extensions/modules/web/test/agy.test.ts +383 -0
- package/extensions/modules/web/test/cdp.test.ts +717 -0
- package/extensions/modules/web/test/chat.test.ts +171 -0
- package/extensions/modules/web/test/chatgpt.test.ts +633 -0
- package/extensions/modules/web/test/chrome.test.ts +282 -0
- package/extensions/modules/web/test/config.test.ts +218 -0
- package/extensions/modules/web/test/configPanel.test.ts +132 -0
- package/extensions/modules/web/test/crawl.test.ts +134 -0
- package/extensions/modules/web/test/crawl4ai.test.ts +105 -0
- package/extensions/modules/web/test/extension.test.ts +118 -0
- package/extensions/modules/web/test/extract.test.ts +436 -0
- package/extensions/modules/web/test/fixtures/dr-confirm.bin +12 -0
- package/extensions/modules/web/test/fixtures/dr-plan.bin +20 -0
- package/extensions/modules/web/test/fixtures/interaction.html +31 -0
- package/extensions/modules/web/test/format.test.ts +230 -0
- package/extensions/modules/web/test/gemini-auth.test.ts +465 -0
- package/extensions/modules/web/test/gemini-dr.test.ts +249 -0
- package/extensions/modules/web/test/gemini.test.ts +472 -0
- package/extensions/modules/web/test/hook.test.ts +101 -0
- package/extensions/modules/web/test/image.test.ts +1089 -0
- package/extensions/modules/web/test/retry.test.ts +119 -0
- package/extensions/modules/web/test/screenshot.test.ts +109 -0
- package/extensions/modules/web/test/search.test.ts +210 -0
- package/extensions/modules/web/test/settings.test.ts +165 -0
- package/extensions/modules/web/test/skill.test.ts +72 -0
- package/extensions/modules/web/types.d.ts +3 -0
- package/extensions/modules/web/vendor/package.json +1 -0
- package/extensions/modules/web/vendor/readability/LICENSE.md +13 -0
- package/extensions/modules/web/vendor/readability/Readability-readerable.js +123 -0
- package/extensions/modules/web/vendor/readability/Readability.js +2787 -0
- package/extensions/modules/web/vendor/readability/index.d.ts +64 -0
- package/extensions/modules/web/vendor/readability/index.js +9 -0
- package/extensions/modules/web/vendor/turndown/LICENSE +21 -0
- package/extensions/modules/web/vendor/turndown/turndown.cjs.js +784 -0
- package/extensions/modules/web/vendor/turndown-plugin-gfm/LICENSE +21 -0
- package/extensions/modules/web/vendor/turndown-plugin-gfm/turndown-plugin-gfm.cjs.js +163 -0
- package/extensions/modules/zai/configPanel.ts +151 -0
- package/extensions/modules/zai/index.ts +186 -0
- package/extensions/modules/zai/lib/anthropic.ts +159 -0
- package/extensions/modules/zai/lib/settings.ts +198 -0
- package/extensions/modules/zai/lib/signing.ts +718 -0
- package/extensions/modules/zai/lib/throttle.ts +198 -0
- package/extensions/modules/zai/test/anthropic.test.ts +132 -0
- package/extensions/modules/zai/test/configPanel.test.ts +207 -0
- package/extensions/modules/zai/test/extension.test.ts +249 -0
- package/extensions/modules/zai/test/settings.test.ts +183 -0
- package/extensions/modules/zai/test/signing-wiring.test.ts +108 -0
- package/extensions/modules/zai/test/signing.test.ts +345 -0
- package/extensions/modules/zai/test/throttle.test.ts +329 -0
- package/package.json +19 -4
- package/scripts/validate-themes.mjs +75 -0
- package/skills/munin/SKILL.md +117 -0
- package/skills/ux-capture/SKILL.md +202 -0
- package/skills/ux-design/SKILL.md +279 -0
- package/skills/ux-presets/SKILL.md +484 -0
- package/skills/ux-routing/SKILL.md +46 -0
- package/skills/web/SKILL.md +153 -0
- package/themes/alabaster.json +93 -0
- package/themes/amethyst.json +96 -0
- package/themes/anthracite.json +93 -0
- package/themes/basalt.json +91 -0
- package/themes/birch.json +95 -0
- package/themes/catppuccin-mocha.json +91 -0
- package/themes/dark-abyss.json +91 -0
- package/themes/dark-arctic.json +104 -0
- package/themes/dark-aurora.json +95 -0
- package/themes/dark-catppuccin.json +107 -0
- package/themes/dark-cavern.json +91 -0
- package/themes/dark-celestial.json +106 -0
- package/themes/dark-copper.json +95 -0
- package/themes/dark-cosmos.json +90 -0
- package/themes/dark-cyberpunk.json +102 -0
- package/themes/dark-dracula.json +98 -0
- package/themes/dark-eclipse.json +91 -0
- package/themes/dark-ember.json +95 -0
- package/themes/dark-equinox.json +90 -0
- package/themes/dark-forest.json +96 -0
- package/themes/dark-github.json +105 -0
- package/themes/dark-gruvbox.json +112 -0
- package/themes/dark-lavender.json +95 -0
- package/themes/dark-lunar.json +89 -0
- package/themes/dark-midnight.json +95 -0
- package/themes/dark-monochrome.json +94 -0
- package/themes/dark-monokai.json +98 -0
- package/themes/dark-nebula.json +90 -0
- package/themes/dark-neon-noir.json +100 -0
- package/themes/dark-nord.json +98 -0
- package/themes/dark-ocean.json +101 -0
- package/themes/dark-one.json +100 -0
- package/themes/dark-poimandres.json +115 -0
- package/themes/dark-rainforest.json +91 -0
- package/themes/dark-reef.json +91 -0
- package/themes/dark-retro.json +92 -0
- package/themes/dark-rose-pine.json +96 -0
- package/themes/dark-sakura.json +95 -0
- package/themes/dark-slate.json +95 -0
- package/themes/dark-solarized.json +97 -0
- package/themes/dark-solstice.json +90 -0
- package/themes/dark-starfall.json +91 -0
- package/themes/dark-sunset.json +99 -0
- package/themes/dark-swamp.json +90 -0
- package/themes/dark-synthwave.json +103 -0
- package/themes/dark-taiga.json +91 -0
- package/themes/dark-terminal.json +95 -0
- package/themes/dark-tokyo-night.json +101 -0
- package/themes/dark-tundra.json +91 -0
- package/themes/dark-twilight.json +91 -0
- package/themes/dark-volcanic.json +91 -0
- package/themes/dark.json +80 -0
- package/themes/graphite.json +92 -0
- package/themes/light-arctic.json +107 -0
- package/themes/light-aurora-day.json +91 -0
- package/themes/light-canyon.json +91 -0
- package/themes/light-catppuccin.json +106 -0
- package/themes/light-cirrus.json +90 -0
- package/themes/light-coral.json +95 -0
- package/themes/light-cyberpunk.json +96 -0
- package/themes/light-dawn.json +90 -0
- package/themes/light-dunes.json +91 -0
- package/themes/light-eucalyptus.json +95 -0
- package/themes/light-forest.json +100 -0
- package/themes/light-frost.json +95 -0
- package/themes/light-github.json +115 -0
- package/themes/light-glacier.json +91 -0
- package/themes/light-gruvbox.json +108 -0
- package/themes/light-haze.json +90 -0
- package/themes/light-honeycomb.json +95 -0
- package/themes/light-lagoon.json +91 -0
- package/themes/light-lavender.json +95 -0
- package/themes/light-meadow.json +91 -0
- package/themes/light-mint.json +95 -0
- package/themes/light-monochrome.json +101 -0
- package/themes/light-ocean.json +99 -0
- package/themes/light-one.json +99 -0
- package/themes/light-opal.json +91 -0
- package/themes/light-orchard.json +91 -0
- package/themes/light-paper.json +95 -0
- package/themes/light-poimandres.json +115 -0
- package/themes/light-prism.json +90 -0
- package/themes/light-retro.json +98 -0
- package/themes/light-sand.json +95 -0
- package/themes/light-savanna.json +91 -0
- package/themes/light-solarized.json +102 -0
- package/themes/light-soleil.json +90 -0
- package/themes/light-sunset.json +99 -0
- package/themes/light-synthwave.json +98 -0
- package/themes/light-tokyo-night.json +111 -0
- package/themes/light-wetland.json +91 -0
- package/themes/light-zenith.json +89 -0
- package/themes/light.json +80 -0
- package/themes/limestone.json +94 -0
- package/themes/mahogany.json +97 -0
- package/themes/marble.json +93 -0
- package/themes/mirage.json +79 -0
- package/themes/obsidian.json +91 -0
- package/themes/onyx.json +91 -0
- package/themes/pearl.json +93 -0
- package/themes/porcelain.json +91 -0
- package/themes/quartz.json +96 -0
- package/themes/sandstone.json +95 -0
- package/themes/titanium.json +90 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ceulen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Ceulen — the Pi coding agent, fully dressed: one bundle extension carrying the full toolkit with a single /ceulen config command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,10 +18,21 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"extensions",
|
|
20
20
|
"skills",
|
|
21
|
+
"themes",
|
|
22
|
+
"scripts",
|
|
21
23
|
"README.md",
|
|
22
24
|
"LICENSE",
|
|
23
25
|
"CHANGELOG.md"
|
|
24
26
|
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@ff-labs/fff-node": "^0.10.6",
|
|
29
|
+
"axios": "^1.20.0",
|
|
30
|
+
"gemini-reverse": "^2.1.0",
|
|
31
|
+
"jsdom": "^27.0.1"
|
|
32
|
+
},
|
|
33
|
+
"optionalDependencies": {
|
|
34
|
+
"@yuuang/ffi-rs-linux-x64-gnu": "1.3.2"
|
|
35
|
+
},
|
|
25
36
|
"repository": {
|
|
26
37
|
"type": "git",
|
|
27
38
|
"url": "git+https://github.com/ceulen-dev/ceulen.git"
|
|
@@ -29,17 +40,21 @@
|
|
|
29
40
|
"homepage": "https://github.com/ceulen-dev/ceulen#readme",
|
|
30
41
|
"bugs": "https://github.com/ceulen-dev/ceulen/issues",
|
|
31
42
|
"scripts": {
|
|
32
|
-
"test": "node --import tsx --test extensions/modules/router/test/unit.test.ts extensions/modules/router/test/guard.test.ts extensions/modules/usage/test/*.test.ts extensions/modules/ponytail/test/*.test.ts extensions/modules/config/test/*.test.ts extensions/modules/composer/test/*.test.ts",
|
|
43
|
+
"test": "node scripts/validate-themes.mjs && node --import tsx --test extensions/modules/router/test/unit.test.ts extensions/modules/router/test/guard.test.ts extensions/modules/classifier/test/*.test.ts extensions/modules/advisor/test/*.test.ts extensions/modules/usage/test/*.test.ts extensions/modules/ponytail/test/*.test.ts extensions/modules/ux/test/*.test.ts extensions/modules/config/test/*.test.ts extensions/modules/composer/test/*.test.ts extensions/modules/serena/test/*.test.ts extensions/modules/fff/test/*.test.ts extensions/modules/rtk/test/*.test.js extensions/modules/munin/test/*.test.ts extensions/modules/subagent/test/*.test.ts extensions/modules/zai/test/*.test.ts extensions/modules/repair/test/*.test.ts extensions/modules/steering/test/*.test.ts extensions/modules/plan/test/*.test.ts extensions/modules/web/test/*.test.ts",
|
|
33
44
|
"typecheck": "tsc --noEmit"
|
|
34
45
|
},
|
|
35
46
|
"pi": {
|
|
36
47
|
"extensions": [
|
|
37
48
|
"./extensions"
|
|
49
|
+
],
|
|
50
|
+
"themes": [
|
|
51
|
+
"./themes"
|
|
38
52
|
]
|
|
39
53
|
},
|
|
40
54
|
"peerDependencies": {
|
|
41
|
-
"@earendil-works/pi-coding-agent": ">=0.99.1 <
|
|
42
|
-
"@earendil-works/pi-tui": ">=0.99.1 <
|
|
55
|
+
"@earendil-works/pi-coding-agent": ">=0.99.1 <1.1.0",
|
|
56
|
+
"@earendil-works/pi-tui": ">=0.99.1 <1.1.0",
|
|
57
|
+
"typebox": "*"
|
|
43
58
|
},
|
|
44
59
|
"devDependencies": {
|
|
45
60
|
"@types/node": "^20.19.43",
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Validates every themes/*.json loads as a pi theme: name present + unique,
|
|
2
|
+
// not colliding with pi's builtin names (dark/light/system are preloaded and
|
|
3
|
+
// win dedupe), full pi-required color token set (from pi's theme-json schema),
|
|
4
|
+
// and every value resolving to a var ref, #RRGGBB, 256-color index, or "".
|
|
5
|
+
// ponytail: adapted from @bacnh85/pi-themes scripts/validate-themes.mjs (MIT).
|
|
6
|
+
// Usage: node scripts/validate-themes.mjs [dir] (dir defaults to ./themes)
|
|
7
|
+
import { readFileSync, readdirSync } from "node:fs";
|
|
8
|
+
import { join, dirname } from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
|
|
11
|
+
const dir = process.argv[2]
|
|
12
|
+
?? join(dirname(dirname(fileURLToPath(import.meta.url))), "themes");
|
|
13
|
+
const files = readdirSync(dir).filter((f) => f.endsWith(".json")).sort();
|
|
14
|
+
if (files.length === 0) {
|
|
15
|
+
console.error(`no theme files found in ${dir}`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// pi's required colors token list (dist/modes/interactive/theme/theme-json.js).
|
|
20
|
+
const REQUIRED = [
|
|
21
|
+
"accent", "border", "borderAccent", "borderMuted", "success", "error",
|
|
22
|
+
"warning", "muted", "dim", "text", "thinkingText", "selectedBg",
|
|
23
|
+
"userMessageBg", "userMessageText", "customMessageBg", "customMessageText",
|
|
24
|
+
"customMessageLabel", "toolPendingBg", "toolSuccessBg", "toolErrorBg",
|
|
25
|
+
"toolTitle", "toolOutput", "mdHeading", "mdLink", "mdLinkUrl", "mdCode",
|
|
26
|
+
"mdCodeBlock", "mdCodeBlockBorder", "mdQuote", "mdQuoteBorder", "mdHr",
|
|
27
|
+
"mdListBullet", "toolDiffAdded", "toolDiffRemoved", "toolDiffContext",
|
|
28
|
+
"syntaxComment", "syntaxKeyword", "syntaxFunction", "syntaxVariable",
|
|
29
|
+
"syntaxString", "syntaxNumber", "syntaxType", "syntaxOperator",
|
|
30
|
+
"syntaxPunctuation", "thinkingOff", "thinkingMinimal", "thinkingLow",
|
|
31
|
+
"thinkingMedium", "thinkingHigh", "thinkingXhigh", "bashMode",
|
|
32
|
+
];
|
|
33
|
+
const BUILTIN = new Set(["dark", "light", "system"]);
|
|
34
|
+
|
|
35
|
+
let failed = false;
|
|
36
|
+
const names = new Set();
|
|
37
|
+
const isColorValue = (v, vars) =>
|
|
38
|
+
(typeof v === "number" && Number.isInteger(v) && v >= 0 && v <= 255)
|
|
39
|
+
|| v === ""
|
|
40
|
+
|| /^#[0-9A-Fa-f]{6}$/.test(v)
|
|
41
|
+
|| vars.has(v);
|
|
42
|
+
|
|
43
|
+
for (const file of files) {
|
|
44
|
+
let theme;
|
|
45
|
+
try {
|
|
46
|
+
theme = JSON.parse(readFileSync(join(dir, file), "utf8"));
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.error(`${file}: not valid JSON: ${e.message}`);
|
|
49
|
+
failed = true;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const fail = (msg) => {
|
|
53
|
+
console.error(`${file}: ${msg}`);
|
|
54
|
+
failed = true;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
if (!theme.name) fail("missing name");
|
|
58
|
+
else if (BUILTIN.has(theme.name)) fail(`name collides with pi builtin: ${theme.name}`);
|
|
59
|
+
else if (names.has(theme.name)) fail(`duplicate theme name: ${theme.name}`);
|
|
60
|
+
else names.add(theme.name);
|
|
61
|
+
|
|
62
|
+
const colors = theme.colors ?? {};
|
|
63
|
+
const missing = REQUIRED.filter((k) => !(k in colors));
|
|
64
|
+
if (missing.length) fail(`missing required tokens: ${missing.join(", ")}`);
|
|
65
|
+
|
|
66
|
+
const vars = new Set(Object.keys(theme.vars ?? {}));
|
|
67
|
+
const bad = [];
|
|
68
|
+
for (const [k, v] of Object.entries({ ...vars.entries && theme.vars, ...colors })) {
|
|
69
|
+
if (!isColorValue(v, vars)) bad.push(`${k}=${JSON.stringify(v)}`);
|
|
70
|
+
}
|
|
71
|
+
if (bad.length) fail(`unresolvable values: ${bad.join(", ")}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (failed) process.exit(1);
|
|
75
|
+
console.log(`themes: ${files.length} files OK`);
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: munin
|
|
3
|
+
description: Use Munin long-term memory before non-trivial repo work, bug fixes with recurring symptoms, architecture/dependency/setup changes, and when storing durable verified knowledge for future sessions. Search, retrieve, verify, list, store, or share project knowledge across sessions. Use munin_search for pre-work context, munin_store for post-work storage. Use when the user mentions memory, recall, remember, past work, previously, store this, document this, or when work could benefit from prior project knowledge.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Munin
|
|
7
|
+
|
|
8
|
+
Munin is the canonical memory system for Pi. Use it for all memory operations — project-local and cross-project.
|
|
9
|
+
|
|
10
|
+
Use the Munin Pi extension tools to recover and preserve verified project knowledge through native Pi-native tool calls. Memory results are leads, not authority: verify them against the current repository, docs, command output, or user-provided facts before relying on them.
|
|
11
|
+
|
|
12
|
+
## How It Works
|
|
13
|
+
|
|
14
|
+
1. The ceulen `munin` module provides native tools: `munin_search`, `munin_get`, `munin_store`, `munin_list`, `munin_recent`, `munin_delete`, `munin_capabilities`, `munin_share`.
|
|
15
|
+
2. Config lives at PROJECT level: `/config` → Memory → Munin (saved to `<repo>/.pi/settings.json` under a `munin` section). `MUNIN_API_KEY` / `MUNIN_PROJECT` / `MUNIN_BASE_URL` env vars (incl. trusted `.env.local` / `.env`) override it; a per-call `api_key`/`project`/`base_url` param overrides everything.
|
|
16
|
+
3. Print readable output by default, or raw JSON via tool details.
|
|
17
|
+
4. Store only durable knowledge that is verified and useful in a future session.
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
**Pre-work: search context:**
|
|
22
|
+
```
|
|
23
|
+
munin_search query="auth refresh token timeout" tags="type:bug-fix,domain:auth" topK=5
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Post-work: store knowledge:**
|
|
27
|
+
```
|
|
28
|
+
munin_store
|
|
29
|
+
key="bug-fix/auth-refresh-timeout"
|
|
30
|
+
title="Auth refresh timeout fix"
|
|
31
|
+
content="Conclusion: The auth refresh timeout was caused by missing timeout fallback...\n\nWhy it matters: Future auth work should avoid this pattern...\n\nEvidence/verification: Verified with test_auth_refresh.py passing...\n\nAnchors: src/auth.ts:42, AuthService.refreshToken"
|
|
32
|
+
tags="type:bug-fix,domain:auth"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Targeted operations:**
|
|
36
|
+
```
|
|
37
|
+
munin_search query="cache policy" tags="type:decision" topK=5
|
|
38
|
+
munin_get key="architecture/cache-policy"
|
|
39
|
+
munin_store key="setup/new-db-migration" title="..." content="..." tags="type:fact,domain:infra"
|
|
40
|
+
munin_list limit=20
|
|
41
|
+
munin_recent limit=10
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Tag Discipline
|
|
45
|
+
|
|
46
|
+
| Category | Examples | Required |
|
|
47
|
+
|----------|----------|----------|
|
|
48
|
+
| `type:` | decision, bug-fix, fact, dependency | Yes, at least one |
|
|
49
|
+
| `domain:` | auth, frontend, backend, infra, memory | Yes, at least one |
|
|
50
|
+
| `status:` | active, deprecated, experimental | Optional |
|
|
51
|
+
| `priority:` | high, medium, low | Optional |
|
|
52
|
+
|
|
53
|
+
## Search Query Quality
|
|
54
|
+
|
|
55
|
+
Use **4-8 word queries** with **quoted phrases** (`"JWT TTL"`) and **capitalized entity names** (`Stripe`, `Munin`). Quoted phrases get +0.25 score boost; named entities get +0.15. **DO NOT use single-word queries** — they return noise. Example: ✅ `"EAI_AGAIN" MongoDB Atlas connection drop` — ❌ `auth`.
|
|
56
|
+
|
|
57
|
+
## Tool Selection
|
|
58
|
+
|
|
59
|
+
| Tool | When to Use |
|
|
60
|
+
|------|-------------|
|
|
61
|
+
| `munin_search` | Targeted search with specific filters before work. |
|
|
62
|
+
| `munin_get` | Retrieve full content of a specific memory by key. |
|
|
63
|
+
| `munin_store` | Store verified knowledge with tag validation. |
|
|
64
|
+
| `munin_list` / `munin_recent` | Browse or audit what is stored. |
|
|
65
|
+
| `munin_delete` | Only when user explicitly requests removal. |
|
|
66
|
+
| `munin_capabilities` | Check what server features are available. |
|
|
67
|
+
| `munin_share` | Share memories across projects. |
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## What to Store
|
|
72
|
+
|
|
73
|
+
Store one verified concept per memory:
|
|
74
|
+
|
|
75
|
+
- Architecture or product decisions and rationale.
|
|
76
|
+
- Recurring bug symptoms, root causes, fixes, and verification.
|
|
77
|
+
- Stable setup facts, conventions, constraints, and dependency choices.
|
|
78
|
+
- Durable user/project preferences when they materially guide work.
|
|
79
|
+
- Cross-reference related memories by mentioning their keys in `content` (e.g., `See also: architecture/cache-policy`). This enables Munin's semantic search to surface related knowledge together.
|
|
80
|
+
|
|
81
|
+
Do not store:
|
|
82
|
+
|
|
83
|
+
- Secrets, credentials, tokens, private keys, or connection strings.
|
|
84
|
+
- Raw logs, transient task progress, temporary TODOs, or unverified guesses.
|
|
85
|
+
- Information already trivial to derive from repository files.
|
|
86
|
+
|
|
87
|
+
## Workflow
|
|
88
|
+
|
|
89
|
+
**Pre-work**: `munin_search` with 4-8 word query + tags → `munin_get` promising results → verify against repo. **Post-work**: `munin_store` with conclusion + why + evidence + anchors + tags.
|
|
90
|
+
|
|
91
|
+
## Examples
|
|
92
|
+
|
|
93
|
+
**Pre-work search for a bug:**
|
|
94
|
+
```
|
|
95
|
+
munin_search query="auth refresh timeout error" tags="type:bug-fix,domain:auth"
|
|
96
|
+
→ I found relevant memory: bug-fix/auth-refresh-timeout — Missing fallback caused 500ms timeout. Verified against src/auth.ts before using it.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Post-work store:**
|
|
100
|
+
```
|
|
101
|
+
munin_store
|
|
102
|
+
key="architecture/cache-policy"
|
|
103
|
+
title="Cache policy decision"
|
|
104
|
+
content="Conclusion: Use LRU with 1h TTL for API responses, no-cache for auth tokens.\n\nWhy it matters: Prevents stale data and reduces backend load.\n\nEvidence/verification: Benchmarked with k6: 40% reduction in DB queries.\n\nAnchors: src/cache.ts, CachePolicy class"
|
|
105
|
+
tags="type:decision,domain:backend"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Troubleshooting
|
|
109
|
+
|
|
110
|
+
- **Missing extension**: Install the ceulen bundle (`pi install npm:ceulen`) and keep the `munin` module enabled (`ceulen.disabled`).
|
|
111
|
+
- **Missing credentials**: Configure via `/config` → Memory → Munin (project-level `.pi/settings.json`), or set `MUNIN_API_KEY` and `MUNIN_PROJECT` in `.env.local` / environment.
|
|
112
|
+
- **"Project not found" errors**: Do **not** pass the `project` parameter to tool calls. It defaults to `$MUNIN_PROJECT`, which is already set correctly. Hardcoding a value like the repo directory name causes this error.
|
|
113
|
+
- **Tag validation failed**: Ensure at least one `type:` and one `domain:` tag. Check spelling.
|
|
114
|
+
- **Single-word search queries return noise**: Use 4-8 word queries with at least one quoted phrase or capitalized entity name. See "Search Query Quality" section above.
|
|
115
|
+
- **No results**: Try broader queries, fewer tags, or `munin_list` to see what exists.
|
|
116
|
+
|
|
117
|
+
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ux-capture
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
description: >
|
|
5
|
+
Capture playbook for the pi-ux render-and-inspect loop: screenshotting a UI
|
|
6
|
+
you just built via local headless Chrome vs web_screenshot, daemon
|
|
7
|
+
reachability (localhost vs LAN IP vs host.docker.internal), SSRF-protected
|
|
8
|
+
daemons, and cloudflared tunnels. Load when setting up render inspection or
|
|
9
|
+
when a UI screenshot capture fails. Covers WebGL/three.js pages (SwiftShader
|
|
10
|
+
capture flags + in-app WebGL guard).
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# UX Capture Playbook
|
|
14
|
+
|
|
15
|
+
Judge captures at viewer resolution (1×–3×); never chase sub-visible precision.
|
|
16
|
+
|
|
17
|
+
**Disable entrance animations when capturing**: pass `reduced_motion=true` to
|
|
18
|
+
`web_screenshot` / `web_interact` (pi-web ≥0.16.0), or add
|
|
19
|
+
`--force-prefers-reduced-motion` to manual headless Chrome (or emulate the media
|
|
20
|
+
query). Pages rightly use staggered page-load reveals with `opacity:0`
|
|
21
|
+
backwards-fill — captured mid-animation they screenshot as blank sections,
|
|
22
|
+
and you will "fix" content that isn't broken. The same forced query doubles
|
|
23
|
+
as a reduced-motion audit: with animations off, every section must still be
|
|
24
|
+
fully visible and readable.
|
|
25
|
+
|
|
26
|
+
**Capture at the brief's target viewport.** Web pages: 1280–1440 wide. App
|
|
27
|
+
screens and mobile-first briefs: the width the brief names (usually 390) at
|
|
28
|
+
its target height (~844). pi-web handles this honestly now: `web_screenshot`
|
|
29
|
+
and `web_interact` with `width`/`viewport` below 500px automatically use CDP
|
|
30
|
+
device-metrics emulation (true 390px CSS viewport) and return a
|
|
31
|
+
`scrollWidth`/`innerWidth` probe — `scrollWidth > width` means overflowing CSS.
|
|
32
|
+
If you fall back to manual headless Chrome, know its trap: many builds
|
|
33
|
+
**clamp window width to 500px**, so a "390 capture" secretly renders at 500
|
|
34
|
+
and crops (see the layout probe below for the wrapper that does it honestly).
|
|
35
|
+
If content overflows or dead-ends at the target size, the page is broken —
|
|
36
|
+
**fix the page. Never widen the viewport to make a problem invisible.**
|
|
37
|
+
|
|
38
|
+
## Interaction — web_interact (pi-web ≥0.16.0)
|
|
39
|
+
|
|
40
|
+
A screenshot proves the page LOOKS right; only interaction proves it WORKS.
|
|
41
|
+
After visual inspection, verify behavior with `web_interact` — one call = one
|
|
42
|
+
browser lifecycle: open `url`, run `steps` in order, get per-step results, a
|
|
43
|
+
final inline PNG, and a scrollWidth probe.
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
web_interact url="http://localhost:5173" viewport={width:390,height:844} \
|
|
47
|
+
reduced_motion=true grant=["clipboard-read","clipboard-write"] steps=[
|
|
48
|
+
{click: "#copy-btn"},
|
|
49
|
+
{evaluate: "document.getElementById('status').textContent", label: "status"},
|
|
50
|
+
{type: {selector: "#email", text: "a@b.co"}},
|
|
51
|
+
{press: "Enter"},
|
|
52
|
+
{wait_for: "[data-success]"}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- **Trusted clicks**: steps click via CDP `Input.dispatchMouseEvent` at the
|
|
56
|
+
element's center — synthetic `el.click()` grants no user activation, so
|
|
57
|
+
`document.execCommand('copy')` and login/clipboard flows would silently fail
|
|
58
|
+
under it. Under a trusted click, copy returns true.
|
|
59
|
+
- **evaluate is double-unwrapped**: `Runtime.evaluate` nests the value at
|
|
60
|
+
`{result:{result:{value}}}` — the tool returns the real value; if you ever
|
|
61
|
+
hand-roll CDP, single-unwrapping yields `undefined` and makes the app LOOK
|
|
62
|
+
broken when it isn't.
|
|
63
|
+
- Steps stop at the first failure with the reason — a broken selector surfaces
|
|
64
|
+
loudly instead of no-op'ing later steps.
|
|
65
|
+
- **Authenticated dev routes need the token set BEFORE navigating**: the call
|
|
66
|
+
opens `url` then runs steps, so a deep link into a login-protected route
|
|
67
|
+
fetches before your token exists and bounces to the login page (you then
|
|
68
|
+
screenshot the login screen and blame the UI). Hop through the origin:
|
|
69
|
+
`{evaluate:"localStorage.setItem('token','…')"}`, `{wait_ms:400}`,
|
|
70
|
+
`{evaluate:"location.replace('/app?id=1')"}`, `{wait_ms:6000}`. The tool warns
|
|
71
|
+
that a navigating step means later steps run against the NEW document — order
|
|
72
|
+
the token step first, never after the navigation.
|
|
73
|
+
- **Read the app's own error/status element** (`{evaluate:"(document.getElementById('error')||{}).textContent"}`)
|
|
74
|
+
before concluding the app is broken: a blank canvas can be an app-side failure
|
|
75
|
+
notice (bad fixture, failed fetch) that only the DOM text names.
|
|
76
|
+
- **One action key per step**: a step object takes exactly ONE of
|
|
77
|
+
click/type/press/evaluate/wait_for/dialog/screenshot (plus optional `label`).
|
|
78
|
+
`wait_for` accepts a selector string OR a millisecond number, and `wait_ms`
|
|
79
|
+
is the flat alias for `wait_for: <number>` (mapped before validation) — but
|
|
80
|
+
it IS an action key, so it cannot ride along with another one
|
|
81
|
+
(`{screenshot:true, wait_ms:1500}` is rejected as two actions — make them two
|
|
82
|
+
steps). `{screenshot:false}` is the lone exception: a declined capture,
|
|
83
|
+
filtered out before validation.
|
|
84
|
+
- **Slow steps — the budget is a top-level param, not a step key**: pass
|
|
85
|
+
`timeout_ms` on the `web_interact` CALL (default 60s, clamped 1s–600s); it
|
|
86
|
+
bounds each step and fails loudly with the reason instead of hanging. A step
|
|
87
|
+
object carrying `timeout_ms` is rejected as an unknown key. Raise it for
|
|
88
|
+
legitimately slow `evaluate` steps.
|
|
89
|
+
- Clipboard readback on insecure origins: there is no clipboard API to read
|
|
90
|
+
back with; `execCommand` returning true under a trusted click is the
|
|
91
|
+
strongest available signal (grant permissions for secure origins).
|
|
92
|
+
|
|
93
|
+
Manual CDP (fallback only, when web_interact is unavailable): launch Chrome
|
|
94
|
+
with `--remote-debugging-port=0`, read `<profile>/DevToolsActivePort` for the
|
|
95
|
+
ws URL, create targets over the websocket (`Target.createTarget` — not the
|
|
96
|
+
`/json/new` HTTP endpoint, whose method flipped to PUT), attach with
|
|
97
|
+
`flatten: true`.
|
|
98
|
+
|
|
99
|
+
## WebGL pages (three.js / r3f / model-viewer)
|
|
100
|
+
|
|
101
|
+
Headless Chrome without a GPU has no WebGL context: a three.js canvas throws
|
|
102
|
+
on creation and — unguarded — the error boundary replaces the whole page with
|
|
103
|
+
"Application error", so you screenshot a blank/error page and blame the app.
|
|
104
|
+
|
|
105
|
+
1. **In the app**: probe first
|
|
106
|
+
(`document.createElement('canvas').getContext('webgl2') ?? …getContext('webgl')`)
|
|
107
|
+
and render a fallback message when absent. A GPU-less viewer must not crash
|
|
108
|
+
the route it lives on.
|
|
109
|
+
2. **In the capture**: launch Chrome with software rendering —
|
|
110
|
+
`--enable-unsafe-swiftshader --use-gl=angle --use-angle=swiftshader` — then
|
|
111
|
+
the canvas really renders and the screenshot shows the model. Verify with a
|
|
112
|
+
CDP probe (`canvas.getContext('webgl')`) before trusting a blank capture;
|
|
113
|
+
`gl:true` with an empty canvas means the scene, not the context, is broken.
|
|
114
|
+
|
|
115
|
+
## Layout probe (fallback for manual captures)
|
|
116
|
+
|
|
117
|
+
Needed only when CDP tooling above is unavailable. Two Chrome facts make naive mobile checks lie:
|
|
118
|
+
|
|
119
|
+
1. **Headless Chrome clamps window width to 500px.** A `--window-size=390`
|
|
120
|
+
capture renders the page at 500px and crops the PNG to 390 — cuts at the
|
|
121
|
+
right edge are the CROP, not your CSS. Detect it:
|
|
122
|
+
`--dump-dom` a page containing `window.innerWidth` — 500 at a 390 request
|
|
123
|
+
means clamped.
|
|
124
|
+
2. `window.innerWidth` therefore never reports the true mobile viewport.
|
|
125
|
+
|
|
126
|
+
The honest way to see and measure a 390px screen: a **wrapper page with a
|
|
127
|
+
390×844 iframe** (an iframe IS a true 390px CSS viewport, immune to the
|
|
128
|
+
clamp), rendered at a 500px window with `--allow-file-access-from-files`:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
cp index.html /tmp/page.html
|
|
132
|
+
cat > /tmp/wrapper.html <<'EOF'
|
|
133
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><style>
|
|
134
|
+
body{margin:0;background:#888}#frame{width:390px;height:844px;border:0;outline:2px solid #000}
|
|
135
|
+
</style></head><body>
|
|
136
|
+
<iframe id="frame" src="./page.html"></iframe>
|
|
137
|
+
<pre id="out">measuring…</pre>
|
|
138
|
+
<script>
|
|
139
|
+
const f=document.getElementById('frame');
|
|
140
|
+
f.addEventListener('load',()=>{
|
|
141
|
+
const d=f.contentDocument;
|
|
142
|
+
document.getElementById('out').textContent=
|
|
143
|
+
'page scrollWidth:'+d.documentElement.scrollWidth+' / viewport:390';
|
|
144
|
+
});
|
|
145
|
+
</script>
|
|
146
|
+
</body></html>
|
|
147
|
+
EOF
|
|
148
|
+
"$CHROME" --headless --disable-gpu --allow-file-access-from-files \
|
|
149
|
+
--virtual-time-budget=6000 --window-size=500,900 \
|
|
150
|
+
--screenshot=/tmp/mobile-390.png "file:///tmp/wrapper.html"
|
|
151
|
+
"$CHROME" --headless --disable-gpu --allow-file-access-from-files \
|
|
152
|
+
--virtual-time-budget=6000 --window-size=500,900 \
|
|
153
|
+
--dump-dom "file:///tmp/wrapper.html" | grep -o 'page scrollWidth:[^<]*'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Pass = scrollWidth 390 / viewport:390**, and the screenshot shows the true
|
|
157
|
+
mobile render (grey letterbox on the right is the wrapper, not your page).
|
|
158
|
+
If scrollWidth exceeds 390, fix the CSS (min-width on rows/grid, an
|
|
159
|
+
unbreakable string, a fixed-width column) and probe again — on the delivered
|
|
160
|
+
file, after the last edit.
|
|
161
|
+
|
|
162
|
+
**Alternative: puppeteer-core device emulation** (when node ≥18 and npm are
|
|
163
|
+
available — no wrapper file, and it gives true `fullPage` + a JS overflow
|
|
164
|
+
probe): `npm i puppeteer-core` once, then launch with
|
|
165
|
+
`executablePath` pointing at installed Chrome and
|
|
166
|
+
`page.setViewport({ width: 390, height: 844, deviceScaleFactor: 2 })`.
|
|
167
|
+
`setViewport` is real device-metrics emulation — immune to the window clamp.
|
|
168
|
+
Probe with `document.documentElement.scrollWidth` via `page.evaluate` before
|
|
169
|
+
screenshotting; `page.screenshot({ fullPage: true })` for the tall capture.
|
|
170
|
+
|
|
171
|
+
## Default — web_screenshot (pi-web ≥0.16.0, auto local detection)
|
|
172
|
+
|
|
173
|
+
`web_screenshot` auto-routes localhost/LAN/file URLs to the locally installed
|
|
174
|
+
headless Chrome and returns the PNG inline — no daemon, no manual commands:
|
|
175
|
+
|
|
176
|
+
- `web_screenshot url="http://localhost:PORT" width=390 height=844` — the
|
|
177
|
+
model sees the render; below 500px the capture is CDP device-emulated
|
|
178
|
+
(honest viewport, no clamp) and includes the scrollWidth probe.
|
|
179
|
+
- `reduced_motion=true` disables entrance animations for the shot.
|
|
180
|
+
- `full_page=true` captures a tall 8000px window; `wait_for` settles JS via
|
|
181
|
+
`--virtual-time-budget`; `engine="local"` forces local on a public URL.
|
|
182
|
+
- `web_pdf` works the same way (`--print-to-pdf`) for full-content archival.
|
|
183
|
+
- If Chrome is missing: `web_status` shows `localChrome.path`; set `CHROME_PATH`.
|
|
184
|
+
- Empty replies / connection resets from a dev-server URL usually mean a
|
|
185
|
+
STALE HUNG server on the port (accepts TCP, returns nothing) — `lsof -ti
|
|
186
|
+
:PORT` and kill it before diagnosing the tools.
|
|
187
|
+
|
|
188
|
+
## Fallback — manual headless Chrome (pi-web <0.7.0 or if the tool errors)
|
|
189
|
+
|
|
190
|
+
Headless Chrome writes the PNG; the `read` tool shows it inline (multimodal models see it). Keep `--window-size` at the target viewport (e.g. `390,844` for a phone screen) — never widen it to hide overflow.
|
|
191
|
+
|
|
192
|
+
- Linux: `google-chrome --headless --screenshot=/tmp/shot.png --window-size=1280,800 http://localhost:PORT` (or `chromium`)
|
|
193
|
+
- macOS: `"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless --screenshot=/tmp/shot.png --window-size=1280,800 http://localhost:PORT`
|
|
194
|
+
|
|
195
|
+
## Alternative — web_screenshot (daemon-rendered, pi-web 0.6.2+)
|
|
196
|
+
|
|
197
|
+
The screenshot URL is navigated by the DAEMON's browser, so addresses must resolve on the daemon host:
|
|
198
|
+
|
|
199
|
+
- Reachable: your machine's LAN IP, or `host.docker.internal` for a Dockerized daemon.
|
|
200
|
+
- Plain localhost/file:// only for a daemon you *know* runs natively on this machine — `web_status` can't tell you (a Dockerized daemon on a published port also shows 127.0.0.1 + healthy but cannot see your localhost).
|
|
201
|
+
- SSRF-protected daemons (common) block private/localhost URLs outright — failures say "URL blocked (SSRF protection)".
|
|
202
|
+
- Last resort: a temporary public tunnel (`cloudflared tunnel --url http://localhost:PORT`) when the remote daemon must render the page; quick tunnels are often flaky. If all capture paths fail, fall back to the deterministic `ux_audit` gates only.
|