@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,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {readEnvFile} from '@amodalai/core';
|
|
8
|
+
import type {PackageAuth} from '@amodalai/core';
|
|
9
|
+
|
|
10
|
+
import type {ConnectionTestReport, EndpointTestResult} from './types.js';
|
|
11
|
+
|
|
12
|
+
export interface TestConnectionOptions {
|
|
13
|
+
connectionName: string;
|
|
14
|
+
testEndpoints: string[];
|
|
15
|
+
envFilePath: string;
|
|
16
|
+
auth?: PackageAuth;
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Substitute $VAR and ${VAR} placeholders in a URL.
|
|
24
|
+
*/
|
|
25
|
+
export function resolveEndpointUrl(
|
|
26
|
+
url: string,
|
|
27
|
+
envVars: Map<string, string>,
|
|
28
|
+
): string {
|
|
29
|
+
return url.replace(/\$\{([A-Z_][A-Z0-9_]*)\}|\$([A-Z_][A-Z0-9_]*)/g, (_match, braced, bare) => {
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- regex capture groups are string|undefined
|
|
31
|
+
const varName = (braced ?? bare) as string;
|
|
32
|
+
return envVars.get(varName) ?? '';
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Build auth headers based on auth config and env vars.
|
|
38
|
+
*/
|
|
39
|
+
export function buildAuthHeaders(
|
|
40
|
+
auth: PackageAuth | undefined,
|
|
41
|
+
envVars: Map<string, string>,
|
|
42
|
+
): Record<string, string> {
|
|
43
|
+
if (!auth) return {};
|
|
44
|
+
|
|
45
|
+
switch (auth.type) {
|
|
46
|
+
case 'bearer': {
|
|
47
|
+
// Use first envVar value as the token
|
|
48
|
+
const envVarEntries = auth['envVars'] ?? {};
|
|
49
|
+
const firstKey = Object.keys(envVarEntries)[0];
|
|
50
|
+
if (firstKey) {
|
|
51
|
+
const token = envVars.get(firstKey) ?? '';
|
|
52
|
+
if (token) {
|
|
53
|
+
return {Authorization: `Bearer ${token}`};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
58
|
+
case 'api_key': {
|
|
59
|
+
const headers: Record<string, string> = {};
|
|
60
|
+
const headerDefs = auth['headers'] ?? {};
|
|
61
|
+
for (const [headerName, template] of Object.entries(headerDefs)) {
|
|
62
|
+
headers[headerName] = template.replace(
|
|
63
|
+
/\$\{?([A-Z_][A-Z0-9_]*)\}?/g,
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- regex capture group
|
|
65
|
+
(_match, varName) => envVars.get(varName as string) ?? '',
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return headers;
|
|
69
|
+
}
|
|
70
|
+
case 'oauth2': {
|
|
71
|
+
const envVarEntries = auth['envVars'] ?? {};
|
|
72
|
+
// Look for access_token mapping or use first entry
|
|
73
|
+
const tokenKey =
|
|
74
|
+
Object.entries(envVarEntries).find(([, desc]) =>
|
|
75
|
+
desc.toLowerCase().includes('access'),
|
|
76
|
+
)?.[0] ?? Object.keys(envVarEntries)[0];
|
|
77
|
+
if (tokenKey) {
|
|
78
|
+
const token = envVars.get(tokenKey) ?? '';
|
|
79
|
+
if (token) {
|
|
80
|
+
return {Authorization: `Bearer ${token}`};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return {};
|
|
84
|
+
}
|
|
85
|
+
default:
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Test a single endpoint. Never throws.
|
|
92
|
+
*/
|
|
93
|
+
async function testSingleEndpoint(
|
|
94
|
+
url: string,
|
|
95
|
+
headers: Record<string, string>,
|
|
96
|
+
timeoutMs: number,
|
|
97
|
+
): Promise<EndpointTestResult> {
|
|
98
|
+
const start = Date.now();
|
|
99
|
+
try {
|
|
100
|
+
const response = await fetch(url, {
|
|
101
|
+
method: 'GET',
|
|
102
|
+
headers,
|
|
103
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const durationMs = Date.now() - start;
|
|
107
|
+
|
|
108
|
+
if (!response.ok) {
|
|
109
|
+
return {
|
|
110
|
+
url,
|
|
111
|
+
status: 'error',
|
|
112
|
+
statusCode: response.status,
|
|
113
|
+
error: `HTTP ${response.status}`,
|
|
114
|
+
durationMs,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Best-effort record count extraction
|
|
119
|
+
let recordCount: number | undefined;
|
|
120
|
+
try {
|
|
121
|
+
const body: unknown = await response.json();
|
|
122
|
+
if (Array.isArray(body)) {
|
|
123
|
+
recordCount = body.length;
|
|
124
|
+
} else if (body && typeof body === 'object') {
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- narrowed by typeof check above
|
|
126
|
+
const obj = body as Record<string, unknown>;
|
|
127
|
+
if (typeof obj['total'] === 'number') {
|
|
128
|
+
recordCount = obj['total'];
|
|
129
|
+
} else if (typeof obj['count'] === 'number') {
|
|
130
|
+
recordCount = obj['count'];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} catch {
|
|
134
|
+
// Not JSON — that's fine
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
url,
|
|
139
|
+
status: 'ok',
|
|
140
|
+
statusCode: response.status,
|
|
141
|
+
recordCount,
|
|
142
|
+
durationMs,
|
|
143
|
+
};
|
|
144
|
+
} catch (err) {
|
|
145
|
+
const durationMs = Date.now() - start;
|
|
146
|
+
const message =
|
|
147
|
+
err instanceof Error ? err.message : 'Unknown error';
|
|
148
|
+
return {
|
|
149
|
+
url,
|
|
150
|
+
status: 'error',
|
|
151
|
+
error: message,
|
|
152
|
+
durationMs,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Test connection endpoints sequentially. Never throws.
|
|
159
|
+
*/
|
|
160
|
+
export async function testConnection(
|
|
161
|
+
options: TestConnectionOptions,
|
|
162
|
+
): Promise<ConnectionTestReport> {
|
|
163
|
+
const {
|
|
164
|
+
connectionName,
|
|
165
|
+
testEndpoints,
|
|
166
|
+
envFilePath,
|
|
167
|
+
auth,
|
|
168
|
+
timeoutMs = DEFAULT_TIMEOUT_MS,
|
|
169
|
+
} = options;
|
|
170
|
+
|
|
171
|
+
const envVars = await readEnvFile(envFilePath);
|
|
172
|
+
const headers = buildAuthHeaders(auth, envVars);
|
|
173
|
+
const results: EndpointTestResult[] = [];
|
|
174
|
+
|
|
175
|
+
for (const endpoint of testEndpoints) {
|
|
176
|
+
const url = resolveEndpointUrl(endpoint, envVars);
|
|
177
|
+
process.stderr.write(` Testing ${url} ... `);
|
|
178
|
+
const result = await testSingleEndpoint(url, headers, timeoutMs);
|
|
179
|
+
if (result.status === 'ok') {
|
|
180
|
+
const countInfo =
|
|
181
|
+
result.recordCount !== undefined
|
|
182
|
+
? ` (${result.recordCount} records)`
|
|
183
|
+
: '';
|
|
184
|
+
process.stderr.write(`OK ${result.statusCode}${countInfo} [${result.durationMs}ms]\n`);
|
|
185
|
+
} else {
|
|
186
|
+
process.stderr.write(`FAILED ${result.error ?? 'unknown'} [${result.durationMs}ms]\n`);
|
|
187
|
+
}
|
|
188
|
+
results.push(result);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
connectionName,
|
|
193
|
+
results,
|
|
194
|
+
allPassed: results.every((r) => r.status === 'ok'),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Result returned by oauth2 and credential prompt flows.
|
|
9
|
+
*/
|
|
10
|
+
export interface AuthResult {
|
|
11
|
+
credentials: Record<string, string>;
|
|
12
|
+
summary: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Per-endpoint test result.
|
|
17
|
+
*/
|
|
18
|
+
export interface EndpointTestResult {
|
|
19
|
+
url: string;
|
|
20
|
+
status: 'ok' | 'error';
|
|
21
|
+
statusCode?: number;
|
|
22
|
+
recordCount?: number;
|
|
23
|
+
error?: string;
|
|
24
|
+
durationMs: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Aggregated connection test report.
|
|
29
|
+
*/
|
|
30
|
+
export interface ConnectionTestReport {
|
|
31
|
+
connectionName: string;
|
|
32
|
+
results: EndpointTestResult[];
|
|
33
|
+
allPassed: boolean;
|
|
34
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {describe, it, expect, vi, beforeEach} from 'vitest';
|
|
8
|
+
|
|
9
|
+
describe('runAudit', () => {
|
|
10
|
+
let fetchSpy: ReturnType<typeof vi.fn>;
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
vi.clearAllMocks();
|
|
14
|
+
fetchSpy = vi.fn();
|
|
15
|
+
vi.stubGlobal('fetch', fetchSpy);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('outputs JSON format', async () => {
|
|
19
|
+
fetchSpy.mockResolvedValue({
|
|
20
|
+
ok: true,
|
|
21
|
+
json: () => Promise.resolve({
|
|
22
|
+
sessionId: 'sess-1',
|
|
23
|
+
events: [
|
|
24
|
+
{id: 'e1', eventType: 'tool_call', data: {}, tokenCount: 10, durationMs: 50, createdAt: '2026-03-15T10:00:00Z'},
|
|
25
|
+
],
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
|
|
30
|
+
|
|
31
|
+
const {runAudit} = await import('./audit.js');
|
|
32
|
+
await runAudit({
|
|
33
|
+
sessionId: 'sess-1',
|
|
34
|
+
format: 'json',
|
|
35
|
+
platformUrl: 'http://localhost:4000',
|
|
36
|
+
platformApiKey: 'key-123',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
expect(fetchSpy).toHaveBeenCalledOnce();
|
|
40
|
+
const output = stdoutSpy.mock.calls.map(([s]) => s).join('');
|
|
41
|
+
expect(output).toContain('"sessionId"');
|
|
42
|
+
stdoutSpy.mockRestore();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('outputs table format by default', async () => {
|
|
46
|
+
fetchSpy.mockResolvedValue({
|
|
47
|
+
ok: true,
|
|
48
|
+
json: () => Promise.resolve({
|
|
49
|
+
sessionId: 'sess-1',
|
|
50
|
+
events: [
|
|
51
|
+
{id: 'e1', eventType: 'tool_call', data: {}, tokenCount: null, durationMs: 50, createdAt: '2026-03-15T10:00:00Z'},
|
|
52
|
+
{id: 'e2', eventType: 'session_end', data: {}, tokenCount: null, durationMs: null, createdAt: '2026-03-15T10:01:00Z'},
|
|
53
|
+
],
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
|
|
58
|
+
|
|
59
|
+
const {runAudit} = await import('./audit.js');
|
|
60
|
+
await runAudit({
|
|
61
|
+
sessionId: 'sess-1',
|
|
62
|
+
platformUrl: 'http://localhost:4000',
|
|
63
|
+
platformApiKey: 'key-123',
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const output = stdoutSpy.mock.calls.map(([s]) => s).join('');
|
|
67
|
+
expect(output).toContain('tool_call');
|
|
68
|
+
expect(output).toContain('session_end');
|
|
69
|
+
expect(output).toContain('Total: 2 events');
|
|
70
|
+
stdoutSpy.mockRestore();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('handles empty events', async () => {
|
|
74
|
+
fetchSpy.mockResolvedValue({
|
|
75
|
+
ok: true,
|
|
76
|
+
json: () => Promise.resolve({sessionId: 'sess-1', events: []}),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
|
|
80
|
+
|
|
81
|
+
const {runAudit} = await import('./audit.js');
|
|
82
|
+
await runAudit({
|
|
83
|
+
sessionId: 'sess-1',
|
|
84
|
+
platformUrl: 'http://localhost:4000',
|
|
85
|
+
platformApiKey: 'key-123',
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const output = stdoutSpy.mock.calls.map(([s]) => s).join('');
|
|
89
|
+
expect(output).toContain('No audit events found');
|
|
90
|
+
stdoutSpy.mockRestore();
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {CommandModule} from 'yargs';
|
|
8
|
+
import {resolvePlatformConfig} from '../shared/platform-client.js';
|
|
9
|
+
|
|
10
|
+
export interface AuditOptions {
|
|
11
|
+
sessionId: string;
|
|
12
|
+
format?: 'json' | 'table';
|
|
13
|
+
platformUrl?: string;
|
|
14
|
+
platformApiKey?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve audit trail for a session from the platform.
|
|
19
|
+
*/
|
|
20
|
+
export async function runAudit(options: AuditOptions): Promise<void> {
|
|
21
|
+
let platformUrl: string;
|
|
22
|
+
let apiKey: string;
|
|
23
|
+
try {
|
|
24
|
+
const config = await resolvePlatformConfig({
|
|
25
|
+
url: options.platformUrl,
|
|
26
|
+
apiKey: options.platformApiKey,
|
|
27
|
+
});
|
|
28
|
+
platformUrl = config.url;
|
|
29
|
+
apiKey = config.apiKey;
|
|
30
|
+
} catch (err) {
|
|
31
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
32
|
+
process.stderr.write(`[audit] ${msg}\n`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const response = await fetch(`${platformUrl}/api/audit/sessions/${options.sessionId}`, {
|
|
38
|
+
headers: {'Authorization': `Bearer ${apiKey}`},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
process.stderr.write(`[audit] HTTP ${response.status}: ${await response.text()}\n`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- platform response
|
|
47
|
+
const data = await response.json() as {
|
|
48
|
+
sessionId: string;
|
|
49
|
+
events: Array<{
|
|
50
|
+
id: string;
|
|
51
|
+
eventType: string;
|
|
52
|
+
data: Record<string, unknown>;
|
|
53
|
+
tokenCount: number | null;
|
|
54
|
+
durationMs: number | null;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if (options.format === 'json') {
|
|
60
|
+
process.stdout.write(JSON.stringify(data, null, 2) + '\n');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Table format
|
|
65
|
+
const events = data.events;
|
|
66
|
+
if (events.length === 0) {
|
|
67
|
+
process.stdout.write('No audit events found for this session.\n');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const typeWidth = Math.max(10, ...events.map((e) => e.eventType.length));
|
|
72
|
+
process.stdout.write(`\nSession: ${data.sessionId}\n`);
|
|
73
|
+
process.stdout.write(`${'Type'.padEnd(typeWidth)} ${'Time'.padEnd(24)} Details\n`);
|
|
74
|
+
process.stdout.write('-'.repeat(typeWidth + 50) + '\n');
|
|
75
|
+
|
|
76
|
+
for (const event of events) {
|
|
77
|
+
const time = event.createdAt.slice(0, 24);
|
|
78
|
+
const details = event.durationMs ? `${event.durationMs}ms` : '';
|
|
79
|
+
process.stdout.write(`${event.eventType.padEnd(typeWidth)} ${time.padEnd(24)} ${details}\n`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
process.stdout.write(`\nTotal: ${events.length} events\n`);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
85
|
+
process.stderr.write(`[audit] Error: ${msg}\n`);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const auditCommand: CommandModule = {
|
|
91
|
+
command: 'audit <session-id>',
|
|
92
|
+
describe: 'View audit trail for a session',
|
|
93
|
+
builder: (yargs) =>
|
|
94
|
+
yargs
|
|
95
|
+
.positional('session-id', {
|
|
96
|
+
type: 'string',
|
|
97
|
+
demandOption: true,
|
|
98
|
+
describe: 'The session ID to retrieve audit events for',
|
|
99
|
+
})
|
|
100
|
+
.option('format', {
|
|
101
|
+
type: 'string',
|
|
102
|
+
choices: ['json', 'table'] as const,
|
|
103
|
+
default: 'table',
|
|
104
|
+
describe: 'Output format',
|
|
105
|
+
}),
|
|
106
|
+
handler: async (argv) => {
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
108
|
+
const sessionId = argv['sessionId'] as string;
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
110
|
+
const format = argv['format'] as 'json' | 'table';
|
|
111
|
+
await runAudit({sessionId, format});
|
|
112
|
+
},
|
|
113
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {describe, it, expect, vi, beforeEach} from 'vitest';
|
|
8
|
+
import {runAutomationsList, runAutomationsStart, runAutomationsStop, runAutomationsRun} from './automations.js';
|
|
9
|
+
|
|
10
|
+
const mockFetch = vi.fn();
|
|
11
|
+
vi.stubGlobal('fetch', mockFetch);
|
|
12
|
+
|
|
13
|
+
function jsonResponse(body: unknown, status = 200): Response {
|
|
14
|
+
return {
|
|
15
|
+
ok: status >= 200 && status < 300,
|
|
16
|
+
status,
|
|
17
|
+
statusText: status === 200 ? 'OK' : 'Error',
|
|
18
|
+
json: () => Promise.resolve(body),
|
|
19
|
+
} as unknown as Response;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('automations CLI', () => {
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
mockFetch.mockReset();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('list', () => {
|
|
28
|
+
it('should list automations from server', async () => {
|
|
29
|
+
mockFetch.mockResolvedValue(jsonResponse({
|
|
30
|
+
automations: [
|
|
31
|
+
{name: 'monitor', title: 'Zone Monitor', schedule: '*/5 * * * *', webhookTriggered: false, running: true},
|
|
32
|
+
{name: 'alerts', title: 'Alert Handler', webhookTriggered: true, running: true},
|
|
33
|
+
],
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
const code = await runAutomationsList({url: 'http://test:3847'});
|
|
37
|
+
expect(code).toBe(0);
|
|
38
|
+
expect(mockFetch).toHaveBeenCalledWith('http://test:3847/automations', {method: 'GET'});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should return 1 on error', async () => {
|
|
42
|
+
mockFetch.mockRejectedValue(new Error('Connection refused'));
|
|
43
|
+
|
|
44
|
+
const code = await runAutomationsList();
|
|
45
|
+
expect(code).toBe(1);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe('start', () => {
|
|
50
|
+
it('should start an automation', async () => {
|
|
51
|
+
mockFetch.mockResolvedValue(jsonResponse({status: 'started', automation: 'monitor'}));
|
|
52
|
+
|
|
53
|
+
const code = await runAutomationsStart('monitor', {url: 'http://test:3847'});
|
|
54
|
+
expect(code).toBe(0);
|
|
55
|
+
expect(mockFetch).toHaveBeenCalledWith('http://test:3847/automations/monitor/start', {method: 'POST'});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should return 1 on error', async () => {
|
|
59
|
+
mockFetch.mockResolvedValue(jsonResponse({error: 'Already running'}, 400));
|
|
60
|
+
|
|
61
|
+
const code = await runAutomationsStart('monitor');
|
|
62
|
+
expect(code).toBe(1);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe('stop', () => {
|
|
67
|
+
it('should stop an automation', async () => {
|
|
68
|
+
mockFetch.mockResolvedValue(jsonResponse({status: 'stopped', automation: 'monitor'}));
|
|
69
|
+
|
|
70
|
+
const code = await runAutomationsStop('monitor', {url: 'http://test:3847'});
|
|
71
|
+
expect(code).toBe(0);
|
|
72
|
+
expect(mockFetch).toHaveBeenCalledWith('http://test:3847/automations/monitor/stop', {method: 'POST'});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('run', () => {
|
|
77
|
+
it('should trigger an automation', async () => {
|
|
78
|
+
mockFetch.mockResolvedValue(jsonResponse({status: 'triggered', automation: 'monitor'}));
|
|
79
|
+
|
|
80
|
+
const code = await runAutomationsRun('monitor', {url: 'http://test:3847'});
|
|
81
|
+
expect(code).toBe(0);
|
|
82
|
+
expect(mockFetch).toHaveBeenCalledWith('http://test:3847/automations/monitor/run', {method: 'POST'});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|