@amodalai/amodal 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/src/auth/index.d.ts +13 -0
- package/dist/src/auth/index.d.ts.map +1 -0
- package/dist/src/auth/index.js +10 -0
- package/dist/src/auth/index.js.map +1 -0
- package/dist/src/auth/oauth2.d.ts +51 -0
- package/dist/src/auth/oauth2.d.ts.map +1 -0
- package/dist/src/auth/oauth2.js +196 -0
- package/dist/src/auth/oauth2.js.map +1 -0
- package/dist/src/auth/prompt.d.ts +21 -0
- package/dist/src/auth/prompt.d.ts.map +1 -0
- package/dist/src/auth/prompt.js +81 -0
- package/dist/src/auth/prompt.js.map +1 -0
- package/dist/src/auth/test-connection.d.ts +27 -0
- package/dist/src/auth/test-connection.d.ts.map +1 -0
- package/dist/src/auth/test-connection.js +153 -0
- package/dist/src/auth/test-connection.js.map +1 -0
- package/dist/src/auth/types.d.ts +32 -0
- package/dist/src/auth/types.d.ts.map +1 -0
- package/dist/src/auth/types.js +7 -0
- package/dist/src/auth/types.js.map +1 -0
- package/dist/src/commands/audit.d.ts +18 -0
- package/dist/src/commands/audit.d.ts.map +1 -0
- package/dist/src/commands/audit.js +86 -0
- package/dist/src/commands/audit.js.map +1 -0
- package/dist/src/commands/automations.d.ts +28 -0
- package/dist/src/commands/automations.d.ts.map +1 -0
- package/dist/src/commands/automations.js +179 -0
- package/dist/src/commands/automations.js.map +1 -0
- package/dist/src/commands/build-manifest-types.d.ts +33 -0
- package/dist/src/commands/build-manifest-types.d.ts.map +1 -0
- package/dist/src/commands/build-manifest-types.js +30 -0
- package/dist/src/commands/build-manifest-types.js.map +1 -0
- package/dist/src/commands/build-tools.d.ts +33 -0
- package/dist/src/commands/build-tools.d.ts.map +1 -0
- package/dist/src/commands/build-tools.js +237 -0
- package/dist/src/commands/build-tools.js.map +1 -0
- package/dist/src/commands/build.d.ts +23 -0
- package/dist/src/commands/build.d.ts.map +1 -0
- package/dist/src/commands/build.js +120 -0
- package/dist/src/commands/build.js.map +1 -0
- package/dist/src/commands/chat.d.ts +26 -0
- package/dist/src/commands/chat.d.ts.map +1 -0
- package/dist/src/commands/chat.js +123 -0
- package/dist/src/commands/chat.js.map +1 -0
- package/dist/src/commands/connect.d.ts +18 -0
- package/dist/src/commands/connect.d.ts.map +1 -0
- package/dist/src/commands/connect.js +198 -0
- package/dist/src/commands/connect.js.map +1 -0
- package/dist/src/commands/deploy.d.ts +20 -0
- package/dist/src/commands/deploy.d.ts.map +1 -0
- package/dist/src/commands/deploy.js +137 -0
- package/dist/src/commands/deploy.js.map +1 -0
- package/dist/src/commands/deployments.d.ts +17 -0
- package/dist/src/commands/deployments.d.ts.map +1 -0
- package/dist/src/commands/deployments.js +77 -0
- package/dist/src/commands/deployments.js.map +1 -0
- package/dist/src/commands/dev.d.ts +17 -0
- package/dist/src/commands/dev.d.ts.map +1 -0
- package/dist/src/commands/dev.js +109 -0
- package/dist/src/commands/dev.js.map +1 -0
- package/dist/src/commands/diff.d.ts +19 -0
- package/dist/src/commands/diff.d.ts.map +1 -0
- package/dist/src/commands/diff.js +120 -0
- package/dist/src/commands/diff.js.map +1 -0
- package/dist/src/commands/docker.d.ts +21 -0
- package/dist/src/commands/docker.d.ts.map +1 -0
- package/dist/src/commands/docker.js +215 -0
- package/dist/src/commands/docker.js.map +1 -0
- package/dist/src/commands/eval.d.ts +20 -0
- package/dist/src/commands/eval.d.ts.map +1 -0
- package/dist/src/commands/eval.js +236 -0
- package/dist/src/commands/eval.js.map +1 -0
- package/dist/src/commands/experiment.d.ts +21 -0
- package/dist/src/commands/experiment.d.ts.map +1 -0
- package/dist/src/commands/experiment.js +133 -0
- package/dist/src/commands/experiment.js.map +1 -0
- package/dist/src/commands/index.d.ts +10 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +75 -0
- package/dist/src/commands/index.js.map +1 -0
- package/dist/src/commands/init.d.ts +17 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +73 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/inspect.d.ts +22 -0
- package/dist/src/commands/inspect.d.ts.map +1 -0
- package/dist/src/commands/inspect.js +131 -0
- package/dist/src/commands/inspect.js.map +1 -0
- package/dist/src/commands/install-pkg.d.ts +29 -0
- package/dist/src/commands/install-pkg.d.ts.map +1 -0
- package/dist/src/commands/install-pkg.js +202 -0
- package/dist/src/commands/install-pkg.js.map +1 -0
- package/dist/src/commands/link.d.ts +32 -0
- package/dist/src/commands/link.d.ts.map +1 -0
- package/dist/src/commands/link.js +227 -0
- package/dist/src/commands/link.js.map +1 -0
- package/dist/src/commands/list.d.ts +19 -0
- package/dist/src/commands/list.d.ts.map +1 -0
- package/dist/src/commands/list.js +78 -0
- package/dist/src/commands/list.js.map +1 -0
- package/dist/src/commands/login.d.ts +31 -0
- package/dist/src/commands/login.d.ts.map +1 -0
- package/dist/src/commands/login.js +205 -0
- package/dist/src/commands/login.js.map +1 -0
- package/dist/src/commands/promote.d.ts +16 -0
- package/dist/src/commands/promote.d.ts.map +1 -0
- package/dist/src/commands/promote.js +55 -0
- package/dist/src/commands/promote.js.map +1 -0
- package/dist/src/commands/publish.d.ts +18 -0
- package/dist/src/commands/publish.d.ts.map +1 -0
- package/dist/src/commands/publish.js +122 -0
- package/dist/src/commands/publish.js.map +1 -0
- package/dist/src/commands/rollback.d.ts +17 -0
- package/dist/src/commands/rollback.d.ts.map +1 -0
- package/dist/src/commands/rollback.js +62 -0
- package/dist/src/commands/rollback.js.map +1 -0
- package/dist/src/commands/search.d.ts +20 -0
- package/dist/src/commands/search.d.ts.map +1 -0
- package/dist/src/commands/search.js +133 -0
- package/dist/src/commands/search.js.map +1 -0
- package/dist/src/commands/secrets.d.ts +20 -0
- package/dist/src/commands/secrets.d.ts.map +1 -0
- package/dist/src/commands/secrets.js +137 -0
- package/dist/src/commands/secrets.js.map +1 -0
- package/dist/src/commands/serve.d.ts +23 -0
- package/dist/src/commands/serve.d.ts.map +1 -0
- package/dist/src/commands/serve.js +144 -0
- package/dist/src/commands/serve.js.map +1 -0
- package/dist/src/commands/status.d.ts +16 -0
- package/dist/src/commands/status.d.ts.map +1 -0
- package/dist/src/commands/status.js +83 -0
- package/dist/src/commands/status.js.map +1 -0
- package/dist/src/commands/sync.d.ts +21 -0
- package/dist/src/commands/sync.d.ts.map +1 -0
- package/dist/src/commands/sync.js +94 -0
- package/dist/src/commands/sync.js.map +1 -0
- package/dist/src/commands/test-query.d.ts +19 -0
- package/dist/src/commands/test-query.d.ts.map +1 -0
- package/dist/src/commands/test-query.js +116 -0
- package/dist/src/commands/test-query.js.map +1 -0
- package/dist/src/commands/uninstall.d.ts +19 -0
- package/dist/src/commands/uninstall.d.ts.map +1 -0
- package/dist/src/commands/uninstall.js +84 -0
- package/dist/src/commands/uninstall.js.map +1 -0
- package/dist/src/commands/update.d.ts +21 -0
- package/dist/src/commands/update.d.ts.map +1 -0
- package/dist/src/commands/update.js +145 -0
- package/dist/src/commands/update.js.map +1 -0
- package/dist/src/commands/validate.d.ts +19 -0
- package/dist/src/commands/validate.d.ts.map +1 -0
- package/dist/src/commands/validate.js +114 -0
- package/dist/src/commands/validate.js.map +1 -0
- package/dist/src/fixtures/incident-response.d.ts +91 -0
- package/dist/src/fixtures/incident-response.d.ts.map +1 -0
- package/dist/src/fixtures/incident-response.js +208 -0
- package/dist/src/fixtures/incident-response.js.map +1 -0
- package/dist/src/main.d.ts +8 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/main.js +30 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/shared/platform-client.d.ts +92 -0
- package/dist/src/shared/platform-client.d.ts.map +1 -0
- package/dist/src/shared/platform-client.js +155 -0
- package/dist/src/shared/platform-client.js.map +1 -0
- package/dist/src/shared/repo-discovery.d.ts +11 -0
- package/dist/src/shared/repo-discovery.d.ts.map +1 -0
- package/dist/src/shared/repo-discovery.js +33 -0
- package/dist/src/shared/repo-discovery.js.map +1 -0
- package/dist/src/templates/compose-template.d.ts +10 -0
- package/dist/src/templates/compose-template.d.ts.map +1 -0
- package/dist/src/templates/compose-template.js +30 -0
- package/dist/src/templates/compose-template.js.map +1 -0
- package/dist/src/templates/config-template.d.ts +14 -0
- package/dist/src/templates/config-template.d.ts.map +1 -0
- package/dist/src/templates/config-template.js +35 -0
- package/dist/src/templates/config-template.js.map +1 -0
- package/dist/src/templates/dockerfile-template.d.ts +10 -0
- package/dist/src/templates/dockerfile-template.d.ts.map +1 -0
- package/dist/src/templates/dockerfile-template.js +30 -0
- package/dist/src/templates/dockerfile-template.js.map +1 -0
- package/dist/src/templates/env-template.d.ts +12 -0
- package/dist/src/templates/env-template.d.ts.map +1 -0
- package/dist/src/templates/env-template.js +24 -0
- package/dist/src/templates/env-template.js.map +1 -0
- package/dist/src/templates/knowledge-template.d.ts +10 -0
- package/dist/src/templates/knowledge-template.d.ts.map +1 -0
- package/dist/src/templates/knowledge-template.js +24 -0
- package/dist/src/templates/knowledge-template.js.map +1 -0
- package/dist/src/templates/skill-template.d.ts +10 -0
- package/dist/src/templates/skill-template.d.ts.map +1 -0
- package/dist/src/templates/skill-template.js +27 -0
- package/dist/src/templates/skill-template.js.map +1 -0
- package/dist/src/ui/AskUserPrompt.d.ts +14 -0
- package/dist/src/ui/AskUserPrompt.d.ts.map +1 -0
- package/dist/src/ui/AskUserPrompt.js +17 -0
- package/dist/src/ui/AskUserPrompt.js.map +1 -0
- package/dist/src/ui/AssistantMessage.d.ts +14 -0
- package/dist/src/ui/AssistantMessage.d.ts.map +1 -0
- package/dist/src/ui/AssistantMessage.js +8 -0
- package/dist/src/ui/AssistantMessage.js.map +1 -0
- package/dist/src/ui/ChatApp.d.ts +15 -0
- package/dist/src/ui/ChatApp.d.ts.map +1 -0
- package/dist/src/ui/ChatApp.js +144 -0
- package/dist/src/ui/ChatApp.js.map +1 -0
- package/dist/src/ui/ConfirmationPrompt.d.ts +17 -0
- package/dist/src/ui/ConfirmationPrompt.d.ts.map +1 -0
- package/dist/src/ui/ConfirmationPrompt.js +21 -0
- package/dist/src/ui/ConfirmationPrompt.js.map +1 -0
- package/dist/src/ui/DiffRenderer.d.ts +32 -0
- package/dist/src/ui/DiffRenderer.d.ts.map +1 -0
- package/dist/src/ui/DiffRenderer.js +118 -0
- package/dist/src/ui/DiffRenderer.js.map +1 -0
- package/dist/src/ui/ExpandableContent.d.ts +15 -0
- package/dist/src/ui/ExpandableContent.d.ts.map +1 -0
- package/dist/src/ui/ExpandableContent.js +22 -0
- package/dist/src/ui/ExpandableContent.js.map +1 -0
- package/dist/src/ui/ExploreIndicator.d.ts +13 -0
- package/dist/src/ui/ExploreIndicator.d.ts.map +1 -0
- package/dist/src/ui/ExploreIndicator.js +14 -0
- package/dist/src/ui/ExploreIndicator.js.map +1 -0
- package/dist/src/ui/Footer.d.ts +19 -0
- package/dist/src/ui/Footer.d.ts.map +1 -0
- package/dist/src/ui/Footer.js +57 -0
- package/dist/src/ui/Footer.js.map +1 -0
- package/dist/src/ui/FullScreenLayout.d.ts +18 -0
- package/dist/src/ui/FullScreenLayout.d.ts.map +1 -0
- package/dist/src/ui/FullScreenLayout.js +14 -0
- package/dist/src/ui/FullScreenLayout.js.map +1 -0
- package/dist/src/ui/Header.d.ts +14 -0
- package/dist/src/ui/Header.d.ts.map +1 -0
- package/dist/src/ui/Header.js +11 -0
- package/dist/src/ui/Header.js.map +1 -0
- package/dist/src/ui/InputBar.d.ts +17 -0
- package/dist/src/ui/InputBar.d.ts.map +1 -0
- package/dist/src/ui/InputBar.js +49 -0
- package/dist/src/ui/InputBar.js.map +1 -0
- package/dist/src/ui/MessageList.d.ts +18 -0
- package/dist/src/ui/MessageList.d.ts.map +1 -0
- package/dist/src/ui/MessageList.js +9 -0
- package/dist/src/ui/MessageList.js.map +1 -0
- package/dist/src/ui/NotificationBar.d.ts +14 -0
- package/dist/src/ui/NotificationBar.d.ts.map +1 -0
- package/dist/src/ui/NotificationBar.js +38 -0
- package/dist/src/ui/NotificationBar.js.map +1 -0
- package/dist/src/ui/ScrollableMessageList.d.ts +27 -0
- package/dist/src/ui/ScrollableMessageList.d.ts.map +1 -0
- package/dist/src/ui/ScrollableMessageList.js +16 -0
- package/dist/src/ui/ScrollableMessageList.js.map +1 -0
- package/dist/src/ui/SessionBrowser.d.ts +20 -0
- package/dist/src/ui/SessionBrowser.d.ts.map +1 -0
- package/dist/src/ui/SessionBrowser.js +93 -0
- package/dist/src/ui/SessionBrowser.js.map +1 -0
- package/dist/src/ui/StatusMessage.d.ts +13 -0
- package/dist/src/ui/StatusMessage.d.ts.map +1 -0
- package/dist/src/ui/StatusMessage.js +17 -0
- package/dist/src/ui/StatusMessage.js.map +1 -0
- package/dist/src/ui/StreamingView.d.ts +19 -0
- package/dist/src/ui/StreamingView.d.ts.map +1 -0
- package/dist/src/ui/StreamingView.js +18 -0
- package/dist/src/ui/StreamingView.js.map +1 -0
- package/dist/src/ui/SubagentDisplay.d.ts +13 -0
- package/dist/src/ui/SubagentDisplay.d.ts.map +1 -0
- package/dist/src/ui/SubagentDisplay.js +22 -0
- package/dist/src/ui/SubagentDisplay.js.map +1 -0
- package/dist/src/ui/ThinkingDisplay.d.ts +13 -0
- package/dist/src/ui/ThinkingDisplay.d.ts.map +1 -0
- package/dist/src/ui/ThinkingDisplay.js +15 -0
- package/dist/src/ui/ThinkingDisplay.js.map +1 -0
- package/dist/src/ui/ToolCallDisplay.d.ts +16 -0
- package/dist/src/ui/ToolCallDisplay.d.ts.map +1 -0
- package/dist/src/ui/ToolCallDisplay.js +136 -0
- package/dist/src/ui/ToolCallDisplay.js.map +1 -0
- package/dist/src/ui/UserMessage.d.ts +12 -0
- package/dist/src/ui/UserMessage.d.ts.map +1 -0
- package/dist/src/ui/UserMessage.js +5 -0
- package/dist/src/ui/UserMessage.js.map +1 -0
- package/dist/src/ui/commands/clear.d.ts +7 -0
- package/dist/src/ui/commands/clear.d.ts.map +1 -0
- package/dist/src/ui/commands/clear.js +13 -0
- package/dist/src/ui/commands/clear.js.map +1 -0
- package/dist/src/ui/commands/help.d.ts +7 -0
- package/dist/src/ui/commands/help.d.ts.map +1 -0
- package/dist/src/ui/commands/help.js +26 -0
- package/dist/src/ui/commands/help.js.map +1 -0
- package/dist/src/ui/commands/index.d.ts +14 -0
- package/dist/src/ui/commands/index.d.ts.map +1 -0
- package/dist/src/ui/commands/index.js +15 -0
- package/dist/src/ui/commands/index.js.map +1 -0
- package/dist/src/ui/commands/model.d.ts +7 -0
- package/dist/src/ui/commands/model.d.ts.map +1 -0
- package/dist/src/ui/commands/model.js +16 -0
- package/dist/src/ui/commands/model.js.map +1 -0
- package/dist/src/ui/commands/registry.d.ts +30 -0
- package/dist/src/ui/commands/registry.d.ts.map +1 -0
- package/dist/src/ui/commands/registry.js +45 -0
- package/dist/src/ui/commands/registry.js.map +1 -0
- package/dist/src/ui/commands/sessions.d.ts +7 -0
- package/dist/src/ui/commands/sessions.d.ts.map +1 -0
- package/dist/src/ui/commands/sessions.js +13 -0
- package/dist/src/ui/commands/sessions.js.map +1 -0
- package/dist/src/ui/commands/stats.d.ts +7 -0
- package/dist/src/ui/commands/stats.d.ts.map +1 -0
- package/dist/src/ui/commands/stats.js +33 -0
- package/dist/src/ui/commands/stats.js.map +1 -0
- package/dist/src/ui/commands/theme.d.ts +7 -0
- package/dist/src/ui/commands/theme.d.ts.map +1 -0
- package/dist/src/ui/commands/theme.js +35 -0
- package/dist/src/ui/commands/theme.js.map +1 -0
- package/dist/src/ui/markdown/CodeBlock.d.ts +14 -0
- package/dist/src/ui/markdown/CodeBlock.d.ts.map +1 -0
- package/dist/src/ui/markdown/CodeBlock.js +55 -0
- package/dist/src/ui/markdown/CodeBlock.js.map +1 -0
- package/dist/src/ui/markdown/InlineRenderer.d.ts +12 -0
- package/dist/src/ui/markdown/InlineRenderer.d.ts.map +1 -0
- package/dist/src/ui/markdown/InlineRenderer.js +70 -0
- package/dist/src/ui/markdown/InlineRenderer.js.map +1 -0
- package/dist/src/ui/markdown/MarkdownDisplay.d.ts +17 -0
- package/dist/src/ui/markdown/MarkdownDisplay.d.ts.map +1 -0
- package/dist/src/ui/markdown/MarkdownDisplay.js +142 -0
- package/dist/src/ui/markdown/MarkdownDisplay.js.map +1 -0
- package/dist/src/ui/markdown/Table.d.ts +14 -0
- package/dist/src/ui/markdown/Table.d.ts.map +1 -0
- package/dist/src/ui/markdown/Table.js +31 -0
- package/dist/src/ui/markdown/Table.js.map +1 -0
- package/dist/src/ui/theme.d.ts +39 -0
- package/dist/src/ui/theme.d.ts.map +1 -0
- package/dist/src/ui/theme.js +39 -0
- package/dist/src/ui/theme.js.map +1 -0
- package/dist/src/ui/themes/index.d.ts +45 -0
- package/dist/src/ui/themes/index.d.ts.map +1 -0
- package/dist/src/ui/themes/index.js +73 -0
- package/dist/src/ui/themes/index.js.map +1 -0
- package/dist/src/ui/themes/light.d.ts +8 -0
- package/dist/src/ui/themes/light.d.ts.map +1 -0
- package/dist/src/ui/themes/light.js +37 -0
- package/dist/src/ui/themes/light.js.map +1 -0
- package/dist/src/ui/themes/monochrome.d.ts +8 -0
- package/dist/src/ui/themes/monochrome.d.ts.map +1 -0
- package/dist/src/ui/themes/monochrome.js +37 -0
- package/dist/src/ui/themes/monochrome.js.map +1 -0
- package/dist/src/ui/types.d.ts +191 -0
- package/dist/src/ui/types.d.ts.map +1 -0
- package/dist/src/ui/types.js +7 -0
- package/dist/src/ui/types.js.map +1 -0
- package/dist/src/ui/useAlternateBuffer.d.ts +11 -0
- package/dist/src/ui/useAlternateBuffer.d.ts.map +1 -0
- package/dist/src/ui/useAlternateBuffer.js +25 -0
- package/dist/src/ui/useAlternateBuffer.js.map +1 -0
- package/dist/src/ui/useChat.d.ts +18 -0
- package/dist/src/ui/useChat.d.ts.map +1 -0
- package/dist/src/ui/useChat.js +599 -0
- package/dist/src/ui/useChat.js.map +1 -0
- package/dist/src/ui/useElapsedTime.d.ts +11 -0
- package/dist/src/ui/useElapsedTime.d.ts.map +1 -0
- package/dist/src/ui/useElapsedTime.js +39 -0
- package/dist/src/ui/useElapsedTime.js.map +1 -0
- package/dist/src/ui/useResponsiveLayout.d.ts +16 -0
- package/dist/src/ui/useResponsiveLayout.d.ts.map +1 -0
- package/dist/src/ui/useResponsiveLayout.js +24 -0
- package/dist/src/ui/useResponsiveLayout.js.map +1 -0
- package/dist/src/ui/useScroll.d.ts +20 -0
- package/dist/src/ui/useScroll.d.ts.map +1 -0
- package/dist/src/ui/useScroll.js +64 -0
- package/dist/src/ui/useScroll.js.map +1 -0
- package/dist/src/ui/useSessionResume.d.ts +20 -0
- package/dist/src/ui/useSessionResume.d.ts.map +1 -0
- package/dist/src/ui/useSessionResume.js +77 -0
- package/dist/src/ui/useSessionResume.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +60 -0
- package/src/auth/index.ts +13 -0
- package/src/auth/oauth2.test.ts +305 -0
- package/src/auth/oauth2.ts +269 -0
- package/src/auth/prompt.test.ts +205 -0
- package/src/auth/prompt.ts +111 -0
- package/src/auth/test-connection.test.ts +224 -0
- package/src/auth/test-connection.ts +196 -0
- package/src/auth/types.ts +34 -0
- package/src/commands/audit.test.ts +92 -0
- package/src/commands/audit.ts +113 -0
- package/src/commands/automations.test.ts +85 -0
- package/src/commands/automations.ts +205 -0
- package/src/commands/build-manifest-types.ts +35 -0
- package/src/commands/build-tools.ts +281 -0
- package/src/commands/build.test.ts +63 -0
- package/src/commands/build.ts +135 -0
- package/src/commands/chat.ts +147 -0
- package/src/commands/command-exports.test.ts +88 -0
- package/src/commands/connect.test.ts +343 -0
- package/src/commands/connect.ts +237 -0
- package/src/commands/deploy.test.ts +124 -0
- package/src/commands/deploy.ts +153 -0
- package/src/commands/deployments.ts +90 -0
- package/src/commands/dev.test.ts +63 -0
- package/src/commands/dev.ts +124 -0
- package/src/commands/diff.test.ts +183 -0
- package/src/commands/diff.ts +143 -0
- package/src/commands/docker.ts +232 -0
- package/src/commands/eval.test.ts +88 -0
- package/src/commands/eval.ts +268 -0
- package/src/commands/experiment.test.ts +125 -0
- package/src/commands/experiment.ts +153 -0
- package/src/commands/index.ts +76 -0
- package/src/commands/init.test.ts +109 -0
- package/src/commands/init.ts +98 -0
- package/src/commands/inspect.test.ts +234 -0
- package/src/commands/inspect.ts +157 -0
- package/src/commands/install-pkg.test.ts +265 -0
- package/src/commands/install-pkg.ts +234 -0
- package/src/commands/link.ts +270 -0
- package/src/commands/list.test.ts +152 -0
- package/src/commands/list.ts +95 -0
- package/src/commands/login.test.ts +195 -0
- package/src/commands/login.ts +258 -0
- package/src/commands/promote.ts +64 -0
- package/src/commands/publish.test.ts +203 -0
- package/src/commands/publish.ts +142 -0
- package/src/commands/rollback.ts +72 -0
- package/src/commands/search.test.ts +174 -0
- package/src/commands/search.ts +154 -0
- package/src/commands/secrets.test.ts +168 -0
- package/src/commands/secrets.ts +163 -0
- package/src/commands/serve.ts +166 -0
- package/src/commands/status.ts +94 -0
- package/src/commands/sync.test.ts +130 -0
- package/src/commands/sync.ts +119 -0
- package/src/commands/test-query.test.ts +42 -0
- package/src/commands/test-query.ts +129 -0
- package/src/commands/uninstall.test.ts +162 -0
- package/src/commands/uninstall.ts +107 -0
- package/src/commands/update.test.ts +281 -0
- package/src/commands/update.ts +180 -0
- package/src/commands/validate.test.ts +260 -0
- package/src/commands/validate.ts +139 -0
- package/src/e2e-automations.test.ts +305 -0
- package/src/e2e-commands.test.ts +587 -0
- package/src/e2e-incident-response.test.ts +345 -0
- package/src/e2e-plugin-connections.test.ts +415 -0
- package/src/e2e-plugins.test.ts +492 -0
- package/src/e2e.test.ts +602 -0
- package/src/fixtures/incident-response.ts +232 -0
- package/src/main.ts +35 -0
- package/src/shared/platform-client.test.ts +106 -0
- package/src/shared/platform-client.ts +193 -0
- package/src/shared/repo-discovery.test.ts +56 -0
- package/src/shared/repo-discovery.ts +40 -0
- package/src/templates/compose-template.ts +30 -0
- package/src/templates/config-template.ts +44 -0
- package/src/templates/deployment-templates.test.ts +99 -0
- package/src/templates/dockerfile-template.ts +30 -0
- package/src/templates/env-template.ts +27 -0
- package/src/templates/knowledge-template.ts +24 -0
- package/src/templates/skill-template.ts +27 -0
- package/src/ui/AskUserPrompt.tsx +58 -0
- package/src/ui/AssistantMessage.tsx +51 -0
- package/src/ui/ChatApp.tsx +283 -0
- package/src/ui/ConfirmationPrompt.tsx +75 -0
- package/src/ui/DiffRenderer.test.ts +104 -0
- package/src/ui/DiffRenderer.tsx +188 -0
- package/src/ui/ExpandableContent.tsx +68 -0
- package/src/ui/ExploreIndicator.tsx +44 -0
- package/src/ui/Footer.tsx +87 -0
- package/src/ui/FullScreenLayout.tsx +45 -0
- package/src/ui/Header.tsx +50 -0
- package/src/ui/InputBar.tsx +105 -0
- package/src/ui/MessageList.tsx +31 -0
- package/src/ui/NotificationBar.tsx +64 -0
- package/src/ui/ScrollableMessageList.tsx +82 -0
- package/src/ui/SessionBrowser.test.ts +49 -0
- package/src/ui/SessionBrowser.tsx +179 -0
- package/src/ui/StatusMessage.tsx +35 -0
- package/src/ui/StreamingView.tsx +87 -0
- package/src/ui/SubagentDisplay.tsx +57 -0
- package/src/ui/ThinkingDisplay.tsx +45 -0
- package/src/ui/ToolCallDisplay.tsx +268 -0
- package/src/ui/UserMessage.tsx +22 -0
- package/src/ui/chat-e2e.test.ts +581 -0
- package/src/ui/commands/clear.ts +15 -0
- package/src/ui/commands/help.ts +31 -0
- package/src/ui/commands/index.ts +22 -0
- package/src/ui/commands/model.ts +19 -0
- package/src/ui/commands/registry.test.ts +76 -0
- package/src/ui/commands/registry.ts +66 -0
- package/src/ui/commands/sessions.ts +16 -0
- package/src/ui/commands/stats.ts +35 -0
- package/src/ui/commands/theme.ts +41 -0
- package/src/ui/markdown/CodeBlock.tsx +118 -0
- package/src/ui/markdown/InlineRenderer.tsx +115 -0
- package/src/ui/markdown/MarkdownDisplay.tsx +223 -0
- package/src/ui/markdown/Table.tsx +75 -0
- package/src/ui/theme.ts +39 -0
- package/src/ui/themes/index.ts +113 -0
- package/src/ui/themes/light.ts +39 -0
- package/src/ui/themes/monochrome.ts +39 -0
- package/src/ui/types.ts +157 -0
- package/src/ui/useAlternateBuffer.ts +27 -0
- package/src/ui/useChat.test.ts +492 -0
- package/src/ui/useChat.ts +693 -0
- package/src/ui/useElapsedTime.test.ts +33 -0
- package/src/ui/useElapsedTime.ts +43 -0
- package/src/ui/useResponsiveLayout.test.ts +54 -0
- package/src/ui/useResponsiveLayout.ts +32 -0
- package/src/ui/useScroll.test.ts +99 -0
- package/src/ui/useScroll.ts +97 -0
- package/src/ui/useSessionResume.test.ts +80 -0
- package/src/ui/useSessionResume.ts +102 -0
- package/tsconfig.json +17 -0
- package/vitest.config.ts +20 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { ensureNpmContext, getLockEntry, makePackageRef, npmView, readPackageFile, listPackageFiles, getPackageDir, } from '@amodalai/core';
|
|
7
|
+
import { findRepoRoot } from '../shared/repo-discovery.js';
|
|
8
|
+
/**
|
|
9
|
+
* Show diff between installed version and latest available.
|
|
10
|
+
* Returns 0 on success, 1 on error.
|
|
11
|
+
*/
|
|
12
|
+
export async function runDiff(options) {
|
|
13
|
+
let repoPath;
|
|
14
|
+
try {
|
|
15
|
+
repoPath = findRepoRoot(options.cwd);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
19
|
+
process.stderr.write(`[diff] ${msg}\n`);
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
const paths = await ensureNpmContext(repoPath);
|
|
23
|
+
const ref = makePackageRef(options.type, options.name);
|
|
24
|
+
// Check if installed
|
|
25
|
+
const lockEntry = await getLockEntry(repoPath, options.type, options.name);
|
|
26
|
+
if (!lockEntry) {
|
|
27
|
+
process.stderr.write(`[diff] Package ${ref.key} is not installed.\n`);
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
// Get latest version info
|
|
31
|
+
let latestVersion;
|
|
32
|
+
try {
|
|
33
|
+
const viewResult = await npmView(paths, ref.npmName);
|
|
34
|
+
latestVersion = viewResult.version;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
38
|
+
process.stderr.write(`[diff] Failed to query registry: ${msg}\n`);
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
if (latestVersion === lockEntry.version) {
|
|
42
|
+
process.stderr.write(`[diff] ${ref.npmName}@${lockEntry.version} is already the latest version.\n`);
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
process.stderr.write(`[diff] Comparing ${ref.npmName}: ${lockEntry.version} (installed) → ${latestVersion} (latest)\n`);
|
|
46
|
+
// Get installed package directory
|
|
47
|
+
const packageDir = await getPackageDir(repoPath, ref);
|
|
48
|
+
if (!packageDir) {
|
|
49
|
+
process.stderr.write(`[diff] Package ${ref.key} is in lock file but not installed on disk.\n`);
|
|
50
|
+
return 1;
|
|
51
|
+
}
|
|
52
|
+
// List installed files
|
|
53
|
+
let installedFiles;
|
|
54
|
+
try {
|
|
55
|
+
installedFiles = await listPackageFiles(packageDir);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
installedFiles = [];
|
|
59
|
+
}
|
|
60
|
+
// Print diff report
|
|
61
|
+
process.stdout.write(`\n ${ref.npmName}\n`);
|
|
62
|
+
process.stdout.write(` Installed: ${lockEntry.version}\n`);
|
|
63
|
+
process.stdout.write(` Latest: ${latestVersion}\n\n`);
|
|
64
|
+
// Show file-level summary
|
|
65
|
+
process.stdout.write(' Files in installed version:\n');
|
|
66
|
+
for (const file of installedFiles) {
|
|
67
|
+
const content = await readPackageFile(packageDir, file);
|
|
68
|
+
if (content !== null) {
|
|
69
|
+
const lineCount = content.split('\n').length;
|
|
70
|
+
let detail = `${lineCount} lines`;
|
|
71
|
+
// Add type-specific details
|
|
72
|
+
if (file === 'surface.md') {
|
|
73
|
+
const endpointCount = (content.match(/^##\s/gm) ?? []).length;
|
|
74
|
+
detail += `, ${endpointCount} endpoint${endpointCount === 1 ? '' : 's'}`;
|
|
75
|
+
}
|
|
76
|
+
else if (file === 'spec.json') {
|
|
77
|
+
try {
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
79
|
+
const spec = JSON.parse(content);
|
|
80
|
+
const keys = Object.keys(spec);
|
|
81
|
+
detail += `, keys: ${keys.join(', ')}`;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// Not valid JSON
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (file === 'access.json') {
|
|
88
|
+
try {
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
90
|
+
const access = JSON.parse(content);
|
|
91
|
+
const ruleCount = Object.keys(access).length;
|
|
92
|
+
detail += `, ${ruleCount} rule${ruleCount === 1 ? '' : 's'}`;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// Not valid JSON
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else if (file === 'entities.md') {
|
|
99
|
+
const sectionCount = (content.match(/^##\s/gm) ?? []).length;
|
|
100
|
+
detail += `, ${sectionCount} entit${sectionCount === 1 ? 'y' : 'ies'}`;
|
|
101
|
+
}
|
|
102
|
+
process.stdout.write(` ${file} (${detail})\n`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
process.stdout.write(`\n Run \`amodal update ${options.type} ${options.name}\` to upgrade.\n\n`);
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
export const diffCommand = {
|
|
109
|
+
command: 'diff <type> <name>',
|
|
110
|
+
describe: 'Show diff between installed and latest version',
|
|
111
|
+
builder: (yargs) => yargs
|
|
112
|
+
.positional('type', { type: 'string', demandOption: true, choices: ['connection', 'skill', 'automation', 'knowledge'], describe: 'Package type' })
|
|
113
|
+
.positional('name', { type: 'string', demandOption: true, describe: 'Package name' }),
|
|
114
|
+
handler: async (argv) => {
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
116
|
+
const code = await runDiff({ type: argv['type'], name: argv['name'] });
|
|
117
|
+
process.exit(code);
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/commands/diff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAQzD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAoB;IAChD,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;QACxC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,GAAG,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,C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I,oBAAoB,CAAC,CAAC;IAClG,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAkB;IACxC,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,gDAAgD;IAC1D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK;SACF,UAAU,CAAC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,CAAU,EAAE,QAAQ,EAAE,cAAc,EAAC,CAAC;SACxJ,UAAU,CAAC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAC,CAAC;IACvF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,uEAAuE;QACvE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAW,EAAC,CAAC,CAAC;QAC9F,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import type { CommandModule } from 'yargs';
|
|
7
|
+
export interface DockerOptions {
|
|
8
|
+
cwd?: string;
|
|
9
|
+
subcommand: 'init' | 'check' | 'build';
|
|
10
|
+
tag?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Docker tooling for self-hosted runtime containerization.
|
|
14
|
+
*
|
|
15
|
+
* - `init`: Generate Dockerfile, docker-compose.yml, .env.production
|
|
16
|
+
* - `check`: Validate repo + env vars + Docker availability
|
|
17
|
+
* - `build`: Run `docker build` and tag the image
|
|
18
|
+
*/
|
|
19
|
+
export declare function runDocker(options: DockerOptions): Promise<void>;
|
|
20
|
+
export declare const dockerCommand: CommandModule;
|
|
21
|
+
//# sourceMappingURL=docker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../../src/commands/docker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAMzC,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBrE;AA6JD,eAAO,MAAM,aAAa,EAAE,aAsB3B,CAAC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
import { execSync } from 'node:child_process';
|
|
9
|
+
import { findRepoRoot } from '../shared/repo-discovery.js';
|
|
10
|
+
import { generateDockerfile } from '../templates/dockerfile-template.js';
|
|
11
|
+
import { generateCompose } from '../templates/compose-template.js';
|
|
12
|
+
import { extractEnvVars } from '../templates/env-template.js';
|
|
13
|
+
/**
|
|
14
|
+
* Docker tooling for self-hosted runtime containerization.
|
|
15
|
+
*
|
|
16
|
+
* - `init`: Generate Dockerfile, docker-compose.yml, .env.production
|
|
17
|
+
* - `check`: Validate repo + env vars + Docker availability
|
|
18
|
+
* - `build`: Run `docker build` and tag the image
|
|
19
|
+
*/
|
|
20
|
+
export async function runDocker(options) {
|
|
21
|
+
let repoPath;
|
|
22
|
+
try {
|
|
23
|
+
repoPath = findRepoRoot(options.cwd);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
27
|
+
process.stderr.write(`[docker] ${msg}\n`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
switch (options.subcommand) {
|
|
31
|
+
case 'init':
|
|
32
|
+
await dockerInit(repoPath);
|
|
33
|
+
break;
|
|
34
|
+
case 'check':
|
|
35
|
+
await dockerCheck(repoPath);
|
|
36
|
+
break;
|
|
37
|
+
case 'build':
|
|
38
|
+
await dockerBuild(repoPath, options.tag);
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
process.stderr.write(`[docker] Unknown subcommand: ${options.subcommand}\n`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function dockerInit(repoPath) {
|
|
46
|
+
const configPath = join(repoPath, 'amodal.json');
|
|
47
|
+
if (!existsSync(configPath)) {
|
|
48
|
+
process.stderr.write('[docker] No amodal.json found. Run `amodal init` first.\n');
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
const configStr = readFileSync(configPath, 'utf-8');
|
|
52
|
+
let config;
|
|
53
|
+
try {
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- parsing config JSON
|
|
55
|
+
config = JSON.parse(configStr);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
process.stderr.write('[docker] Failed to parse amodal.json.\n');
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
// Generate Dockerfile
|
|
62
|
+
const dockerfilePath = join(repoPath, 'Dockerfile');
|
|
63
|
+
if (existsSync(dockerfilePath)) {
|
|
64
|
+
process.stderr.write('[docker] Dockerfile already exists, skipping.\n');
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
writeFileSync(dockerfilePath, generateDockerfile());
|
|
68
|
+
process.stderr.write('[docker] Generated Dockerfile\n');
|
|
69
|
+
}
|
|
70
|
+
// Generate docker-compose.yml
|
|
71
|
+
const composePath = join(repoPath, 'docker-compose.yml');
|
|
72
|
+
if (existsSync(composePath)) {
|
|
73
|
+
process.stderr.write('[docker] docker-compose.yml already exists, skipping.\n');
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const name = typeof config['name'] === 'string' ? config['name'] : 'amodal-agent';
|
|
77
|
+
writeFileSync(composePath, generateCompose(name));
|
|
78
|
+
process.stderr.write('[docker] Generated docker-compose.yml\n');
|
|
79
|
+
}
|
|
80
|
+
// Generate .env.production
|
|
81
|
+
const envPath = join(repoPath, '.env.production');
|
|
82
|
+
if (existsSync(envPath)) {
|
|
83
|
+
process.stderr.write('[docker] .env.production already exists, skipping.\n');
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const envVars = extractEnvVars(configStr);
|
|
87
|
+
// Also check spec.json files
|
|
88
|
+
const specPath = join(repoPath, 'connections');
|
|
89
|
+
if (existsSync(specPath)) {
|
|
90
|
+
try {
|
|
91
|
+
const { readdirSync } = await import('node:fs');
|
|
92
|
+
const dirs = readdirSync(specPath);
|
|
93
|
+
for (const dir of dirs) {
|
|
94
|
+
const specFile = join(specPath, dir, 'spec.json');
|
|
95
|
+
if (existsSync(specFile)) {
|
|
96
|
+
const specStr = readFileSync(specFile, 'utf-8');
|
|
97
|
+
const specVars = extractEnvVars(specStr);
|
|
98
|
+
for (const v of specVars) {
|
|
99
|
+
if (!envVars.includes(v)) {
|
|
100
|
+
envVars.push(v);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Ignore scan errors
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const envContent = envVars.map((v) => `${v}=`).join('\n') + '\n';
|
|
111
|
+
writeFileSync(envPath, envContent);
|
|
112
|
+
process.stderr.write(`[docker] Generated .env.production with ${envVars.length} variables\n`);
|
|
113
|
+
}
|
|
114
|
+
process.stderr.write('[docker] Init complete. Review generated files before deploying.\n');
|
|
115
|
+
}
|
|
116
|
+
async function dockerCheck(repoPath) {
|
|
117
|
+
let hasErrors = false;
|
|
118
|
+
// Check config exists
|
|
119
|
+
const configPath = join(repoPath, 'amodal.json');
|
|
120
|
+
if (!existsSync(configPath)) {
|
|
121
|
+
process.stderr.write('[docker] ✗ Missing amodal.json\n');
|
|
122
|
+
hasErrors = true;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
process.stderr.write('[docker] ✓ amodal.json found\n');
|
|
126
|
+
}
|
|
127
|
+
// Check Dockerfile
|
|
128
|
+
if (!existsSync(join(repoPath, 'Dockerfile'))) {
|
|
129
|
+
process.stderr.write('[docker] ✗ Missing Dockerfile (run `amodal docker init`)\n');
|
|
130
|
+
hasErrors = true;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
process.stderr.write('[docker] ✓ Dockerfile found\n');
|
|
134
|
+
}
|
|
135
|
+
// Check Docker
|
|
136
|
+
try {
|
|
137
|
+
execSync('docker --version', { stdio: 'pipe' });
|
|
138
|
+
process.stderr.write('[docker] ✓ Docker available\n');
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
process.stderr.write('[docker] ✗ Docker not found. Install Docker to build images.\n');
|
|
142
|
+
hasErrors = true;
|
|
143
|
+
}
|
|
144
|
+
// Check env vars
|
|
145
|
+
const configStr = existsSync(configPath) ? readFileSync(configPath, 'utf-8') : '';
|
|
146
|
+
const envVars = extractEnvVars(configStr);
|
|
147
|
+
const missing = envVars.filter((v) => !process.env[v]);
|
|
148
|
+
if (missing.length > 0) {
|
|
149
|
+
process.stderr.write(`[docker] ⚠ ${missing.length} env vars not set: ${missing.join(', ')}\n`);
|
|
150
|
+
}
|
|
151
|
+
else if (envVars.length > 0) {
|
|
152
|
+
process.stderr.write(`[docker] ✓ All ${envVars.length} env vars set\n`);
|
|
153
|
+
}
|
|
154
|
+
if (hasErrors) {
|
|
155
|
+
process.stderr.write('[docker] Check failed.\n');
|
|
156
|
+
process.exit(1);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
process.stderr.write('[docker] All checks passed.\n');
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async function dockerBuild(repoPath, tag) {
|
|
163
|
+
const configPath = join(repoPath, 'amodal.json');
|
|
164
|
+
if (!existsSync(configPath)) {
|
|
165
|
+
process.stderr.write('[docker] No amodal.json found.\n');
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
let imageName;
|
|
169
|
+
try {
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- parsing config JSON
|
|
171
|
+
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
172
|
+
imageName = typeof config['name'] === 'string' ? config['name'] : 'amodal-agent';
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
imageName = 'amodal-agent';
|
|
176
|
+
}
|
|
177
|
+
const imageTag = tag ?? 'latest';
|
|
178
|
+
const fullTag = `${imageName}:${imageTag}`;
|
|
179
|
+
process.stderr.write(`[docker] Building ${fullTag}...\n`);
|
|
180
|
+
try {
|
|
181
|
+
execSync(`docker build -t ${fullTag} .`, {
|
|
182
|
+
cwd: repoPath,
|
|
183
|
+
stdio: 'inherit',
|
|
184
|
+
});
|
|
185
|
+
process.stderr.write(`[docker] Built ${fullTag}\n`);
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
189
|
+
process.stderr.write(`[docker] Build failed: ${msg}\n`);
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
export const dockerCommand = {
|
|
194
|
+
command: 'docker <subcommand>',
|
|
195
|
+
describe: 'Docker tooling for self-hosted deployment',
|
|
196
|
+
builder: (yargs) => yargs
|
|
197
|
+
.positional('subcommand', {
|
|
198
|
+
type: 'string',
|
|
199
|
+
demandOption: true,
|
|
200
|
+
choices: ['init', 'check', 'build'],
|
|
201
|
+
})
|
|
202
|
+
.option('tag', {
|
|
203
|
+
type: 'string',
|
|
204
|
+
describe: 'Image tag for build',
|
|
205
|
+
}),
|
|
206
|
+
handler: async (argv) => {
|
|
207
|
+
await runDocker({
|
|
208
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
209
|
+
subcommand: argv['subcommand'],
|
|
210
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
211
|
+
tag: argv['tag'],
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
//# sourceMappingURL=docker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../src/commands/docker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAChE,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAC,kBAAkB,EAAC,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAC,eAAe,EAAC,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAQ5D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAsB;IACpD,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC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AAC;IACN,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,MAAM,SAAS,CAAC;YACd,uEAAuE;YACvE,UAAU,EAAE,IAAI,CAAC,YAAY,CAA+B;YAC5D,uEAAuE;YACvE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAuB;SACvC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import type { CommandModule } from 'yargs';
|
|
7
|
+
export interface EvalOptions {
|
|
8
|
+
cwd?: string;
|
|
9
|
+
filter?: string;
|
|
10
|
+
save?: string;
|
|
11
|
+
diff?: string;
|
|
12
|
+
ci?: boolean;
|
|
13
|
+
port?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Run eval suite against a local repo.
|
|
17
|
+
*/
|
|
18
|
+
export declare function runEval(options: EvalOptions): Promise<void>;
|
|
19
|
+
export declare const evalCommand: CommandModule;
|
|
20
|
+
//# sourceMappingURL=eval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval.d.ts","sourceRoot":"","sources":["../../../src/commands/eval.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAIzC,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA6MjE;AAED,eAAO,MAAM,WAAW,EAAE,aAwBzB,CAAC"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { readFile, writeFile, mkdir } from 'node:fs/promises';
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
import { formatEvalTable, formatComparisonTable, formatEvalMarkdown, diffEvalResults, } from '@amodalai/core';
|
|
9
|
+
import { createLocalServer } from '@amodalai/runtime';
|
|
10
|
+
import { findRepoRoot } from '../shared/repo-discovery.js';
|
|
11
|
+
/**
|
|
12
|
+
* Run eval suite against a local repo.
|
|
13
|
+
*/
|
|
14
|
+
export async function runEval(options) {
|
|
15
|
+
let repoPath;
|
|
16
|
+
try {
|
|
17
|
+
repoPath = findRepoRoot(options.cwd);
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
21
|
+
process.stderr.write(`[eval] ${msg}\n`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
const port = options.port ?? 0;
|
|
25
|
+
process.stderr.write(`[eval] Loading repo from ${repoPath}\n`);
|
|
26
|
+
const server = await createLocalServer({
|
|
27
|
+
repoPath,
|
|
28
|
+
port,
|
|
29
|
+
host: '127.0.0.1',
|
|
30
|
+
hotReload: false,
|
|
31
|
+
});
|
|
32
|
+
const httpServer = await server.start();
|
|
33
|
+
const addr = httpServer.address();
|
|
34
|
+
const actualPort = typeof addr === 'object' && addr !== null ? addr.port : port;
|
|
35
|
+
const baseUrl = `http://127.0.0.1:${actualPort}`;
|
|
36
|
+
try {
|
|
37
|
+
// Load repo to get evals
|
|
38
|
+
const { loadRepoFromDisk } = await import('@amodalai/core');
|
|
39
|
+
const repo = await loadRepoFromDisk(repoPath);
|
|
40
|
+
if (repo.evals.length === 0) {
|
|
41
|
+
process.stderr.write('[eval] No evals found in evals/\n');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// Create query provider that hits the local server
|
|
45
|
+
const queryProvider = {
|
|
46
|
+
query: async (message, tenantId) => {
|
|
47
|
+
const response = await fetch(`${baseUrl}/chat`, {
|
|
48
|
+
method: 'POST',
|
|
49
|
+
headers: { 'Content-Type': 'application/json' },
|
|
50
|
+
body: JSON.stringify({ message, tenant_id: tenantId ?? 'eval-runner' }),
|
|
51
|
+
});
|
|
52
|
+
const text = await response.text();
|
|
53
|
+
const lines = text.split('\n');
|
|
54
|
+
let fullResponse = '';
|
|
55
|
+
const toolCalls = [];
|
|
56
|
+
let usage;
|
|
57
|
+
for (const line of lines) {
|
|
58
|
+
if (!line.startsWith('data: '))
|
|
59
|
+
continue;
|
|
60
|
+
try {
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- SSE parsing
|
|
62
|
+
const event = JSON.parse(line.substring(6));
|
|
63
|
+
if (event['type'] === 'text_delta') {
|
|
64
|
+
fullResponse += String(event['content'] ?? '');
|
|
65
|
+
}
|
|
66
|
+
else if (event['type'] === 'tool_call_start') {
|
|
67
|
+
toolCalls.push({
|
|
68
|
+
name: String(event['tool_name'] ?? ''),
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- SSE data
|
|
70
|
+
parameters: (event['parameters'] ?? {}),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
else if (event['type'] === 'done') {
|
|
74
|
+
// Extract usage from done event if the runtime provides it
|
|
75
|
+
if (event['usage']) {
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
77
|
+
const u = event['usage'];
|
|
78
|
+
if (u.input_tokens > 0 || u.output_tokens > 0) {
|
|
79
|
+
usage = { inputTokens: u.input_tokens, outputTokens: u.output_tokens };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (event['type'] === 'tool_call_result') {
|
|
84
|
+
// Enrich the last matching tool call with result info
|
|
85
|
+
const toolId = String(event['tool_id'] ?? '');
|
|
86
|
+
const status = String(event['status'] ?? '');
|
|
87
|
+
const result = String(event['result'] ?? event['error'] ?? '');
|
|
88
|
+
const preview = result.length > 300 ? result.substring(0, 300) + '...' : result;
|
|
89
|
+
// Add as a separate entry so the eval runner can see outcomes
|
|
90
|
+
toolCalls.push({
|
|
91
|
+
name: `${String(event['tool_name'] ?? 'request')}_result`,
|
|
92
|
+
parameters: { tool_id: toolId, status, result: preview },
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
// skip
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// If runtime didn't report usage, estimate from content length
|
|
101
|
+
// (~4 chars per token is a reasonable approximation for English text)
|
|
102
|
+
if (!usage) {
|
|
103
|
+
const outputChars = fullResponse.length + toolCalls.reduce((n, tc) => n + JSON.stringify(tc.parameters).length, 0);
|
|
104
|
+
const estimatedOutput = Math.ceil(outputChars / 4);
|
|
105
|
+
// Input is harder to estimate — use 3x output as a rough proxy (prompt + context)
|
|
106
|
+
const estimatedInput = estimatedOutput * 3;
|
|
107
|
+
usage = { inputTokens: estimatedInput, outputTokens: estimatedOutput };
|
|
108
|
+
}
|
|
109
|
+
return { response: fullResponse, toolCalls, usage };
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
// Simple judge — use the same server's LLM
|
|
113
|
+
const judgeProvider = {
|
|
114
|
+
judge: async (prompt) => {
|
|
115
|
+
const response = await fetch(`${baseUrl}/chat`, {
|
|
116
|
+
method: 'POST',
|
|
117
|
+
headers: { 'Content-Type': 'application/json' },
|
|
118
|
+
body: JSON.stringify({ message: prompt, tenant_id: 'eval-judge', session_id: `judge-${Date.now()}` }),
|
|
119
|
+
});
|
|
120
|
+
const text = await response.text();
|
|
121
|
+
let result = '';
|
|
122
|
+
for (const line of text.split('\n')) {
|
|
123
|
+
if (!line.startsWith('data: '))
|
|
124
|
+
continue;
|
|
125
|
+
try {
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- SSE parsing
|
|
127
|
+
const event = JSON.parse(line.substring(6));
|
|
128
|
+
if (event['type'] === 'text_delta') {
|
|
129
|
+
result += String(event['content'] ?? '');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// skip
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return result;
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
// Get git SHA
|
|
140
|
+
let gitSha;
|
|
141
|
+
try {
|
|
142
|
+
const { execSync } = await import('node:child_process');
|
|
143
|
+
gitSha = execSync('git rev-parse HEAD', { cwd: repoPath }).toString().trim();
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// not a git repo
|
|
147
|
+
}
|
|
148
|
+
// Get model info from repo config for cost tracking
|
|
149
|
+
const modelConfig = repo.config.models.main;
|
|
150
|
+
const model = { provider: modelConfig.provider, model: modelConfig.model };
|
|
151
|
+
const { runEvalSuite } = await import('@amodalai/core');
|
|
152
|
+
const gen = runEvalSuite(repo, { queryProvider, judgeProvider, filter: options.filter, gitSha, model });
|
|
153
|
+
let suiteResult;
|
|
154
|
+
while (true) {
|
|
155
|
+
const next = await gen.next();
|
|
156
|
+
if (next.done) {
|
|
157
|
+
suiteResult = next.value;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
const progress = next.value;
|
|
161
|
+
if (progress.type === 'eval_start') {
|
|
162
|
+
process.stderr.write(`[${progress.current}/${progress.total}] Running ${progress.evalName}...\n`);
|
|
163
|
+
}
|
|
164
|
+
else if (progress.type === 'eval_complete') {
|
|
165
|
+
const icon = progress.passed ? 'PASS' : 'FAIL';
|
|
166
|
+
process.stderr.write(`[${progress.current}/${progress.total}] ${icon} ${progress.evalName}\n`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (!suiteResult)
|
|
170
|
+
return;
|
|
171
|
+
// Save results if --save <name>
|
|
172
|
+
if (options.save) {
|
|
173
|
+
const saveDir = path.join(repoPath, '.amodal', 'evals');
|
|
174
|
+
await mkdir(saveDir, { recursive: true });
|
|
175
|
+
const savePath = path.join(saveDir, `${options.save}.json`);
|
|
176
|
+
await writeFile(savePath, JSON.stringify(suiteResult, null, 2) + '\n');
|
|
177
|
+
process.stderr.write(`[eval] Saved results to ${savePath}\n`);
|
|
178
|
+
}
|
|
179
|
+
// Compare against saved baseline if --diff <name>
|
|
180
|
+
if (options.diff) {
|
|
181
|
+
const baselinePath = path.join(repoPath, '.amodal', 'evals', `${options.diff}.json`);
|
|
182
|
+
let baseline;
|
|
183
|
+
try {
|
|
184
|
+
const raw = await readFile(baselinePath, 'utf-8');
|
|
185
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
186
|
+
baseline = JSON.parse(raw);
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
process.stderr.write(`[eval] Baseline "${options.diff}" not found at ${baselinePath}\n`);
|
|
190
|
+
process.stderr.write(`[eval] Run with --save ${options.diff} first to create it.\n`);
|
|
191
|
+
}
|
|
192
|
+
if (baseline) {
|
|
193
|
+
const diffs = diffEvalResults(suiteResult, baseline);
|
|
194
|
+
process.stdout.write(formatComparisonTable(suiteResult, baseline, diffs));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Always show the current run table
|
|
198
|
+
if (options.ci) {
|
|
199
|
+
process.stdout.write(formatEvalMarkdown(suiteResult, undefined, model));
|
|
200
|
+
}
|
|
201
|
+
else if (!options.diff) {
|
|
202
|
+
process.stdout.write(formatEvalTable(suiteResult, model));
|
|
203
|
+
}
|
|
204
|
+
// Exit with non-zero if any failures
|
|
205
|
+
if (suiteResult.totalFailed > 0) {
|
|
206
|
+
process.exitCode = 1;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
finally {
|
|
210
|
+
await server.stop();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
export const evalCommand = {
|
|
214
|
+
command: 'eval',
|
|
215
|
+
describe: 'Run eval suite',
|
|
216
|
+
builder: (yargs) => yargs
|
|
217
|
+
.option('filter', { type: 'string', describe: 'Filter evals by name' })
|
|
218
|
+
.option('save', { type: 'string', describe: 'Save results with a name (e.g. --save baseline)' })
|
|
219
|
+
.option('diff', { type: 'string', describe: 'Compare against a saved run (e.g. --diff baseline)' })
|
|
220
|
+
.option('ci', { type: 'boolean', default: false, describe: 'Output in CI-friendly markdown format' })
|
|
221
|
+
.option('port', { type: 'number', describe: 'Port for local eval server' }),
|
|
222
|
+
handler: async (argv) => {
|
|
223
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
224
|
+
const filter = argv['filter'];
|
|
225
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
226
|
+
const save = argv['save'];
|
|
227
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
228
|
+
const diff = argv['diff'];
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
230
|
+
const ci = argv['ci'];
|
|
231
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
232
|
+
const port = argv['port'];
|
|
233
|
+
await runEval({ filter, save, diff, ci, port });
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
//# sourceMappingURL=eval.js.map
|