@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,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for formatting data for display
|
|
3
|
+
*
|
|
4
|
+
* This module provides consistent formatting for numbers, dates, sizes, and prices
|
|
5
|
+
* across all CLI commands. All formatters handle edge cases gracefully.
|
|
6
|
+
*
|
|
7
|
+
* @module formatters
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Formats byte sizes into human-readable format with appropriate units.
|
|
11
|
+
*
|
|
12
|
+
* Converts raw byte counts into B (bytes), KB (kilobytes), or MB (megabytes)
|
|
13
|
+
* with 1 decimal place of precision for KB and MB.
|
|
14
|
+
*
|
|
15
|
+
* @param bytes - The number of bytes to format
|
|
16
|
+
* @returns Formatted string with unit suffix
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* formatBytes(512) // → "512 B"
|
|
21
|
+
* formatBytes(1024) // → "1.0 KB"
|
|
22
|
+
* formatBytes(2560) // → "2.5 KB"
|
|
23
|
+
* formatBytes(1048576) // → "1.0 MB"
|
|
24
|
+
* formatBytes(5242880) // → "5.0 MB"
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @see {@link https://en.wikipedia.org/wiki/Byte | Byte on Wikipedia}
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatBytes(bytes: number): string;
|
|
30
|
+
/**
|
|
31
|
+
* Formats dates into locale-aware strings.
|
|
32
|
+
*
|
|
33
|
+
* Accepts either Date objects or ISO 8601 strings and converts them to
|
|
34
|
+
* a locale-appropriate format using the system's default locale.
|
|
35
|
+
* Returns "Invalid Date" for any invalid input.
|
|
36
|
+
*
|
|
37
|
+
* @param date - Date object or ISO 8601 string to format
|
|
38
|
+
* @returns Locale-formatted date string, or "Invalid Date" if input is invalid
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* formatDate(new Date('2025-01-14T20:00:00Z'))
|
|
43
|
+
* // → "1/14/2025, 8:00:00 PM" (en-US locale)
|
|
44
|
+
*
|
|
45
|
+
* formatDate('2025-01-14T20:00:00Z')
|
|
46
|
+
* // → "1/14/2025, 8:00:00 PM"
|
|
47
|
+
*
|
|
48
|
+
* formatDate('not-a-date')
|
|
49
|
+
* // → "Invalid Date"
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString | Date.toLocaleString()}
|
|
53
|
+
*/
|
|
54
|
+
export declare function formatDate(date: Date | string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Formats dates as relative time strings (e.g., "5 minutes ago").
|
|
57
|
+
*
|
|
58
|
+
* Calculates the time difference between the given date and now, then
|
|
59
|
+
* formats it in a human-readable relative format with automatic pluralization.
|
|
60
|
+
* Returns "Invalid Date" for any invalid input.
|
|
61
|
+
*
|
|
62
|
+
* Time ranges:
|
|
63
|
+
* - < 10 seconds: "just now"
|
|
64
|
+
* - < 60 seconds: "{n} seconds ago"
|
|
65
|
+
* - < 60 minutes: "{n} minute(s) ago"
|
|
66
|
+
* - < 24 hours: "{n} hour(s) ago"
|
|
67
|
+
* - < 7 days: "{n} day(s) ago"
|
|
68
|
+
* - >= 7 days: "{n} week(s) ago"
|
|
69
|
+
*
|
|
70
|
+
* @param date - Date object or ISO 8601 string to format
|
|
71
|
+
* @returns Relative time string, or "Invalid Date" if input is invalid
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* // Assuming current time is 2025-01-14 20:00:00
|
|
76
|
+
*
|
|
77
|
+
* formatRelativeTime(new Date('2025-01-14 19:59:55'))
|
|
78
|
+
* // → "just now" (5 seconds ago)
|
|
79
|
+
*
|
|
80
|
+
* formatRelativeTime(new Date('2025-01-14 19:30:00'))
|
|
81
|
+
* // → "30 minutes ago"
|
|
82
|
+
*
|
|
83
|
+
* formatRelativeTime(new Date('2025-01-14 18:00:00'))
|
|
84
|
+
* // → "2 hours ago"
|
|
85
|
+
*
|
|
86
|
+
* formatRelativeTime(new Date('2025-01-13 20:00:00'))
|
|
87
|
+
* // → "1 day ago"
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare function formatRelativeTime(date: Date | string): string;
|
|
91
|
+
/**
|
|
92
|
+
* Formats numbers with thousands separators for readability.
|
|
93
|
+
*
|
|
94
|
+
* Uses the en-US locale to add comma separators every three digits.
|
|
95
|
+
* Handles negative numbers and zero correctly.
|
|
96
|
+
*
|
|
97
|
+
* @param num - The number to format
|
|
98
|
+
* @returns Formatted string with comma separators
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* formatNumber(1234) // → "1,234"
|
|
103
|
+
* formatNumber(1000000) // → "1,000,000"
|
|
104
|
+
* formatNumber(999) // → "999"
|
|
105
|
+
* formatNumber(0) // → "0"
|
|
106
|
+
* formatNumber(-1234) // → "-1,234"
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString | Number.toLocaleString()}
|
|
110
|
+
*/
|
|
111
|
+
export declare function formatNumber(num: number): string;
|
|
112
|
+
/**
|
|
113
|
+
* Formats numbers in compact form with k/M/B suffixes.
|
|
114
|
+
*
|
|
115
|
+
* Converts large numbers into human-readable compact form with one decimal
|
|
116
|
+
* place of precision. Useful for displaying statistics in limited space.
|
|
117
|
+
*
|
|
118
|
+
* Ranges:
|
|
119
|
+
* - < 1,000: As-is (no suffix)
|
|
120
|
+
* - 1,000 - 999,999: Thousands with 'k' suffix
|
|
121
|
+
* - 1,000,000 - 999,999,999: Millions with 'M' suffix
|
|
122
|
+
* - >= 1,000,000,000: Billions with 'B' suffix
|
|
123
|
+
*
|
|
124
|
+
* @param num - The number to format
|
|
125
|
+
* @returns Compact formatted string with suffix
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* formatCompactNumber(999) // → "999"
|
|
130
|
+
* formatCompactNumber(1000) // → "1.0k"
|
|
131
|
+
* formatCompactNumber(1500) // → "1.5k"
|
|
132
|
+
* formatCompactNumber(1000000) // → "1.0M"
|
|
133
|
+
* formatCompactNumber(2500000) // → "2.5M"
|
|
134
|
+
* formatCompactNumber(1000000000) // → "1.0B"
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export declare function formatCompactNumber(num: number): string;
|
|
138
|
+
/**
|
|
139
|
+
* Formats token counts in compact form.
|
|
140
|
+
*
|
|
141
|
+
* Similar to {@link formatCompactNumber} but specifically for token counts.
|
|
142
|
+
* Does not format billions as token counts rarely reach that magnitude.
|
|
143
|
+
*
|
|
144
|
+
* Ranges:
|
|
145
|
+
* - < 1,000: As-is (no suffix)
|
|
146
|
+
* - 1,000 - 999,999: Thousands with 'k' suffix
|
|
147
|
+
* - >= 1,000,000: Millions with 'M' suffix
|
|
148
|
+
*
|
|
149
|
+
* @param tokens - The number of tokens to format
|
|
150
|
+
* @returns Compact formatted string with suffix
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* formatTokens(256) // → "256"
|
|
155
|
+
* formatTokens(1000) // → "1.0k"
|
|
156
|
+
* formatTokens(1500) // → "1.5k"
|
|
157
|
+
* formatTokens(1200000) // → "1.2M"
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* @see {@link formatContextWindow} for context window formatting
|
|
161
|
+
*/
|
|
162
|
+
export declare function formatTokens(tokens: number): string;
|
|
163
|
+
/**
|
|
164
|
+
* Calculates and formats percentage values.
|
|
165
|
+
*
|
|
166
|
+
* Computes the percentage of value relative to total and formats it with
|
|
167
|
+
* one decimal place. Handles edge case of zero total by returning "0.0%"
|
|
168
|
+
* instead of dividing by zero.
|
|
169
|
+
*
|
|
170
|
+
* @param value - The value to calculate percentage for
|
|
171
|
+
* @param total - The total value (denominator)
|
|
172
|
+
* @returns Percentage string with one decimal place
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* formatPercentage(75, 100) // → "75.0%"
|
|
177
|
+
* formatPercentage(50, 200) // → "25.0%"
|
|
178
|
+
* formatPercentage(755, 1000) // → "75.5%"
|
|
179
|
+
* formatPercentage(0, 100) // → "0.0%"
|
|
180
|
+
* formatPercentage(100, 100) // → "100.0%"
|
|
181
|
+
* formatPercentage(50, 0) // → "0.0%" (avoids division by zero)
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
export declare function formatPercentage(value: number, total: number): string;
|
|
185
|
+
/**
|
|
186
|
+
* Formats context window sizes for model listings.
|
|
187
|
+
*
|
|
188
|
+
* Similar to {@link formatTokens} but specifically for context window sizes.
|
|
189
|
+
* Uses integer division (no decimal places) for cleaner display.
|
|
190
|
+
*
|
|
191
|
+
* Ranges:
|
|
192
|
+
* - < 1,000: As-is (no suffix)
|
|
193
|
+
* - 1,000 - 999,999: Thousands with 'K' suffix (no decimals)
|
|
194
|
+
* - >= 1,000,000: Millions with 'M' suffix (no decimals)
|
|
195
|
+
*
|
|
196
|
+
* @param tokens - The number of tokens in the context window
|
|
197
|
+
* @returns Formatted string with K or M suffix
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* formatContextWindow(999) // → "999"
|
|
202
|
+
* formatContextWindow(8000) // → "8K"
|
|
203
|
+
* formatContextWindow(128000) // → "128K"
|
|
204
|
+
* formatContextWindow(200000) // → "200K"
|
|
205
|
+
* formatContextWindow(1000000) // → "1M"
|
|
206
|
+
* formatContextWindow(2000000) // → "2M"
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @see {@link formatTokens} for general token formatting
|
|
210
|
+
*/
|
|
211
|
+
export declare function formatContextWindow(tokens: number): string;
|
|
212
|
+
/**
|
|
213
|
+
* Formats prices in USD currency with 2 decimal places.
|
|
214
|
+
*
|
|
215
|
+
* Formats monetary values with a dollar sign and exactly 2 decimal places.
|
|
216
|
+
* Primarily used for displaying model pricing (cost per 1M tokens).
|
|
217
|
+
*
|
|
218
|
+
* @param pricePerMillion - The price value to format (typically per 1M tokens)
|
|
219
|
+
* @returns Formatted price string with $ prefix and 2 decimals
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* formatPrice(0) // → "$0.00"
|
|
224
|
+
* formatPrice(0.074) // → "$0.07"
|
|
225
|
+
* formatPrice(0.076) // → "$0.08"
|
|
226
|
+
* formatPrice(3.5) // → "$3.50"
|
|
227
|
+
* formatPrice(15.0) // → "$15.00"
|
|
228
|
+
* formatPrice(1000.5) // → "$1000.50"
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* @remarks
|
|
232
|
+
* Uses banker's rounding (round half to even) as implemented by toFixed().
|
|
233
|
+
*/
|
|
234
|
+
export declare function formatPrice(pricePerMillion: number): string;
|
|
235
|
+
/**
|
|
236
|
+
* Formats duration in milliseconds into human-readable format.
|
|
237
|
+
*
|
|
238
|
+
* Converts millisecond durations into a compact format showing hours, minutes,
|
|
239
|
+
* and seconds as appropriate. Omits zero values for cleaner display.
|
|
240
|
+
*
|
|
241
|
+
* @param ms - Duration in milliseconds
|
|
242
|
+
* @returns Formatted duration string
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* formatDuration(1000) // → "1s"
|
|
247
|
+
* formatDuration(60000) // → "1m"
|
|
248
|
+
* formatDuration(61000) // → "1m 1s"
|
|
249
|
+
* formatDuration(3661000) // → "1h 1m 1s"
|
|
250
|
+
* formatDuration(7200000) // → "2h"
|
|
251
|
+
* formatDuration(3723000) // → "1h 2m 3s"
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
export declare function formatDuration(ms: number): string;
|
|
255
|
+
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAQtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CA4B9D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUvD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQnD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAOrE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAsBjD"}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for formatting data for display
|
|
3
|
+
*
|
|
4
|
+
* This module provides consistent formatting for numbers, dates, sizes, and prices
|
|
5
|
+
* across all CLI commands. All formatters handle edge cases gracefully.
|
|
6
|
+
*
|
|
7
|
+
* @module formatters
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Formats byte sizes into human-readable format with appropriate units.
|
|
11
|
+
*
|
|
12
|
+
* Converts raw byte counts into B (bytes), KB (kilobytes), or MB (megabytes)
|
|
13
|
+
* with 1 decimal place of precision for KB and MB.
|
|
14
|
+
*
|
|
15
|
+
* @param bytes - The number of bytes to format
|
|
16
|
+
* @returns Formatted string with unit suffix
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* formatBytes(512) // → "512 B"
|
|
21
|
+
* formatBytes(1024) // → "1.0 KB"
|
|
22
|
+
* formatBytes(2560) // → "2.5 KB"
|
|
23
|
+
* formatBytes(1048576) // → "1.0 MB"
|
|
24
|
+
* formatBytes(5242880) // → "5.0 MB"
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @see {@link https://en.wikipedia.org/wiki/Byte | Byte on Wikipedia}
|
|
28
|
+
*/
|
|
29
|
+
export function formatBytes(bytes) {
|
|
30
|
+
if (bytes < 1024) {
|
|
31
|
+
return `${bytes} B`;
|
|
32
|
+
}
|
|
33
|
+
else if (bytes < 1024 * 1024) {
|
|
34
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Formats dates into locale-aware strings.
|
|
42
|
+
*
|
|
43
|
+
* Accepts either Date objects or ISO 8601 strings and converts them to
|
|
44
|
+
* a locale-appropriate format using the system's default locale.
|
|
45
|
+
* Returns "Invalid Date" for any invalid input.
|
|
46
|
+
*
|
|
47
|
+
* @param date - Date object or ISO 8601 string to format
|
|
48
|
+
* @returns Locale-formatted date string, or "Invalid Date" if input is invalid
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* formatDate(new Date('2025-01-14T20:00:00Z'))
|
|
53
|
+
* // → "1/14/2025, 8:00:00 PM" (en-US locale)
|
|
54
|
+
*
|
|
55
|
+
* formatDate('2025-01-14T20:00:00Z')
|
|
56
|
+
* // → "1/14/2025, 8:00:00 PM"
|
|
57
|
+
*
|
|
58
|
+
* formatDate('not-a-date')
|
|
59
|
+
* // → "Invalid Date"
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString | Date.toLocaleString()}
|
|
63
|
+
*/
|
|
64
|
+
export function formatDate(date) {
|
|
65
|
+
const dateObj = typeof date === 'string' ? new Date(date) : date;
|
|
66
|
+
if (isNaN(dateObj.getTime())) {
|
|
67
|
+
return 'Invalid Date';
|
|
68
|
+
}
|
|
69
|
+
return dateObj.toLocaleString();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Formats dates as relative time strings (e.g., "5 minutes ago").
|
|
73
|
+
*
|
|
74
|
+
* Calculates the time difference between the given date and now, then
|
|
75
|
+
* formats it in a human-readable relative format with automatic pluralization.
|
|
76
|
+
* Returns "Invalid Date" for any invalid input.
|
|
77
|
+
*
|
|
78
|
+
* Time ranges:
|
|
79
|
+
* - < 10 seconds: "just now"
|
|
80
|
+
* - < 60 seconds: "{n} seconds ago"
|
|
81
|
+
* - < 60 minutes: "{n} minute(s) ago"
|
|
82
|
+
* - < 24 hours: "{n} hour(s) ago"
|
|
83
|
+
* - < 7 days: "{n} day(s) ago"
|
|
84
|
+
* - >= 7 days: "{n} week(s) ago"
|
|
85
|
+
*
|
|
86
|
+
* @param date - Date object or ISO 8601 string to format
|
|
87
|
+
* @returns Relative time string, or "Invalid Date" if input is invalid
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* // Assuming current time is 2025-01-14 20:00:00
|
|
92
|
+
*
|
|
93
|
+
* formatRelativeTime(new Date('2025-01-14 19:59:55'))
|
|
94
|
+
* // → "just now" (5 seconds ago)
|
|
95
|
+
*
|
|
96
|
+
* formatRelativeTime(new Date('2025-01-14 19:30:00'))
|
|
97
|
+
* // → "30 minutes ago"
|
|
98
|
+
*
|
|
99
|
+
* formatRelativeTime(new Date('2025-01-14 18:00:00'))
|
|
100
|
+
* // → "2 hours ago"
|
|
101
|
+
*
|
|
102
|
+
* formatRelativeTime(new Date('2025-01-13 20:00:00'))
|
|
103
|
+
* // → "1 day ago"
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export function formatRelativeTime(date) {
|
|
107
|
+
const dateObj = typeof date === 'string' ? new Date(date) : date;
|
|
108
|
+
if (isNaN(dateObj.getTime())) {
|
|
109
|
+
return 'Invalid Date';
|
|
110
|
+
}
|
|
111
|
+
const now = new Date();
|
|
112
|
+
const diffMs = now.getTime() - dateObj.getTime();
|
|
113
|
+
const diffSeconds = Math.floor(diffMs / 1000);
|
|
114
|
+
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
115
|
+
const diffHours = Math.floor(diffMinutes / 60);
|
|
116
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
117
|
+
const diffWeeks = Math.floor(diffDays / 7);
|
|
118
|
+
if (diffSeconds < 10) {
|
|
119
|
+
return 'just now';
|
|
120
|
+
}
|
|
121
|
+
else if (diffSeconds < 60) {
|
|
122
|
+
return `${diffSeconds} seconds ago`;
|
|
123
|
+
}
|
|
124
|
+
else if (diffMinutes < 60) {
|
|
125
|
+
return diffMinutes === 1 ? '1 minute ago' : `${diffMinutes} minutes ago`;
|
|
126
|
+
}
|
|
127
|
+
else if (diffHours < 24) {
|
|
128
|
+
return diffHours === 1 ? '1 hour ago' : `${diffHours} hours ago`;
|
|
129
|
+
}
|
|
130
|
+
else if (diffDays < 7) {
|
|
131
|
+
return diffDays === 1 ? '1 day ago' : `${diffDays} days ago`;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return diffWeeks === 1 ? '1 week ago' : `${diffWeeks} weeks ago`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Formats numbers with thousands separators for readability.
|
|
139
|
+
*
|
|
140
|
+
* Uses the en-US locale to add comma separators every three digits.
|
|
141
|
+
* Handles negative numbers and zero correctly.
|
|
142
|
+
*
|
|
143
|
+
* @param num - The number to format
|
|
144
|
+
* @returns Formatted string with comma separators
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* formatNumber(1234) // → "1,234"
|
|
149
|
+
* formatNumber(1000000) // → "1,000,000"
|
|
150
|
+
* formatNumber(999) // → "999"
|
|
151
|
+
* formatNumber(0) // → "0"
|
|
152
|
+
* formatNumber(-1234) // → "-1,234"
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString | Number.toLocaleString()}
|
|
156
|
+
*/
|
|
157
|
+
export function formatNumber(num) {
|
|
158
|
+
return num.toLocaleString('en-US');
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Formats numbers in compact form with k/M/B suffixes.
|
|
162
|
+
*
|
|
163
|
+
* Converts large numbers into human-readable compact form with one decimal
|
|
164
|
+
* place of precision. Useful for displaying statistics in limited space.
|
|
165
|
+
*
|
|
166
|
+
* Ranges:
|
|
167
|
+
* - < 1,000: As-is (no suffix)
|
|
168
|
+
* - 1,000 - 999,999: Thousands with 'k' suffix
|
|
169
|
+
* - 1,000,000 - 999,999,999: Millions with 'M' suffix
|
|
170
|
+
* - >= 1,000,000,000: Billions with 'B' suffix
|
|
171
|
+
*
|
|
172
|
+
* @param num - The number to format
|
|
173
|
+
* @returns Compact formatted string with suffix
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
* formatCompactNumber(999) // → "999"
|
|
178
|
+
* formatCompactNumber(1000) // → "1.0k"
|
|
179
|
+
* formatCompactNumber(1500) // → "1.5k"
|
|
180
|
+
* formatCompactNumber(1000000) // → "1.0M"
|
|
181
|
+
* formatCompactNumber(2500000) // → "2.5M"
|
|
182
|
+
* formatCompactNumber(1000000000) // → "1.0B"
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
export function formatCompactNumber(num) {
|
|
186
|
+
if (num < 1000) {
|
|
187
|
+
return num.toString();
|
|
188
|
+
}
|
|
189
|
+
else if (num < 1000000) {
|
|
190
|
+
return `${(num / 1000).toFixed(1)}k`;
|
|
191
|
+
}
|
|
192
|
+
else if (num < 1000000000) {
|
|
193
|
+
return `${(num / 1000000).toFixed(1)}M`;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
return `${(num / 1000000000).toFixed(1)}B`;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Formats token counts in compact form.
|
|
201
|
+
*
|
|
202
|
+
* Similar to {@link formatCompactNumber} but specifically for token counts.
|
|
203
|
+
* Does not format billions as token counts rarely reach that magnitude.
|
|
204
|
+
*
|
|
205
|
+
* Ranges:
|
|
206
|
+
* - < 1,000: As-is (no suffix)
|
|
207
|
+
* - 1,000 - 999,999: Thousands with 'k' suffix
|
|
208
|
+
* - >= 1,000,000: Millions with 'M' suffix
|
|
209
|
+
*
|
|
210
|
+
* @param tokens - The number of tokens to format
|
|
211
|
+
* @returns Compact formatted string with suffix
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* formatTokens(256) // → "256"
|
|
216
|
+
* formatTokens(1000) // → "1.0k"
|
|
217
|
+
* formatTokens(1500) // → "1.5k"
|
|
218
|
+
* formatTokens(1200000) // → "1.2M"
|
|
219
|
+
* ```
|
|
220
|
+
*
|
|
221
|
+
* @see {@link formatContextWindow} for context window formatting
|
|
222
|
+
*/
|
|
223
|
+
export function formatTokens(tokens) {
|
|
224
|
+
if (tokens < 1000) {
|
|
225
|
+
return tokens.toString();
|
|
226
|
+
}
|
|
227
|
+
else if (tokens < 1000000) {
|
|
228
|
+
return `${(tokens / 1000).toFixed(1)}k`;
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
return `${(tokens / 1000000).toFixed(1)}M`;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Calculates and formats percentage values.
|
|
236
|
+
*
|
|
237
|
+
* Computes the percentage of value relative to total and formats it with
|
|
238
|
+
* one decimal place. Handles edge case of zero total by returning "0.0%"
|
|
239
|
+
* instead of dividing by zero.
|
|
240
|
+
*
|
|
241
|
+
* @param value - The value to calculate percentage for
|
|
242
|
+
* @param total - The total value (denominator)
|
|
243
|
+
* @returns Percentage string with one decimal place
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```typescript
|
|
247
|
+
* formatPercentage(75, 100) // → "75.0%"
|
|
248
|
+
* formatPercentage(50, 200) // → "25.0%"
|
|
249
|
+
* formatPercentage(755, 1000) // → "75.5%"
|
|
250
|
+
* formatPercentage(0, 100) // → "0.0%"
|
|
251
|
+
* formatPercentage(100, 100) // → "100.0%"
|
|
252
|
+
* formatPercentage(50, 0) // → "0.0%" (avoids division by zero)
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
export function formatPercentage(value, total) {
|
|
256
|
+
if (total === 0) {
|
|
257
|
+
return '0.0%';
|
|
258
|
+
}
|
|
259
|
+
const percentage = (value / total) * 100;
|
|
260
|
+
return `${percentage.toFixed(1)}%`;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Formats context window sizes for model listings.
|
|
264
|
+
*
|
|
265
|
+
* Similar to {@link formatTokens} but specifically for context window sizes.
|
|
266
|
+
* Uses integer division (no decimal places) for cleaner display.
|
|
267
|
+
*
|
|
268
|
+
* Ranges:
|
|
269
|
+
* - < 1,000: As-is (no suffix)
|
|
270
|
+
* - 1,000 - 999,999: Thousands with 'K' suffix (no decimals)
|
|
271
|
+
* - >= 1,000,000: Millions with 'M' suffix (no decimals)
|
|
272
|
+
*
|
|
273
|
+
* @param tokens - The number of tokens in the context window
|
|
274
|
+
* @returns Formatted string with K or M suffix
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```typescript
|
|
278
|
+
* formatContextWindow(999) // → "999"
|
|
279
|
+
* formatContextWindow(8000) // → "8K"
|
|
280
|
+
* formatContextWindow(128000) // → "128K"
|
|
281
|
+
* formatContextWindow(200000) // → "200K"
|
|
282
|
+
* formatContextWindow(1000000) // → "1M"
|
|
283
|
+
* formatContextWindow(2000000) // → "2M"
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* @see {@link formatTokens} for general token formatting
|
|
287
|
+
*/
|
|
288
|
+
export function formatContextWindow(tokens) {
|
|
289
|
+
if (tokens < 1000) {
|
|
290
|
+
return tokens.toString();
|
|
291
|
+
}
|
|
292
|
+
else if (tokens < 1000000) {
|
|
293
|
+
return `${Math.floor(tokens / 1000)}K`;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
return `${Math.floor(tokens / 1000000)}M`;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Formats prices in USD currency with 2 decimal places.
|
|
301
|
+
*
|
|
302
|
+
* Formats monetary values with a dollar sign and exactly 2 decimal places.
|
|
303
|
+
* Primarily used for displaying model pricing (cost per 1M tokens).
|
|
304
|
+
*
|
|
305
|
+
* @param pricePerMillion - The price value to format (typically per 1M tokens)
|
|
306
|
+
* @returns Formatted price string with $ prefix and 2 decimals
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```typescript
|
|
310
|
+
* formatPrice(0) // → "$0.00"
|
|
311
|
+
* formatPrice(0.074) // → "$0.07"
|
|
312
|
+
* formatPrice(0.076) // → "$0.08"
|
|
313
|
+
* formatPrice(3.5) // → "$3.50"
|
|
314
|
+
* formatPrice(15.0) // → "$15.00"
|
|
315
|
+
* formatPrice(1000.5) // → "$1000.50"
|
|
316
|
+
* ```
|
|
317
|
+
*
|
|
318
|
+
* @remarks
|
|
319
|
+
* Uses banker's rounding (round half to even) as implemented by toFixed().
|
|
320
|
+
*/
|
|
321
|
+
export function formatPrice(pricePerMillion) {
|
|
322
|
+
return `$${pricePerMillion.toFixed(2)}`;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Formats duration in milliseconds into human-readable format.
|
|
326
|
+
*
|
|
327
|
+
* Converts millisecond durations into a compact format showing hours, minutes,
|
|
328
|
+
* and seconds as appropriate. Omits zero values for cleaner display.
|
|
329
|
+
*
|
|
330
|
+
* @param ms - Duration in milliseconds
|
|
331
|
+
* @returns Formatted duration string
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* formatDuration(1000) // → "1s"
|
|
336
|
+
* formatDuration(60000) // → "1m"
|
|
337
|
+
* formatDuration(61000) // → "1m 1s"
|
|
338
|
+
* formatDuration(3661000) // → "1h 1m 1s"
|
|
339
|
+
* formatDuration(7200000) // → "2h"
|
|
340
|
+
* formatDuration(3723000) // → "1h 2m 3s"
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
export function formatDuration(ms) {
|
|
344
|
+
const seconds = Math.floor(ms / 1000);
|
|
345
|
+
const minutes = Math.floor(seconds / 60);
|
|
346
|
+
const hours = Math.floor(minutes / 60);
|
|
347
|
+
const parts = [];
|
|
348
|
+
if (hours > 0) {
|
|
349
|
+
parts.push(`${hours}h`);
|
|
350
|
+
}
|
|
351
|
+
const remainingMinutes = minutes % 60;
|
|
352
|
+
if (remainingMinutes > 0) {
|
|
353
|
+
parts.push(`${remainingMinutes}m`);
|
|
354
|
+
}
|
|
355
|
+
const remainingSeconds = seconds % 60;
|
|
356
|
+
if (remainingSeconds > 0 || parts.length === 0) {
|
|
357
|
+
parts.push(`${remainingSeconds}s`);
|
|
358
|
+
}
|
|
359
|
+
return parts.join(' ');
|
|
360
|
+
}
|
|
361
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;QACjB,OAAO,GAAG,KAAK,IAAI,CAAC;IACtB,CAAC;SAAM,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QAC/B,OAAO,GAA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AE,CAAC;IACtC,IAAI,gBAAgB,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/C,KAAK,CAAC,IAAI,CAAC,GAAG,gBAAgB,GAAG,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Math utility functions
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Linear interpolation between two values
|
|
6
|
+
* @param a Start value
|
|
7
|
+
* @param b End value
|
|
8
|
+
* @param t Interpolation factor (0-1)
|
|
9
|
+
*/
|
|
10
|
+
export declare function lerp(a: number, b: number, t: number): number;
|
|
11
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/utils/math.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Math utility functions
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Linear interpolation between two values
|
|
6
|
+
* @param a Start value
|
|
7
|
+
* @param b End value
|
|
8
|
+
* @param t Interpolation factor (0-1)
|
|
9
|
+
*/
|
|
10
|
+
export function lerp(a, b, t) {
|
|
11
|
+
return a + (b - a) * Math.max(0, Math.min(1, t));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=math.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.js","sourceRoot":"","sources":["../../src/utils/math.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IAClD,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC"}
|