@yeshwanthyk/coding-agent 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +372 -0
- package/package.json +42 -0
- package/src/adapters/acp/index.ts +305 -0
- package/src/adapters/acp/protocol.ts +191 -0
- package/src/adapters/acp/session.ts +289 -0
- package/src/adapters/acp/updates.ts +96 -0
- package/src/adapters/cli/headless.ts +112 -0
- package/src/adapters/cli/validate.ts +50 -0
- package/src/adapters/tui/app.tsx +39 -0
- package/src/agent-events.ts +671 -0
- package/src/args.ts +102 -0
- package/src/autocomplete-commands.ts +102 -0
- package/src/commands.ts +23 -0
- package/src/compact-handler.ts +272 -0
- package/src/components/Footer.tsx +49 -0
- package/src/components/Header.tsx +218 -0
- package/src/components/MessageList.tsx +380 -0
- package/src/config.ts +1 -0
- package/src/domain/commands/builtin/clear.ts +14 -0
- package/src/domain/commands/builtin/compact.ts +96 -0
- package/src/domain/commands/builtin/conceal.ts +9 -0
- package/src/domain/commands/builtin/diffwrap.ts +9 -0
- package/src/domain/commands/builtin/editor.ts +24 -0
- package/src/domain/commands/builtin/exit.ts +14 -0
- package/src/domain/commands/builtin/followup.ts +24 -0
- package/src/domain/commands/builtin/index.ts +29 -0
- package/src/domain/commands/builtin/login.ts +118 -0
- package/src/domain/commands/builtin/model.ts +66 -0
- package/src/domain/commands/builtin/status.ts +32 -0
- package/src/domain/commands/builtin/steer.ts +24 -0
- package/src/domain/commands/builtin/theme.ts +23 -0
- package/src/domain/commands/builtin/thinking.ts +16 -0
- package/src/domain/commands/helpers.ts +41 -0
- package/src/domain/commands/registry.ts +42 -0
- package/src/domain/commands/types.ts +69 -0
- package/src/domain/messaging/content.ts +117 -0
- package/src/editor.ts +103 -0
- package/src/extensibility/schema.ts +1 -0
- package/src/extensibility/validation.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAgentEvents.ts +28 -0
- package/src/hooks/useEditorBridge.ts +101 -0
- package/src/hooks/useGitStatus.ts +28 -0
- package/src/hooks/usePromptQueue.ts +7 -0
- package/src/hooks/useSessionController.ts +5 -0
- package/src/hooks/useSpinner.ts +28 -0
- package/src/hooks/useToastManager.ts +26 -0
- package/src/index.ts +188 -0
- package/src/keyboard-handler.ts +134 -0
- package/src/profiler.ts +40 -0
- package/src/runtime/context.tsx +16 -0
- package/src/runtime/factory.ts +63 -0
- package/src/runtime/git/git-info.ts +25 -0
- package/src/runtime/session/session-controller.ts +208 -0
- package/src/session-manager.ts +1 -0
- package/src/session-picker.tsx +134 -0
- package/src/shell-runner.ts +134 -0
- package/src/syntax-highlighting.ts +114 -0
- package/src/theme-names.ts +37 -0
- package/src/tool-ui-contracts.ts +77 -0
- package/src/tui-open-rendering.tsx +565 -0
- package/src/types.ts +89 -0
- package/src/ui/app-shell/TuiApp.tsx +586 -0
- package/src/ui/clipboard/osc52.ts +18 -0
- package/src/ui/components/modals/ConfirmModal.tsx +52 -0
- package/src/ui/components/modals/EditorModal.tsx +39 -0
- package/src/ui/components/modals/InputModal.tsx +30 -0
- package/src/ui/components/modals/ModalContainer.tsx +67 -0
- package/src/ui/components/modals/SelectModal.tsx +48 -0
- package/src/ui/components/modals/index.ts +4 -0
- package/src/ui/features/composer/Composer.tsx +73 -0
- package/src/ui/features/composer/SlashCommandHandler.ts +58 -0
- package/src/ui/features/composer/keyboard.ts +3 -0
- package/src/ui/features/main-view/MainView.tsx +367 -0
- package/src/ui/features/message-pane/MessagePane.tsx +34 -0
- package/src/ui/hooks/useModals.ts +74 -0
- package/src/ui/state/app-store.ts +67 -0
- package/src/utils.ts +14 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createSignal } from "solid-js"
|
|
2
|
+
|
|
3
|
+
export type ModalType = "select" | "input" | "confirm" | "editor" | null
|
|
4
|
+
|
|
5
|
+
export interface SelectModalState {
|
|
6
|
+
type: "select"
|
|
7
|
+
title: string
|
|
8
|
+
options: string[]
|
|
9
|
+
resolve: (value: string | undefined) => void
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface InputModalState {
|
|
13
|
+
type: "input"
|
|
14
|
+
title: string
|
|
15
|
+
placeholder?: string
|
|
16
|
+
resolve: (value: string | undefined) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ConfirmModalState {
|
|
20
|
+
type: "confirm"
|
|
21
|
+
title: string
|
|
22
|
+
message: string
|
|
23
|
+
resolve: (confirmed: boolean) => void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface EditorModalState {
|
|
27
|
+
type: "editor"
|
|
28
|
+
title: string
|
|
29
|
+
initialText?: string
|
|
30
|
+
resolve: (value: string | undefined) => void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type ModalState = SelectModalState | InputModalState | ConfirmModalState | EditorModalState | null
|
|
34
|
+
|
|
35
|
+
export function useModals() {
|
|
36
|
+
const [modalState, setModalState] = createSignal<ModalState>(null)
|
|
37
|
+
|
|
38
|
+
const showSelect = (title: string, options: string[]): Promise<string | undefined> => {
|
|
39
|
+
return new Promise((resolve) => {
|
|
40
|
+
setModalState({ type: "select", title, options, resolve })
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const showInput = (title: string, placeholder?: string): Promise<string | undefined> => {
|
|
45
|
+
return new Promise((resolve) => {
|
|
46
|
+
setModalState({ type: "input", title, placeholder, resolve })
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const showConfirm = (title: string, message: string): Promise<boolean> => {
|
|
51
|
+
return new Promise((resolve) => {
|
|
52
|
+
setModalState({ type: "confirm", title, message, resolve })
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const showEditor = (title: string, initialText?: string): Promise<string | undefined> => {
|
|
57
|
+
return new Promise((resolve) => {
|
|
58
|
+
setModalState({ type: "editor", title, initialText, resolve })
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const closeModal = () => {
|
|
63
|
+
setModalState(null)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
modalState,
|
|
68
|
+
showSelect,
|
|
69
|
+
showInput,
|
|
70
|
+
showConfirm,
|
|
71
|
+
showEditor,
|
|
72
|
+
closeModal,
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createSignal, type Accessor, type Setter } from "solid-js"
|
|
2
|
+
import type { ThinkingLevel } from "@yeshwanthyk/agent-core"
|
|
3
|
+
import type { KnownProvider } from "@yeshwanthyk/ai"
|
|
4
|
+
import type { ActivityState, ToolBlock, UIMessage } from "../../types.js"
|
|
5
|
+
import type { QueueCounts } from "@yeshwanthyk/runtime-effect/session/prompt-queue.js"
|
|
6
|
+
|
|
7
|
+
interface SignalRef<T> {
|
|
8
|
+
value: Accessor<T>
|
|
9
|
+
set: Setter<T>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const createSignalRef = <T,>(initial: T): SignalRef<T> => {
|
|
13
|
+
const [value, set] = createSignal(initial)
|
|
14
|
+
return { value, set }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface AppStore {
|
|
18
|
+
theme: SignalRef<string>
|
|
19
|
+
messages: SignalRef<UIMessage[]>
|
|
20
|
+
toolBlocks: SignalRef<ToolBlock[]>
|
|
21
|
+
isResponding: SignalRef<boolean>
|
|
22
|
+
activityState: SignalRef<ActivityState>
|
|
23
|
+
thinkingVisible: SignalRef<boolean>
|
|
24
|
+
diffWrapMode: SignalRef<"word" | "none">
|
|
25
|
+
concealMarkdown: SignalRef<boolean>
|
|
26
|
+
displayModelId: SignalRef<string>
|
|
27
|
+
displayThinking: SignalRef<ThinkingLevel>
|
|
28
|
+
displayContextWindow: SignalRef<number>
|
|
29
|
+
contextTokens: SignalRef<number>
|
|
30
|
+
cacheStats: SignalRef<{ cacheRead: number; input: number } | null>
|
|
31
|
+
retryStatus: SignalRef<string | null>
|
|
32
|
+
turnCount: SignalRef<number>
|
|
33
|
+
lspActive: SignalRef<boolean>
|
|
34
|
+
queueCounts: SignalRef<QueueCounts>
|
|
35
|
+
currentProvider: SignalRef<KnownProvider>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface AppStoreConfig {
|
|
39
|
+
initialTheme: string
|
|
40
|
+
initialModelId: string
|
|
41
|
+
initialThinking: ThinkingLevel
|
|
42
|
+
initialContextWindow: number
|
|
43
|
+
initialProvider: KnownProvider
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const createAppStore = (config: AppStoreConfig): AppStore => {
|
|
47
|
+
return {
|
|
48
|
+
theme: createSignalRef(config.initialTheme),
|
|
49
|
+
messages: createSignalRef<UIMessage[]>([]),
|
|
50
|
+
toolBlocks: createSignalRef<ToolBlock[]>([]),
|
|
51
|
+
isResponding: createSignalRef(false),
|
|
52
|
+
activityState: createSignalRef<ActivityState>("idle"),
|
|
53
|
+
thinkingVisible: createSignalRef(true),
|
|
54
|
+
diffWrapMode: createSignalRef<"word" | "none">("word"),
|
|
55
|
+
concealMarkdown: createSignalRef(true),
|
|
56
|
+
displayModelId: createSignalRef(config.initialModelId),
|
|
57
|
+
displayThinking: createSignalRef<ThinkingLevel>(config.initialThinking),
|
|
58
|
+
displayContextWindow: createSignalRef(config.initialContextWindow),
|
|
59
|
+
contextTokens: createSignalRef(0),
|
|
60
|
+
cacheStats: createSignalRef<{ cacheRead: number; input: number } | null>(null),
|
|
61
|
+
retryStatus: createSignalRef<string | null>(null),
|
|
62
|
+
turnCount: createSignalRef(0),
|
|
63
|
+
lspActive: createSignalRef(false),
|
|
64
|
+
queueCounts: createSignalRef<QueueCounts>({ steer: 0, followUp: 0 }),
|
|
65
|
+
currentProvider: createSignalRef(config.initialProvider),
|
|
66
|
+
}
|
|
67
|
+
}
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export {
|
|
2
|
+
MESSAGE_CAP,
|
|
3
|
+
appendWithCap,
|
|
4
|
+
extractOrderedBlocks,
|
|
5
|
+
extractThinking,
|
|
6
|
+
extractToolCalls,
|
|
7
|
+
extractText,
|
|
8
|
+
getEditDiffText,
|
|
9
|
+
getToolText,
|
|
10
|
+
type ExtractedToolCall,
|
|
11
|
+
type OrderedBlock,
|
|
12
|
+
} from "@domain/messaging/content.js"
|
|
13
|
+
|
|
14
|
+
export { findGitHeadPath, getCurrentBranch } from "@runtime/git/git-info.js"
|