portercode 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/LICENSE +123 -0
- package/NOTICE +45 -0
- package/README.md +178 -0
- package/dist/auth/index.d.ts +103 -0
- package/dist/bus/bus-event.d.ts +10 -0
- package/dist/bus/global.d.ts +7 -0
- package/dist/bus/index.d.ts +26 -0
- package/dist/cli/auth.d.ts +11 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/ui.d.ts +26 -0
- package/dist/command/index.d.ts +54 -0
- package/dist/config/config.d.ts +6756 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/markdown.d.ts +415 -0
- package/dist/constants/index.d.ts +9 -0
- package/dist/diff/engine.d.ts +15 -0
- package/dist/diff/index.d.ts +8 -0
- package/dist/diff/types.d.ts +66 -0
- package/dist/file/ignore.d.ts +7 -0
- package/dist/flag/index.d.ts +19 -0
- package/dist/gateway/bridge.d.ts +11 -0
- package/dist/gateway/handlers/llm.d.ts +7 -0
- package/dist/gateway/handlers/permission.d.ts +15 -0
- package/dist/gateway/handlers/session.d.ts +7 -0
- package/dist/gateway/handlers/system.d.ts +7 -0
- package/dist/gateway/handlers/tool.d.ts +7 -0
- package/dist/gateway/index.d.ts +17 -0
- package/dist/gateway/protocol.d.ts +159 -0
- package/dist/gateway/router.d.ts +7 -0
- package/dist/gateway/server.d.ts +24 -0
- package/dist/global/index.d.ts +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/permission/index.d.ts +2 -0
- package/dist/permission/permission.d.ts +172 -0
- package/dist/permission/types.d.ts +109 -0
- package/dist/project/index.d.ts +3 -0
- package/dist/project/instance.d.ts +33 -0
- package/dist/project/project.d.ts +82 -0
- package/dist/project/state.d.ts +4 -0
- package/dist/prompt/index.d.ts +5 -0
- package/dist/prompt/system.d.ts +24 -0
- package/dist/provider/index.d.ts +3 -0
- package/dist/provider/models.d.ts +17 -0
- package/dist/provider/provider.d.ts +844 -0
- package/dist/provider/types.d.ts +328 -0
- package/dist/session/context-optimization.d.ts +160 -0
- package/dist/session/index.d.ts +4 -0
- package/dist/session/llm.d.ts +29 -0
- package/dist/session/session.d.ts +400 -0
- package/dist/session/types.d.ts +544 -0
- package/dist/snapshot/index.d.ts +40 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/storage.d.ts +34 -0
- package/dist/tool/bash.d.ts +19 -0
- package/dist/tool/edit.d.ts +21 -0
- package/dist/tool/glob.d.ts +15 -0
- package/dist/tool/grep.d.ts +20 -0
- package/dist/tool/image.d.ts +23 -0
- package/dist/tool/index.d.ts +11 -0
- package/dist/tool/ls.d.ts +14 -0
- package/dist/tool/read.d.ts +17 -0
- package/dist/tool/registry.d.ts +30 -0
- package/dist/tool/todo.d.ts +76 -0
- package/dist/tool/tool.d.ts +65 -0
- package/dist/tool/write.d.ts +16 -0
- package/dist/tui/App.d.ts +10 -0
- package/dist/tui/components/Header.d.ts +12 -0
- package/dist/tui/components/Message/AssistantMessage.d.ts +10 -0
- package/dist/tui/components/Message/ReasoningMessage.d.ts +20 -0
- package/dist/tui/components/Message/ToolCallMessage.d.ts +25 -0
- package/dist/tui/components/Message/UserMessage.d.ts +11 -0
- package/dist/tui/components/Message/index.d.ts +13 -0
- package/dist/tui/components/PermissionPrompt.d.ts +6 -0
- package/dist/tui/components/PromptInput.d.ts +32 -0
- package/dist/tui/components/REPL.d.ts +17 -0
- package/dist/tui/components/Spinner.d.ts +13 -0
- package/dist/tui/components/StatusBar.d.ts +12 -0
- package/dist/tui/components/TodoList.d.ts +17 -0
- package/dist/tui/components/WelcomeBox.d.ts +13 -0
- package/dist/tui/components/dialogs/DiagnosticsPanel.d.ts +12 -0
- package/dist/tui/components/dialogs/HelpPanel.d.ts +11 -0
- package/dist/tui/components/dialogs/ModelSelector.d.ts +14 -0
- package/dist/tui/components/dialogs/PermissionPrompt.d.ts +17 -0
- package/dist/tui/components/dialogs/SessionPicker.d.ts +15 -0
- package/dist/tui/components/dialogs/index.d.ts +10 -0
- package/dist/tui/components/diff/DiffHunk.d.ts +12 -0
- package/dist/tui/components/diff/DiffLine.d.ts +14 -0
- package/dist/tui/components/diff/DiffStats.d.ts +12 -0
- package/dist/tui/components/diff/DiffView.d.ts +15 -0
- package/dist/tui/components/diff/index.d.ts +9 -0
- package/dist/tui/hooks/usePermission.d.ts +26 -0
- package/dist/tui/index.d.ts +15 -0
- package/dist/tui/theme.d.ts +27 -0
- package/dist/tui/utils/Cursor.d.ts +37 -0
- package/dist/tui/utils/clipboard.d.ts +3 -0
- package/dist/tui/utils/keypress.d.ts +39 -0
- package/dist/tui/utils/markdown.d.ts +13 -0
- package/dist/tui/utils/openContent.d.ts +22 -0
- package/dist/util/context.d.ts +10 -0
- package/dist/util/debug.d.ts +51 -0
- package/dist/util/error.d.ts +294 -0
- package/dist/util/example-commands.d.ts +18 -0
- package/dist/util/filesystem.d.ts +17 -0
- package/dist/util/id.d.ts +24 -0
- package/dist/util/iife.d.ts +1 -0
- package/dist/util/index.d.ts +7 -0
- package/dist/util/lazy.d.ts +1 -0
- package/dist/util/log.d.ts +26 -0
- package/dist/util/timeout.d.ts +1 -0
- package/dist/util/wildcard.d.ts +8 -0
- package/package.json +72 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { Tool } from "./tool";
|
|
3
|
+
export declare const ImageTool: Tool.Info<z.ZodObject<{
|
|
4
|
+
prompt: z.ZodString;
|
|
5
|
+
filename: z.ZodString;
|
|
6
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
7
|
+
aspectRatio: z.ZodOptional<z.ZodEnum<["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5", "21:9"]>>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
prompt: string;
|
|
10
|
+
filename: string;
|
|
11
|
+
directory?: string | undefined;
|
|
12
|
+
aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "5:4" | "4:5" | "21:9" | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
prompt: string;
|
|
15
|
+
filename: string;
|
|
16
|
+
directory?: string | undefined;
|
|
17
|
+
aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "5:4" | "4:5" | "21:9" | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
path: string;
|
|
20
|
+
size: number;
|
|
21
|
+
duration: string;
|
|
22
|
+
aspectRatio: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "5:4" | "4:5" | "21:9";
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { Tool } from "./tool";
|
|
2
|
+
export { ToolRegistry } from "./registry";
|
|
3
|
+
export { ReadTool } from "./read";
|
|
4
|
+
export { GlobTool } from "./glob";
|
|
5
|
+
export { GrepTool } from "./grep";
|
|
6
|
+
export { BashTool } from "./bash";
|
|
7
|
+
export { WriteTool } from "./write";
|
|
8
|
+
export { EditTool } from "./edit";
|
|
9
|
+
export { LsTool } from "./ls";
|
|
10
|
+
export { TodoTool, TodoEvent, getTodos, clearTodos, type TodoItem } from "./todo";
|
|
11
|
+
export { ImageTool } from "./image";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { Tool } from "./tool";
|
|
3
|
+
export declare const LsTool: Tool.Info<z.ZodObject<{
|
|
4
|
+
path: z.ZodOptional<z.ZodString>;
|
|
5
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
path?: string | undefined;
|
|
8
|
+
depth?: number | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
path?: string | undefined;
|
|
11
|
+
depth?: number | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
count: number;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { Tool } from "./tool";
|
|
3
|
+
export declare const ReadTool: Tool.Info<z.ZodObject<{
|
|
4
|
+
filePath: z.ZodString;
|
|
5
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
filePath: string;
|
|
9
|
+
offset?: number | undefined;
|
|
10
|
+
limit?: number | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
filePath: string;
|
|
13
|
+
offset?: number | undefined;
|
|
14
|
+
limit?: number | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
preview: string;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Tool } from "./tool";
|
|
2
|
+
export declare namespace ToolRegistry {
|
|
3
|
+
/**
|
|
4
|
+
* Get all registered tools
|
|
5
|
+
*/
|
|
6
|
+
function all(): readonly Tool.Info<any, any>[];
|
|
7
|
+
/**
|
|
8
|
+
* Get a tool by its ID
|
|
9
|
+
*/
|
|
10
|
+
function get(id: string): Tool.Info<any, any> | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Check if a tool exists
|
|
13
|
+
*/
|
|
14
|
+
function has(id: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Get all tool IDs
|
|
17
|
+
*/
|
|
18
|
+
function ids(): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Initialize all tools and return their definitions
|
|
21
|
+
* This is used when setting up the LLM with available tools
|
|
22
|
+
* Conditional tools that return null during init are skipped
|
|
23
|
+
*/
|
|
24
|
+
function initialize(ctx?: Tool.InitContext): Promise<Tool.Initialized[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Initialize a specific subset of tools
|
|
27
|
+
* Conditional tools that return null during init are skipped
|
|
28
|
+
*/
|
|
29
|
+
function initializeSubset(ids: string[], ctx?: Tool.InitContext): Promise<Tool.Initialized[]>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { Tool } from "./tool";
|
|
3
|
+
/**
|
|
4
|
+
* Todo Tool
|
|
5
|
+
*
|
|
6
|
+
* Allows the agent to create and manage a task list for tracking progress.
|
|
7
|
+
* Tasks are displayed in the UI and help users understand what the agent is doing.
|
|
8
|
+
*/
|
|
9
|
+
export interface TodoItem {
|
|
10
|
+
content: string;
|
|
11
|
+
status: "pending" | "in_progress" | "completed";
|
|
12
|
+
activeForm: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const TodoEvent: {
|
|
15
|
+
Updated: {
|
|
16
|
+
type: "todo.updated";
|
|
17
|
+
properties: z.ZodObject<{
|
|
18
|
+
todos: z.ZodArray<z.ZodObject<{
|
|
19
|
+
content: z.ZodString;
|
|
20
|
+
status: z.ZodEnum<["pending", "in_progress", "completed"]>;
|
|
21
|
+
activeForm: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
status: "completed" | "pending" | "in_progress";
|
|
24
|
+
content: string;
|
|
25
|
+
activeForm: string;
|
|
26
|
+
}, {
|
|
27
|
+
status: "completed" | "pending" | "in_progress";
|
|
28
|
+
content: string;
|
|
29
|
+
activeForm: string;
|
|
30
|
+
}>, "many">;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
todos: {
|
|
33
|
+
status: "completed" | "pending" | "in_progress";
|
|
34
|
+
content: string;
|
|
35
|
+
activeForm: string;
|
|
36
|
+
}[];
|
|
37
|
+
}, {
|
|
38
|
+
todos: {
|
|
39
|
+
status: "completed" | "pending" | "in_progress";
|
|
40
|
+
content: string;
|
|
41
|
+
activeForm: string;
|
|
42
|
+
}[];
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export declare function getTodos(sessionId: string): TodoItem[];
|
|
47
|
+
export declare function clearTodos(sessionId: string): void;
|
|
48
|
+
export declare const TodoTool: Tool.Info<z.ZodObject<{
|
|
49
|
+
todos: z.ZodArray<z.ZodObject<{
|
|
50
|
+
content: z.ZodString;
|
|
51
|
+
status: z.ZodEnum<["pending", "in_progress", "completed"]>;
|
|
52
|
+
activeForm: z.ZodString;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
status: "completed" | "pending" | "in_progress";
|
|
55
|
+
content: string;
|
|
56
|
+
activeForm: string;
|
|
57
|
+
}, {
|
|
58
|
+
status: "completed" | "pending" | "in_progress";
|
|
59
|
+
content: string;
|
|
60
|
+
activeForm: string;
|
|
61
|
+
}>, "many">;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
todos: {
|
|
64
|
+
status: "completed" | "pending" | "in_progress";
|
|
65
|
+
content: string;
|
|
66
|
+
activeForm: string;
|
|
67
|
+
}[];
|
|
68
|
+
}, {
|
|
69
|
+
todos: {
|
|
70
|
+
status: "completed" | "pending" | "in_progress";
|
|
71
|
+
content: string;
|
|
72
|
+
activeForm: string;
|
|
73
|
+
}[];
|
|
74
|
+
}>, {
|
|
75
|
+
todosCount: number;
|
|
76
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare namespace Tool {
|
|
3
|
+
interface Metadata {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export interface InitContext {
|
|
7
|
+
agent?: any;
|
|
8
|
+
}
|
|
9
|
+
export type Context<M extends Metadata = Metadata> = {
|
|
10
|
+
sessionID: string;
|
|
11
|
+
messageID: string;
|
|
12
|
+
agent: string;
|
|
13
|
+
abort: AbortSignal;
|
|
14
|
+
callID?: string;
|
|
15
|
+
extra?: {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
metadata(input: {
|
|
19
|
+
title?: string;
|
|
20
|
+
metadata?: M;
|
|
21
|
+
}): void;
|
|
22
|
+
};
|
|
23
|
+
export interface FilePart {
|
|
24
|
+
id: string;
|
|
25
|
+
sessionID: string;
|
|
26
|
+
messageID: string;
|
|
27
|
+
type: "file";
|
|
28
|
+
mime: string;
|
|
29
|
+
url: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ToolDefinition<Parameters extends z.ZodType = z.ZodType, M extends Metadata = Metadata> {
|
|
32
|
+
description: string;
|
|
33
|
+
parameters: Parameters;
|
|
34
|
+
execute(args: z.infer<Parameters>, ctx: Context): Promise<{
|
|
35
|
+
title: string;
|
|
36
|
+
metadata: M;
|
|
37
|
+
output: string;
|
|
38
|
+
attachments?: FilePart[];
|
|
39
|
+
}>;
|
|
40
|
+
formatValidationError?(error: z.ZodError): string;
|
|
41
|
+
}
|
|
42
|
+
export interface Info<Parameters extends z.ZodType = z.ZodType, M extends Metadata = Metadata> {
|
|
43
|
+
id: string;
|
|
44
|
+
init: (ctx?: InitContext) => Promise<ToolDefinition<Parameters, M> | null>;
|
|
45
|
+
}
|
|
46
|
+
export type InferParameters<T extends Info> = T extends Info<infer P> ? z.infer<P> : never;
|
|
47
|
+
export type InferMetadata<T extends Info> = T extends Info<any, infer M> ? M : never;
|
|
48
|
+
/**
|
|
49
|
+
* Represents an initialized tool ready for use
|
|
50
|
+
*/
|
|
51
|
+
export interface Initialized<P extends z.ZodType = z.ZodType, M extends Metadata = Metadata> {
|
|
52
|
+
id: string;
|
|
53
|
+
description: string;
|
|
54
|
+
parameters: P;
|
|
55
|
+
execute(args: z.infer<P>, ctx: Context): Promise<{
|
|
56
|
+
title: string;
|
|
57
|
+
metadata: M;
|
|
58
|
+
output: string;
|
|
59
|
+
attachments?: FilePart[];
|
|
60
|
+
}>;
|
|
61
|
+
formatValidationError?(error: z.ZodError): string;
|
|
62
|
+
}
|
|
63
|
+
export function define<Parameters extends z.ZodType, Result extends Metadata>(id: string, init: Info<Parameters, Result>["init"] | ToolDefinition<Parameters, Result> | null): Info<Parameters, Result>;
|
|
64
|
+
export {};
|
|
65
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { Tool } from "./tool";
|
|
3
|
+
export declare const WriteTool: Tool.Info<z.ZodObject<{
|
|
4
|
+
filePath: z.ZodString;
|
|
5
|
+
content: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
content: string;
|
|
8
|
+
filePath: string;
|
|
9
|
+
}, {
|
|
10
|
+
content: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
}>, {
|
|
13
|
+
action: string;
|
|
14
|
+
lines: number;
|
|
15
|
+
preview: string;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main TUI Application Component
|
|
3
|
+
*
|
|
4
|
+
* Root React component that manages routing and global state.
|
|
5
|
+
*/
|
|
6
|
+
import type { TuiOptions } from "./index";
|
|
7
|
+
interface AppProps extends TuiOptions {
|
|
8
|
+
}
|
|
9
|
+
export declare function App({ sessionId: initialSessionId, onExit }: AppProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Header Component
|
|
3
|
+
*
|
|
4
|
+
* Displays the app title, mode indicator, and session title.
|
|
5
|
+
*/
|
|
6
|
+
type Mode = "auto" | "plan" | "ask";
|
|
7
|
+
interface HeaderProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
mode: Mode;
|
|
10
|
+
}
|
|
11
|
+
export declare function Header({ title, mode }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AssistantMessage Component
|
|
3
|
+
*
|
|
4
|
+
* Displays an assistant message with markdown rendering.
|
|
5
|
+
*/
|
|
6
|
+
interface AssistantMessageProps {
|
|
7
|
+
content: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function AssistantMessage({ content }: AssistantMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReasoningMessage Component
|
|
3
|
+
*
|
|
4
|
+
* Displays agent reasoning/thinking in a compact format.
|
|
5
|
+
*/
|
|
6
|
+
import React from "react";
|
|
7
|
+
interface ReasoningMessageProps {
|
|
8
|
+
content: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
streaming?: boolean;
|
|
11
|
+
termWidth?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const ReasoningMessage: React.NamedExoticComponent<ReasoningMessageProps>;
|
|
14
|
+
/**
|
|
15
|
+
* Compact version for message history
|
|
16
|
+
*/
|
|
17
|
+
export declare function ReasoningHistoryMessage({ content }: {
|
|
18
|
+
content: string;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolCallMessage Component
|
|
3
|
+
*
|
|
4
|
+
* Displays a tool call with IN/OUT format.
|
|
5
|
+
* For edit/write tools, shows a compact diff preview.
|
|
6
|
+
*/
|
|
7
|
+
import React from "react";
|
|
8
|
+
type ToolStatus = "pending" | "running" | "completed" | "failed";
|
|
9
|
+
interface ToolCallMessageProps {
|
|
10
|
+
name: string;
|
|
11
|
+
args?: Record<string, any>;
|
|
12
|
+
status: ToolStatus;
|
|
13
|
+
output?: string;
|
|
14
|
+
termWidth?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const ToolCallMessage: React.NamedExoticComponent<ToolCallMessageProps>;
|
|
17
|
+
/**
|
|
18
|
+
* Compact version for message history (tool results)
|
|
19
|
+
*/
|
|
20
|
+
export declare function ToolResultMessage({ toolName, input, output, }: {
|
|
21
|
+
toolName?: string;
|
|
22
|
+
input?: Record<string, any>;
|
|
23
|
+
output?: string;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UserMessage Component
|
|
3
|
+
*
|
|
4
|
+
* Displays a user message in the conversation.
|
|
5
|
+
* Long messages are truncated to 3 lines with a count indicator.
|
|
6
|
+
*/
|
|
7
|
+
interface UserMessageProps {
|
|
8
|
+
content: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function UserMessage({ content }: UserMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message Component
|
|
3
|
+
*
|
|
4
|
+
* Dispatcher that renders the appropriate message component based on type.
|
|
5
|
+
*/
|
|
6
|
+
import type { MessageWithParts } from "../../../session/types";
|
|
7
|
+
interface MessageProps {
|
|
8
|
+
message: MessageWithParts;
|
|
9
|
+
}
|
|
10
|
+
export declare function Message({ message }: MessageProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export { UserMessage } from "./UserMessage";
|
|
12
|
+
export { AssistantMessage } from "./AssistantMessage";
|
|
13
|
+
export { ToolCallMessage, ToolResultMessage } from "./ToolCallMessage";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PromptInput Component
|
|
3
|
+
*
|
|
4
|
+
* Multiline text input for the terminal with cursor management.
|
|
5
|
+
* Supports:
|
|
6
|
+
* - Multiline input:
|
|
7
|
+
* - Ctrl+J: insert newline (most reliable, works in all terminals)
|
|
8
|
+
* - Ctrl+O: insert newline
|
|
9
|
+
* - Backslash at end of line + Enter: continue on next line
|
|
10
|
+
* - Shift+Enter: insert newline (requires CSI u mode - Kitty, WezTerm, iTerm2 with setting)
|
|
11
|
+
* - Meta+Enter: insert newline (if terminal supports it)
|
|
12
|
+
* - Cursor navigation (arrows, home, end)
|
|
13
|
+
* - Word navigation (Ctrl+arrows)
|
|
14
|
+
* - History navigation (up/down when at first/last line)
|
|
15
|
+
* - Paste detection
|
|
16
|
+
*
|
|
17
|
+
* Note on Shift+Enter:
|
|
18
|
+
* Most terminal emulators (Terminal.app, default iTerm2) don't distinguish Shift+Enter
|
|
19
|
+
* from regular Enter. To enable Shift+Enter support:
|
|
20
|
+
* - iTerm2: Preferences > Profiles > Keys > Report modifiers using CSI u
|
|
21
|
+
* - Kitty/WezTerm: Enabled by default
|
|
22
|
+
* - Other terminals: Use Ctrl+J as a reliable alternative
|
|
23
|
+
*/
|
|
24
|
+
interface PromptInputProps {
|
|
25
|
+
onSubmit: (value: string) => void;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
history?: string[];
|
|
29
|
+
queued?: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function PromptInput({ onSubmit, placeholder, disabled, history, queued, }: PromptInputProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REPL Component
|
|
3
|
+
*
|
|
4
|
+
* Main session view that displays messages, handles input, and manages LLM interaction.
|
|
5
|
+
*/
|
|
6
|
+
type Mode = "auto" | "plan" | "ask";
|
|
7
|
+
interface REPLProps {
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
mode: Mode;
|
|
10
|
+
ctrlCPressed: boolean;
|
|
11
|
+
onNewSession: () => void;
|
|
12
|
+
onSessionCreated?: (sessionId: string) => void;
|
|
13
|
+
onSwitchSession?: (sessionId: string) => void;
|
|
14
|
+
onModeChange?: (mode: Mode) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function REPL({ sessionId, mode, ctrlCPressed, onNewSession, onSessionCreated, onSwitchSession, onModeChange }: REPLProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spinner Component
|
|
3
|
+
*
|
|
4
|
+
* Simple animated loading indicator for the terminal.
|
|
5
|
+
*/
|
|
6
|
+
import React from "react";
|
|
7
|
+
interface SpinnerProps {
|
|
8
|
+
message?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
showTime?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const Spinner: React.NamedExoticComponent<SpinnerProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StatusBar Component
|
|
3
|
+
*
|
|
4
|
+
* Bottom status bar with shortcuts and connection status.
|
|
5
|
+
*/
|
|
6
|
+
type Mode = "auto" | "plan" | "ask";
|
|
7
|
+
interface StatusBarProps {
|
|
8
|
+
mode: Mode;
|
|
9
|
+
contextUsage?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function StatusBar({ mode, contextUsage }: StatusBarProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TodoList Component
|
|
3
|
+
*
|
|
4
|
+
* Displays the current task list with status indicators.
|
|
5
|
+
*/
|
|
6
|
+
import React from "react";
|
|
7
|
+
import type { TodoItem } from "../../tool/todo";
|
|
8
|
+
interface TodoListProps {
|
|
9
|
+
todos: TodoItem[];
|
|
10
|
+
termWidth?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const TodoList: React.NamedExoticComponent<TodoListProps>;
|
|
13
|
+
/**
|
|
14
|
+
* Compact inline version for status bar
|
|
15
|
+
*/
|
|
16
|
+
export declare function TodoStatus({ todos }: TodoListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WelcomeBox Component
|
|
3
|
+
*
|
|
4
|
+
* Welcome screen displayed on startup with product info and tips.
|
|
5
|
+
*/
|
|
6
|
+
interface WelcomeBoxProps {
|
|
7
|
+
user?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
provider?: string;
|
|
10
|
+
cwd: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function WelcomeBox({ user, model, provider, cwd }: WelcomeBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiagnosticsPanel Dialog
|
|
3
|
+
*
|
|
4
|
+
* System diagnostics and health check for /doctor command.
|
|
5
|
+
* Displays environment info, API status, and configuration checks.
|
|
6
|
+
*/
|
|
7
|
+
interface DiagnosticsProps {
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function DiagnosticsPanel({ sessionId, onClose }: DiagnosticsProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HelpPanel Dialog
|
|
3
|
+
*
|
|
4
|
+
* Interactive help panel for /help command.
|
|
5
|
+
* Shows available commands grouped by category with descriptions.
|
|
6
|
+
*/
|
|
7
|
+
interface HelpPanelProps {
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function HelpPanel({ onClose }: HelpPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ModelSelector Dialog
|
|
3
|
+
*
|
|
4
|
+
* Interactive model selection for /model command.
|
|
5
|
+
* Allows users to browse and select AI models from available providers.
|
|
6
|
+
*/
|
|
7
|
+
interface ModelSelectorProps {
|
|
8
|
+
currentModel?: string;
|
|
9
|
+
availableProviders: string[];
|
|
10
|
+
onSelect: (providerId: string, modelId: string) => void;
|
|
11
|
+
onCancel: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function ModelSelector({ currentModel, availableProviders, onSelect, onCancel, }: ModelSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PermissionPrompt Dialog
|
|
3
|
+
*
|
|
4
|
+
* Interactive permission request dialog for ask mode.
|
|
5
|
+
* Displays when an operation requires user approval.
|
|
6
|
+
* Options: Allow, Allow (don't ask again), Deny, Other
|
|
7
|
+
*/
|
|
8
|
+
import React from "react";
|
|
9
|
+
import type { PermissionRequest } from "../../../permission/types";
|
|
10
|
+
interface PermissionPromptProps {
|
|
11
|
+
request: PermissionRequest;
|
|
12
|
+
onRespond: (granted: boolean, pattern?: string, switchToAuto?: boolean) => void;
|
|
13
|
+
onOtherSelected?: (selected: boolean) => void;
|
|
14
|
+
termWidth?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const PermissionPrompt: React.NamedExoticComponent<PermissionPromptProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SessionPicker Dialog
|
|
3
|
+
*
|
|
4
|
+
* Interactive session selection for /resume command.
|
|
5
|
+
* Groups sessions by date: Today, Yesterday, This Week, Earlier.
|
|
6
|
+
* Shows session titles based on first user prompt.
|
|
7
|
+
* Features windowed scrolling (5 visible items) and Tab section navigation.
|
|
8
|
+
*/
|
|
9
|
+
interface SessionPickerProps {
|
|
10
|
+
currentSessionId?: string;
|
|
11
|
+
onSelect: (sessionId: string) => void;
|
|
12
|
+
onCancel: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function SessionPicker({ currentSessionId, onSelect, onCancel, }: SessionPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dialog Components
|
|
3
|
+
*
|
|
4
|
+
* Interactive panels and dialogs for commands.
|
|
5
|
+
*/
|
|
6
|
+
export { ModelSelector } from "./ModelSelector";
|
|
7
|
+
export { HelpPanel } from "./HelpPanel";
|
|
8
|
+
export { DiagnosticsPanel } from "./DiagnosticsPanel";
|
|
9
|
+
export { PermissionPrompt } from "./PermissionPrompt";
|
|
10
|
+
export { SessionPicker } from "./SessionPicker";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiffHunk Component
|
|
3
|
+
*
|
|
4
|
+
* Displays a hunk (section) of diff with header and lines.
|
|
5
|
+
*/
|
|
6
|
+
import type { DiffHunk as DiffHunkType } from "../../../diff";
|
|
7
|
+
interface DiffHunkProps {
|
|
8
|
+
hunk: DiffHunkType;
|
|
9
|
+
showLineNumbers?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function DiffHunk({ hunk, showLineNumbers }: DiffHunkProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiffLine Component
|
|
3
|
+
*
|
|
4
|
+
* Displays a single line of diff with proper styling.
|
|
5
|
+
* Supports word-level highlighting for modified lines.
|
|
6
|
+
*/
|
|
7
|
+
import type { DiffLine as DiffLineType } from "../../../diff";
|
|
8
|
+
interface DiffLineProps {
|
|
9
|
+
line: DiffLineType;
|
|
10
|
+
showLineNumbers?: boolean;
|
|
11
|
+
lineNumberWidth?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function DiffLine({ line, showLineNumbers, lineNumberWidth }: DiffLineProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiffStats Component
|
|
3
|
+
*
|
|
4
|
+
* Displays diff statistics (additions/deletions) with visual bar.
|
|
5
|
+
*/
|
|
6
|
+
interface DiffStatsProps {
|
|
7
|
+
additions: number;
|
|
8
|
+
deletions: number;
|
|
9
|
+
maxWidth?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function DiffStats({ additions, deletions, maxWidth }: DiffStatsProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiffView Component
|
|
3
|
+
*
|
|
4
|
+
* Main component for displaying file diffs in the TUI.
|
|
5
|
+
* Shows file header, stats, and all hunks.
|
|
6
|
+
*/
|
|
7
|
+
import type { DiffResult } from "../../../diff";
|
|
8
|
+
interface DiffViewProps {
|
|
9
|
+
diff: DiffResult;
|
|
10
|
+
showLineNumbers?: boolean;
|
|
11
|
+
showStats?: boolean;
|
|
12
|
+
collapsed?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function DiffView({ diff, showLineNumbers, showStats, collapsed, }: DiffViewProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diff TUI Components
|
|
3
|
+
*
|
|
4
|
+
* React/Ink components for rendering diffs in the terminal.
|
|
5
|
+
*/
|
|
6
|
+
export { DiffView } from "./DiffView";
|
|
7
|
+
export { DiffHunk } from "./DiffHunk";
|
|
8
|
+
export { DiffLine } from "./DiffLine";
|
|
9
|
+
export { DiffStats } from "./DiffStats";
|