stk-codegen 1.0.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/LICENSE +70 -0
- package/README.md +213 -0
- package/dist/96.index.js +189 -0
- package/dist/984.index.js +99 -0
- package/dist/App.d.ts +4 -0
- package/dist/cli.d.ts +1 -0
- package/dist/components/AgentStatus.d.ts +6 -0
- package/dist/components/Conversation.d.ts +11 -0
- package/dist/components/DiffView.d.ts +9 -0
- package/dist/components/EscapeClearIndicator.d.ts +3 -0
- package/dist/components/ExitIndicator.d.ts +3 -0
- package/dist/components/Footer.d.ts +3 -0
- package/dist/components/Input.d.ts +13 -0
- package/dist/components/Message.d.ts +11 -0
- package/dist/components/ShellConfirmation.d.ts +6 -0
- package/dist/components/ShellExecution.d.ts +9 -0
- package/dist/components/SplashScreen.d.ts +4 -0
- package/dist/components/ToolExecution.d.ts +8 -0
- package/dist/config.d.ts +8 -0
- package/dist/hooks/hooks.d.ts +5 -0
- package/dist/hooks/useAgent.d.ts +28 -0
- package/dist/hooks/useMagicCommands.d.ts +1 -0
- package/dist/index.js +112 -0
- package/dist/package.json +3 -0
- package/dist/services/versionCheck.d.ts +1 -0
- package/dist/services/websocketClient.d.ts +17 -0
- package/dist/tools/Edit.d.ts +14 -0
- package/dist/tools/FindFiles.d.ts +12 -0
- package/dist/tools/GoogleSearch.d.ts +9 -0
- package/dist/tools/ReadFile.d.ts +11 -0
- package/dist/tools/ReadFolder.d.ts +12 -0
- package/dist/tools/ReadManyFiles.d.ts +10 -0
- package/dist/tools/SaveMemory.d.ts +9 -0
- package/dist/tools/SearchText.d.ts +18 -0
- package/dist/tools/Shell.d.ts +11 -0
- package/dist/tools/WebFetch.d.ts +9 -0
- package/dist/tools/WriteFile.d.ts +10 -0
- package/dist/tools/WriteTodos.d.ts +9 -0
- package/dist/tools/index.d.ts +12 -0
- package/dist/tools/runShellCommandAsync.d.ts +2 -0
- package/dist/types/index.d.ts +116 -0
- package/dist/utils/display.d.ts +1 -0
- package/dist/utils/keyMatchers.d.ts +3 -0
- package/dist/utils/paths.d.ts +1 -0
- package/dist/utils/projectSpecLoader.d.ts +5 -0
- package/dist/utils/text-buffer.d.ts +25 -0
- package/package.json +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkCliVersion(): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BackendMessage, ClientMessage } from '../types/index.js';
|
|
2
|
+
type MessageHandler = (data: BackendMessage) => void;
|
|
3
|
+
declare class WebSocketClient {
|
|
4
|
+
private ws;
|
|
5
|
+
private messageHandler;
|
|
6
|
+
private sessionId;
|
|
7
|
+
private handshakeSent;
|
|
8
|
+
private isConnecting;
|
|
9
|
+
private connectionPromise;
|
|
10
|
+
private createSession;
|
|
11
|
+
private setupWebSocketConnection;
|
|
12
|
+
ensureConnected(): Promise<void>;
|
|
13
|
+
connect(messageHandler: MessageHandler): Promise<void>;
|
|
14
|
+
send(data: ClientMessage): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const websocketClient: WebSocketClient;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const Edit: (parameters: {
|
|
2
|
+
file_path: string;
|
|
3
|
+
old_string: string;
|
|
4
|
+
new_string: string;
|
|
5
|
+
expected_replacements?: number;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
success: boolean;
|
|
8
|
+
replacementsMade: number;
|
|
9
|
+
error?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
error: any;
|
|
12
|
+
success?: undefined;
|
|
13
|
+
replacementsMade?: undefined;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const ReadFolder: (parameters: {
|
|
2
|
+
dir_path: string;
|
|
3
|
+
ignore?: string[];
|
|
4
|
+
}) => Promise<{
|
|
5
|
+
llmContent: string;
|
|
6
|
+
returnDisplay: string;
|
|
7
|
+
error?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
error: any;
|
|
10
|
+
llmContent?: undefined;
|
|
11
|
+
returnDisplay?: undefined;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const SearchText: (parameters: {
|
|
2
|
+
pattern: string;
|
|
3
|
+
dir_path?: string;
|
|
4
|
+
include?: string;
|
|
5
|
+
case_sensitive?: boolean;
|
|
6
|
+
fixed_strings?: boolean;
|
|
7
|
+
context?: number;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
matches: ({
|
|
10
|
+
file: string;
|
|
11
|
+
line: any;
|
|
12
|
+
content: any;
|
|
13
|
+
} | null)[];
|
|
14
|
+
error?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
error: any;
|
|
17
|
+
matches?: undefined;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { ReadFile } from './ReadFile.js';
|
|
2
|
+
export { ReadFolder } from './ReadFolder.js';
|
|
3
|
+
export { Shell } from './Shell.js';
|
|
4
|
+
export { FindFiles } from './FindFiles.js';
|
|
5
|
+
export { SearchText } from './SearchText.js';
|
|
6
|
+
export { WriteFile } from './WriteFile.js';
|
|
7
|
+
export { Edit } from './Edit.js';
|
|
8
|
+
export { ReadManyFiles } from './ReadManyFiles.js';
|
|
9
|
+
export { SaveMemory } from './SaveMemory.js';
|
|
10
|
+
export { WebFetch } from './WebFetch.js';
|
|
11
|
+
export { GoogleSearch } from './GoogleSearch.js';
|
|
12
|
+
export { WriteTodos } from './WriteTodos.js';
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export interface ConversationMessage {
|
|
2
|
+
id: number;
|
|
3
|
+
sender: 'user' | 'agent' | 'tool' | 'agent_thought' | 'agent_error' | 'system';
|
|
4
|
+
text: string;
|
|
5
|
+
toolName?: string;
|
|
6
|
+
toolParams?: Record<string, any>;
|
|
7
|
+
status?: 'running' | 'finished';
|
|
8
|
+
stream?: {
|
|
9
|
+
status: 'streaming' | 'finished';
|
|
10
|
+
content?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface DiffViewPropsState {
|
|
14
|
+
oldContent: string;
|
|
15
|
+
newContent: string;
|
|
16
|
+
filePath: string;
|
|
17
|
+
onComplete: (action: 'accept' | 'reject' | 'edit', editedContent?: string) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface PendingShellCommand {
|
|
20
|
+
tool_name: string;
|
|
21
|
+
tool_id: string;
|
|
22
|
+
generation_id: string;
|
|
23
|
+
parameters: {
|
|
24
|
+
command: string;
|
|
25
|
+
dir_path?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface RunTool {
|
|
29
|
+
type: 'run_tool';
|
|
30
|
+
payload: {
|
|
31
|
+
tool_name: string;
|
|
32
|
+
tool_id: string;
|
|
33
|
+
generation_id: string;
|
|
34
|
+
parameters: Record<string, any>;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface ToolResult {
|
|
38
|
+
type: 'tool_result';
|
|
39
|
+
payload: {
|
|
40
|
+
tool_name: string;
|
|
41
|
+
tool_id: string;
|
|
42
|
+
generation_id: string;
|
|
43
|
+
status: 'success' | 'error';
|
|
44
|
+
result: any;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export interface ClientCancelGeneration {
|
|
48
|
+
type: 'client_cancel_generation';
|
|
49
|
+
payload: {
|
|
50
|
+
generation_id: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface AgentGenerationCancelled {
|
|
54
|
+
type: 'agent_generation_cancelled';
|
|
55
|
+
payload: {
|
|
56
|
+
generation_id: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface UserMessage {
|
|
60
|
+
type: 'user_message';
|
|
61
|
+
payload: {
|
|
62
|
+
prompt: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface MagicCommand {
|
|
66
|
+
type: 'magic_command';
|
|
67
|
+
payload: {
|
|
68
|
+
name: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export interface WriteTodosResponse {
|
|
72
|
+
llmContent: string;
|
|
73
|
+
returnDisplay: {
|
|
74
|
+
todos: {
|
|
75
|
+
description: string;
|
|
76
|
+
status: string;
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface HandshakeMessage {
|
|
81
|
+
type: 'handshake';
|
|
82
|
+
payload: {
|
|
83
|
+
client_type: 'cli';
|
|
84
|
+
known_tools: string[];
|
|
85
|
+
custom_tools: any[];
|
|
86
|
+
projectSpec: {
|
|
87
|
+
content: string;
|
|
88
|
+
filePaths: string[];
|
|
89
|
+
} | null;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export interface ClientCancelLast {
|
|
93
|
+
type: 'client_cancel_last';
|
|
94
|
+
payload: Record<string, never>;
|
|
95
|
+
}
|
|
96
|
+
export type ClientMessage = UserMessage | MagicCommand | ClientCancelGeneration | ClientCancelLast | ToolResult | HandshakeMessage;
|
|
97
|
+
export type BackendMessage = RunTool | AgentGenerationCancelled | {
|
|
98
|
+
type: 'agent_error';
|
|
99
|
+
payload: {
|
|
100
|
+
message: string;
|
|
101
|
+
details?: string;
|
|
102
|
+
};
|
|
103
|
+
} | {
|
|
104
|
+
type: 'agent_message_delta';
|
|
105
|
+
payload: {
|
|
106
|
+
content: string;
|
|
107
|
+
};
|
|
108
|
+
} | {
|
|
109
|
+
type: 'agent_thought';
|
|
110
|
+
payload: {
|
|
111
|
+
content: string;
|
|
112
|
+
};
|
|
113
|
+
} | {
|
|
114
|
+
type: 'agent_finished';
|
|
115
|
+
payload: Record<string, never>;
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getToolDisplayMessage: (toolName: string, parameters: any) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sanitizePath: (p?: string) => string | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare class TextBuffer {
|
|
2
|
+
private text;
|
|
3
|
+
private cursor;
|
|
4
|
+
constructor(initialValue?: string);
|
|
5
|
+
get value(): string;
|
|
6
|
+
get cursorPosition(): number;
|
|
7
|
+
insert(char: string): void;
|
|
8
|
+
insertText(text: string): void;
|
|
9
|
+
backspace(): void;
|
|
10
|
+
delete(): void;
|
|
11
|
+
moveCursorLeft(): void;
|
|
12
|
+
moveCursorRight(): void;
|
|
13
|
+
moveCursorToStart(): void;
|
|
14
|
+
moveCursorToEnd(): void;
|
|
15
|
+
private _getLines;
|
|
16
|
+
private _offsetToRowCol;
|
|
17
|
+
private _rowColToOffset;
|
|
18
|
+
getLineCount(): number;
|
|
19
|
+
getCursorRow(): number;
|
|
20
|
+
moveCursorUp(): void;
|
|
21
|
+
moveCursorDown(): void;
|
|
22
|
+
moveCursorWordLeft(): void;
|
|
23
|
+
moveCursorWordRight(): void;
|
|
24
|
+
clone(): TextBuffer;
|
|
25
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "stk-codegen",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A CLI executor for the autonomous agent.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"stk-codegen": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "vitest",
|
|
16
|
+
"start": "npm run build && node dist/index.js",
|
|
17
|
+
"build": "ncc build src/cli.tsx -o dist -m",
|
|
18
|
+
"prepare-publish": "rm -rf dist && npm run build && npm pack"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [],
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@joshua.litt/get-ripgrep": "^0.0.3",
|
|
26
|
+
"@types/inquirer": "^9.0.9",
|
|
27
|
+
"@types/tmp": "^0.2.6",
|
|
28
|
+
"axios": "^1.13.2",
|
|
29
|
+
"diff": "^8.0.2",
|
|
30
|
+
"glob": "^11.1.0",
|
|
31
|
+
"html-to-text": "^9.0.5",
|
|
32
|
+
"ink": "^5.0.0",
|
|
33
|
+
"ink-spinner": "^5.0.0",
|
|
34
|
+
"ink-text-input": "^6.0.0",
|
|
35
|
+
"inquirer": "^13.0.1",
|
|
36
|
+
"meow": "^11.0.0",
|
|
37
|
+
"open": "^11.0.0",
|
|
38
|
+
"react": "^18.2.0",
|
|
39
|
+
"serpapi": "^2.2.1",
|
|
40
|
+
"strip-ansi": "^7.1.2",
|
|
41
|
+
"tmp": "^0.2.5",
|
|
42
|
+
"ws": "^8.18.3"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@sindresorhus/tsconfig": "^3.0.1",
|
|
46
|
+
"@types/diff": "^7.0.2",
|
|
47
|
+
"@types/glob": "^8.1.0",
|
|
48
|
+
"@types/html-to-text": "^9.0.4",
|
|
49
|
+
"@types/ink-spinner": "^3.0.5",
|
|
50
|
+
"@types/react": "^18.0.32",
|
|
51
|
+
"@types/ws": "^8.18.1",
|
|
52
|
+
"@vercel/ncc": "^0.38.4",
|
|
53
|
+
"ink-testing-library": "^4.0.0",
|
|
54
|
+
"typescript": "^5.0.3",
|
|
55
|
+
"vitest": "^1.0.0"
|
|
56
|
+
}
|
|
57
|
+
}
|