@odysx/codemind 0.1.0 → 0.1.1
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/dist/core/provider/index.d.ts +52 -10
- package/dist/core/provider/index.js +99 -12
- package/package.json +6 -1
- package/dist/commands/agents.d.ts.map +0 -1
- package/dist/commands/agents.js.map +0 -1
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/chat.d.ts.map +0 -1
- package/dist/commands/chat.js.map +0 -1
- package/dist/commands/keys.d.ts.map +0 -1
- package/dist/commands/keys.js.map +0 -1
- package/dist/commands/local.d.ts.map +0 -1
- package/dist/commands/local.js.map +0 -1
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/prompts.d.ts.map +0 -1
- package/dist/commands/prompts.js.map +0 -1
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js.map +0 -1
- package/dist/core/auth/index.d.ts.map +0 -1
- package/dist/core/auth/index.js.map +0 -1
- package/dist/core/config/index.d.ts.map +0 -1
- package/dist/core/config/index.js.map +0 -1
- package/dist/core/history.d.ts.map +0 -1
- package/dist/core/history.js.map +0 -1
- package/dist/core/markdown-renderer.d.ts.map +0 -1
- package/dist/core/markdown-renderer.js.map +0 -1
- package/dist/core/permissions/index.d.ts.map +0 -1
- package/dist/core/permissions/index.js.map +0 -1
- package/dist/core/provider/external.d.ts.map +0 -1
- package/dist/core/provider/external.js.map +0 -1
- package/dist/core/provider/index.d.ts.map +0 -1
- package/dist/core/provider/index.js.map +0 -1
- package/dist/core/registry/index.d.ts.map +0 -1
- package/dist/core/registry/index.js.map +0 -1
- package/dist/core/schema/types.d.ts.map +0 -1
- package/dist/core/schema/types.js.map +0 -1
- package/dist/core/terminal.d.ts.map +0 -1
- package/dist/core/terminal.js.map +0 -1
- package/dist/core/workspace/index.d.ts.map +0 -1
- package/dist/core/workspace/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/ui/app.d.ts.map +0 -1
- package/dist/ui/app.js.map +0 -1
- package/dist/ui/commands/cases/catalog.d.ts.map +0 -1
- package/dist/ui/commands/cases/catalog.js.map +0 -1
- package/dist/ui/commands/cases/misc.d.ts.map +0 -1
- package/dist/ui/commands/cases/misc.js.map +0 -1
- package/dist/ui/commands/cases/tasks.d.ts.map +0 -1
- package/dist/ui/commands/cases/tasks.js.map +0 -1
- package/dist/ui/commands/runCommand.d.ts.map +0 -1
- package/dist/ui/commands/runCommand.js.map +0 -1
- package/dist/ui/components/AgentPicker.d.ts.map +0 -1
- package/dist/ui/components/AgentPicker.js.map +0 -1
- package/dist/ui/components/AuthPicker.d.ts.map +0 -1
- package/dist/ui/components/AuthPicker.js.map +0 -1
- package/dist/ui/components/Banner.d.ts.map +0 -1
- package/dist/ui/components/Banner.js.map +0 -1
- package/dist/ui/components/CommandMenu.d.ts.map +0 -1
- package/dist/ui/components/CommandMenu.js.map +0 -1
- package/dist/ui/components/ErrorBoundary.d.ts.map +0 -1
- package/dist/ui/components/ErrorBoundary.js.map +0 -1
- package/dist/ui/components/InputBar.d.ts.map +0 -1
- package/dist/ui/components/InputBar.js.map +0 -1
- package/dist/ui/components/KeysPanel.d.ts.map +0 -1
- package/dist/ui/components/KeysPanel.js.map +0 -1
- package/dist/ui/components/MessageView.d.ts.map +0 -1
- package/dist/ui/components/MessageView.js.map +0 -1
- package/dist/ui/components/PermissionPrompt.d.ts.map +0 -1
- package/dist/ui/components/PermissionPrompt.js.map +0 -1
- package/dist/ui/components/Pickers.d.ts.map +0 -1
- package/dist/ui/components/Pickers.js.map +0 -1
- package/dist/ui/components/SearchOverlay.d.ts.map +0 -1
- package/dist/ui/components/SearchOverlay.js.map +0 -1
- package/dist/ui/components/SessionPicker.d.ts.map +0 -1
- package/dist/ui/components/SessionPicker.js.map +0 -1
- package/dist/ui/components/WorkingIndicator.d.ts.map +0 -1
- package/dist/ui/components/WorkingIndicator.js.map +0 -1
- package/dist/ui/controls/ApiKeyEntry.d.ts.map +0 -1
- package/dist/ui/controls/ApiKeyEntry.js.map +0 -1
- package/dist/ui/controls/MultiSelect.d.ts.map +0 -1
- package/dist/ui/controls/MultiSelect.js.map +0 -1
- package/dist/ui/hooks/useAgentPicker.d.ts.map +0 -1
- package/dist/ui/hooks/useAgentPicker.js.map +0 -1
- package/dist/ui/hooks/useAuthFlow.d.ts.map +0 -1
- package/dist/ui/hooks/useAuthFlow.js.map +0 -1
- package/dist/ui/hooks/useKeysFlow.d.ts.map +0 -1
- package/dist/ui/hooks/useKeysFlow.js.map +0 -1
- package/dist/ui/hooks/useSessionPicker.d.ts.map +0 -1
- package/dist/ui/hooks/useSessionPicker.js.map +0 -1
- package/dist/ui/hooks/useTerminalSize.d.ts.map +0 -1
- package/dist/ui/hooks/useTerminalSize.js.map +0 -1
- package/dist/ui/input/keyRouter.d.ts.map +0 -1
- package/dist/ui/input/keyRouter.js.map +0 -1
- package/dist/ui/layouts/ScreenLayout.d.ts.map +0 -1
- package/dist/ui/layouts/ScreenLayout.js.map +0 -1
- package/dist/ui/shared/types.d.ts.map +0 -1
- package/dist/ui/shared/types.js.map +0 -1
- package/dist/ui/theme.d.ts.map +0 -1
- package/dist/ui/theme.js.map +0 -1
- package/dist/ui/utils/markdown.d.ts.map +0 -1
- package/dist/ui/utils/markdown.js.map +0 -1
- package/dist/ui/utils/mentions.d.ts.map +0 -1
- package/dist/ui/utils/mentions.js.map +0 -1
- package/dist/ui/utils/terminal-text.d.ts.map +0 -1
- package/dist/ui/utils/terminal-text.js.map +0 -1
- package/dist/ui/utils/text.d.ts.map +0 -1
- package/dist/ui/utils/text.js.map +0 -1
- package/eslint.config.js +0 -40
- package/graphify-out/GRAPH_REPORT.md +0 -140
- package/graphify-out/cache/1236b1806943f8eb5c64fece9fb448149370f4a1b52b32f0977ad528d7911291.json +0 -1
- package/graphify-out/cache/15cbf641dcc0fd641c18da872214918203a1f64baa7ac8430e4702ef32d18b02.json +0 -1
- package/graphify-out/cache/1abc52745bb46f6cc5a528530e2bc1f368c26e348dff85cdde5cad6f275d7177.json +0 -1
- package/graphify-out/cache/1c7815c37c13177e98895e272285f6151a8d0807478fc843ec452634b3e9912d.json +0 -1
- package/graphify-out/cache/1ec38c39f044f329c78642b61d6394fb8e15d0014335f32947d1f5c7b88c02bc.json +0 -1
- package/graphify-out/cache/20c9b57ff76dbb9d57cbd00659b0a42d2b28dd2abacf1ef4143cc67a5b6fe7f4.json +0 -1
- package/graphify-out/cache/285e11876884eb619e779d540cd957b33e70f14c67ecc26c9b9755aa9cedd717.json +0 -1
- package/graphify-out/cache/2c0a9c49ab51f4e0f07543b4e941bf802b7db31fa607c4cee8e595575be68fe7.json +0 -1
- package/graphify-out/cache/3025e6c2756c79ccaadd51d611f25a8b6630a6a11ce1b4e6e261b3e033dc194f.json +0 -1
- package/graphify-out/cache/4801a686ddfa0a52824a4fc3d65443cbb0ab9f0b030af67d02fccb520c584a08.json +0 -1
- package/graphify-out/cache/4f8fd96f38aa7d0293b4fab60c4581c4f3e68f4533c664c9cd78d1c53bea1cba.json +0 -1
- package/graphify-out/cache/5928e562b0f5700184b810e2403f4aa685e2b93c3c584c10460562b514c40fdd.json +0 -1
- package/graphify-out/cache/66132486efb0a4cfaeea766448f1f15bb33635808714052e7e24e5b00fbc984f.json +0 -1
- package/graphify-out/cache/66ab27669e7ec685130063662af9f30018c267f7639b4af4b0504a98282c383a.json +0 -1
- package/graphify-out/cache/6ff6b3dd433b5ffe96e166263a203dd622397e419dc00bb676824988b7defeab.json +0 -1
- package/graphify-out/cache/7a00a49932177a6215e2590b1ddfd6f1d8494792f693068e9d427d16b165d370.json +0 -1
- package/graphify-out/cache/7b681bc5182f40f707f1c0b16b78af38efffa62a1df315d10878f4de888408ef.json +0 -1
- package/graphify-out/cache/81196d44e50ac0b276d826a531ed10c425a528b298e3fe18e8d5a3eec996e9d5.json +0 -1
- package/graphify-out/cache/8934e9b32dea6e66fdc34fa1681b287ff1335c389917e0fc6ee2fc573e23e87b.json +0 -1
- package/graphify-out/cache/975f6c99807f86b79c80ca40c783618e2080a927eaebe6ea3db37b869f048851.json +0 -1
- package/graphify-out/cache/9ab98f08626fd8190462595e38de828293ad184db8df5e1177b05a8fe290faa1.json +0 -1
- package/graphify-out/cache/9c434a6796d7932b6e87a908c155c09cb2b8d097fc55f141f0302b6600f94749.json +0 -1
- package/graphify-out/cache/ac5cf4c489dc417c1f6ea728d0b6ba12ac7087bc6c2e736697ff3024b4d4e534.json +0 -1
- package/graphify-out/cache/ae5083b5c1dca3e5c6af485e7f6eb8a08ff8b382cdecf92ab5e0902053442afe.json +0 -1
- package/graphify-out/cache/b274057fc2e0118cf2746d1d8060841122bb2a2b0305566fc3f32d3a51e08bcc.json +0 -1
- package/graphify-out/cache/b39beef31da682387f030c0d149f6cd5b3e66effbf936cc8430db15360759dda.json +0 -1
- package/graphify-out/cache/bf3c6a36bb72820bc11cbf4a5c49067d1f62013d4686c019a4dbd9951b1e980e.json +0 -1
- package/graphify-out/cache/c034e156028d1a58b89bce659726e9a4065ddc4d2b560d6bce7a206fdff8dad3.json +0 -1
- package/graphify-out/cache/c619b5bbe8d1f427fbd7816d1e9fcfaf90d7201b020ae6b578166aeb9cb20683.json +0 -1
- package/graphify-out/cache/c8db77a9da0b0f601acfa50a620f31155cdda0d0cc0f2285adcea19e77194ee6.json +0 -1
- package/graphify-out/cache/ca664791ec7741a2077d9e7c10384142d30e7a3b77b388df719c315da608d57d.json +0 -1
- package/graphify-out/cache/cba43a116186bd55c8a63368dea4eee4a8123b2bec0a42df6efb3254f89f9a7a.json +0 -1
- package/graphify-out/cache/cd51cbb3dad1cf34417b9761fe2eb184a9f57d23dc86e45630e63bfa2ecafddc.json +0 -1
- package/graphify-out/cache/d06738cde193b34a136b94104220c17e0212b814b3e4d7ff399105635cae1a03.json +0 -1
- package/graphify-out/cache/d093c19f0169c0398eeb1360895b1c16ecc50abc59f4be8eec3f6fd27c89a6e5.json +0 -1
- package/graphify-out/cache/da8f75c438531d232fe114d5cbf2374576ce842a5fb87c7e5a88b78fdb334e5e.json +0 -1
- package/graphify-out/cache/e35798fa04ddede548a6953bdea506bd7d0788dfed4e8a8ea6ae77b1b60ef5e0.json +0 -1
- package/graphify-out/cache/e5a38c254719000487098782125e15e2e982c07d66b99d359ed1781f30f9fc8c.json +0 -1
- package/graphify-out/cache/e6e4c4a5a7200ee0154585b5d6538f699b0a746dbded3164f8391f06ce7cb212.json +0 -1
- package/graphify-out/cache/ea8d0838df6309b673b031f616b253af957898ee7289d25a541fa6183b732e4e.json +0 -1
- package/graphify-out/cache/ebaee92b0e881efd7a08f3143e2c1803310396b4651d4f77532003c699cc6836.json +0 -1
- package/graphify-out/cache/edf8543318a9e60d56d04704078da6c37202ddd6fdfc83144fe2b94fe19b80ef.json +0 -1
- package/graphify-out/cache/efca19d3668035f11126fc9eccbeab290abfa94babf3f9a8706de81d17aba263.json +0 -1
- package/graphify-out/cache/f1480bb642025ebd6d99986cdd8a7d5726897ec038300e4b095c9c938435dfad.json +0 -1
- package/graphify-out/cache/f459f21277f03865f732affb175b1b092954dae5967f27b3cd1864466e3e24f4.json +0 -1
- package/graphify-out/cache/f899e37e864010b30f4c196e86082d7bd022a0df032005e0407883ebcec36514.json +0 -1
- package/graphify-out/cache/fb3cbe07fbcd97c536cff9c6bc343c35f22d49613f05c53ad30ef67a75c5d93e.json +0 -1
- package/graphify-out/cache/fd3dc682b1ca2f5ae03b50d6b0e045ae50f5701c0a21c5a388d77ef482939d3a.json +0 -1
- package/graphify-out/graph.html +0 -257
- package/graphify-out/graph.json +0 -4396
- package/scripts/e2e-external.mjs +0 -65
- package/scripts/live-agents.mjs +0 -6
- package/scripts/live-stream.mjs +0 -51
- package/src/commands/agents.ts +0 -91
- package/src/commands/auth.ts +0 -39
- package/src/commands/chat.ts +0 -198
- package/src/commands/keys.ts +0 -83
- package/src/commands/local.ts +0 -302
- package/src/commands/mcp.ts +0 -74
- package/src/commands/prompts.ts +0 -58
- package/src/commands/skills.ts +0 -43
- package/src/core/auth/index.ts +0 -101
- package/src/core/config/index.ts +0 -152
- package/src/core/history.ts +0 -79
- package/src/core/markdown-renderer.ts +0 -420
- package/src/core/permissions/index.ts +0 -99
- package/src/core/provider/external.ts +0 -312
- package/src/core/provider/index.ts +0 -517
- package/src/core/registry/index.ts +0 -250
- package/src/core/schema/types.ts +0 -106
- package/src/core/terminal.ts +0 -124
- package/src/core/workspace/index.ts +0 -216
- package/src/index.ts +0 -401
- package/src/ui/app.tsx +0 -644
- package/src/ui/commands/cases/catalog.ts +0 -76
- package/src/ui/commands/cases/misc.ts +0 -293
- package/src/ui/commands/cases/tasks.ts +0 -115
- package/src/ui/commands/runCommand.ts +0 -178
- package/src/ui/components/Banner.tsx +0 -63
- package/src/ui/components/CommandMenu.tsx +0 -63
- package/src/ui/components/ErrorBoundary.tsx +0 -75
- package/src/ui/components/InputBar.tsx +0 -227
- package/src/ui/components/KeysPanel.tsx +0 -115
- package/src/ui/components/MessageView.tsx +0 -226
- package/src/ui/components/Pickers.tsx +0 -234
- package/src/ui/components/SearchOverlay.tsx +0 -65
- package/src/ui/components/WorkingIndicator.tsx +0 -35
- package/src/ui/controls/ApiKeyEntry.tsx +0 -29
- package/src/ui/controls/MultiSelect.tsx +0 -55
- package/src/ui/hooks/useAgentPicker.ts +0 -64
- package/src/ui/hooks/useAuthFlow.ts +0 -47
- package/src/ui/hooks/useKeysFlow.ts +0 -157
- package/src/ui/hooks/useSessionPicker.ts +0 -84
- package/src/ui/hooks/useTerminalSize.ts +0 -36
- package/src/ui/input/keyRouter.ts +0 -627
- package/src/ui/layouts/ScreenLayout.tsx +0 -202
- package/src/ui/shared/types.ts +0 -160
- package/src/ui/theme.ts +0 -53
- package/src/ui/utils/markdown.ts +0 -255
- package/src/ui/utils/mentions.ts +0 -40
- package/src/ui/utils/terminal-text.ts +0 -130
- package/src/ui/utils/text.ts +0 -174
- package/test/commands.test.mjs +0 -127
- package/test/config.test.mjs +0 -123
- package/test/history.test.mjs +0 -42
- package/test/keyrouter.test.mjs +0 -324
- package/test/layout.test.mjs +0 -271
- package/test/markdown.test.mjs +0 -92
- package/test/mentions.test.mjs +0 -51
- package/test/permissions.test.mjs +0 -130
- package/test/provider.test.mjs +0 -287
- package/test/terminal-text.test.mjs +0 -116
- package/test/text.test.mjs +0 -134
- package/test/workspace.test.mjs +0 -101
- package/tsconfig.json +0 -32
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
import { Box, Text, useStdout } from "ink";
|
|
8
|
-
import { theme } from "../theme.js";
|
|
9
|
-
|
|
10
|
-
/** Full logo, used when the terminal is wide enough. */
|
|
11
|
-
const LOGO = `██████╗ ██████╗ ██╗ ██╗███████╗██╗ ██╗
|
|
12
|
-
██╔═══██╗██╔══██╗╚██╗ ██╔╝██╔════╝╚██╗██╔╝
|
|
13
|
-
██║ ██║██║ ██║ ╚████╔╝ ███████╗ ╚███╔╝
|
|
14
|
-
██║ ██║██║ ██║ ╚██╔╝ ╚════██║ ██╔██╗
|
|
15
|
-
╚██████╔╝██████╔╝ ██║ ███████║██╔╝ ██╗
|
|
16
|
-
╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝`;
|
|
17
|
-
|
|
18
|
-
const LOGO_MIN_COLUMNS = LOGO.split("\n")[0].length + 4;
|
|
19
|
-
|
|
20
|
-
const Hint = ({ keys, label }: { keys: string; label: string }) => (
|
|
21
|
-
<Text dimColor>
|
|
22
|
-
<Text color={theme.color.accent}>{keys}</Text> {label}
|
|
23
|
-
</Text>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export const Banner = () => {
|
|
27
|
-
const { stdout } = useStdout();
|
|
28
|
-
const columns = stdout?.columns ?? 80;
|
|
29
|
-
const wide = columns >= LOGO_MIN_COLUMNS;
|
|
30
|
-
// Below ~60 columns the tagline and the hints wrapped into each other,
|
|
31
|
-
// producing a sentence that could not be read. Drop the tagline and let the
|
|
32
|
-
// hints wrap as whole units (each Hint is one Text node, so a wrap falls
|
|
33
|
-
// between hints, never inside one).
|
|
34
|
-
const roomy = columns >= 60;
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<Box flexDirection="column" marginTop={wide ? 1 : 0} marginBottom={1}>
|
|
38
|
-
{wide && (
|
|
39
|
-
<Box flexDirection="column">
|
|
40
|
-
<Text color={theme.color.brand}>{LOGO}</Text>
|
|
41
|
-
</Box>
|
|
42
|
-
)}
|
|
43
|
-
|
|
44
|
-
<Box marginTop={wide ? 1 : 0} columnGap={2} flexWrap="wrap">
|
|
45
|
-
<Text>
|
|
46
|
-
<Text bold color={theme.color.brand}>
|
|
47
|
-
Codemind
|
|
48
|
-
</Text>
|
|
49
|
-
<Text dimColor> v0.1.0</Text>
|
|
50
|
-
</Text>
|
|
51
|
-
{roomy && <Text dimColor>build, run, and orchestrate agents from your terminal</Text>}
|
|
52
|
-
</Box>
|
|
53
|
-
|
|
54
|
-
<Box marginTop={1} columnGap={2} flexWrap="wrap">
|
|
55
|
-
<Hint keys="/" label="commands" />
|
|
56
|
-
<Hint keys="/help" label="everything" />
|
|
57
|
-
<Hint keys="@file" label="attach context" />
|
|
58
|
-
<Hint keys="⇧⏎" label="new line" />
|
|
59
|
-
<Hint keys="ctrl+c" label="exit" />
|
|
60
|
-
</Box>
|
|
61
|
-
</Box>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slash-command suggestion 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 { Box, Text, useStdout } from "ink";
|
|
10
|
-
import type { SlashCommand } from "../shared/types.js";
|
|
11
|
-
import { theme } from "../theme.js";
|
|
12
|
-
import { displayWidth, truncateToWidth } from "../utils/terminal-text.js";
|
|
13
|
-
|
|
14
|
-
export const CommandMenu = ({
|
|
15
|
-
commands,
|
|
16
|
-
selected,
|
|
17
|
-
total,
|
|
18
|
-
above = 0,
|
|
19
|
-
}: {
|
|
20
|
-
commands: SlashCommand[];
|
|
21
|
-
selected: number;
|
|
22
|
-
total?: number;
|
|
23
|
-
/** Commands scrolled off the top of the window. */
|
|
24
|
-
above?: number;
|
|
25
|
-
}) => {
|
|
26
|
-
const { stdout } = useStdout();
|
|
27
|
-
// Row chrome: paddingLeft={2} + the 2-column pointer column.
|
|
28
|
-
const width = (stdout?.columns ?? 80) - 4;
|
|
29
|
-
const hidden = Math.max(0, (total ?? commands.length) - above - commands.length);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<Box flexDirection="column" paddingLeft={2} marginBottom={0}>
|
|
33
|
-
{above > 0 && (
|
|
34
|
-
<Text dimColor>
|
|
35
|
-
{" "}… {above} above
|
|
36
|
-
</Text>
|
|
37
|
-
)}
|
|
38
|
-
{commands.map((cmd, idx) => {
|
|
39
|
-
const isSelected = idx === selected;
|
|
40
|
-
const head = `${cmd.args ? `/${cmd.name} ${cmd.args}` : `/${cmd.name}`}`;
|
|
41
|
-
// Measure in display columns and truncate `head` itself: a long
|
|
42
|
-
// argument list used to overflow the budget and wrap the row.
|
|
43
|
-
const headShown = truncateToWidth(head, Math.max(8, Math.floor(width * 0.6)));
|
|
44
|
-
const room = Math.max(6, width - displayWidth(headShown) - 2);
|
|
45
|
-
const description = truncateToWidth(cmd.description, room);
|
|
46
|
-
return (
|
|
47
|
-
<Box key={cmd.name}>
|
|
48
|
-
<Text color={isSelected ? theme.color.brand : theme.color.muted} bold={isSelected}>
|
|
49
|
-
{isSelected ? "› " : " "}
|
|
50
|
-
{headShown}
|
|
51
|
-
</Text>
|
|
52
|
-
<Text dimColor> {description}</Text>
|
|
53
|
-
</Box>
|
|
54
|
-
);
|
|
55
|
-
})}
|
|
56
|
-
{hidden > 0 && (
|
|
57
|
-
<Text dimColor>
|
|
58
|
-
{" "}… {hidden} more — keep typing to narrow
|
|
59
|
-
</Text>
|
|
60
|
-
)}
|
|
61
|
-
</Box>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
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
|
-
import { Box, Text, useInput } from "ink";
|
|
13
|
-
import { theme } from "../theme.js";
|
|
14
|
-
import { exitWith } from "../../core/terminal.js";
|
|
15
|
-
|
|
16
|
-
interface State {
|
|
17
|
-
error: Error | null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** The crash card owns input too: without this, ctrl+c would do nothing. */
|
|
21
|
-
const CrashCard = ({ error }: { error: Error }) => {
|
|
22
|
-
useInput((chunk, key) => {
|
|
23
|
-
if ((key.ctrl && chunk === "c") || key.escape || key.return) {
|
|
24
|
-
exitWith(1);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Box flexDirection="column" paddingX={1} marginTop={1}>
|
|
30
|
-
<Text color={theme.color.error} bold>
|
|
31
|
-
{theme.glyph.cross} the interface hit an unexpected error
|
|
32
|
-
</Text>
|
|
33
|
-
<Text dimColor>{error.message}</Text>
|
|
34
|
-
<Box marginTop={1} flexDirection="column">
|
|
35
|
-
<Text dimColor>The stack was written to ~/.odysx/last-crash.log.</Text>
|
|
36
|
-
<Text>
|
|
37
|
-
Press <Text color={theme.color.accent}>ctrl+c</Text> to exit, then restart with{" "}
|
|
38
|
-
<Text color={theme.color.accent}>odysx</Text>.
|
|
39
|
-
</Text>
|
|
40
|
-
</Box>
|
|
41
|
-
</Box>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export class ErrorBoundary extends React.Component<{ children: React.ReactNode }, State> {
|
|
46
|
-
state: State = { error: null };
|
|
47
|
-
|
|
48
|
-
static getDerivedStateFromError(error: Error): State {
|
|
49
|
-
return { error };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
componentDidCatch(error: Error): void {
|
|
53
|
-
// Best-effort diagnostic file — the screen may be gone by the time the
|
|
54
|
-
// user reads the card, so keep the stack somewhere durable.
|
|
55
|
-
void (async () => {
|
|
56
|
-
try {
|
|
57
|
-
const { writeFileSync, mkdirSync } = await import("node:fs");
|
|
58
|
-
const { join } = await import("node:path");
|
|
59
|
-
const { homedir } = await import("node:os");
|
|
60
|
-
const dir = join(homedir(), ".odysx");
|
|
61
|
-
mkdirSync(dir, { recursive: true });
|
|
62
|
-
writeFileSync(
|
|
63
|
-
join(dir, "last-crash.log"),
|
|
64
|
-
`${new Date().toISOString()}\n${error.stack ?? error.message}\n`,
|
|
65
|
-
"utf-8",
|
|
66
|
-
);
|
|
67
|
-
} catch { /* never let the crash log crash */ }
|
|
68
|
-
})();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
render(): React.ReactNode {
|
|
72
|
-
if (!this.state.error) return this.props.children;
|
|
73
|
-
return <CrashCard error={this.state.error} />;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,227 +0,0 @@
|
|
|
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
|
-
import { Box, Text, useStdout } from "ink";
|
|
17
|
-
import { theme } from "../theme.js";
|
|
18
|
-
import { toChars } from "../utils/text.js";
|
|
19
|
-
import { displayWidth, truncateToWidth } from "../utils/terminal-text.js";
|
|
20
|
-
|
|
21
|
-
/** Rows of draft shown at once, caret kept inside the window. */
|
|
22
|
-
const MAX_VISIBLE_LINES = 8;
|
|
23
|
-
|
|
24
|
-
/** Horizontal chrome around a draft row: 2 border + 2 padding + 2 prefix. */
|
|
25
|
-
const ROW_CHROME = 6;
|
|
26
|
-
|
|
27
|
-
/** Keep the trailing part of a path so the leaf directory stays visible. */
|
|
28
|
-
const tailTruncate = (value: string, max: number): string => {
|
|
29
|
-
if (max <= 1) return "";
|
|
30
|
-
const chars = toChars(value); // never split an emoji / surrogate pair
|
|
31
|
-
if (chars.length <= max) return value;
|
|
32
|
-
return "…" + chars.slice(chars.length - (max - 1)).join("");
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/** Visible priority: prompt · agent · model are fixed; cwd absorbs slack. */
|
|
36
|
-
export const InputBar = ({
|
|
37
|
-
value,
|
|
38
|
-
cursor,
|
|
39
|
-
agent,
|
|
40
|
-
model,
|
|
41
|
-
authed,
|
|
42
|
-
provider,
|
|
43
|
-
turns,
|
|
44
|
-
cwd,
|
|
45
|
-
mode,
|
|
46
|
-
}: {
|
|
47
|
-
value: string;
|
|
48
|
-
cursor: number;
|
|
49
|
-
agent: string;
|
|
50
|
-
model: string;
|
|
51
|
-
authed: boolean;
|
|
52
|
-
provider?: string;
|
|
53
|
-
turns: number;
|
|
54
|
-
cwd: string;
|
|
55
|
-
mode: string;
|
|
56
|
-
}) => {
|
|
57
|
-
const { stdout } = useStdout();
|
|
58
|
-
const width = stdout?.columns ?? 80;
|
|
59
|
-
|
|
60
|
-
// Footer budget: every block on the row is measured in display columns and
|
|
61
|
-
// the workspace absorbs the remainder. The previous estimate used a magic
|
|
62
|
-
// `+ 22` and ignored the actual gaps, so at 80 columns the row silently
|
|
63
|
-
// wrapped as soon as the path got long — pushing the input up a line.
|
|
64
|
-
const providerLabel = provider && provider !== "odysx" ? provider : "odysx";
|
|
65
|
-
const authLabel = authed ? "✓ authed" : "○ /signin to start";
|
|
66
|
-
const turnsLabel = `${turns} msg${turns === 1 ? "" : "s"}`;
|
|
67
|
-
const modeLabel = `mode:${mode}`;
|
|
68
|
-
const hintsLabel = "/help · ctrl+c";
|
|
69
|
-
const leftText = [agent, providerLabel, model || "default", turnsLabel, modeLabel].reduce(
|
|
70
|
-
(n, s) => n + displayWidth(s),
|
|
71
|
-
0,
|
|
72
|
-
);
|
|
73
|
-
// columnGap={1} between 10 left children and 3 right children, plus the
|
|
74
|
-
// container's paddingX={1} on both sides.
|
|
75
|
-
const gaps = 9 + 2 + 2;
|
|
76
|
-
const fixed = leftText + displayWidth(authLabel) + displayWidth(hintsLabel) + gaps;
|
|
77
|
-
const cwdBudget = Math.max(8, width - fixed);
|
|
78
|
-
const shownCwd = tailTruncate(cwd, cwdBudget);
|
|
79
|
-
|
|
80
|
-
// Work in code points so an emoji is never split by the caret. The draft is
|
|
81
|
-
// split into rows here (not by string index) to keep the caret column right.
|
|
82
|
-
const chars = toChars(value);
|
|
83
|
-
const at = Math.max(0, Math.min(cursor, chars.length));
|
|
84
|
-
const rows: string[][] = [[]];
|
|
85
|
-
let caretLine = 0;
|
|
86
|
-
let caretCol = 0;
|
|
87
|
-
for (let i = 0; i < chars.length; i++) {
|
|
88
|
-
if (chars[i] === "\n") {
|
|
89
|
-
rows.push([]);
|
|
90
|
-
if (i < at) {
|
|
91
|
-
caretLine++;
|
|
92
|
-
caretCol = 0;
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
rows[rows.length - 1].push(chars[i]);
|
|
96
|
-
if (i < at) caretCol++;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// A single logical line can still be thousands of columns wide (a pasted
|
|
101
|
-
// file with no newlines). Window it by columns too, keeping the caret in
|
|
102
|
-
// view; otherwise the text node overflows the box and Ink loses the border
|
|
103
|
-
// on every wrapped continuation row.
|
|
104
|
-
const rowBudget = Math.max(8, width - ROW_CHROME);
|
|
105
|
-
const windowRow = (
|
|
106
|
-
row: string[],
|
|
107
|
-
caret: number,
|
|
108
|
-
): { chars: string[]; caret: number; cutLeft: boolean; cutRight: boolean } => {
|
|
109
|
-
// Prefix sums keep this linear: measuring a growing slice per iteration
|
|
110
|
-
// turned a 5k-character paste into tens of millions of width calls.
|
|
111
|
-
const prefix = [0];
|
|
112
|
-
for (const ch of row) prefix.push(prefix[prefix.length - 1] + displayWidth(ch));
|
|
113
|
-
if (prefix[row.length] <= rowBudget) {
|
|
114
|
-
return { chars: row, caret: Math.max(0, caret), cutLeft: false, cutRight: false };
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Centre the caret when there is one, otherwise show the head of the row.
|
|
118
|
-
const start = caret >= 0
|
|
119
|
-
? Math.min(Math.max(0, caret - Math.floor(rowBudget / 2)), caret)
|
|
120
|
-
: 0;
|
|
121
|
-
let end = start;
|
|
122
|
-
while (end < row.length && prefix[end + 1] - prefix[start] <= rowBudget) end++;
|
|
123
|
-
return {
|
|
124
|
-
chars: row.slice(start, end),
|
|
125
|
-
caret: caret >= 0 ? Math.max(0, Math.min(caret - start, end - start)) : 0,
|
|
126
|
-
cutLeft: start > 0,
|
|
127
|
-
cutRight: end < row.length,
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// Window the draft so a large paste cannot push the transcript off-screen.
|
|
132
|
-
const total = rows.length;
|
|
133
|
-
let start = 0;
|
|
134
|
-
if (total > MAX_VISIBLE_LINES) {
|
|
135
|
-
start = Math.max(0, Math.min(caretLine - Math.floor(MAX_VISIBLE_LINES / 2), total - MAX_VISIBLE_LINES));
|
|
136
|
-
}
|
|
137
|
-
const end = Math.min(total, start + MAX_VISIBLE_LINES);
|
|
138
|
-
const hiddenAbove = start;
|
|
139
|
-
const hiddenBelow = total - end;
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<Box flexDirection="column">
|
|
143
|
-
<Box
|
|
144
|
-
borderStyle="round"
|
|
145
|
-
borderColor={value ? theme.color.user : theme.color.muted}
|
|
146
|
-
paddingX={1}
|
|
147
|
-
flexDirection="column"
|
|
148
|
-
>
|
|
149
|
-
{hiddenAbove > 0 && (
|
|
150
|
-
<Text dimColor>
|
|
151
|
-
{" "}… {hiddenAbove} earlier line{hiddenAbove === 1 ? "" : "s"}
|
|
152
|
-
</Text>
|
|
153
|
-
)}
|
|
154
|
-
|
|
155
|
-
{rows.slice(start, end).map((row, i) => {
|
|
156
|
-
const index = start + i;
|
|
157
|
-
const isCaretRow = index === caretLine;
|
|
158
|
-
// Clamp each row to the box width. A wrapped continuation row
|
|
159
|
-
// overflows the yoga box and Ink stops drawing its border.
|
|
160
|
-
const shown = windowRow(row, isCaretRow ? caretCol : -1);
|
|
161
|
-
return (
|
|
162
|
-
<Text key={index}>
|
|
163
|
-
{index === 0 ? (
|
|
164
|
-
<Text color={theme.color.user} bold>
|
|
165
|
-
{theme.glyph.pointer}{" "}
|
|
166
|
-
</Text>
|
|
167
|
-
) : (
|
|
168
|
-
" "
|
|
169
|
-
)}
|
|
170
|
-
{shown.cutLeft ? "…" : ""}
|
|
171
|
-
{isCaretRow ? (
|
|
172
|
-
<>
|
|
173
|
-
{shown.chars.slice(0, shown.caret).join("")}
|
|
174
|
-
<Text inverse>{shown.chars[shown.caret] ?? " "}</Text>
|
|
175
|
-
{shown.chars.slice(shown.caret + 1).join("")}
|
|
176
|
-
</>
|
|
177
|
-
) : (
|
|
178
|
-
shown.chars.join("")
|
|
179
|
-
)}
|
|
180
|
-
{shown.cutRight ? "…" : ""}
|
|
181
|
-
</Text>
|
|
182
|
-
);
|
|
183
|
-
})}
|
|
184
|
-
|
|
185
|
-
{hiddenBelow > 0 && (
|
|
186
|
-
<Text dimColor>
|
|
187
|
-
{" "}… {hiddenBelow} more line{hiddenBelow === 1 ? "" : "s"}
|
|
188
|
-
</Text>
|
|
189
|
-
)}
|
|
190
|
-
</Box>
|
|
191
|
-
|
|
192
|
-
<Box justifyContent="space-between" paddingX={1}>
|
|
193
|
-
<Box columnGap={1} flexShrink={1}>
|
|
194
|
-
<Text color={theme.color.success}>{agent}</Text>
|
|
195
|
-
<Text dimColor>{theme.glyph.info}</Text>
|
|
196
|
-
<Text dimColor>{providerLabel}</Text>
|
|
197
|
-
<Text color={theme.color.info}>{model || "default"}</Text>
|
|
198
|
-
<Text dimColor>{theme.glyph.info}</Text>
|
|
199
|
-
<Text dimColor>{turnsLabel}</Text>
|
|
200
|
-
<Text dimColor>{theme.glyph.info}</Text>
|
|
201
|
-
<Text
|
|
202
|
-
color={
|
|
203
|
-
mode === "plan" ? theme.color.warning :
|
|
204
|
-
mode === "auto" ? theme.color.error :
|
|
205
|
-
theme.color.info
|
|
206
|
-
}
|
|
207
|
-
>
|
|
208
|
-
{modeLabel}
|
|
209
|
-
</Text>
|
|
210
|
-
<Text dimColor>{theme.glyph.info}</Text>
|
|
211
|
-
{/* Last resort: if the measured budget was still too generous,
|
|
212
|
-
truncate the path rather than wrapping the whole footer. */}
|
|
213
|
-
<Text dimColor wrap="truncate-end">{shownCwd}</Text>
|
|
214
|
-
</Box>
|
|
215
|
-
<Box columnGap={1} flexShrink={0}>
|
|
216
|
-
{authed ? (
|
|
217
|
-
<Text color={theme.color.success}>{theme.glyph.check} authed</Text>
|
|
218
|
-
) : (
|
|
219
|
-
<Text color={theme.color.warning}>○ /signin to start</Text>
|
|
220
|
-
)}
|
|
221
|
-
<Text dimColor>{theme.glyph.info}</Text>
|
|
222
|
-
<Text dimColor>{hintsLabel}</Text>
|
|
223
|
-
</Box>
|
|
224
|
-
</Box>
|
|
225
|
-
</Box>
|
|
226
|
-
);
|
|
227
|
-
};
|
|
@@ -1,115 +0,0 @@
|
|
|
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 { Box, Text } from "ink";
|
|
9
|
-
import type { KeysState } from "../shared/types.js";
|
|
10
|
-
import { theme } from "../theme.js";
|
|
11
|
-
|
|
12
|
-
const Frame = ({ color, title, children }: { color?: string; title: string; children: React.ReactNode }) => (
|
|
13
|
-
<Box flexDirection="column" borderStyle="round" borderColor={color} paddingX={1} marginBottom={1}>
|
|
14
|
-
<Text bold color={color}>
|
|
15
|
-
{title}
|
|
16
|
-
</Text>
|
|
17
|
-
{children}
|
|
18
|
-
</Box>
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export const KeysPanel = ({ state }: { state: KeysState }) => {
|
|
22
|
-
if (state.mode === "create-name") {
|
|
23
|
-
return (
|
|
24
|
-
<Frame color={theme.color.accent} title="Create API key — name">
|
|
25
|
-
<Text dimColor>Enter continue · esc cancel</Text>
|
|
26
|
-
<Box marginTop={1}>
|
|
27
|
-
<Text color={theme.color.accent} bold>
|
|
28
|
-
{theme.glyph.pointer} {state.draftName}
|
|
29
|
-
<Text dimColor>_</Text>
|
|
30
|
-
</Text>
|
|
31
|
-
</Box>
|
|
32
|
-
</Frame>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (state.mode === "created" && state.createdKey) {
|
|
37
|
-
return (
|
|
38
|
-
<Frame color={theme.color.warning} title={`${theme.glyph.warn} Key created — copy it now`}>
|
|
39
|
-
<Text dimColor>This is the only time the full key is shown.</Text>
|
|
40
|
-
<Box marginTop={1}>
|
|
41
|
-
<Text color={theme.color.success} bold>
|
|
42
|
-
{state.createdKey.key}
|
|
43
|
-
</Text>
|
|
44
|
-
</Box>
|
|
45
|
-
<Box marginTop={1}>
|
|
46
|
-
<Text dimColor>
|
|
47
|
-
Name: {state.createdKey.name} · Enter to dismiss
|
|
48
|
-
</Text>
|
|
49
|
-
</Box>
|
|
50
|
-
</Frame>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const selected = state.rows[state.selectedIndex];
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<Frame color={theme.color.accent} title="API keys">
|
|
58
|
-
<Text dimColor>↑/↓ move · a create · r revoke · u usage · s set active · esc close</Text>
|
|
59
|
-
|
|
60
|
-
{state.mode === "confirm-revoke" && selected && (
|
|
61
|
-
<Box marginTop={1} flexDirection="column">
|
|
62
|
-
<Text color={theme.color.warning} bold>
|
|
63
|
-
{theme.glyph.warn} Revoke “{selected.name}” ({selected.key_prefix}…)?
|
|
64
|
-
</Text>
|
|
65
|
-
<Text dimColor>This cannot be undone. y revoke · n/esc keep</Text>
|
|
66
|
-
</Box>
|
|
67
|
-
)}
|
|
68
|
-
|
|
69
|
-
{state.busy && (
|
|
70
|
-
<Box marginTop={1}>
|
|
71
|
-
<Text color={theme.color.accent}>Loading…</Text>
|
|
72
|
-
</Box>
|
|
73
|
-
)}
|
|
74
|
-
|
|
75
|
-
{!state.busy && state.rows.length === 0 && (
|
|
76
|
-
<Box marginTop={1}>
|
|
77
|
-
<Text dimColor>
|
|
78
|
-
No keys yet — press <Text color={theme.color.brand}>a</Text> to create one.
|
|
79
|
-
</Text>
|
|
80
|
-
</Box>
|
|
81
|
-
)}
|
|
82
|
-
|
|
83
|
-
{!state.busy && state.rows.length > 0 && (
|
|
84
|
-
<Box marginTop={1} flexDirection="column">
|
|
85
|
-
{state.rows.map((row, idx) => {
|
|
86
|
-
const sel = idx === state.selectedIndex;
|
|
87
|
-
const status = row.is_active ? "active" : "revoked";
|
|
88
|
-
const lastUsed = row.last_used_at
|
|
89
|
-
? new Date(row.last_used_at).toLocaleDateString()
|
|
90
|
-
: "never";
|
|
91
|
-
const isActive = state.activeKeyLabel
|
|
92
|
-
? row.key_prefix.startsWith(state.activeKeyLabel)
|
|
93
|
-
: false;
|
|
94
|
-
return (
|
|
95
|
-
<Box key={row.id} flexDirection="column">
|
|
96
|
-
<Text color={sel ? theme.color.accent : theme.color.muted} bold={sel}>
|
|
97
|
-
{sel ? `${theme.glyph.pointer} ` : " "}
|
|
98
|
-
{isActive ? "● " : ""}
|
|
99
|
-
{row.name}
|
|
100
|
-
<Text dimColor>
|
|
101
|
-
{" "}
|
|
102
|
-
{row.key_prefix}… · {status}{isActive ? " · active (local)" : ""} · last used {lastUsed}
|
|
103
|
-
</Text>
|
|
104
|
-
</Text>
|
|
105
|
-
{sel && row.scopes && row.scopes.length > 0 && (
|
|
106
|
-
<Text dimColor>{" "}scopes: {row.scopes.join(", ")}</Text>
|
|
107
|
-
)}
|
|
108
|
-
</Box>
|
|
109
|
-
);
|
|
110
|
-
})}
|
|
111
|
-
</Box>
|
|
112
|
-
)}
|
|
113
|
-
</Frame>
|
|
114
|
-
);
|
|
115
|
-
};
|