@odysx/codemind 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +293 -2
- package/dist/commands/agents.d.ts +2 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +91 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +35 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/chat.d.ts +2 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +180 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/keys.d.ts +2 -0
- package/dist/commands/keys.d.ts.map +1 -0
- package/dist/commands/keys.js +81 -0
- package/dist/commands/keys.js.map +1 -0
- package/dist/commands/local.d.ts +2 -0
- package/dist/commands/local.d.ts.map +1 -0
- package/dist/commands/local.js +325 -0
- package/dist/commands/local.js.map +1 -0
- package/dist/commands/mcp.d.ts +2 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +73 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/prompts.d.ts +2 -0
- package/dist/commands/prompts.d.ts.map +1 -0
- package/dist/commands/prompts.js +59 -0
- package/dist/commands/prompts.js.map +1 -0
- package/dist/commands/skills.d.ts +2 -0
- package/dist/commands/skills.d.ts.map +1 -0
- package/dist/commands/skills.js +41 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/core/auth/index.d.ts +10 -0
- package/dist/core/auth/index.d.ts.map +1 -0
- package/dist/core/auth/index.js +82 -0
- package/dist/core/auth/index.js.map +1 -0
- package/dist/core/config/index.d.ts +47 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/index.js +118 -0
- package/dist/core/config/index.js.map +1 -0
- package/dist/core/history.d.ts +14 -0
- package/dist/core/history.d.ts.map +1 -0
- package/dist/core/history.js +80 -0
- package/dist/core/history.js.map +1 -0
- package/dist/core/markdown-renderer.d.ts +47 -0
- package/dist/core/markdown-renderer.d.ts.map +1 -0
- package/dist/core/markdown-renderer.js +385 -0
- package/dist/core/markdown-renderer.js.map +1 -0
- package/dist/core/permissions/index.d.ts +31 -0
- package/dist/core/permissions/index.d.ts.map +1 -0
- package/dist/core/permissions/index.js +64 -0
- package/dist/core/permissions/index.js.map +1 -0
- package/dist/core/provider/external.d.ts +28 -0
- package/dist/core/provider/external.d.ts.map +1 -0
- package/dist/core/provider/external.js +248 -0
- package/dist/core/provider/external.js.map +1 -0
- package/dist/core/provider/index.d.ts +96 -0
- package/dist/core/provider/index.d.ts.map +1 -0
- package/dist/core/provider/index.js +423 -0
- package/dist/core/provider/index.js.map +1 -0
- package/dist/core/registry/index.d.ts +25 -0
- package/dist/core/registry/index.d.ts.map +1 -0
- package/dist/core/registry/index.js +216 -0
- package/dist/core/registry/index.js.map +1 -0
- package/dist/core/schema/types.d.ts +93 -0
- package/dist/core/schema/types.d.ts.map +1 -0
- package/dist/core/schema/types.js +12 -0
- package/dist/core/schema/types.js.map +1 -0
- package/dist/core/terminal.d.ts +40 -0
- package/dist/core/terminal.d.ts.map +1 -0
- package/dist/core/terminal.js +134 -0
- package/dist/core/terminal.js.map +1 -0
- package/dist/core/workspace/index.d.ts +35 -0
- package/dist/core/workspace/index.d.ts.map +1 -0
- package/dist/core/workspace/index.js +194 -0
- package/dist/core/workspace/index.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +393 -0
- package/dist/index.js.map +1 -0
- package/dist/ui/app.d.ts +3 -0
- package/dist/ui/app.d.ts.map +1 -0
- package/dist/ui/app.js +554 -0
- package/dist/ui/app.js.map +1 -0
- package/dist/ui/commands/cases/catalog.d.ts +11 -0
- package/dist/ui/commands/cases/catalog.d.ts.map +1 -0
- package/dist/ui/commands/cases/catalog.js +62 -0
- package/dist/ui/commands/cases/catalog.js.map +1 -0
- package/dist/ui/commands/cases/misc.d.ts +35 -0
- package/dist/ui/commands/cases/misc.d.ts.map +1 -0
- package/dist/ui/commands/cases/misc.js +245 -0
- package/dist/ui/commands/cases/misc.js.map +1 -0
- package/dist/ui/commands/cases/tasks.d.ts +13 -0
- package/dist/ui/commands/cases/tasks.d.ts.map +1 -0
- package/dist/ui/commands/cases/tasks.js +91 -0
- package/dist/ui/commands/cases/tasks.js.map +1 -0
- package/dist/ui/commands/runCommand.d.ts +22 -0
- package/dist/ui/commands/runCommand.d.ts.map +1 -0
- package/dist/ui/commands/runCommand.js +136 -0
- package/dist/ui/commands/runCommand.js.map +1 -0
- package/dist/ui/components/AgentPicker.d.ts +11 -0
- package/dist/ui/components/AgentPicker.d.ts.map +1 -0
- package/dist/ui/components/AgentPicker.js +7 -0
- package/dist/ui/components/AgentPicker.js.map +1 -0
- package/dist/ui/components/AuthPicker.d.ts +14 -0
- package/dist/ui/components/AuthPicker.d.ts.map +1 -0
- package/dist/ui/components/AuthPicker.js +7 -0
- package/dist/ui/components/AuthPicker.js.map +1 -0
- package/dist/ui/components/Banner.d.ts +8 -0
- package/dist/ui/components/Banner.d.ts.map +1 -0
- package/dist/ui/components/Banner.js +24 -0
- package/dist/ui/components/Banner.js.map +1 -0
- package/dist/ui/components/CommandMenu.d.ts +17 -0
- package/dist/ui/components/CommandMenu.d.ts.map +1 -0
- package/dist/ui/components/CommandMenu.js +21 -0
- package/dist/ui/components/CommandMenu.js.map +1 -0
- package/dist/ui/components/ErrorBoundary.d.ts +24 -0
- package/dist/ui/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/ui/components/ErrorBoundary.js +51 -0
- package/dist/ui/components/ErrorBoundary.js.map +1 -0
- package/dist/ui/components/InputBar.d.ts +28 -0
- package/dist/ui/components/InputBar.d.ts.map +1 -0
- package/dist/ui/components/InputBar.js +108 -0
- package/dist/ui/components/InputBar.js.map +1 -0
- package/dist/ui/components/KeysPanel.d.ts +12 -0
- package/dist/ui/components/KeysPanel.d.ts.map +1 -0
- package/dist/ui/components/KeysPanel.js +25 -0
- package/dist/ui/components/KeysPanel.js.map +1 -0
- package/dist/ui/components/MessageView.d.ts +29 -0
- package/dist/ui/components/MessageView.d.ts.map +1 -0
- package/dist/ui/components/MessageView.js +107 -0
- package/dist/ui/components/MessageView.js.map +1 -0
- package/dist/ui/components/PermissionPrompt.d.ts +10 -0
- package/dist/ui/components/PermissionPrompt.d.ts.map +1 -0
- package/dist/ui/components/PermissionPrompt.js +4 -0
- package/dist/ui/components/PermissionPrompt.js.map +1 -0
- package/dist/ui/components/Pickers.d.ts +43 -0
- package/dist/ui/components/Pickers.d.ts.map +1 -0
- package/dist/ui/components/Pickers.js +33 -0
- package/dist/ui/components/Pickers.js.map +1 -0
- package/dist/ui/components/SearchOverlay.d.ts +21 -0
- package/dist/ui/components/SearchOverlay.d.ts.map +1 -0
- package/dist/ui/components/SearchOverlay.js +14 -0
- package/dist/ui/components/SearchOverlay.js.map +1 -0
- package/dist/ui/components/SessionPicker.d.ts +12 -0
- package/dist/ui/components/SessionPicker.d.ts.map +1 -0
- package/dist/ui/components/SessionPicker.js +8 -0
- package/dist/ui/components/SessionPicker.js.map +1 -0
- package/dist/ui/components/WorkingIndicator.d.ts +10 -0
- package/dist/ui/components/WorkingIndicator.d.ts.map +1 -0
- package/dist/ui/components/WorkingIndicator.js +23 -0
- package/dist/ui/components/WorkingIndicator.js.map +1 -0
- package/dist/ui/controls/ApiKeyEntry.d.ts +8 -0
- package/dist/ui/controls/ApiKeyEntry.d.ts.map +1 -0
- package/dist/ui/controls/ApiKeyEntry.js +5 -0
- package/dist/ui/controls/ApiKeyEntry.js.map +1 -0
- package/dist/ui/controls/MultiSelect.d.ts +18 -0
- package/dist/ui/controls/MultiSelect.d.ts.map +1 -0
- package/dist/ui/controls/MultiSelect.js +9 -0
- package/dist/ui/controls/MultiSelect.js.map +1 -0
- package/dist/ui/hooks/useAgentPicker.d.ts +14 -0
- package/dist/ui/hooks/useAgentPicker.d.ts.map +1 -0
- package/dist/ui/hooks/useAgentPicker.js +53 -0
- package/dist/ui/hooks/useAgentPicker.js.map +1 -0
- package/dist/ui/hooks/useAuthFlow.d.ts +14 -0
- package/dist/ui/hooks/useAuthFlow.d.ts.map +1 -0
- package/dist/ui/hooks/useAuthFlow.js +31 -0
- package/dist/ui/hooks/useAuthFlow.js.map +1 -0
- package/dist/ui/hooks/useKeysFlow.d.ts +17 -0
- package/dist/ui/hooks/useKeysFlow.d.ts.map +1 -0
- package/dist/ui/hooks/useKeysFlow.js +130 -0
- package/dist/ui/hooks/useKeysFlow.js.map +1 -0
- package/dist/ui/hooks/useSessionPicker.d.ts +29 -0
- package/dist/ui/hooks/useSessionPicker.d.ts.map +1 -0
- package/dist/ui/hooks/useSessionPicker.js +58 -0
- package/dist/ui/hooks/useSessionPicker.js.map +1 -0
- package/dist/ui/hooks/useTerminalSize.d.ts +6 -0
- package/dist/ui/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/ui/hooks/useTerminalSize.js +29 -0
- package/dist/ui/hooks/useTerminalSize.js.map +1 -0
- package/dist/ui/input/keyRouter.d.ts +125 -0
- package/dist/ui/input/keyRouter.d.ts.map +1 -0
- package/dist/ui/input/keyRouter.js +574 -0
- package/dist/ui/input/keyRouter.js.map +1 -0
- package/dist/ui/layouts/ScreenLayout.d.ts +98 -0
- package/dist/ui/layouts/ScreenLayout.d.ts.map +1 -0
- package/dist/ui/layouts/ScreenLayout.js +56 -0
- package/dist/ui/layouts/ScreenLayout.js.map +1 -0
- package/dist/ui/shared/types.d.ts +143 -0
- package/dist/ui/shared/types.d.ts.map +1 -0
- package/dist/ui/shared/types.js +38 -0
- package/dist/ui/shared/types.js.map +1 -0
- package/dist/ui/theme.d.ts +29 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +54 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/ui/utils/markdown.d.ts +74 -0
- package/dist/ui/utils/markdown.d.ts.map +1 -0
- package/dist/ui/utils/markdown.js +187 -0
- package/dist/ui/utils/markdown.js.map +1 -0
- package/dist/ui/utils/mentions.d.ts +12 -0
- package/dist/ui/utils/mentions.d.ts.map +1 -0
- package/dist/ui/utils/mentions.js +28 -0
- package/dist/ui/utils/mentions.js.map +1 -0
- package/dist/ui/utils/terminal-text.d.ts +33 -0
- package/dist/ui/utils/terminal-text.d.ts.map +1 -0
- package/dist/ui/utils/terminal-text.js +123 -0
- package/dist/ui/utils/terminal-text.js.map +1 -0
- package/dist/ui/utils/text.d.ts +72 -0
- package/dist/ui/utils/text.d.ts.map +1 -0
- package/dist/ui/utils/text.js +171 -0
- package/dist/ui/utils/text.js.map +1 -0
- package/eslint.config.js +40 -0
- package/graphify-out/GRAPH_REPORT.md +140 -0
- package/graphify-out/cache/1236b1806943f8eb5c64fece9fb448149370f4a1b52b32f0977ad528d7911291.json +1 -0
- package/graphify-out/cache/15cbf641dcc0fd641c18da872214918203a1f64baa7ac8430e4702ef32d18b02.json +1 -0
- package/graphify-out/cache/1abc52745bb46f6cc5a528530e2bc1f368c26e348dff85cdde5cad6f275d7177.json +1 -0
- package/graphify-out/cache/1c7815c37c13177e98895e272285f6151a8d0807478fc843ec452634b3e9912d.json +1 -0
- package/graphify-out/cache/1ec38c39f044f329c78642b61d6394fb8e15d0014335f32947d1f5c7b88c02bc.json +1 -0
- package/graphify-out/cache/20c9b57ff76dbb9d57cbd00659b0a42d2b28dd2abacf1ef4143cc67a5b6fe7f4.json +1 -0
- package/graphify-out/cache/285e11876884eb619e779d540cd957b33e70f14c67ecc26c9b9755aa9cedd717.json +1 -0
- package/graphify-out/cache/2c0a9c49ab51f4e0f07543b4e941bf802b7db31fa607c4cee8e595575be68fe7.json +1 -0
- package/graphify-out/cache/3025e6c2756c79ccaadd51d611f25a8b6630a6a11ce1b4e6e261b3e033dc194f.json +1 -0
- package/graphify-out/cache/4801a686ddfa0a52824a4fc3d65443cbb0ab9f0b030af67d02fccb520c584a08.json +1 -0
- package/graphify-out/cache/4f8fd96f38aa7d0293b4fab60c4581c4f3e68f4533c664c9cd78d1c53bea1cba.json +1 -0
- package/graphify-out/cache/5928e562b0f5700184b810e2403f4aa685e2b93c3c584c10460562b514c40fdd.json +1 -0
- package/graphify-out/cache/66132486efb0a4cfaeea766448f1f15bb33635808714052e7e24e5b00fbc984f.json +1 -0
- package/graphify-out/cache/66ab27669e7ec685130063662af9f30018c267f7639b4af4b0504a98282c383a.json +1 -0
- package/graphify-out/cache/6ff6b3dd433b5ffe96e166263a203dd622397e419dc00bb676824988b7defeab.json +1 -0
- package/graphify-out/cache/7a00a49932177a6215e2590b1ddfd6f1d8494792f693068e9d427d16b165d370.json +1 -0
- package/graphify-out/cache/7b681bc5182f40f707f1c0b16b78af38efffa62a1df315d10878f4de888408ef.json +1 -0
- package/graphify-out/cache/81196d44e50ac0b276d826a531ed10c425a528b298e3fe18e8d5a3eec996e9d5.json +1 -0
- package/graphify-out/cache/8934e9b32dea6e66fdc34fa1681b287ff1335c389917e0fc6ee2fc573e23e87b.json +1 -0
- package/graphify-out/cache/975f6c99807f86b79c80ca40c783618e2080a927eaebe6ea3db37b869f048851.json +1 -0
- package/graphify-out/cache/9ab98f08626fd8190462595e38de828293ad184db8df5e1177b05a8fe290faa1.json +1 -0
- package/graphify-out/cache/9c434a6796d7932b6e87a908c155c09cb2b8d097fc55f141f0302b6600f94749.json +1 -0
- package/graphify-out/cache/ac5cf4c489dc417c1f6ea728d0b6ba12ac7087bc6c2e736697ff3024b4d4e534.json +1 -0
- package/graphify-out/cache/ae5083b5c1dca3e5c6af485e7f6eb8a08ff8b382cdecf92ab5e0902053442afe.json +1 -0
- package/graphify-out/cache/b274057fc2e0118cf2746d1d8060841122bb2a2b0305566fc3f32d3a51e08bcc.json +1 -0
- package/graphify-out/cache/b39beef31da682387f030c0d149f6cd5b3e66effbf936cc8430db15360759dda.json +1 -0
- package/graphify-out/cache/bf3c6a36bb72820bc11cbf4a5c49067d1f62013d4686c019a4dbd9951b1e980e.json +1 -0
- package/graphify-out/cache/c034e156028d1a58b89bce659726e9a4065ddc4d2b560d6bce7a206fdff8dad3.json +1 -0
- package/graphify-out/cache/c619b5bbe8d1f427fbd7816d1e9fcfaf90d7201b020ae6b578166aeb9cb20683.json +1 -0
- package/graphify-out/cache/c8db77a9da0b0f601acfa50a620f31155cdda0d0cc0f2285adcea19e77194ee6.json +1 -0
- package/graphify-out/cache/ca664791ec7741a2077d9e7c10384142d30e7a3b77b388df719c315da608d57d.json +1 -0
- package/graphify-out/cache/cba43a116186bd55c8a63368dea4eee4a8123b2bec0a42df6efb3254f89f9a7a.json +1 -0
- package/graphify-out/cache/cd51cbb3dad1cf34417b9761fe2eb184a9f57d23dc86e45630e63bfa2ecafddc.json +1 -0
- package/graphify-out/cache/d06738cde193b34a136b94104220c17e0212b814b3e4d7ff399105635cae1a03.json +1 -0
- package/graphify-out/cache/d093c19f0169c0398eeb1360895b1c16ecc50abc59f4be8eec3f6fd27c89a6e5.json +1 -0
- package/graphify-out/cache/da8f75c438531d232fe114d5cbf2374576ce842a5fb87c7e5a88b78fdb334e5e.json +1 -0
- package/graphify-out/cache/e35798fa04ddede548a6953bdea506bd7d0788dfed4e8a8ea6ae77b1b60ef5e0.json +1 -0
- package/graphify-out/cache/e5a38c254719000487098782125e15e2e982c07d66b99d359ed1781f30f9fc8c.json +1 -0
- package/graphify-out/cache/e6e4c4a5a7200ee0154585b5d6538f699b0a746dbded3164f8391f06ce7cb212.json +1 -0
- package/graphify-out/cache/ea8d0838df6309b673b031f616b253af957898ee7289d25a541fa6183b732e4e.json +1 -0
- package/graphify-out/cache/ebaee92b0e881efd7a08f3143e2c1803310396b4651d4f77532003c699cc6836.json +1 -0
- package/graphify-out/cache/edf8543318a9e60d56d04704078da6c37202ddd6fdfc83144fe2b94fe19b80ef.json +1 -0
- package/graphify-out/cache/efca19d3668035f11126fc9eccbeab290abfa94babf3f9a8706de81d17aba263.json +1 -0
- package/graphify-out/cache/f1480bb642025ebd6d99986cdd8a7d5726897ec038300e4b095c9c938435dfad.json +1 -0
- package/graphify-out/cache/f459f21277f03865f732affb175b1b092954dae5967f27b3cd1864466e3e24f4.json +1 -0
- package/graphify-out/cache/f899e37e864010b30f4c196e86082d7bd022a0df032005e0407883ebcec36514.json +1 -0
- package/graphify-out/cache/fb3cbe07fbcd97c536cff9c6bc343c35f22d49613f05c53ad30ef67a75c5d93e.json +1 -0
- package/graphify-out/cache/fd3dc682b1ca2f5ae03b50d6b0e045ae50f5701c0a21c5a388d77ef482939d3a.json +1 -0
- package/graphify-out/graph.html +257 -0
- package/graphify-out/graph.json +4396 -0
- package/package.json +45 -6
- package/scripts/e2e-external.mjs +65 -0
- package/scripts/live-agents.mjs +6 -0
- package/scripts/live-stream.mjs +51 -0
- package/src/commands/agents.ts +91 -0
- package/src/commands/auth.ts +39 -0
- package/src/commands/chat.ts +198 -0
- package/src/commands/keys.ts +83 -0
- package/src/commands/local.ts +302 -0
- package/src/commands/mcp.ts +74 -0
- package/src/commands/prompts.ts +58 -0
- package/src/commands/skills.ts +43 -0
- package/src/core/auth/index.ts +101 -0
- package/src/core/config/index.ts +152 -0
- package/src/core/history.ts +79 -0
- package/src/core/markdown-renderer.ts +420 -0
- package/src/core/permissions/index.ts +99 -0
- package/src/core/provider/external.ts +312 -0
- package/src/core/provider/index.ts +517 -0
- package/src/core/registry/index.ts +250 -0
- package/src/core/schema/types.ts +106 -0
- package/src/core/terminal.ts +124 -0
- package/src/core/workspace/index.ts +216 -0
- package/src/index.ts +401 -0
- package/src/ui/app.tsx +644 -0
- package/src/ui/commands/cases/catalog.ts +76 -0
- package/src/ui/commands/cases/misc.ts +293 -0
- package/src/ui/commands/cases/tasks.ts +115 -0
- package/src/ui/commands/runCommand.ts +178 -0
- package/src/ui/components/Banner.tsx +63 -0
- package/src/ui/components/CommandMenu.tsx +63 -0
- package/src/ui/components/ErrorBoundary.tsx +75 -0
- package/src/ui/components/InputBar.tsx +227 -0
- package/src/ui/components/KeysPanel.tsx +115 -0
- package/src/ui/components/MessageView.tsx +226 -0
- package/src/ui/components/Pickers.tsx +234 -0
- package/src/ui/components/SearchOverlay.tsx +65 -0
- package/src/ui/components/WorkingIndicator.tsx +35 -0
- package/src/ui/controls/ApiKeyEntry.tsx +29 -0
- package/src/ui/controls/MultiSelect.tsx +55 -0
- package/src/ui/hooks/useAgentPicker.ts +64 -0
- package/src/ui/hooks/useAuthFlow.ts +47 -0
- package/src/ui/hooks/useKeysFlow.ts +157 -0
- package/src/ui/hooks/useSessionPicker.ts +84 -0
- package/src/ui/hooks/useTerminalSize.ts +36 -0
- package/src/ui/input/keyRouter.ts +627 -0
- package/src/ui/layouts/ScreenLayout.tsx +202 -0
- package/src/ui/shared/types.ts +160 -0
- package/src/ui/theme.ts +53 -0
- package/src/ui/utils/markdown.ts +255 -0
- package/src/ui/utils/mentions.ts +40 -0
- package/src/ui/utils/terminal-text.ts +130 -0
- package/src/ui/utils/text.ts +174 -0
- package/test/commands.test.mjs +127 -0
- package/test/config.test.mjs +123 -0
- package/test/history.test.mjs +42 -0
- package/test/keyrouter.test.mjs +324 -0
- package/test/layout.test.mjs +271 -0
- package/test/markdown.test.mjs +92 -0
- package/test/mentions.test.mjs +51 -0
- package/test/permissions.test.mjs +130 -0
- package/test/provider.test.mjs +287 -0
- package/test/terminal-text.test.mjs +116 -0
- package/test/text.test.mjs +134 -0
- package/test/workspace.test.mjs +101 -0
- package/tsconfig.json +32 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { runTasks, runRalph } from "./cases/tasks.js";
|
|
2
|
+
import { runMcp, runPrompts, runSkills } from "./cases/catalog.js";
|
|
3
|
+
import { runHelp, runStatus, runModel, runProvider, runUsage, runExport, runLocalGate, runMode, runTrust, } from "./cases/misc.js";
|
|
4
|
+
/** Run a registered `local` command handler and print its result (non-gated ops). */
|
|
5
|
+
const runLocal = async (cliArgs, ctx) => {
|
|
6
|
+
try {
|
|
7
|
+
// Import registers the command, then fetch it from the registry.
|
|
8
|
+
await import("../../commands/local.js");
|
|
9
|
+
const { getAllCommands } = await import("../../core/registry/index.js");
|
|
10
|
+
const entry = getAllCommands().get("local");
|
|
11
|
+
if (!entry)
|
|
12
|
+
throw new Error("local command not registered");
|
|
13
|
+
const result = await entry.handler({}, { args: cliArgs });
|
|
14
|
+
// Keep the command's own output even when it failed: `local exec` reports
|
|
15
|
+
// a non-zero status *and* carries the compiler/test output the user needs.
|
|
16
|
+
// Showing only the error phrase discarded it.
|
|
17
|
+
const output = typeof result.data === "string"
|
|
18
|
+
? result.data
|
|
19
|
+
: result.data === undefined
|
|
20
|
+
? ""
|
|
21
|
+
: JSON.stringify(result.data);
|
|
22
|
+
const body = [
|
|
23
|
+
result.error ? `✗ ${result.error}` : result.message,
|
|
24
|
+
output.trim(),
|
|
25
|
+
].filter(Boolean).join("\n");
|
|
26
|
+
ctx.addMessage((body || "(no output)").slice(0, 1500));
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
const text = err instanceof Error ? err.message : String(err);
|
|
30
|
+
ctx.addMessage(`✗ ${text}`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Slash name → body. Keys must stay in sync with SLASH_COMMANDS.
|
|
35
|
+
* A handler may ignore `arg` (no-argument commands) or parse it.
|
|
36
|
+
*/
|
|
37
|
+
const HANDLERS = {
|
|
38
|
+
help: (_a, ctx) => runHelp(ctx),
|
|
39
|
+
clear: (_a, ctx, messages) => {
|
|
40
|
+
// Wipe the transcript; if a reply is mid-stream, stop it too so its
|
|
41
|
+
// tokens don't keep appending after the wipe. resetTranscript also
|
|
42
|
+
// remounts the <Static> region, which otherwise keeps old lines.
|
|
43
|
+
ctx.abortStream();
|
|
44
|
+
const had = messages.length > 0;
|
|
45
|
+
ctx.resetTranscript();
|
|
46
|
+
if (!had) {
|
|
47
|
+
// Nothing to wipe — still confirm so Enter visibly did something.
|
|
48
|
+
ctx.addMessage("✓ conversation already empty");
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
// /compact is the historical alias for a context wipe; same behavior.
|
|
52
|
+
compact: (_a, ctx, messages) => HANDLERS.clear("", ctx, messages),
|
|
53
|
+
new: (_a, ctx) => ctx.newSession(),
|
|
54
|
+
status: (_a, ctx) => runStatus(ctx),
|
|
55
|
+
agent: (arg, ctx) => {
|
|
56
|
+
if (!arg) {
|
|
57
|
+
ctx.openAgentPicker();
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
ctx.setAgentId(arg);
|
|
61
|
+
ctx.addMessage(`Agent set to: ${arg}`);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
model: (arg, ctx) => runModel(arg, ctx),
|
|
65
|
+
provider: (arg, ctx) => runProvider(arg, ctx),
|
|
66
|
+
// Open the sign-in menu (auth picker). Shareable between the base path and
|
|
67
|
+
// the slash-menu's Enter handler since both route through here.
|
|
68
|
+
signin: (_a, ctx) => {
|
|
69
|
+
ctx.setAuthIndex(0);
|
|
70
|
+
ctx.setAuthMode("picker");
|
|
71
|
+
},
|
|
72
|
+
// /keys and /keys new both open the panel; creation starts from a keystroke
|
|
73
|
+
// there, because the flow needs the keys state owned by app.tsx.
|
|
74
|
+
keys: (_a, ctx) => ctx.openKeysPanel(),
|
|
75
|
+
sessions: (arg, ctx) => {
|
|
76
|
+
// /sessions <id> → resume directly; bare /sessions → interactive picker
|
|
77
|
+
const sid = arg.trim();
|
|
78
|
+
return sid ? ctx.resumeSession(sid) : ctx.openSessionPicker();
|
|
79
|
+
},
|
|
80
|
+
tasks: (arg, ctx) => runTasks(arg, ctx),
|
|
81
|
+
ralph: (arg, ctx) => runRalph(arg, ctx),
|
|
82
|
+
mcp: (_a, ctx) => runMcp(ctx),
|
|
83
|
+
prompts: (arg, ctx) => runPrompts(arg, ctx),
|
|
84
|
+
skills: (_a, ctx) => runSkills(ctx),
|
|
85
|
+
usage: (_a, ctx) => runUsage(ctx),
|
|
86
|
+
export: (_a, ctx, messages) => runExport(messages, ctx),
|
|
87
|
+
// Who decides whether a workspace operation may run, and which folders this
|
|
88
|
+
// session is allowed to touch at all.
|
|
89
|
+
mode: (arg, ctx) => runMode(arg, ctx),
|
|
90
|
+
trust: (arg, ctx) => runTrust(arg, ctx),
|
|
91
|
+
local: async (arg, ctx) => {
|
|
92
|
+
// Risky ops (write/exec/delete/move) go through the permission prompt
|
|
93
|
+
// first. The gate is async because it reads the current file for the diff.
|
|
94
|
+
const cliArgs = arg.trim().split(/\s+/).filter(Boolean);
|
|
95
|
+
// Awaited, not fire-and-forget: a rejection here used to escape as an
|
|
96
|
+
// unhandledRejection, and the piped path would exit before the op ran.
|
|
97
|
+
const gated = await runLocalGate(arg, ctx);
|
|
98
|
+
if (!gated)
|
|
99
|
+
await runLocal(cliArgs, ctx);
|
|
100
|
+
},
|
|
101
|
+
quit: (_a, ctx) => ctx.requestExit(),
|
|
102
|
+
// /exit is a documented alias of /quit; aliases are declared in the handler
|
|
103
|
+
// table rather than duplicated in the menu so /help stays one row each.
|
|
104
|
+
exit: (_a, ctx) => ctx.requestExit(),
|
|
105
|
+
};
|
|
106
|
+
/** Alternate names that dispatch to the same body but are hidden from /help. */
|
|
107
|
+
const ALIASES = {
|
|
108
|
+
q: "quit",
|
|
109
|
+
};
|
|
110
|
+
/** Every dispatchable slash name, including hidden aliases. Used by tests. */
|
|
111
|
+
export const DISPATCHABLE_COMMANDS = [
|
|
112
|
+
...Object.keys(HANDLERS),
|
|
113
|
+
...Object.keys(ALIASES),
|
|
114
|
+
];
|
|
115
|
+
/**
|
|
116
|
+
* Dispatch a slash command. Resolves once the handler's async work is done,
|
|
117
|
+
* so a non-interactive caller can await it before exiting. Rejections are
|
|
118
|
+
* reported into the transcript rather than escaping to the process.
|
|
119
|
+
*/
|
|
120
|
+
export const runCommand = async (raw, ctx, messages) => {
|
|
121
|
+
const [name, ...rest] = raw.replace(/^\//, "").split(" ");
|
|
122
|
+
const arg = rest.join(" ");
|
|
123
|
+
const key = (ALIASES[name.toLowerCase()] ?? name.toLowerCase());
|
|
124
|
+
const handler = HANDLERS[key];
|
|
125
|
+
if (!handler) {
|
|
126
|
+
ctx.addMessage(`Unknown command: /${name}. Try /help.`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
await handler(arg, ctx, messages);
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
ctx.addMessage(`✗ ${err instanceof Error ? err.message : String(err)}`);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=runCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runCommand.js","sourceRoot":"","sources":["../../../src/ui/commands/runCommand.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EACL,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,GAChG,MAAM,iBAAiB,CAAC;AAUzB,qFAAqF;AACrF,MAAM,QAAQ,GAAG,KAAK,EAAE,OAAiB,EAAE,GAAe,EAAiB,EAAE;IAC3E,IAAI,CAAC;QACH,iEAAiE;QACjE,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC;QACxC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;QACxE,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC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O,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAE9B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,GAAG,CAAC,UAAU,CAAC,qBAAqB,IAAI,cAAc,CAAC,CAAC;QACxD,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,UAAU,CAAC,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent picker (/agent with no args → select from your agents)
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
import type { AgentOption } from "../shared/types.js";
|
|
6
|
+
export declare const AgentPicker: ({ options, selected, busy, }: {
|
|
7
|
+
options: AgentOption[];
|
|
8
|
+
selected: number;
|
|
9
|
+
busy?: boolean;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
//# sourceMappingURL=AgentPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentPicker.d.ts","sourceRoot":"","sources":["../../../src/ui/components/AgentPicker.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,eAAO,MAAM,WAAW,iCAIrB;IACD,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,sBAuBA,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
export const AgentPicker = ({ options, selected, busy, }) => (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 1, marginBottom: 1, children: [_jsx(Text, { bold: true, color: "magenta", children: "Select an agent" }), _jsx(Text, { dimColor: true, children: "\u2191/\u2193 to move \u00B7 Enter to switch \u00B7 esc to cancel" }), _jsx(Box, { marginTop: 1, flexDirection: "column", children: busy && options.length === 0 ? (_jsx(Text, { dimColor: true, children: "Loading your agents\u2026" })) : (options.map((opt, idx) => {
|
|
4
|
+
const isSelected = idx === selected && !busy;
|
|
5
|
+
return (_jsx(Box, { children: _jsxs(Text, { color: isSelected ? "magenta" : "gray", bold: isSelected, children: [isSelected ? "❯ " : " ", opt.label, _jsxs(Text, { dimColor: true, children: [" \u2014 ", opt.description] })] }) }, opt.id));
|
|
6
|
+
})) })] }));
|
|
7
|
+
//# sourceMappingURL=AgentPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentPicker.js","sourceRoot":"","sources":["../../../src/ui/components/AgentPicker.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAGhC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,OAAO,EACP,QAAQ,EACR,IAAI,GAKL,EAAE,EAAE,CAAC,CACJ,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,WAAW,EAAC,OAAO,EAAC,WAAW,EAAC,SAAS,EAAC,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,aAChG,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,SAAS,gCAAuB,EACjD,KAAC,IAAI,IAAC,QAAQ,wFAAqD,EAEnE,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,YACtC,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAC9B,KAAC,IAAI,IAAC,QAAQ,gDAA4B,CAC3C,CAAC,CAAC,CAAC,CACF,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;gBACvB,MAAM,UAAU,GAAG,GAAG,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC;gBAC7C,OAAO,CACL,KAAC,GAAG,cACF,MAAC,IAAI,IAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,aAC3D,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,EACpC,MAAC,IAAI,IAAC,QAAQ,+BAAK,GAAG,CAAC,WAAW,IAAQ,IACrC,IAJC,GAAG,CAAC,EAAE,CAKV,CACP,CAAC;YACJ,CAAC,CAAC,CACH,GACG,IACF,CACP,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth picker (two options: API key / account sign-in)
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
export declare const AuthPicker: ({ options, selected, busy, }: {
|
|
6
|
+
options: readonly {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}[];
|
|
11
|
+
selected: number;
|
|
12
|
+
busy?: boolean;
|
|
13
|
+
}) => React.JSX.Element;
|
|
14
|
+
//# sourceMappingURL=AuthPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthPicker.d.ts","sourceRoot":"","sources":["../../../src/ui/components/AuthPicker.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,UAAU,iCAIpB;IACD,OAAO,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvE,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,sBAsBA,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
export const AuthPicker = ({ options, selected, busy, }) => (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, marginBottom: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "Sign in to OdysX" }), _jsx(Text, { dimColor: true, children: "\u2191/\u2193 to move \u00B7 Enter to select \u00B7 esc to cancel" }), _jsx(Box, { marginTop: 1, flexDirection: "column", children: options.map((opt, idx) => {
|
|
4
|
+
const isSelected = idx === selected && !busy;
|
|
5
|
+
return (_jsx(Box, { children: _jsxs(Text, { color: isSelected ? "cyan" : "gray", bold: isSelected, children: [isSelected ? "❯ " : " ", opt.label, _jsxs(Text, { dimColor: true, children: [" \u2014 ", opt.description] })] }) }, opt.id));
|
|
6
|
+
}) })] }));
|
|
7
|
+
//# sourceMappingURL=AuthPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthPicker.js","sourceRoot":"","sources":["../../../src/ui/components/AuthPicker.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,OAAO,EACP,QAAQ,EACR,IAAI,GAKL,EAAE,EAAE,CAAC,CACJ,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,WAAW,EAAC,OAAO,EAAC,WAAW,EAAC,MAAM,EAAC,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,aAC7F,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,MAAM,iCAAwB,EAC/C,KAAC,IAAI,IAAC,QAAQ,wFAAqD,EAEnE,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,YACtC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;gBACxB,MAAM,UAAU,GAAG,GAAG,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC;gBAC7C,OAAO,CACL,KAAC,GAAG,cACF,MAAC,IAAI,IACH,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EACnC,IAAI,EAAE,UAAU,aAEf,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,EACpC,MAAC,IAAI,IAAC,QAAQ,+BAAK,GAAG,CAAC,WAAW,IAAQ,IACrC,IAPC,GAAG,CAAC,EAAE,CAQV,CACP,CAAC;YACJ,CAAC,CAAC,GACE,IACF,CACP,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Welcome banner — shown once, above the first exchange, then scrolled into
|
|
3
|
+
* the static transcript. Intentionally compact: the logo, one line of
|
|
4
|
+
* orientation, and the three keys a new user needs.
|
|
5
|
+
*/
|
|
6
|
+
import React from "react";
|
|
7
|
+
export declare const Banner: () => React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=Banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Banner.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAoB1B,eAAO,MAAM,MAAM,yBAqClB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useStdout } from "ink";
|
|
3
|
+
import { theme } from "../theme.js";
|
|
4
|
+
/** Full logo, used when the terminal is wide enough. */
|
|
5
|
+
const LOGO = `██████╗ ██████╗ ██╗ ██╗███████╗██╗ ██╗
|
|
6
|
+
██╔═══██╗██╔══██╗╚██╗ ██╔╝██╔════╝╚██╗██╔╝
|
|
7
|
+
██║ ██║██║ ██║ ╚████╔╝ ███████╗ ╚███╔╝
|
|
8
|
+
██║ ██║██║ ██║ ╚██╔╝ ╚════██║ ██╔██╗
|
|
9
|
+
╚██████╔╝██████╔╝ ██║ ███████║██╔╝ ██╗
|
|
10
|
+
╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝`;
|
|
11
|
+
const LOGO_MIN_COLUMNS = LOGO.split("\n")[0].length + 4;
|
|
12
|
+
const Hint = ({ keys, label }) => (_jsxs(Text, { dimColor: true, children: [_jsx(Text, { color: theme.color.accent, children: keys }), " ", label] }));
|
|
13
|
+
export const Banner = () => {
|
|
14
|
+
const { stdout } = useStdout();
|
|
15
|
+
const columns = stdout?.columns ?? 80;
|
|
16
|
+
const wide = columns >= LOGO_MIN_COLUMNS;
|
|
17
|
+
// Below ~60 columns the tagline and the hints wrapped into each other,
|
|
18
|
+
// producing a sentence that could not be read. Drop the tagline and let the
|
|
19
|
+
// hints wrap as whole units (each Hint is one Text node, so a wrap falls
|
|
20
|
+
// between hints, never inside one).
|
|
21
|
+
const roomy = columns >= 60;
|
|
22
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: wide ? 1 : 0, marginBottom: 1, children: [wide && (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { color: theme.color.brand, children: LOGO }) })), _jsxs(Box, { marginTop: wide ? 1 : 0, columnGap: 2, flexWrap: "wrap", children: [_jsxs(Text, { children: [_jsx(Text, { bold: true, color: theme.color.brand, children: "Codemind" }), _jsx(Text, { dimColor: true, children: " v0.1.0" })] }), roomy && _jsx(Text, { dimColor: true, children: "build, run, and orchestrate agents from your terminal" })] }), _jsxs(Box, { marginTop: 1, columnGap: 2, flexWrap: "wrap", children: [_jsx(Hint, { keys: "/", label: "commands" }), _jsx(Hint, { keys: "/help", label: "everything" }), _jsx(Hint, { keys: "@file", label: "attach context" }), _jsx(Hint, { keys: "\u21E7\u23CE", label: "new line" }), _jsx(Hint, { keys: "ctrl+c", label: "exit" })] })] }));
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../src/ui/components/Banner.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,wDAAwD;AACxD,MAAM,IAAI,GAAG;;;;;2CAK8B,CAAC;AAE5C,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAExD,MAAM,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAmC,EAAE,EAAE,CAAC,CACjE,MAAC,IAAI,IAAC,QAAQ,mBACZ,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,YAAG,IAAI,GAAQ,OAAE,KAAK,IAChD,CACR,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE;IACzB,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,IAAI,gBAAgB,CAAC;IACzC,uEAAuE;IACvE,4EAA4E;IAC5E,yEAAyE;IACzE,oCAAoC;IACpC,MAAM,KAAK,GAAG,OAAO,I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estion menu (bottom, above input).
|
|
3
|
+
*
|
|
4
|
+
* Bounded by the terminal height and truncated to the width, so a long
|
|
5
|
+
* command list can never push the input bar off-screen. A "+N more" line
|
|
6
|
+
* keeps it obvious that filtering narrows the list.
|
|
7
|
+
*/
|
|
8
|
+
import React from "react";
|
|
9
|
+
import type { SlashCommand } from "../shared/types.js";
|
|
10
|
+
export declare const CommandMenu: ({ commands, selected, total, above, }: {
|
|
11
|
+
commands: SlashCommand[];
|
|
12
|
+
selected: number;
|
|
13
|
+
total?: number;
|
|
14
|
+
/** Commands scrolled off the top of the window. */
|
|
15
|
+
above?: number;
|
|
16
|
+
}) => React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=CommandMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandMenu.d.ts","sourceRoot":"","sources":["../../../src/ui/components/CommandMenu.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,eAAO,MAAM,WAAW,0CAKrB;IACD,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,sBAsCA,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useStdout } from "ink";
|
|
3
|
+
import { theme } from "../theme.js";
|
|
4
|
+
import { displayWidth, truncateToWidth } from "../utils/terminal-text.js";
|
|
5
|
+
export const CommandMenu = ({ commands, selected, total, above = 0, }) => {
|
|
6
|
+
const { stdout } = useStdout();
|
|
7
|
+
// Row chrome: paddingLeft={2} + the 2-column pointer column.
|
|
8
|
+
const width = (stdout?.columns ?? 80) - 4;
|
|
9
|
+
const hidden = Math.max(0, (total ?? commands.length) - above - commands.length);
|
|
10
|
+
return (_jsxs(Box, { flexDirection: "column", paddingLeft: 2, marginBottom: 0, children: [above > 0 && (_jsxs(Text, { dimColor: true, children: [" ", "\u2026 ", above, " above"] })), commands.map((cmd, idx) => {
|
|
11
|
+
const isSelected = idx === selected;
|
|
12
|
+
const head = `${cmd.args ? `/${cmd.name} ${cmd.args}` : `/${cmd.name}`}`;
|
|
13
|
+
// Measure in display columns and truncate `head` itself: a long
|
|
14
|
+
// argument list used to overflow the budget and wrap the row.
|
|
15
|
+
const headShown = truncateToWidth(head, Math.max(8, Math.floor(width * 0.6)));
|
|
16
|
+
const room = Math.max(6, width - displayWidth(headShown) - 2);
|
|
17
|
+
const description = truncateToWidth(cmd.description, room);
|
|
18
|
+
return (_jsxs(Box, { children: [_jsxs(Text, { color: isSelected ? theme.color.brand : theme.color.muted, bold: isSelected, children: [isSelected ? "› " : " ", headShown] }), _jsxs(Text, { dimColor: true, children: [" ", description] })] }, cmd.name));
|
|
19
|
+
}), hidden > 0 && (_jsxs(Text, { dimColor: true, children: [" ", "\u2026 ", hidden, " more \u2014 keep typing to narrow"] }))] }));
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=CommandMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandMenu.js","sourceRoot":"","sources":["../../../src/ui/components/CommandMenu.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE1E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,KAAK,GAAG,CAAC,GAOV,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,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AE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,aAC9E,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EACxB,SAAS,IACL,EACP,MAAC,IAAI,IAAC,QAAQ,yBAAI,WAAW,IAAQ,KAL7B,GAAG,CAAC,IAAI,CAMZ,CACP,CAAC;YACJ,CAAC,CAAC,EACD,MAAM,GAAG,CAAC,IAAI,CACb,MAAC,IAAI,IAAC,QAAQ,mBACX,IAAI,aAAI,MAAM,0CACV,CACR,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Last-resort render boundary.
|
|
3
|
+
*
|
|
4
|
+
* Ink unmounts with a raw stack trace when a component throws mid-render —
|
|
5
|
+
* inside the alternate screen that trace is painted over the user's prompt and
|
|
6
|
+
* the terminal is left in the alternate buffer. This boundary catches the
|
|
7
|
+
* throw, renders a readable card, and leaves the user with a working shell.
|
|
8
|
+
*
|
|
9
|
+
* Class component because React only supports error boundaries that way.
|
|
10
|
+
*/
|
|
11
|
+
import React from "react";
|
|
12
|
+
interface State {
|
|
13
|
+
error: Error | null;
|
|
14
|
+
}
|
|
15
|
+
export declare class ErrorBoundary extends React.Component<{
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}, State> {
|
|
18
|
+
state: State;
|
|
19
|
+
static getDerivedStateFromError(error: Error): State;
|
|
20
|
+
componentDidCatch(error: Error): void;
|
|
21
|
+
render(): React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=ErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,KAAK;IACb,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AA2BD,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,EAAE,KAAK,CAAC;IACtF,KAAK,EAAE,KAAK,CAAmB;IAE/B,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAEnD;IAED,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAiBpC;IAED,MAAM,IAAI,KAAK,CAAC,SAAS,CAGxB;CACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Last-resort render boundary.
|
|
4
|
+
*
|
|
5
|
+
* Ink unmounts with a raw stack trace when a component throws mid-render —
|
|
6
|
+
* inside the alternate screen that trace is painted over the user's prompt and
|
|
7
|
+
* the terminal is left in the alternate buffer. This boundary catches the
|
|
8
|
+
* throw, renders a readable card, and leaves the user with a working shell.
|
|
9
|
+
*
|
|
10
|
+
* Class component because React only supports error boundaries that way.
|
|
11
|
+
*/
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { Box, Text, useInput } from "ink";
|
|
14
|
+
import { theme } from "../theme.js";
|
|
15
|
+
import { exitWith } from "../../core/terminal.js";
|
|
16
|
+
/** The crash card owns input too: without this, ctrl+c would do nothing. */
|
|
17
|
+
const CrashCard = ({ error }) => {
|
|
18
|
+
useInput((chunk, key) => {
|
|
19
|
+
if ((key.ctrl && chunk === "c") || key.escape || key.return) {
|
|
20
|
+
exitWith(1);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [_jsxs(Text, { color: theme.color.error, bold: true, children: [theme.glyph.cross, " the interface hit an unexpected error"] }), _jsx(Text, { dimColor: true, children: error.message }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "The stack was written to ~/.odysx/last-crash.log." }), _jsxs(Text, { children: ["Press ", _jsx(Text, { color: theme.color.accent, children: "ctrl+c" }), " to exit, then restart with", " ", _jsx(Text, { color: theme.color.accent, children: "odysx" }), "."] })] })] }));
|
|
24
|
+
};
|
|
25
|
+
export class ErrorBoundary extends React.Component {
|
|
26
|
+
state = { error: null };
|
|
27
|
+
static getDerivedStateFromError(error) {
|
|
28
|
+
return { error };
|
|
29
|
+
}
|
|
30
|
+
componentDidCatch(error) {
|
|
31
|
+
// Best-effort diagnostic file — the screen may be gone by the time the
|
|
32
|
+
// user reads the card, so keep the stack somewhere durable.
|
|
33
|
+
void (async () => {
|
|
34
|
+
try {
|
|
35
|
+
const { writeFileSync, mkdirSync } = await import("node:fs");
|
|
36
|
+
const { join } = await import("node:path");
|
|
37
|
+
const { homedir } = await import("node:os");
|
|
38
|
+
const dir = join(homedir(), ".odysx");
|
|
39
|
+
mkdirSync(dir, { recursive: true });
|
|
40
|
+
writeFileSync(join(dir, "last-crash.log"), `${new Date().toISOString()}\n${error.stack ?? error.message}\n`, "utf-8");
|
|
41
|
+
}
|
|
42
|
+
catch { /* never let the crash log crash */ }
|
|
43
|
+
})();
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
if (!this.state.error)
|
|
47
|
+
return this.props.children;
|
|
48
|
+
return _jsx(CrashCard, { error: this.state.error });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=ErrorBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../src/ui/components/ErrorBoundary.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,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BAAwB,CAAC,KAAY;QAC1C,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,iBAAiB,CAAC,KAAY;QAC5B,uEAAuE;QACvE,4DAA4D;QAC5D,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,IAAI,CAAC;gBACH,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;gBAC7D,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;gBAC3C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;gBAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;gBACtC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBACpC,aAAa,CACX,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,EAC3B,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,IAAI,EAChE,OAAO,CACR,CAAC;YACJ,CAAC;YAAC,MAAM,CAAC,CAAC,mCAAmC,CAAC,CAAC;QACjD,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAClD,OAAO,KAAC,SAAS,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAI,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed bottom input bar — the prompt line plus a context footer.
|
|
3
|
+
*
|
|
4
|
+
* The footer answers "where am I and what will my Enter do?" at a glance:
|
|
5
|
+
* agent · model · provider · workspace on the left, auth + key hints on the
|
|
6
|
+
* right. It is a single row that never wraps: the two blocks are measured in
|
|
7
|
+
* display columns and the workspace absorbs whatever slack is left (truncated
|
|
8
|
+
* from the front so the leaf folder stays visible, like Claude Code).
|
|
9
|
+
*
|
|
10
|
+
* The draft is multiline (Shift/Alt+Enter or a trailing `\`) and is windowed
|
|
11
|
+
* twice — by logical line and, within a line, by columns. A pasted file or a
|
|
12
|
+
* very long single line must not push the transcript off-screen, and must not
|
|
13
|
+
* overflow the box (an overflowing text node loses the border on wrapped rows).
|
|
14
|
+
*/
|
|
15
|
+
import React from "react";
|
|
16
|
+
/** Visible priority: prompt · agent · model are fixed; cwd absorbs slack. */
|
|
17
|
+
export declare const InputBar: ({ value, cursor, agent, model, authed, provider, turns, cwd, mode, }: {
|
|
18
|
+
value: string;
|
|
19
|
+
cursor: number;
|
|
20
|
+
agent: string;
|
|
21
|
+
model: string;
|
|
22
|
+
authed: boolean;
|
|
23
|
+
provider?: string;
|
|
24
|
+
turns: number;
|
|
25
|
+
cwd: string;
|
|
26
|
+
mode: string;
|
|
27
|
+
}) => React.JSX.Element;
|
|
28
|
+
//# sourceMappingURL=InputBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputBar.d.ts","sourceRoot":"","sources":["../../../src/ui/components/InputBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAoB1B,6EAA6E;AAC7E,eAAO,MAAM,QAAQ,yEAUlB;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,sBA2KA,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useStdout } from "ink";
|
|
3
|
+
import { theme } from "../theme.js";
|
|
4
|
+
import { toChars } from "../utils/text.js";
|
|
5
|
+
import { displayWidth } from "../utils/terminal-text.js";
|
|
6
|
+
/** Rows of draft shown at once, caret kept inside the window. */
|
|
7
|
+
const MAX_VISIBLE_LINES = 8;
|
|
8
|
+
/** Horizontal chrome around a draft row: 2 border + 2 padding + 2 prefix. */
|
|
9
|
+
const ROW_CHROME = 6;
|
|
10
|
+
/** Keep the trailing part of a path so the leaf directory stays visible. */
|
|
11
|
+
const tailTruncate = (value, max) => {
|
|
12
|
+
if (max <= 1)
|
|
13
|
+
return "";
|
|
14
|
+
const chars = toChars(value); // never split an emoji / surrogate pair
|
|
15
|
+
if (chars.length <= max)
|
|
16
|
+
return value;
|
|
17
|
+
return "…" + chars.slice(chars.length - (max - 1)).join("");
|
|
18
|
+
};
|
|
19
|
+
/** Visible priority: prompt · agent · model are fixed; cwd absorbs slack. */
|
|
20
|
+
export const InputBar = ({ value, cursor, agent, model, authed, provider, turns, cwd, mode, }) => {
|
|
21
|
+
const { stdout } = useStdout();
|
|
22
|
+
const width = stdout?.columns ?? 80;
|
|
23
|
+
// Footer budget: every block on the row is measured in display columns and
|
|
24
|
+
// the workspace absorbs the remainder. The previous estimate used a magic
|
|
25
|
+
// `+ 22` and ignored the actual gaps, so at 80 columns the row silently
|
|
26
|
+
// wrapped as soon as the path got long — pushing the input up a line.
|
|
27
|
+
const providerLabel = provider && provider !== "odysx" ? provider : "odysx";
|
|
28
|
+
const authLabel = authed ? "✓ authed" : "○ /signin to start";
|
|
29
|
+
const turnsLabel = `${turns} msg${turns === 1 ? "" : "s"}`;
|
|
30
|
+
const modeLabel = `mode:${mode}`;
|
|
31
|
+
const hintsLabel = "/help · ctrl+c";
|
|
32
|
+
const leftText = [agent, providerLabel, model || "default", turnsLabel, modeLabel].reduce((n, s) => n + displayWidth(s), 0);
|
|
33
|
+
// columnGap={1} between 10 left children and 3 right children, plus the
|
|
34
|
+
// container's paddingX={1} on both sides.
|
|
35
|
+
const gaps = 9 + 2 + 2;
|
|
36
|
+
const fixed = leftText + displayWidth(authLabel) + displayWidth(hintsLabel) + gaps;
|
|
37
|
+
const cwdBudget = Math.max(8, width - fixed);
|
|
38
|
+
const shownCwd = tailTruncate(cwd, cwdBudget);
|
|
39
|
+
// Work in code points so an emoji is never split by the caret. The draft is
|
|
40
|
+
// split into rows here (not by string index) to keep the caret column right.
|
|
41
|
+
const chars = toChars(value);
|
|
42
|
+
const at = Math.max(0, Math.min(cursor, chars.length));
|
|
43
|
+
const rows = [[]];
|
|
44
|
+
let caretLine = 0;
|
|
45
|
+
let caretCol = 0;
|
|
46
|
+
for (let i = 0; i < chars.length; i++) {
|
|
47
|
+
if (chars[i] === "\n") {
|
|
48
|
+
rows.push([]);
|
|
49
|
+
if (i < at) {
|
|
50
|
+
caretLine++;
|
|
51
|
+
caretCol = 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
rows[rows.length - 1].push(chars[i]);
|
|
56
|
+
if (i < at)
|
|
57
|
+
caretCol++;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// A single logical line can still be thousands of columns wide (a pasted
|
|
61
|
+
// file with no newlines). Window it by columns too, keeping the caret in
|
|
62
|
+
// view; otherwise the text node overflows the box and Ink loses the border
|
|
63
|
+
// on every wrapped continuation row.
|
|
64
|
+
const rowBudget = Math.max(8, width - ROW_CHROME);
|
|
65
|
+
const windowRow = (row, caret) => {
|
|
66
|
+
// Prefix sums keep this linear: measuring a growing slice per iteration
|
|
67
|
+
// turned a 5k-character paste into tens of millions of width calls.
|
|
68
|
+
const prefix = [0];
|
|
69
|
+
for (const ch of row)
|
|
70
|
+
prefix.push(prefix[prefix.length - 1] + displayWidth(ch));
|
|
71
|
+
if (prefix[row.length] <= rowBudget) {
|
|
72
|
+
return { chars: row, caret: Math.max(0, caret), cutLeft: false, cutRight: false };
|
|
73
|
+
}
|
|
74
|
+
// Centre the caret when there is one, otherwise show the head of the row.
|
|
75
|
+
const start = caret >= 0
|
|
76
|
+
? Math.min(Math.max(0, caret - Math.floor(rowBudget / 2)), caret)
|
|
77
|
+
: 0;
|
|
78
|
+
let end = start;
|
|
79
|
+
while (end < row.length && prefix[end + 1] - prefix[start] <= rowBudget)
|
|
80
|
+
end++;
|
|
81
|
+
return {
|
|
82
|
+
chars: row.slice(start, end),
|
|
83
|
+
caret: caret >= 0 ? Math.max(0, Math.min(caret - start, end - start)) : 0,
|
|
84
|
+
cutLeft: start > 0,
|
|
85
|
+
cutRight: end < row.length,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
// Window the draft so a large paste cannot push the transcript off-screen.
|
|
89
|
+
const total = rows.length;
|
|
90
|
+
let start = 0;
|
|
91
|
+
if (total > MAX_VISIBLE_LINES) {
|
|
92
|
+
start = Math.max(0, Math.min(caretLine - Math.floor(MAX_VISIBLE_LINES / 2), total - MAX_VISIBLE_LINES));
|
|
93
|
+
}
|
|
94
|
+
const end = Math.min(total, start + MAX_VISIBLE_LINES);
|
|
95
|
+
const hiddenAbove = start;
|
|
96
|
+
const hiddenBelow = total - end;
|
|
97
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { borderStyle: "round", borderColor: value ? theme.color.user : theme.color.muted, paddingX: 1, flexDirection: "column", children: [hiddenAbove > 0 && (_jsxs(Text, { dimColor: true, children: [" ", "\u2026 ", hiddenAbove, " earlier line", hiddenAbove === 1 ? "" : "s"] })), rows.slice(start, end).map((row, i) => {
|
|
98
|
+
const index = start + i;
|
|
99
|
+
const isCaretRow = index === caretLine;
|
|
100
|
+
// Clamp each row to the box width. A wrapped continuation row
|
|
101
|
+
// overflows the yoga box and Ink stops drawing its border.
|
|
102
|
+
const shown = windowRow(row, isCaretRow ? caretCol : -1);
|
|
103
|
+
return (_jsxs(Text, { children: [index === 0 ? (_jsxs(Text, { color: theme.color.user, bold: true, children: [theme.glyph.pointer, " "] })) : (" "), shown.cutLeft ? "…" : "", isCaretRow ? (_jsxs(_Fragment, { children: [shown.chars.slice(0, shown.caret).join(""), _jsx(Text, { inverse: true, children: shown.chars[shown.caret] ?? " " }), shown.chars.slice(shown.caret + 1).join("")] })) : (shown.chars.join("")), shown.cutRight ? "…" : ""] }, index));
|
|
104
|
+
}), hiddenBelow > 0 && (_jsxs(Text, { dimColor: true, children: [" ", "\u2026 ", hiddenBelow, " more line", hiddenBelow === 1 ? "" : "s"] }))] }), _jsxs(Box, { justifyContent: "space-between", paddingX: 1, children: [_jsxs(Box, { columnGap: 1, flexShrink: 1, children: [_jsx(Text, { color: theme.color.success, children: agent }), _jsx(Text, { dimColor: true, children: theme.glyph.info }), _jsx(Text, { dimColor: true, children: providerLabel }), _jsx(Text, { color: theme.color.info, children: model || "default" }), _jsx(Text, { dimColor: true, children: theme.glyph.info }), _jsx(Text, { dimColor: true, children: turnsLabel }), _jsx(Text, { dimColor: true, children: theme.glyph.info }), _jsx(Text, { color: mode === "plan" ? theme.color.warning :
|
|
105
|
+
mode === "auto" ? theme.color.error :
|
|
106
|
+
theme.color.info, children: modeLabel }), _jsx(Text, { dimColor: true, children: theme.glyph.info }), _jsx(Text, { dimColor: true, wrap: "truncate-end", children: shownCwd })] }), _jsxs(Box, { columnGap: 1, flexShrink: 0, children: [authed ? (_jsxs(Text, { color: theme.color.success, children: [theme.glyph.check, " authed"] })) : (_jsx(Text, { color: theme.color.warning, children: "\u25CB /signin to start" })), _jsx(Text, { dimColor: true, children: theme.glyph.info }), _jsx(Text, { dimColor: true, children: hintsLabel })] })] })] }));
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=InputBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputBar.js","sourceRoot":"","sources":["../../../src/ui/components/InputBar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K,CAAC,IAAI,GAAQ,EACxC,KAAC,IAAI,IAAC,QAAQ,kBAAE,UAAU,GAAQ,EAClC,KAAC,IAAI,IAAC,QAAQ,kBAAE,KAAK,CAAC,KAAK,CAAC,IAAI,GAAQ,EACxC,KAAC,IAAI,IACH,KAAK,EACH,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oCACvC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;wCACrC,KAAK,CAAC,KAAK,CAAC,IAAI,YAGjB,SAAS,GACL,EACP,KAAC,IAAI,IAAC,QAAQ,kBAAE,KAAK,CAAC,KAAK,CAAC,IAAI,GAAQ,EAGxC,KAAC,IAAI,IAAC,QAAQ,QAAC,IAAI,EAAC,cAAc,YAAE,QAAQ,GAAQ,IAChD,EACN,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,aAC7B,MAAM,CAAC,CAAC,CAAC,CACR,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,aAAG,KAAK,CAAC,KAAK,CAAC,KAAK,eAAe,CACpE,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,wCAA2B,CAC5D,EACD,KAAC,IAAI,IAAC,QAAQ,kBAAE,KAAK,CAAC,KAAK,CAAC,IAAI,GAAQ,EACxC,KAAC,IAAI,IAAC,QAAQ,kBAAE,UAAU,GAAQ,IAC9B,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* /keys panel — list, create, revoke, usage; shows the full key once on create.
|
|
3
|
+
*
|
|
4
|
+
* Revocation requires a second confirmation (see keyRouter confirm-revoke):
|
|
5
|
+
* the panel renders the question and the valid answers, nothing more.
|
|
6
|
+
*/
|
|
7
|
+
import React from "react";
|
|
8
|
+
import type { KeysState } from "../shared/types.js";
|
|
9
|
+
export declare const KeysPanel: ({ state }: {
|
|
10
|
+
state: KeysState;
|
|
11
|
+
}) => React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=KeysPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeysPanel.d.ts","sourceRoot":"","sources":["../../../src/ui/components/KeysPanel.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAYpD,eAAO,MAAM,SAAS,cAAe;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,sBA8FxD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { theme } from "../theme.js";
|
|
4
|
+
const Frame = ({ color, title, children }) => (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: color, paddingX: 1, marginBottom: 1, children: [_jsx(Text, { bold: true, color: color, children: title }), children] }));
|
|
5
|
+
export const KeysPanel = ({ state }) => {
|
|
6
|
+
if (state.mode === "create-name") {
|
|
7
|
+
return (_jsxs(Frame, { color: theme.color.accent, title: "Create API key \u2014 name", children: [_jsx(Text, { dimColor: true, children: "Enter continue \u00B7 esc cancel" }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: theme.color.accent, bold: true, children: [theme.glyph.pointer, " ", state.draftName, _jsx(Text, { dimColor: true, children: "_" })] }) })] }));
|
|
8
|
+
}
|
|
9
|
+
if (state.mode === "created" && state.createdKey) {
|
|
10
|
+
return (_jsxs(Frame, { color: theme.color.warning, title: `${theme.glyph.warn} Key created — copy it now`, children: [_jsx(Text, { dimColor: true, children: "This is the only time the full key is shown." }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: theme.color.success, bold: true, children: state.createdKey.key }) }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: ["Name: ", state.createdKey.name, " \u00B7 Enter to dismiss"] }) })] }));
|
|
11
|
+
}
|
|
12
|
+
const selected = state.rows[state.selectedIndex];
|
|
13
|
+
return (_jsxs(Frame, { color: theme.color.accent, title: "API keys", children: [_jsx(Text, { dimColor: true, children: "\u2191/\u2193 move \u00B7 a create \u00B7 r revoke \u00B7 u usage \u00B7 s set active \u00B7 esc close" }), state.mode === "confirm-revoke" && selected && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Text, { color: theme.color.warning, bold: true, children: [theme.glyph.warn, " Revoke \u201C", selected.name, "\u201D (", selected.key_prefix, "\u2026)?"] }), _jsx(Text, { dimColor: true, children: "This cannot be undone. y revoke \u00B7 n/esc keep" })] })), state.busy && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: theme.color.accent, children: "Loading\u2026" }) })), !state.busy && state.rows.length === 0 && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: ["No keys yet \u2014 press ", _jsx(Text, { color: theme.color.brand, children: "a" }), " to create one."] }) })), !state.busy && state.rows.length > 0 && (_jsx(Box, { marginTop: 1, flexDirection: "column", children: state.rows.map((row, idx) => {
|
|
14
|
+
const sel = idx === state.selectedIndex;
|
|
15
|
+
const status = row.is_active ? "active" : "revoked";
|
|
16
|
+
const lastUsed = row.last_used_at
|
|
17
|
+
? new Date(row.last_used_at).toLocaleDateString()
|
|
18
|
+
: "never";
|
|
19
|
+
const isActive = state.activeKeyLabel
|
|
20
|
+
? row.key_prefix.startsWith(state.activeKeyLabel)
|
|
21
|
+
: false;
|
|
22
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: sel ? theme.color.accent : theme.color.muted, bold: sel, children: [sel ? `${theme.glyph.pointer} ` : " ", isActive ? "● " : "", row.name, _jsxs(Text, { dimColor: true, children: [" ", row.key_prefix, "\u2026 \u00B7 ", status, isActive ? " · active (local)" : "", " \u00B7 last used ", lastUsed] })] }), sel && row.scopes && row.scopes.length > 0 && (_jsxs(Text, { dimColor: true, children: [" ", "scopes: ", row.scopes.join(", ")] }))] }, row.id));
|
|
23
|
+
}) }))] }));
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=KeysPanel.js.map
|