@nexus-cortex/cli 4.26.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/.cortex/agents/AGENT_PROFILE_GUIDE.md +307 -0
- package/.cortex/agents/README.md +268 -0
- package/.cortex/agents/a-frontend-landing-page-designer.md +41 -0
- package/.cortex/agents/autoresearch-agent.md +49 -0
- package/.cortex/agents/code-reviewer.md +63 -0
- package/.cortex/agents/context-research.md +26 -0
- package/.cortex/agents/doc-writer.md +92 -0
- package/.cortex/agents/explore.md +63 -0
- package/.cortex/agents/new-model-api-integrator-analyst.md +41 -0
- package/.cortex/agents/plan.md +109 -0
- package/.cortex/agents/pr-architecture-reviewer.md +77 -0
- package/.cortex/agents/pr-code-quality.md +78 -0
- package/.cortex/agents/pr-implementer.md +50 -0
- package/.cortex/agents/pr-security-auditor.md +62 -0
- package/.cortex/agents/pr-test-writer.md +67 -0
- package/.cortex/agents/refactor.md +118 -0
- package/.cortex/agents/test-writer.md +72 -0
- package/.cortex/agents/web-researcher.md +72 -0
- package/.cortex/bench/tasks/sample-tasks.json +20 -0
- package/.cortex/commands/compare.md +14 -0
- package/.cortex/commands/deps.md +16 -0
- package/.cortex/commands/diff.md +14 -0
- package/.cortex/commands/explain.md +16 -0
- package/.cortex/commands/find-bug.md +13 -0
- package/.cortex/commands/profile.md +15 -0
- package/.cortex/commands/review.md +18 -0
- package/.cortex/commands/search.md +16 -0
- package/.cortex/commands/test.md +15 -0
- package/.cortex/permissions.dev.json +20 -0
- package/.cortex/permissions.example.json +71 -0
- package/.cortex/permissions.prod.json +63 -0
- package/.cortex/permissions.test.json +19 -0
- package/.cortex/skills/autoresearch/SKILL.md +77 -0
- package/.cortex/skills/autoresearch/personas/README.md +45 -0
- package/.cortex/skills/autoresearch/personas/aggressive-refactor.md +25 -0
- package/.cortex/skills/autoresearch/personas/creative.md +29 -0
- package/.cortex/skills/autoresearch/personas/perf-hunter.md +27 -0
- package/.cortex/skills/autoresearch/personas/precise.md +23 -0
- package/.cortex/skills/autoresearch/personas/root-cause.md +26 -0
- package/.cortex/skills/autoresearch/personas/security-auditor.md +29 -0
- package/.cortex/skills/autoresearch/personas/skeptic-reviewer.md +31 -0
- package/.cortex/skills/autoresearch/personas/test-first.md +25 -0
- package/.cortex/skills/best-of-n/SKILL.md +76 -0
- package/.cortex/skills/cortex/SKILL.md +834 -0
- package/.cortex/skills/cortex-bench/SKILL.md +354 -0
- package/.cortex/skills/docx/SKILL.md +83 -0
- package/.cortex/skills/pdf-documents/SKILL.md +297 -0
- package/.cortex/skills/pdf-documents/sections/01-image-acquisition.md +132 -0
- package/.cortex/skills/pdf-documents/sections/02-ai-image-generation.md +274 -0
- package/.cortex/skills/pdf-documents/sections/03-paper-sizes.md +89 -0
- package/.cortex/skills/pdf-documents/sections/04-design-system.md +549 -0
- package/.cortex/skills/pdf-documents/sections/05-css-print-rules.md +135 -0
- package/.cortex/skills/pdf-documents/sections/06-svg-charts.md +100 -0
- package/.cortex/skills/pdf-documents/sections/07-templates.md +224 -0
- package/.cortex/skills/pdf-documents/sections/08-scaled-output.md +164 -0
- package/.cortex/skills/pdf-documents/sections/09-preview-qa.md +66 -0
- package/.cortex/skills/pdf-documents/sections/10-reading-pdfs.md +499 -0
- package/.cortex/skills/pdf-documents/sections/11-form-filling.md +241 -0
- package/.cortex/skills/pptx/SKILL.md +90 -0
- package/.cortex/skills/resume-analyst/SKILL.md +373 -0
- package/.cortex/skills/verify-work/SKILL.md +74 -0
- package/.cortex/skills/xlsx/SKILL.md +101 -0
- package/.cortex/system-messages/messages/WORK_QUALITY.md +159 -0
- package/.cortex/system-messages/registry.json +18 -0
- package/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +13 -0
- package/bin/cortex.js +548 -0
- package/dist/agent-mode.d.ts +21 -0
- package/dist/agent-mode.d.ts.map +1 -0
- package/dist/agent-mode.js +511 -0
- package/dist/agent-mode.js.map +1 -0
- package/dist/client/CortexClient.d.ts +84 -0
- package/dist/client/CortexClient.d.ts.map +1 -0
- package/dist/client/CortexClient.js +163 -0
- package/dist/client/CortexClient.js.map +1 -0
- package/dist/commands/artifact/list.d.ts +15 -0
- package/dist/commands/artifact/list.d.ts.map +1 -0
- package/dist/commands/artifact/list.js +89 -0
- package/dist/commands/artifact/list.js.map +1 -0
- package/dist/commands/artifact/restart.d.ts +13 -0
- package/dist/commands/artifact/restart.d.ts.map +1 -0
- package/dist/commands/artifact/restart.js +56 -0
- package/dist/commands/artifact/restart.js.map +1 -0
- package/dist/commands/artifact/status.d.ts +13 -0
- package/dist/commands/artifact/status.d.ts.map +1 -0
- package/dist/commands/artifact/status.js +100 -0
- package/dist/commands/artifact/status.js.map +1 -0
- package/dist/commands/artifact/stop.d.ts +13 -0
- package/dist/commands/artifact/stop.d.ts.map +1 -0
- package/dist/commands/artifact/stop.js +50 -0
- package/dist/commands/artifact/stop.js.map +1 -0
- package/dist/commands/autoresearch/bench.d.ts +32 -0
- package/dist/commands/autoresearch/bench.d.ts.map +1 -0
- package/dist/commands/autoresearch/bench.js +123 -0
- package/dist/commands/autoresearch/bench.js.map +1 -0
- package/dist/commands/autoresearch/commandRunner.d.ts +35 -0
- package/dist/commands/autoresearch/commandRunner.d.ts.map +1 -0
- package/dist/commands/autoresearch/commandRunner.js +91 -0
- package/dist/commands/autoresearch/commandRunner.js.map +1 -0
- package/dist/commands/autoresearch/evaluate.d.ts +18 -0
- package/dist/commands/autoresearch/evaluate.d.ts.map +1 -0
- package/dist/commands/autoresearch/evaluate.js +117 -0
- package/dist/commands/autoresearch/evaluate.js.map +1 -0
- package/dist/commands/autoresearch/experiment.d.ts +38 -0
- package/dist/commands/autoresearch/experiment.d.ts.map +1 -0
- package/dist/commands/autoresearch/experiment.js +168 -0
- package/dist/commands/autoresearch/experiment.js.map +1 -0
- package/dist/commands/autoresearch/fix.d.ts +10 -0
- package/dist/commands/autoresearch/fix.d.ts.map +1 -0
- package/dist/commands/autoresearch/fix.js +86 -0
- package/dist/commands/autoresearch/fix.js.map +1 -0
- package/dist/commands/autoresearch/harnessProcess.d.ts +48 -0
- package/dist/commands/autoresearch/harnessProcess.d.ts.map +1 -0
- package/dist/commands/autoresearch/harnessProcess.js +140 -0
- package/dist/commands/autoresearch/harnessProcess.js.map +1 -0
- package/dist/commands/autoresearch/list.d.ts +6 -0
- package/dist/commands/autoresearch/list.d.ts.map +1 -0
- package/dist/commands/autoresearch/list.js +38 -0
- package/dist/commands/autoresearch/list.js.map +1 -0
- package/dist/commands/autoresearch/loop.d.ts +26 -0
- package/dist/commands/autoresearch/loop.d.ts.map +1 -0
- package/dist/commands/autoresearch/loop.js +242 -0
- package/dist/commands/autoresearch/loop.js.map +1 -0
- package/dist/commands/cache/metrics.d.ts +13 -0
- package/dist/commands/cache/metrics.d.ts.map +1 -0
- package/dist/commands/cache/metrics.js +77 -0
- package/dist/commands/cache/metrics.js.map +1 -0
- package/dist/commands/chat/AgenticChat.d.ts +39 -0
- package/dist/commands/chat/AgenticChat.d.ts.map +1 -0
- package/dist/commands/chat/AgenticChat.js +201 -0
- package/dist/commands/chat/AgenticChat.js.map +1 -0
- package/dist/commands/chat/renderers/CodeRenderer.d.ts +36 -0
- package/dist/commands/chat/renderers/CodeRenderer.d.ts.map +1 -0
- package/dist/commands/chat/renderers/CodeRenderer.js +85 -0
- package/dist/commands/chat/renderers/CodeRenderer.js.map +1 -0
- package/dist/commands/chat/renderers/ToolRenderer.d.ts +30 -0
- package/dist/commands/chat/renderers/ToolRenderer.d.ts.map +1 -0
- package/dist/commands/chat/renderers/ToolRenderer.js +93 -0
- package/dist/commands/chat/renderers/ToolRenderer.js.map +1 -0
- package/dist/commands/chat/single-message.d.ts +15 -0
- package/dist/commands/chat/single-message.d.ts.map +1 -0
- package/dist/commands/chat/single-message.js +85 -0
- package/dist/commands/chat/single-message.js.map +1 -0
- package/dist/commands/config/categories.d.ts +8 -0
- package/dist/commands/config/categories.d.ts.map +1 -0
- package/dist/commands/config/categories.js +75 -0
- package/dist/commands/config/categories.js.map +1 -0
- package/dist/commands/config/category.d.ts +8 -0
- package/dist/commands/config/category.d.ts.map +1 -0
- package/dist/commands/config/category.js +81 -0
- package/dist/commands/config/category.js.map +1 -0
- package/dist/commands/config/get.d.ts +9 -0
- package/dist/commands/config/get.d.ts.map +1 -0
- package/dist/commands/config/get.js +98 -0
- package/dist/commands/config/get.js.map +1 -0
- package/dist/commands/config/reset.d.ts +6 -0
- package/dist/commands/config/reset.d.ts.map +1 -0
- package/dist/commands/config/reset.js +68 -0
- package/dist/commands/config/reset.js.map +1 -0
- package/dist/commands/config/set.d.ts +6 -0
- package/dist/commands/config/set.d.ts.map +1 -0
- package/dist/commands/config/set.js +60 -0
- package/dist/commands/config/set.js.map +1 -0
- package/dist/commands/config/utils.d.ts +14 -0
- package/dist/commands/config/utils.d.ts.map +1 -0
- package/dist/commands/config/utils.js +54 -0
- package/dist/commands/config/utils.js.map +1 -0
- package/dist/commands/context/boundaries.d.ts +13 -0
- package/dist/commands/context/boundaries.d.ts.map +1 -0
- package/dist/commands/context/boundaries.js +45 -0
- package/dist/commands/context/boundaries.js.map +1 -0
- package/dist/commands/context/compact.d.ts +13 -0
- package/dist/commands/context/compact.d.ts.map +1 -0
- package/dist/commands/context/compact.js +41 -0
- package/dist/commands/context/compact.js.map +1 -0
- package/dist/commands/context/savings.d.ts +13 -0
- package/dist/commands/context/savings.d.ts.map +1 -0
- package/dist/commands/context/savings.js +49 -0
- package/dist/commands/context/savings.js.map +1 -0
- package/dist/commands/context/status.d.ts +13 -0
- package/dist/commands/context/status.d.ts.map +1 -0
- package/dist/commands/context/status.js +52 -0
- package/dist/commands/context/status.js.map +1 -0
- package/dist/commands/context/strategy.d.ts +13 -0
- package/dist/commands/context/strategy.d.ts.map +1 -0
- package/dist/commands/context/strategy.js +66 -0
- package/dist/commands/context/strategy.js.map +1 -0
- package/dist/commands/mcp/disable.d.ts +5 -0
- package/dist/commands/mcp/disable.d.ts.map +1 -0
- package/dist/commands/mcp/disable.js +26 -0
- package/dist/commands/mcp/disable.js.map +1 -0
- package/dist/commands/mcp/edit.d.ts +9 -0
- package/dist/commands/mcp/edit.d.ts.map +1 -0
- package/dist/commands/mcp/edit.js +62 -0
- package/dist/commands/mcp/edit.js.map +1 -0
- package/dist/commands/mcp/enable.d.ts +5 -0
- package/dist/commands/mcp/enable.d.ts.map +1 -0
- package/dist/commands/mcp/enable.js +27 -0
- package/dist/commands/mcp/enable.js.map +1 -0
- package/dist/commands/mcp/init.d.ts +9 -0
- package/dist/commands/mcp/init.d.ts.map +1 -0
- package/dist/commands/mcp/init.js +97 -0
- package/dist/commands/mcp/init.js.map +1 -0
- package/dist/commands/mcp/list.d.ts +6 -0
- package/dist/commands/mcp/list.d.ts.map +1 -0
- package/dist/commands/mcp/list.js +56 -0
- package/dist/commands/mcp/list.js.map +1 -0
- package/dist/commands/mcp/server.d.ts +6 -0
- package/dist/commands/mcp/server.d.ts.map +1 -0
- package/dist/commands/mcp/server.js +44 -0
- package/dist/commands/mcp/server.js.map +1 -0
- package/dist/commands/mcp/status.d.ts +6 -0
- package/dist/commands/mcp/status.d.ts.map +1 -0
- package/dist/commands/mcp/status.js +43 -0
- package/dist/commands/mcp/status.js.map +1 -0
- package/dist/commands/mcp/tools.d.ts +7 -0
- package/dist/commands/mcp/tools.d.ts.map +1 -0
- package/dist/commands/mcp/tools.js +82 -0
- package/dist/commands/mcp/tools.js.map +1 -0
- package/dist/commands/mcp/validate.d.ts +8 -0
- package/dist/commands/mcp/validate.d.ts.map +1 -0
- package/dist/commands/mcp/validate.js +121 -0
- package/dist/commands/mcp/validate.js.map +1 -0
- package/dist/commands/middleware/config.d.ts +13 -0
- package/dist/commands/middleware/config.d.ts.map +1 -0
- package/dist/commands/middleware/config.js +87 -0
- package/dist/commands/middleware/config.js.map +1 -0
- package/dist/commands/middleware/disable.d.ts +13 -0
- package/dist/commands/middleware/disable.d.ts.map +1 -0
- package/dist/commands/middleware/disable.js +50 -0
- package/dist/commands/middleware/disable.js.map +1 -0
- package/dist/commands/middleware/enable.d.ts +13 -0
- package/dist/commands/middleware/enable.d.ts.map +1 -0
- package/dist/commands/middleware/enable.js +50 -0
- package/dist/commands/middleware/enable.js.map +1 -0
- package/dist/commands/middleware/list.d.ts +13 -0
- package/dist/commands/middleware/list.d.ts.map +1 -0
- package/dist/commands/middleware/list.js +64 -0
- package/dist/commands/middleware/list.js.map +1 -0
- package/dist/commands/middleware/status.d.ts +13 -0
- package/dist/commands/middleware/status.d.ts.map +1 -0
- package/dist/commands/middleware/status.js +80 -0
- package/dist/commands/middleware/status.js.map +1 -0
- package/dist/commands/models/compare.d.ts +9 -0
- package/dist/commands/models/compare.d.ts.map +1 -0
- package/dist/commands/models/compare.js +76 -0
- package/dist/commands/models/compare.js.map +1 -0
- package/dist/commands/models/cost.d.ts +9 -0
- package/dist/commands/models/cost.d.ts.map +1 -0
- package/dist/commands/models/cost.js +64 -0
- package/dist/commands/models/cost.js.map +1 -0
- package/dist/commands/models/info.d.ts +9 -0
- package/dist/commands/models/info.d.ts.map +1 -0
- package/dist/commands/models/info.js +61 -0
- package/dist/commands/models/info.js.map +1 -0
- package/dist/commands/models/list.d.ts +6 -0
- package/dist/commands/models/list.d.ts.map +1 -0
- package/dist/commands/models/list.js +66 -0
- package/dist/commands/models/list.js.map +1 -0
- package/dist/commands/models/providers.d.ts +13 -0
- package/dist/commands/models/providers.d.ts.map +1 -0
- package/dist/commands/models/providers.js +45 -0
- package/dist/commands/models/providers.js.map +1 -0
- package/dist/commands/models/search.d.ts +10 -0
- package/dist/commands/models/search.d.ts.map +1 -0
- package/dist/commands/models/search.js +56 -0
- package/dist/commands/models/search.js.map +1 -0
- package/dist/commands/models/switch.d.ts +14 -0
- package/dist/commands/models/switch.d.ts.map +1 -0
- package/dist/commands/models/switch.js +67 -0
- package/dist/commands/models/switch.js.map +1 -0
- package/dist/commands/permissions/auto-approve.d.ts +13 -0
- package/dist/commands/permissions/auto-approve.d.ts.map +1 -0
- package/dist/commands/permissions/auto-approve.js +53 -0
- package/dist/commands/permissions/auto-approve.js.map +1 -0
- package/dist/commands/permissions/grant.d.ts +13 -0
- package/dist/commands/permissions/grant.d.ts.map +1 -0
- package/dist/commands/permissions/grant.js +46 -0
- package/dist/commands/permissions/grant.js.map +1 -0
- package/dist/commands/permissions/mode.d.ts +12 -0
- package/dist/commands/permissions/mode.d.ts.map +1 -0
- package/dist/commands/permissions/mode.js +61 -0
- package/dist/commands/permissions/mode.js.map +1 -0
- package/dist/commands/permissions/policies.d.ts +13 -0
- package/dist/commands/permissions/policies.d.ts.map +1 -0
- package/dist/commands/permissions/policies.js +47 -0
- package/dist/commands/permissions/policies.js.map +1 -0
- package/dist/commands/permissions/revoke.d.ts +13 -0
- package/dist/commands/permissions/revoke.d.ts.map +1 -0
- package/dist/commands/permissions/revoke.js +46 -0
- package/dist/commands/permissions/revoke.js.map +1 -0
- package/dist/commands/permissions/set.d.ts +13 -0
- package/dist/commands/permissions/set.d.ts.map +1 -0
- package/dist/commands/permissions/set.js +57 -0
- package/dist/commands/permissions/set.js.map +1 -0
- package/dist/commands/permissions/tools.d.ts +13 -0
- package/dist/commands/permissions/tools.d.ts.map +1 -0
- package/dist/commands/permissions/tools.js +50 -0
- package/dist/commands/permissions/tools.js.map +1 -0
- package/dist/commands/server/start.d.ts +11 -0
- package/dist/commands/server/start.d.ts.map +1 -0
- package/dist/commands/server/start.js +58 -0
- package/dist/commands/server/start.js.map +1 -0
- package/dist/commands/session/checkpoints.d.ts +6 -0
- package/dist/commands/session/checkpoints.d.ts.map +1 -0
- package/dist/commands/session/checkpoints.js +41 -0
- package/dist/commands/session/checkpoints.js.map +1 -0
- package/dist/commands/session/compact.d.ts +13 -0
- package/dist/commands/session/compact.d.ts.map +1 -0
- package/dist/commands/session/compact.js +56 -0
- package/dist/commands/session/compact.js.map +1 -0
- package/dist/commands/session/export.d.ts +6 -0
- package/dist/commands/session/export.d.ts.map +1 -0
- package/dist/commands/session/export.js +31 -0
- package/dist/commands/session/export.js.map +1 -0
- package/dist/commands/session/list.d.ts +7 -0
- package/dist/commands/session/list.d.ts.map +1 -0
- package/dist/commands/session/list.js +63 -0
- package/dist/commands/session/list.js.map +1 -0
- package/dist/commands/session/new.d.ts +8 -0
- package/dist/commands/session/new.d.ts.map +1 -0
- package/dist/commands/session/new.js +23 -0
- package/dist/commands/session/new.js.map +1 -0
- package/dist/commands/session/resume.d.ts +6 -0
- package/dist/commands/session/resume.d.ts.map +1 -0
- package/dist/commands/session/resume.js +32 -0
- package/dist/commands/session/resume.js.map +1 -0
- package/dist/commands/session/search.d.ts +10 -0
- package/dist/commands/session/search.d.ts.map +1 -0
- package/dist/commands/session/search.js +65 -0
- package/dist/commands/session/search.js.map +1 -0
- package/dist/commands/session/stats.d.ts +6 -0
- package/dist/commands/session/stats.d.ts.map +1 -0
- package/dist/commands/session/stats.js +58 -0
- package/dist/commands/session/stats.js.map +1 -0
- package/dist/commands/session/view.d.ts +6 -0
- package/dist/commands/session/view.d.ts.map +1 -0
- package/dist/commands/session/view.js +65 -0
- package/dist/commands/session/view.js.map +1 -0
- package/dist/commands/slash/CommandPalette.d.ts +60 -0
- package/dist/commands/slash/CommandPalette.d.ts.map +1 -0
- package/dist/commands/slash/CommandPalette.js +351 -0
- package/dist/commands/slash/CommandPalette.js.map +1 -0
- package/dist/commands/slash/SlashCommandParser.d.ts +11 -0
- package/dist/commands/slash/SlashCommandParser.d.ts.map +1 -0
- package/dist/commands/slash/SlashCommandParser.js +11 -0
- package/dist/commands/slash/SlashCommandParser.js.map +1 -0
- package/dist/commands/slash/SlashCommandRegistry.d.ts +11 -0
- package/dist/commands/slash/SlashCommandRegistry.d.ts.map +1 -0
- package/dist/commands/slash/SlashCommandRegistry.js +11 -0
- package/dist/commands/slash/SlashCommandRegistry.js.map +1 -0
- package/dist/commands/slash/index.d.ts +11 -0
- package/dist/commands/slash/index.d.ts.map +1 -0
- package/dist/commands/slash/index.js +13 -0
- package/dist/commands/slash/index.js.map +1 -0
- package/dist/commands/system-messages/list.d.ts +13 -0
- package/dist/commands/system-messages/list.d.ts.map +1 -0
- package/dist/commands/system-messages/list.js +54 -0
- package/dist/commands/system-messages/list.js.map +1 -0
- package/dist/commands/system-messages/reload.d.ts +13 -0
- package/dist/commands/system-messages/reload.d.ts.map +1 -0
- package/dist/commands/system-messages/reload.js +36 -0
- package/dist/commands/system-messages/reload.js.map +1 -0
- package/dist/commands/system-messages/view.d.ts +13 -0
- package/dist/commands/system-messages/view.d.ts.map +1 -0
- package/dist/commands/system-messages/view.js +52 -0
- package/dist/commands/system-messages/view.js.map +1 -0
- package/dist/commands/tmux/list.d.ts +13 -0
- package/dist/commands/tmux/list.d.ts.map +1 -0
- package/dist/commands/tmux/list.js +68 -0
- package/dist/commands/tmux/list.js.map +1 -0
- package/dist/commands/tools/info.d.ts +13 -0
- package/dist/commands/tools/info.d.ts.map +1 -0
- package/dist/commands/tools/info.js +82 -0
- package/dist/commands/tools/info.js.map +1 -0
- package/dist/commands/tools/list.d.ts +14 -0
- package/dist/commands/tools/list.d.ts.map +1 -0
- package/dist/commands/tools/list.js +67 -0
- package/dist/commands/tools/list.js.map +1 -0
- package/dist/config/ConfigManager.d.ts +40 -0
- package/dist/config/ConfigManager.d.ts.map +1 -0
- package/dist/config/ConfigManager.js +162 -0
- package/dist/config/ConfigManager.js.map +1 -0
- package/dist/config/extension.d.ts +12 -0
- package/dist/config/extension.d.ts.map +1 -0
- package/dist/config/extension.js +5 -0
- package/dist/config/extension.js.map +1 -0
- package/dist/config/settings.d.ts +42 -0
- package/dist/config/settings.d.ts.map +1 -0
- package/dist/config/settings.js +32 -0
- package/dist/config/settings.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +883 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator/OrchestratorClient.d.ts +385 -0
- package/dist/orchestrator/OrchestratorClient.d.ts.map +1 -0
- package/dist/orchestrator/OrchestratorClient.js +1195 -0
- package/dist/orchestrator/OrchestratorClient.js.map +1 -0
- package/dist/themes/DefaultTheme.d.ts +9 -0
- package/dist/themes/DefaultTheme.d.ts.map +1 -0
- package/dist/themes/DefaultTheme.js +29 -0
- package/dist/themes/DefaultTheme.js.map +1 -0
- package/dist/themes/MinimalTheme.d.ts +9 -0
- package/dist/themes/MinimalTheme.d.ts.map +1 -0
- package/dist/themes/MinimalTheme.js +29 -0
- package/dist/themes/MinimalTheme.js.map +1 -0
- package/dist/themes/Theme.interface.d.ts +36 -0
- package/dist/themes/Theme.interface.d.ts.map +1 -0
- package/dist/themes/Theme.interface.js +5 -0
- package/dist/themes/Theme.interface.js.map +1 -0
- package/dist/themes/ThemeManager.d.ts +63 -0
- package/dist/themes/ThemeManager.d.ts.map +1 -0
- package/dist/themes/ThemeManager.js +257 -0
- package/dist/themes/ThemeManager.js.map +1 -0
- package/dist/themes/colors.d.ts +108 -0
- package/dist/themes/colors.d.ts.map +1 -0
- package/dist/themes/colors.js +284 -0
- package/dist/themes/colors.js.map +1 -0
- package/dist/themes/createTheme.d.ts +40 -0
- package/dist/themes/createTheme.d.ts.map +1 -0
- package/dist/themes/createTheme.js +114 -0
- package/dist/themes/createTheme.js.map +1 -0
- package/dist/themes/themeDefinitions.d.ts +27 -0
- package/dist/themes/themeDefinitions.d.ts.map +1 -0
- package/dist/themes/themeDefinitions.js +244 -0
- package/dist/themes/themeDefinitions.js.map +1 -0
- package/dist/utils/CodeDiffRenderer.d.ts +124 -0
- package/dist/utils/CodeDiffRenderer.d.ts.map +1 -0
- package/dist/utils/CodeDiffRenderer.js +257 -0
- package/dist/utils/CodeDiffRenderer.js.map +1 -0
- package/dist/utils/MarkdownRenderer.d.ts +74 -0
- package/dist/utils/MarkdownRenderer.d.ts.map +1 -0
- package/dist/utils/MarkdownRenderer.js +260 -0
- package/dist/utils/MarkdownRenderer.js.map +1 -0
- package/dist/utils/MessageRenderer.d.ts +200 -0
- package/dist/utils/MessageRenderer.d.ts.map +1 -0
- package/dist/utils/MessageRenderer.js +283 -0
- package/dist/utils/MessageRenderer.js.map +1 -0
- package/dist/utils/ToolFormatter.d.ts +103 -0
- package/dist/utils/ToolFormatter.d.ts.map +1 -0
- package/dist/utils/ToolFormatter.js +357 -0
- package/dist/utils/ToolFormatter.js.map +1 -0
- package/dist/utils/boxDrawing.d.ts +23 -0
- package/dist/utils/boxDrawing.d.ts.map +1 -0
- package/dist/utils/boxDrawing.js +78 -0
- package/dist/utils/boxDrawing.js.map +1 -0
- package/dist/utils/checks.d.ts +9 -0
- package/dist/utils/checks.d.ts.map +1 -0
- package/dist/utils/checks.js +11 -0
- package/dist/utils/checks.js.map +1 -0
- package/dist/utils/events.d.ts +24 -0
- package/dist/utils/events.d.ts.map +1 -0
- package/dist/utils/events.js +17 -0
- package/dist/utils/events.js.map +1 -0
- package/dist/utils/formatters.d.ts +255 -0
- package/dist/utils/formatters.d.ts.map +1 -0
- package/dist/utils/formatters.js +361 -0
- package/dist/utils/formatters.js.map +1 -0
- package/dist/utils/math.d.ts +11 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/math.js +13 -0
- package/dist/utils/math.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pdf-documents
|
|
3
|
+
description: Create rich PDF documents (reports, blueprints, posters, banners) from HTML and read/deconstruct existing PDFs for agent consumption. Covers page sizes, print CSS, SVG charts, scaled output, and lossless PDF-to-HTML conversion.
|
|
4
|
+
triggers:
|
|
5
|
+
- create a pdf
|
|
6
|
+
- generate a pdf
|
|
7
|
+
- write a pdf
|
|
8
|
+
- pdf document
|
|
9
|
+
- pdf report
|
|
10
|
+
- read a pdf
|
|
11
|
+
- parse a pdf
|
|
12
|
+
- convert pdf
|
|
13
|
+
- pdf to html
|
|
14
|
+
- html to pdf
|
|
15
|
+
- blueprint
|
|
16
|
+
- poster layout
|
|
17
|
+
- banner layout
|
|
18
|
+
- print layout
|
|
19
|
+
- paper size
|
|
20
|
+
- A4 document
|
|
21
|
+
- letter size
|
|
22
|
+
- pdf charts
|
|
23
|
+
- pdf tables
|
|
24
|
+
metadata:
|
|
25
|
+
created: "2026-05-17"
|
|
26
|
+
author: "nexus-cortex"
|
|
27
|
+
version: "2.0.0"
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
# PDF Documents Skill
|
|
31
|
+
|
|
32
|
+
**HTML is the translation layer** between agents and PDF.
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
WRITE: Research → Semantic HTML + Print CSS + SVG → PDF (chromium --print-to-pdf)
|
|
36
|
+
READ: PDF → HTML extraction (PyMuPDF / pdf2htmlEX) → Media index + DOM text → Agent
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Task Routing — Weighted Spoke Scores
|
|
42
|
+
|
|
43
|
+
**STOP.** Before writing ANY HTML or reading ANY PDF, score your task against this matrix. Read ALL spoke files scoring **8+** for your task type — these are **MANDATORY**. Read **5–7** if token budget allows. Skip below 5.
|
|
44
|
+
|
|
45
|
+
Spoke files live in `sections/` alongside this file.
|
|
46
|
+
|
|
47
|
+
| Spoke File | Create Report | Illustrated Doc | Blueprint / Poster | Read PDF | Match a Template | Invoice / Form |
|
|
48
|
+
|---|---|---|---|---|---|---|
|
|
49
|
+
| **01-image-acquisition.md** — mandatory image capture, model-aware embed (both models: save files + relative refs; platform inlines on download), sizing | 9 | **10** | 3 | 2 | 5 | 4 |
|
|
50
|
+
| **02-ai-image-generation.md** — CF FLUX, xAI, OpenAI, HF; img2img grounding | 4 | **10** | 2 | 1 | 3 | 2 |
|
|
51
|
+
| **03-paper-sizes.md** — ISO A/B, US/ANSI, JIS; orientation; Chromium flags | 6 | 6 | **10** | 2 | 5 | 5 |
|
|
52
|
+
| **04-design-system.md** — typography, fonts, OKLCH color, spacing, texture, layout, starter template | **8** | **9** | 4 | 2 | **10** | 7 |
|
|
53
|
+
| **05-css-print-rules.md** — @page, page breaks, pitfall table | **10** | **10** | **10** | 2 | **8** | **9** |
|
|
54
|
+
| **06-svg-charts.md** — bar, pie, line, map patterns | 7 | 5 | 3 | 2 | 3 | 2 |
|
|
55
|
+
| **07-templates.md** — layout snippets, external template sources, conversion, recipes | 5 | 5 | 3 | 2 | **10** | **8** |
|
|
56
|
+
| **08-scaled-output.md** — 1:1 blueprints, posters, banners, scale bars, Puppeteer | 2 | 2 | **10** | 1 | 2 | 2 |
|
|
57
|
+
| **09-preview-qa.md** — print-to-pdf QA loop, browser preview, checklist | 7 | **8** | **9** | 2 | 6 | 6 |
|
|
58
|
+
| **10-reading-pdfs.md** — PyMuPDF, pdf2htmlEX, deconstruction, media index, charts | 2 | 2 | 2 | **10** | 4 | 2 |
|
|
59
|
+
|
|
60
|
+
**Scoring examples** (read spokes in descending score order):
|
|
61
|
+
- *"Create a research report with charts"* → 05(10), 01(9), 04(8), 06(7), 09(7)
|
|
62
|
+
- *"Make an illustrated history document"* → 01(10), 02(10), 05(10), 04(9), 09(8)
|
|
63
|
+
- *"Read this PDF and extract the data"* → 10(10) — done
|
|
64
|
+
- *"Recreate this Word template as HTML"* → 04(10), 07(10), 05(8)
|
|
65
|
+
- *"Create a 1:1 blueprint"* → 03(10), 05(10), 08(10), 09(9)
|
|
66
|
+
- *"Generate an invoice PDF"* → 05(9), 07(8), 04(7)
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## ⚠️ DELIVERY MODEL DECIDES EVERYTHING — read this first
|
|
71
|
+
|
|
72
|
+
How the PDF reaches the user determines the final conversion step. There are
|
|
73
|
+
TWO models. **Both use the same image approach: save files, reference by path.**
|
|
74
|
+
|
|
75
|
+
### Model A — Nexus (file-based, user prints from browser)
|
|
76
|
+
|
|
77
|
+
In Nexus there is **no in-platform print-to-PDF you can invoke**. The
|
|
78
|
+
deliverable is HTML + image files written to the VFS. The user downloads the
|
|
79
|
+
HTML from the FILE manager and prints it to PDF from **their own browser**
|
|
80
|
+
(Ctrl/Cmd+P → Save as PDF). Tell the user to do this.
|
|
81
|
+
|
|
82
|
+
**Image workflow:** Save images to the VFS via `cortex_write_binary`, then
|
|
83
|
+
reference them with relative `<img src="images/photo.jpg">` in the HTML.
|
|
84
|
+
**The platform's download step automatically inlines VFS-referenced images
|
|
85
|
+
as base64 data URIs**, producing a self-contained HTML file. You NEVER emit
|
|
86
|
+
base64 yourself. No output-token cap on images. No size ceiling.
|
|
87
|
+
|
|
88
|
+
### Model B — Sandbox Chromium: full agent-driven PDF cycle
|
|
89
|
+
|
|
90
|
+
When `run_command` is available (requires the **nexus-browser** backend, not
|
|
91
|
+
the Playwright MCP backend), the sandbox container has `html2pdf` and
|
|
92
|
+
`pdf2html` pre-installed alongside headless Chrome. Save image FILES into
|
|
93
|
+
the sandbox working dir, reference them by **relative path**
|
|
94
|
+
`<img src="images/photo.jpg">`, and convert:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
run_command("html2pdf /tmp/report.html --base64 --no-header --paper a4")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The base64 PDF appears in the tool result. Write it to VFS:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
cortex_write_binary({ path: "/sandbox/documents/report.pdf",
|
|
104
|
+
data: "<base64 from tool result>",
|
|
105
|
+
mimeType: "application/pdf" })
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Token cost caveat**: base64 PDF flows through model output. A 500KB PDF
|
|
109
|
+
costs ~170K output tokens. For documents >100KB, prefer Model A (HTML
|
|
110
|
+
delivery, zero image token cost). Reserve Model B for small files or when
|
|
111
|
+
the user specifically requests `.pdf`.
|
|
112
|
+
|
|
113
|
+
**Timeout**: `run_command` defaults to 30s. For large PDFs, pass
|
|
114
|
+
`timeout: 75000` to `run_command` and `--timeout 60` to `html2pdf`.
|
|
115
|
+
|
|
116
|
+
> **Both models → save files + relative refs.** Model A's download surface
|
|
117
|
+
> bundles images automatically. See `sections/01-image-acquisition.md`.
|
|
118
|
+
|
|
119
|
+
## The Pipeline
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
1. Research / gather content; capture images (screenshots, downloads)
|
|
123
|
+
2. Save images:
|
|
124
|
+
- Model A: cortex_write_binary to VFS (images MUST use cortex_write_binary,
|
|
125
|
+
NOT cortex_write — the download inliner only recognizes data URIs)
|
|
126
|
+
- Model B: curl/save to sandbox disk alongside HTML
|
|
127
|
+
3. Write semantic HTML with inline CSS
|
|
128
|
+
- Reference images with relative <img src>
|
|
129
|
+
- Wrap every image in <figure> with <figcaption>
|
|
130
|
+
- SVG preferred for charts/diagrams (inline markup)
|
|
131
|
+
4. (Model B only) print-to-pdf QA loop — preview, fix breaks, repeat
|
|
132
|
+
5. Deliver:
|
|
133
|
+
- Model A: cortex_write the .html to the VFS; images alongside via
|
|
134
|
+
cortex_write_binary; tell user to download and print from browser
|
|
135
|
+
(download auto-inlines images for self-contained output)
|
|
136
|
+
- Model B: html2pdf --base64 → cortex_write_binary to VFS
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Why HTML, not Markdown:** semantic structure (`<table>`,`<figure>`,`<aside>`),
|
|
140
|
+
inline SVG charts, `@media print` pagination control, round-trip fidelity.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Conversion Commands (Always Needed)
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# ── html2pdf (pre-installed in sandbox — recommended) ─────
|
|
148
|
+
html2pdf input.html -o output.pdf --no-header --paper a4
|
|
149
|
+
html2pdf input.html --base64 --no-header --paper a4 # base64 to stdout (for cortex_write_binary)
|
|
150
|
+
html2pdf input.html --fetch-images --no-header # download remote <img src> for offline render
|
|
151
|
+
html2pdf input.html --landscape --paper letter # landscape letter
|
|
152
|
+
html2pdf input.html --inject-css extra.css # inject additional CSS before render
|
|
153
|
+
|
|
154
|
+
# ── Chromium (direct — same engine html2pdf wraps) ────────
|
|
155
|
+
chromium --headless --no-sandbox --disable-gpu \
|
|
156
|
+
--print-to-pdf=output.pdf \
|
|
157
|
+
--print-to-pdf-no-header \
|
|
158
|
+
input.html
|
|
159
|
+
|
|
160
|
+
# With explicit paper size (default: Letter)
|
|
161
|
+
chromium --headless --no-sandbox --disable-gpu \
|
|
162
|
+
--print-to-pdf=output.pdf \
|
|
163
|
+
--print-to-pdf-no-header \
|
|
164
|
+
--paper-width=8.27 --paper-height=11.69 \
|
|
165
|
+
input.html
|
|
166
|
+
|
|
167
|
+
# ── WeasyPrint (Python — excellent CSS support) ────────────
|
|
168
|
+
weasyprint input.html output.pdf
|
|
169
|
+
|
|
170
|
+
# ── Puppeteer (Node.js — full control, exact page sizes) ───
|
|
171
|
+
# See 08-scaled-output.md for the Puppeteer recipe
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`html2pdf` wraps Chrome headless with convenience flags. Use `--base64` for piping into `cortex_write_binary`. Chromium `--paper-width` and `--paper-height` are in **inches**. See `03-paper-sizes.md` for the full conversion table.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Universal Rules (Apply to ALL PDF Tasks)
|
|
179
|
+
|
|
180
|
+
These gotchas are critical enough that skipping them causes the most common failures. They are here — not in spokes — so no task routing can bypass them.
|
|
181
|
+
|
|
182
|
+
### Rule 1: Images Are Mandatory
|
|
183
|
+
|
|
184
|
+
**Every image you view during research MUST be captured and included.** A "rich PDF" without the images you researched is just a text document with extra CSS.
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
# Both models: save images as files, reference with relative paths.
|
|
188
|
+
#
|
|
189
|
+
# Model A (Nexus): cortex_write_binary to save images to VFS,
|
|
190
|
+
# then <img src="images/photo.jpg"> in your HTML.
|
|
191
|
+
# The platform download step inlines them automatically.
|
|
192
|
+
# IMPORTANT: images MUST be saved via cortex_write_binary (NOT cortex_write).
|
|
193
|
+
# The download inliner only recognizes data: URI content in VFS storage.
|
|
194
|
+
# NEVER emit base64 yourself — no output-token cost for images.
|
|
195
|
+
#
|
|
196
|
+
# Model B (sandbox chromium): download images to sandbox disk (curl/screenshot),
|
|
197
|
+
# <img src="images/photo.jpg"> — html2pdf/chromium resolves at render.
|
|
198
|
+
# Then pipe: html2pdf --base64 → cortex_write_binary to deliver the PDF.
|
|
199
|
+
#
|
|
200
|
+
# Always use SVG (inline markup) for charts/diagrams — both models.
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Rule 2: The Blank Page Bug
|
|
204
|
+
|
|
205
|
+
`break-inside: avoid` on an element **taller than one page** creates a blank page before it. Chromium pushes the entire element to the next page, leaving the previous page empty.
|
|
206
|
+
|
|
207
|
+
```css
|
|
208
|
+
/* BAD — timeline section is multi-page, creates blank page */
|
|
209
|
+
.timeline { break-inside: avoid; }
|
|
210
|
+
|
|
211
|
+
/* GOOD — individual items are shorter than a page */
|
|
212
|
+
.timeline-item { break-inside: avoid; }
|
|
213
|
+
.timeline { /* no break-inside rule */ }
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Rule 3: Heading Orphans
|
|
217
|
+
|
|
218
|
+
Always prevent headings from sitting alone at the bottom of a page:
|
|
219
|
+
|
|
220
|
+
```css
|
|
221
|
+
h1, h2, h3, h4 { break-after: avoid; }
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Rule 4: Table Continuity
|
|
225
|
+
|
|
226
|
+
```css
|
|
227
|
+
thead { display: table-header-group; } /* repeat header on each page */
|
|
228
|
+
tr { break-inside: avoid; }
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Rule 5: Print Units
|
|
232
|
+
|
|
233
|
+
Use `pt` for text, `mm`/`in` for layout — never `px` in print CSS. `1pt = 1/72 inch`. Body text minimum: **10pt** (comfortable reading), captions: **8pt** minimum.
|
|
234
|
+
|
|
235
|
+
### Rule 6: Font Choice
|
|
236
|
+
|
|
237
|
+
**NEVER** use Arial, Inter, Roboto, Calibri, or system-ui as the primary font. These are non-decisions that make the document look auto-generated. See `04-design-system.md` for 30+ categorized alternatives with pairing guides.
|
|
238
|
+
|
|
239
|
+
### Rule 7: Color for Print
|
|
240
|
+
|
|
241
|
+
- Never use pure `#000` — use `oklch(0.18 0.01 hue)` for body text
|
|
242
|
+
- Never use pure white backgrounds — use `oklch(0.97 0.005 hue)` for warmth
|
|
243
|
+
- Keep background chroma below `0.03` (high chroma wastes ink)
|
|
244
|
+
- See `04-design-system.md` for the full OKLCH color system
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Quick Reference Card
|
|
249
|
+
|
|
250
|
+
### Create PDF — Fastest Path
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Sandbox (pre-installed):
|
|
254
|
+
html2pdf input.html -o output.pdf --no-header --paper a4
|
|
255
|
+
html2pdf input.html --base64 --no-header # base64 to stdout for cortex_write_binary
|
|
256
|
+
|
|
257
|
+
# Or direct Chromium:
|
|
258
|
+
chromium --headless --no-sandbox --disable-gpu \
|
|
259
|
+
--print-to-pdf=output.pdf --print-to-pdf-no-header \
|
|
260
|
+
input.html
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Read PDF — Fastest Path
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Sandbox (pre-installed):
|
|
267
|
+
pdf2html input.pdf # structured HTML
|
|
268
|
+
pdf2html input.pdf --manifest # JSON structure only
|
|
269
|
+
pdf2html input.pdf --images # extract images
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
```python
|
|
273
|
+
# Or Python directly:
|
|
274
|
+
import fitz
|
|
275
|
+
doc = fitz.open('input.pdf')
|
|
276
|
+
for page in doc:
|
|
277
|
+
print(page.get_text('html'))
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Paper Sizes (Most Common)
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
A4: 210 x 297mm (8.27 x 11.69in) @page { size: A4; }
|
|
284
|
+
Letter: 215.9 x 279.4mm (8.5 x 11in) @page { size: letter; }
|
|
285
|
+
A3: 297 x 420mm (11.69 x 16.54in) @page { size: A3; }
|
|
286
|
+
Legal: 215.9 x 355.6mm (8.5 x 14in) @page { size: legal; }
|
|
287
|
+
ANSI D: 558.8 x 863.6mm (22 x 34in) @page { size: 558.8mm 863.6mm; }
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Chromium Paper Size Flags
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# --paper-width and --paper-height are in INCHES
|
|
294
|
+
# A4: --paper-width=8.27 --paper-height=11.69
|
|
295
|
+
# Letter: --paper-width=8.5 --paper-height=11
|
|
296
|
+
# Custom: --paper-width=11.81 --paper-height=59.06 (300mm x 1500mm banner)
|
|
297
|
+
```
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Image Acquisition and Embedding (MANDATORY)
|
|
2
|
+
|
|
3
|
+
Every rich PDF document MUST include relevant images discovered during research. A text-only document dressed up with CSS is not a rich document.
|
|
4
|
+
|
|
5
|
+
## ⚠️ First: which delivery model? (see SKILL.md "DELIVERY MODEL DECIDES EVERYTHING")
|
|
6
|
+
|
|
7
|
+
The embedding mechanism is **not absolute — it depends on how the PDF reaches the user.**
|
|
8
|
+
|
|
9
|
+
- **Model A — Nexus (file-based).** Save images as files to the VFS via `cortex_write_binary`, then reference them with **relative `<img src="...">`** in the HTML. The platform's download step **automatically inlines** VFS-referenced images as base64 data URIs, producing a self-contained HTML file the user can print to PDF. **You never emit base64 yourself.** No output-token cap on images. No size ceiling.
|
|
10
|
+
- **Model B — sandbox / real Chromium.** A real shell runs `chromium --print-to-pdf`. Save image **files** next to the HTML and reference them by **relative path**; Chromium resolves them at render. NEVER inline base64 here either.
|
|
11
|
+
|
|
12
|
+
**Both models use the same approach: save files, reference by path.** Model A's download surface handles the self-contained bundling automatically.
|
|
13
|
+
|
|
14
|
+
## Acquisition Methods (both models)
|
|
15
|
+
|
|
16
|
+
**Method 1: Browser screenshot during research**
|
|
17
|
+
```bash
|
|
18
|
+
# nexus-browser MCP:
|
|
19
|
+
browse({ url: "https://example.com/museum" })
|
|
20
|
+
screenshot({ format: "jpeg", quality: 85 }) # returns a base64 dataUrl
|
|
21
|
+
|
|
22
|
+
# Save to VFS (Model A):
|
|
23
|
+
cortex_write_binary({ path: "images/museum.jpg", data: "<base64 from screenshot>", mimeType: "image/jpeg" })
|
|
24
|
+
|
|
25
|
+
# Puppeteer (sandbox/real env):
|
|
26
|
+
await page.screenshot({ path: 'images/museum.jpg', type: 'jpeg', quality: 85 });
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Method 2: Direct download (Model B / sandbox — runs where the shell is)**
|
|
30
|
+
```bash
|
|
31
|
+
curl -L -o images/museum.jpg "https://example.com/photo.jpg"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Method 3: Extract from a referenced PDF**
|
|
35
|
+
```python
|
|
36
|
+
import fitz
|
|
37
|
+
doc = fitz.open('reference.pdf')
|
|
38
|
+
for i, info in enumerate(doc[0].get_images(full=True)):
|
|
39
|
+
pix = fitz.Pixmap(doc, info[0])
|
|
40
|
+
if pix.n >= 5: pix = fitz.Pixmap(fitz.csRGB, pix)
|
|
41
|
+
pix.save(f'images/extracted-{i}.png')
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Model A — Nexus: save files + relative references (PREFERRED)
|
|
45
|
+
|
|
46
|
+
Save images to the VFS with `cortex_write_binary`, then reference them in HTML
|
|
47
|
+
with relative paths. The platform download step resolves every `<img src>` against
|
|
48
|
+
the VFS and inlines the data URI automatically — the downloaded `.html` is fully
|
|
49
|
+
self-contained with zero model output-token cost for images.
|
|
50
|
+
|
|
51
|
+
**IMPORTANT:** Images MUST be written via `cortex_write_binary` (not `cortex_write`).
|
|
52
|
+
The download inliner only recognizes `data:` URI content in VFS storage — raw base64
|
|
53
|
+
text strings written by `cortex_write` will not be inlined.
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<!-- In your HTML (written via cortex_write to VFS): -->
|
|
57
|
+
<figure>
|
|
58
|
+
<img src="images/museum.jpg"
|
|
59
|
+
alt="Museum entrance with replica Spanish cannons"
|
|
60
|
+
style="max-width:100%; height:auto;"/>
|
|
61
|
+
<figcaption>Fig 1. Maritime Museum entrance. <span class="photo-credit">Photo: R. Nunez / Flickr</span></figcaption>
|
|
62
|
+
</figure>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
VFS layout:
|
|
67
|
+
reports/
|
|
68
|
+
report.html <img src="images/museum.jpg">
|
|
69
|
+
images/
|
|
70
|
+
museum.jpg (saved via cortex_write_binary)
|
|
71
|
+
diagram.svg (inline SVG still preferred for charts)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Delivery: `cortex_write` the `.html` to the VFS, save images alongside via
|
|
75
|
+
`cortex_write_binary`, then tell the user: *"Download this file from the FILE
|
|
76
|
+
manager and open it in your browser, then Ctrl/Cmd+P → Save as PDF. Images are
|
|
77
|
+
bundled automatically on download."*
|
|
78
|
+
|
|
79
|
+
## Model B — sandbox Chromium: full agent-driven PDF cycle
|
|
80
|
+
|
|
81
|
+
Requires the **nexus-browser** backend (not Playwright MCP). Download images
|
|
82
|
+
directly in the sandbox, write HTML alongside them, convert with `html2pdf`:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
/tmp/report/
|
|
86
|
+
report.html <img src="images/museum.jpg">
|
|
87
|
+
images/
|
|
88
|
+
museum.jpg (downloaded via curl in sandbox)
|
|
89
|
+
```
|
|
90
|
+
```bash
|
|
91
|
+
# Download images in sandbox (no output-token cost):
|
|
92
|
+
run_command("curl -L -o /tmp/report/images/museum.jpg 'https://example.com/museum.jpg'")
|
|
93
|
+
|
|
94
|
+
# Convert — base64 output for piping back to VFS:
|
|
95
|
+
run_command("html2pdf /tmp/report/report.html --base64 --no-header --paper a4")
|
|
96
|
+
|
|
97
|
+
# Write PDF to VFS:
|
|
98
|
+
cortex_write_binary({ path: "/sandbox/documents/report.pdf",
|
|
99
|
+
data: "<base64 from tool result>",
|
|
100
|
+
mimeType: "application/pdf" })
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
No image output-token cost (images stay in sandbox; only the final PDF base64
|
|
104
|
+
flows through the model). Token cost of a 500KB PDF ≈ ~170K output tokens —
|
|
105
|
+
prefer Model A for large documents.
|
|
106
|
+
|
|
107
|
+
**Timeout**: `run_command` defaults to 30s. For large PDFs, pass
|
|
108
|
+
`timeout: 75000` and use `html2pdf --timeout 60`.
|
|
109
|
+
|
|
110
|
+
## Image Sizing Guidelines
|
|
111
|
+
|
|
112
|
+
| Use | Resolution | Target size | Notes |
|
|
113
|
+
|-----|-----------|-------------|-------|
|
|
114
|
+
| Full-width photo | 300 DPI (~1800px/6in) | ~2MB | Download inliner handles any size |
|
|
115
|
+
| Half-width photo | 200 DPI (~600px/3in) | ~800KB | No model output cap applies |
|
|
116
|
+
| Thumbnail | 150 DPI (~300px) | ~200KB | |
|
|
117
|
+
| Diagram/chart | SVG preferred | inline SVG | Compact markup, no base64 needed |
|
|
118
|
+
|
|
119
|
+
## Embedding Rules (both models)
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
[ ] Every section with a visual subject has ≥1 image
|
|
123
|
+
[ ] Every <img> has descriptive alt text
|
|
124
|
+
[ ] Every <figure> has a <figcaption> with description + attribution
|
|
125
|
+
[ ] Photo credits included where the source is known
|
|
126
|
+
[ ] Images saved as files (cortex_write_binary or disk), referenced by relative path
|
|
127
|
+
[ ] HTML and images in the same VFS directory tree
|
|
128
|
+
[ ] SVG preferred for charts/diagrams (inline markup, not files)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Format choice:** JPEG for photos, PNG for sharp-edge/transparent diagrams,
|
|
132
|
+
**SVG preferred** for anything non-photographic (compact in both models).
|