thatgfsj-code 0.4.1 → 0.5.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/dist/app/index.d.ts +6 -14
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +28 -30
- package/dist/app/index.js.map +1 -1
- package/dist/cmd/index.js +33 -25
- package/dist/cmd/index.js.map +1 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +0 -1
- package/dist/llm/index.js.map +1 -1
- package/dist/tui/output.d.ts +12 -3
- package/dist/tui/output.d.ts.map +1 -1
- package/dist/tui/output.js +43 -47
- package/dist/tui/output.js.map +1 -1
- package/dist/tui/repl.d.ts.map +1 -1
- package/dist/tui/repl.js +42 -28
- package/dist/tui/repl.js.map +1 -1
- package/dist/tui/welcome.js +1 -1
- package/package.json +1 -1
- package/src/app/index.ts +28 -33
- package/src/cmd/index.ts +26 -22
- package/src/llm/index.ts +0 -1
- package/src/tui/output.ts +43 -44
- package/src/tui/repl.ts +40 -29
- package/src/tui/welcome.ts +1 -1
- package/src/app/agent.ts +0 -140
package/dist/tui/repl.js
CHANGED
|
@@ -87,50 +87,64 @@ export class REPL {
|
|
|
87
87
|
let fullResponse = '';
|
|
88
88
|
let hasStartedOutput = false;
|
|
89
89
|
try {
|
|
90
|
-
const stream = this.app.
|
|
90
|
+
const stream = this.app.streamResponse();
|
|
91
91
|
for await (const chunk of stream) {
|
|
92
92
|
this.output.stopThinking();
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
// Check for structured tool messages
|
|
94
|
+
if (chunk.includes('@@TOOL@@')) {
|
|
95
|
+
const parts = chunk.split('\n');
|
|
96
|
+
for (const part of parts) {
|
|
97
|
+
if (part.startsWith('@@TOOL@@')) {
|
|
98
|
+
try {
|
|
99
|
+
const data = JSON.parse(part.slice(8));
|
|
100
|
+
if (data.action === 'call') {
|
|
101
|
+
if (hasStartedOutput) {
|
|
102
|
+
this.output.endAssistant();
|
|
103
|
+
hasStartedOutput = false;
|
|
104
|
+
}
|
|
105
|
+
this.output.printToolCall(data.name, data.args || '');
|
|
106
|
+
this.output.startExecuting(data.name);
|
|
107
|
+
}
|
|
108
|
+
else if (data.action === 'result') {
|
|
109
|
+
this.output.stopThinking();
|
|
110
|
+
this.output.printToolResult(data.output || data.error || '', !!data.error);
|
|
111
|
+
this.output.printToolEnd();
|
|
103
112
|
}
|
|
104
|
-
this.output.printToolCall(data.name, data.args || '');
|
|
105
|
-
// Show executing state
|
|
106
|
-
this.output.startExecuting(data.name);
|
|
107
113
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
catch {
|
|
115
|
+
// If parse fails, treat as regular text
|
|
116
|
+
if (part) {
|
|
117
|
+
if (!hasStartedOutput) {
|
|
118
|
+
this.output.beginAssistant();
|
|
119
|
+
hasStartedOutput = true;
|
|
120
|
+
}
|
|
121
|
+
this.output.writeChunk(part);
|
|
122
|
+
}
|
|
112
123
|
}
|
|
113
124
|
}
|
|
114
|
-
|
|
125
|
+
else if (part) {
|
|
126
|
+
// Regular text between tool messages
|
|
127
|
+
if (!hasStartedOutput) {
|
|
128
|
+
this.output.beginAssistant();
|
|
129
|
+
hasStartedOutput = true;
|
|
130
|
+
}
|
|
115
131
|
this.output.writeChunk(part + '\n');
|
|
116
132
|
}
|
|
117
|
-
continue;
|
|
118
133
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.output.writeChunk(part + '\n');
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
// Pure text chunk - just output it
|
|
137
|
+
if (!hasStartedOutput) {
|
|
138
|
+
this.output.beginAssistant();
|
|
139
|
+
hasStartedOutput = true;
|
|
126
140
|
}
|
|
141
|
+
this.output.writeChunk(chunk);
|
|
127
142
|
}
|
|
128
143
|
fullResponse += chunk;
|
|
129
144
|
}
|
|
130
145
|
if (hasStartedOutput) {
|
|
131
146
|
this.output.endAssistant();
|
|
132
147
|
}
|
|
133
|
-
// Don't save empty responses
|
|
134
148
|
if (fullResponse.trim()) {
|
|
135
149
|
this.app.session.addMessage('assistant', fullResponse);
|
|
136
150
|
this.app.session.truncate();
|
package/dist/tui/repl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repl.js","sourceRoot":"","sources":["../../src/tui/repl.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,OAAO,IAAI;IACP,KAAK,CAAY;IACjB,MAAM,CAAa;IACnB,GAAG,CAAM;IACT,OAAO,GAAG,KAAK,CAAC;IAExB,YAAY,GAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,SAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC/B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAE1B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE;YAC7B,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,CA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IAAI,CAAC,gBAAgB,EAAE,CAAC;wBACtB,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;wBAC7B,gBAAgB,GAAG,IAAI,CAAC;oBAC1B,CAAC;oBACD,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;gBAChC,CAAC;gBAED,YAAY,IAAI,KAAK,CAAC;YACxB,CAAC;YAED,IAAI,gBAAgB,EAAE,CAAC;gBACrB,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7B,CAAC;YAED,IAAI,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC;gBACxB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;gBACvD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,CAAC;QAEH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,gBAAgB,EAAE,CAAC;gBACrB,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7B,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;CACF"}
|
package/dist/tui/welcome.js
CHANGED
|
@@ -13,7 +13,7 @@ export class WelcomeScreen {
|
|
|
13
13
|
if (hasApiKey)
|
|
14
14
|
return;
|
|
15
15
|
console.log();
|
|
16
|
-
console.log(chalk.cyan.bold(' ⚡ Thatgfsj Code') + chalk.gray(' v0.
|
|
16
|
+
console.log(chalk.cyan.bold(' ⚡ Thatgfsj Code') + chalk.gray(' v0.5.0'));
|
|
17
17
|
console.log(chalk.gray(' AI Coding Assistant'));
|
|
18
18
|
console.log(line);
|
|
19
19
|
console.log();
|
package/package.json
CHANGED
package/src/app/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* App - Core application singleton
|
|
3
|
-
*
|
|
4
|
-
* Replaces the scattered initialization in old src/index.ts
|
|
3
|
+
* Simplified: directly uses LLMService (which has built-in agent loop)
|
|
5
4
|
*/
|
|
6
5
|
|
|
7
6
|
import { ConfigManager } from '../config/index.js';
|
|
@@ -10,8 +9,7 @@ import { SessionManager } from '../session/index.js';
|
|
|
10
9
|
import { ToolRegistry } from '../tools/index.js';
|
|
11
10
|
import { HookManager } from '../hooks/index.js';
|
|
12
11
|
import { SystemPromptBuilder } from '../prompts/index.js';
|
|
13
|
-
import {
|
|
14
|
-
import type { ChatMessage } from '../types.js';
|
|
12
|
+
import type { ChatMessage, ChatResponse } from '../types.js';
|
|
15
13
|
|
|
16
14
|
export class App {
|
|
17
15
|
config: ConfigManager;
|
|
@@ -20,7 +18,6 @@ export class App {
|
|
|
20
18
|
tools: ToolRegistry;
|
|
21
19
|
hooks: HookManager;
|
|
22
20
|
prompts: SystemPromptBuilder;
|
|
23
|
-
private agent: Agent;
|
|
24
21
|
|
|
25
22
|
private constructor(
|
|
26
23
|
config: ConfigManager,
|
|
@@ -29,7 +26,6 @@ export class App {
|
|
|
29
26
|
tools: ToolRegistry,
|
|
30
27
|
hooks: HookManager,
|
|
31
28
|
prompts: SystemPromptBuilder,
|
|
32
|
-
agent: Agent,
|
|
33
29
|
) {
|
|
34
30
|
this.config = config;
|
|
35
31
|
this.llm = llm;
|
|
@@ -37,18 +33,12 @@ export class App {
|
|
|
37
33
|
this.tools = tools;
|
|
38
34
|
this.hooks = hooks;
|
|
39
35
|
this.prompts = prompts;
|
|
40
|
-
this.agent = agent;
|
|
41
36
|
}
|
|
42
37
|
|
|
43
|
-
/**
|
|
44
|
-
* Create and initialize the App
|
|
45
|
-
*/
|
|
46
38
|
static async create(): Promise<App> {
|
|
47
|
-
// Load config
|
|
48
39
|
const config = await ConfigManager.load();
|
|
49
40
|
const aiConfig = config.getAIConfig();
|
|
50
41
|
|
|
51
|
-
// Create services
|
|
52
42
|
const llm = LLMService.fromConfig(aiConfig);
|
|
53
43
|
const session = new SessionManager();
|
|
54
44
|
const tools = new ToolRegistry();
|
|
@@ -59,13 +49,24 @@ export class App {
|
|
|
59
49
|
permissionMode: 'ask',
|
|
60
50
|
});
|
|
61
51
|
|
|
62
|
-
//
|
|
63
|
-
|
|
52
|
+
// Register tools with LLM service
|
|
53
|
+
llm.registerTools(tools.list());
|
|
64
54
|
|
|
65
55
|
// Set up system prompt
|
|
66
56
|
session.addMessage('system', prompts.build());
|
|
67
57
|
|
|
68
|
-
return new App(config, llm, session, tools, hooks, prompts
|
|
58
|
+
return new App(config, llm, session, tools, hooks, prompts);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Stream a response for the current session messages.
|
|
63
|
+
* The LLMService handles the full agent loop internally.
|
|
64
|
+
*/
|
|
65
|
+
async *streamResponse(messages?: ChatMessage[]): AsyncGenerator<string, void> {
|
|
66
|
+
const msgs = messages || this.session.getMessages();
|
|
67
|
+
for await (const chunk of this.llm.chatStream(msgs)) {
|
|
68
|
+
yield chunk;
|
|
69
|
+
}
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
/**
|
|
@@ -75,27 +76,21 @@ export class App {
|
|
|
75
76
|
this.session.addMessage('user', prompt);
|
|
76
77
|
|
|
77
78
|
let fullResponse = '';
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
try {
|
|
80
|
+
for await (const chunk of this.streamResponse()) {
|
|
81
|
+
process.stdout.write(chunk);
|
|
82
|
+
fullResponse += chunk;
|
|
83
|
+
}
|
|
84
|
+
} catch (err) {
|
|
85
|
+
// Re-throw after saving partial response
|
|
86
|
+
if (fullResponse) {
|
|
87
|
+
this.session.addMessage('assistant', fullResponse);
|
|
88
|
+
}
|
|
89
|
+
throw err;
|
|
81
90
|
}
|
|
82
91
|
|
|
83
|
-
console.log();
|
|
92
|
+
console.log();
|
|
84
93
|
this.session.addMessage('assistant', fullResponse);
|
|
85
94
|
return fullResponse;
|
|
86
95
|
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Get the agent for streaming control
|
|
90
|
-
*/
|
|
91
|
-
getAgent(): Agent {
|
|
92
|
-
return this.agent;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Get current config
|
|
97
|
-
*/
|
|
98
|
-
getConfig(): ConfigManager {
|
|
99
|
-
return this.config;
|
|
100
|
-
}
|
|
101
96
|
}
|
package/src/cmd/index.ts
CHANGED
|
@@ -40,7 +40,7 @@ process.on('unhandledRejection', (reason) => {
|
|
|
40
40
|
program
|
|
41
41
|
.name('gfcode')
|
|
42
42
|
.description('🤖 Thatgfsj Code - AI Coding Assistant')
|
|
43
|
-
.version('0.
|
|
43
|
+
.version('0.5.0')
|
|
44
44
|
.argument('[prompt]', 'Task to execute (omit to start interactive mode)')
|
|
45
45
|
.option('-m, --model <model>', 'Specify model')
|
|
46
46
|
.option('-i, --interactive', 'Force interactive mode')
|
|
@@ -82,32 +82,36 @@ program
|
|
|
82
82
|
let hasStarted = false;
|
|
83
83
|
|
|
84
84
|
try {
|
|
85
|
-
const stream = app.
|
|
85
|
+
const stream = app.streamResponse();
|
|
86
86
|
for await (const chunk of stream) {
|
|
87
87
|
out.stopThinking();
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
89
|
+
if (chunk.includes('@@TOOL@@')) {
|
|
90
|
+
const parts = chunk.split('\n');
|
|
91
|
+
for (const part of parts) {
|
|
92
|
+
if (part.startsWith('@@TOOL@@')) {
|
|
93
|
+
try {
|
|
94
|
+
const data = JSON.parse(part.slice(8));
|
|
95
|
+
if (data.action === 'call') {
|
|
96
|
+
if (hasStarted) { out.endAssistant(); hasStarted = false; }
|
|
97
|
+
out.printToolCall(data.name, data.args || '');
|
|
98
|
+
out.startExecuting(data.name);
|
|
99
|
+
} else if (data.action === 'result') {
|
|
100
|
+
out.stopThinking();
|
|
101
|
+
out.printToolResult(data.output || data.error || '', !!data.error);
|
|
102
|
+
out.printToolEnd();
|
|
103
|
+
}
|
|
104
|
+
} catch {}
|
|
105
|
+
} else if (part) {
|
|
106
|
+
if (!hasStarted) { out.beginAssistant(); hasStarted = true; }
|
|
107
|
+
out.writeChunk(part + '\n');
|
|
108
|
+
}
|
|
109
109
|
}
|
|
110
|
+
} else {
|
|
111
|
+
if (!hasStarted) { out.beginAssistant(); hasStarted = true; }
|
|
112
|
+
out.writeChunk(chunk);
|
|
110
113
|
}
|
|
114
|
+
|
|
111
115
|
fullResponse += chunk;
|
|
112
116
|
}
|
|
113
117
|
if (hasStarted) out.endAssistant();
|
package/src/llm/index.ts
CHANGED
|
@@ -91,7 +91,6 @@ export class LLMService {
|
|
|
91
91
|
let fullContent = '';
|
|
92
92
|
let detectedToolCalls: ToolCall[] | undefined;
|
|
93
93
|
|
|
94
|
-
// Stream the response, passing tools so the API knows about them
|
|
95
94
|
const stream = this.provider.chatStream(currentMessages, options, hasTools ? toolsArray : undefined);
|
|
96
95
|
|
|
97
96
|
for await (const chunk of stream) {
|
package/src/tui/output.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* REPL Output -
|
|
2
|
+
* REPL Output - Clean terminal UI
|
|
3
|
+
* Inspired by opencode: simple indentation for streaming, clean boundaries
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
import chalk from 'chalk';
|
|
@@ -7,14 +8,12 @@ import ora, { Ora } from 'ora';
|
|
|
7
8
|
|
|
8
9
|
export class REPLOutput {
|
|
9
10
|
private spinner: Ora | null = null;
|
|
10
|
-
private inAssistantBlock = false;
|
|
11
|
-
private currentLineHasContent = false;
|
|
12
11
|
|
|
13
12
|
// ── Banner ──────────────────────────────────────────────
|
|
14
13
|
|
|
15
14
|
printBanner(): void {
|
|
16
15
|
console.log();
|
|
17
|
-
console.log(chalk.cyan.bold(' ⚡ Thatgfsj Code') + chalk.gray(' v0.
|
|
16
|
+
console.log(chalk.cyan.bold(' ⚡ Thatgfsj Code') + chalk.gray(' v0.5.0'));
|
|
18
17
|
console.log(chalk.gray(' AI Coding Assistant'));
|
|
19
18
|
console.log(chalk.gray(' ' + '─'.repeat(52)));
|
|
20
19
|
console.log();
|
|
@@ -30,54 +29,54 @@ export class REPLOutput {
|
|
|
30
29
|
|
|
31
30
|
printUserInput(input: string): void {
|
|
32
31
|
console.log();
|
|
33
|
-
console.log(chalk.
|
|
32
|
+
console.log(chalk.bold(' You'));
|
|
33
|
+
console.log(chalk.gray(' ' + '─'.repeat(40)));
|
|
34
34
|
for (const line of input.split('\n')) {
|
|
35
|
-
console.log(
|
|
35
|
+
console.log(' ' + line);
|
|
36
36
|
}
|
|
37
|
-
console.log(
|
|
37
|
+
console.log();
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// ── Assistant Streaming ─────────────────────────────────
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Begin assistant response - just print the header
|
|
44
|
+
*/
|
|
42
45
|
beginAssistant(): void {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.currentLineHasContent = false;
|
|
46
|
-
console.log();
|
|
47
|
-
process.stdout.write(chalk.cyan(' ┌─ ') + chalk.bold('AI') + '\n' + chalk.cyan(' │ '));
|
|
46
|
+
console.log(chalk.bold(' AI'));
|
|
47
|
+
console.log(chalk.gray(' ' + '─'.repeat(40)));
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Write streaming chunk - output as-is with indent.
|
|
52
|
+
* The chunk already contains proper newlines from the AI.
|
|
53
|
+
*/
|
|
50
54
|
writeChunk(chunk: string): void {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
for (
|
|
54
|
-
if (
|
|
55
|
-
process.stdout.write('
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
process.stdout.write(
|
|
59
|
-
this.currentLineHasContent = true;
|
|
55
|
+
// Indent each line by 2 spaces
|
|
56
|
+
const lines = chunk.split('\n');
|
|
57
|
+
for (let i = 0; i < lines.length; i++) {
|
|
58
|
+
if (lines[i]) {
|
|
59
|
+
process.stdout.write(' ' + lines[i]);
|
|
60
|
+
}
|
|
61
|
+
if (i < lines.length - 1) {
|
|
62
|
+
process.stdout.write('\n');
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
|
|
67
|
+
/**
|
|
68
|
+
* End assistant response
|
|
69
|
+
*/
|
|
64
70
|
endAssistant(): void {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
process.stdout.write('\n');
|
|
68
|
-
}
|
|
69
|
-
process.stdout.write(chalk.cyan(' └─') + '\n\n');
|
|
70
|
-
this.inAssistantBlock = false;
|
|
71
|
-
this.currentLineHasContent = false;
|
|
71
|
+
process.stdout.write('\n');
|
|
72
|
+
console.log();
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
// ── Tool Calls ──────────────────────────────────────────
|
|
75
76
|
|
|
76
77
|
printToolCall(name: string, args: string): void {
|
|
77
|
-
if (this.inAssistantBlock) this.endAssistant();
|
|
78
|
-
|
|
79
78
|
console.log();
|
|
80
|
-
console.log(chalk.yellow(' ⚙ ') + chalk.bold(name)
|
|
79
|
+
console.log(chalk.yellow(' ⚙ ') + chalk.bold(name));
|
|
81
80
|
|
|
82
81
|
if (args) {
|
|
83
82
|
try {
|
|
@@ -85,15 +84,15 @@ export class REPLOutput {
|
|
|
85
84
|
for (const [key, val] of Object.entries(obj)) {
|
|
86
85
|
let display: string;
|
|
87
86
|
if (typeof val === 'string') {
|
|
88
|
-
display = val.length >
|
|
87
|
+
display = val.length > 100 ? val.slice(0, 100) + '...' : val;
|
|
89
88
|
} else {
|
|
90
89
|
display = JSON.stringify(val);
|
|
91
|
-
if (display.length >
|
|
90
|
+
if (display.length > 100) display = display.slice(0, 100) + '...';
|
|
92
91
|
}
|
|
93
|
-
console.log(chalk.gray(' ' + key + ': ') +
|
|
92
|
+
console.log(chalk.gray(' ' + key + ': ') + display);
|
|
94
93
|
}
|
|
95
94
|
} catch {
|
|
96
|
-
const display = args.length >
|
|
95
|
+
const display = args.length > 120 ? args.slice(0, 120) + '...' : args;
|
|
97
96
|
console.log(chalk.gray(' ') + display);
|
|
98
97
|
}
|
|
99
98
|
}
|
|
@@ -103,7 +102,7 @@ export class REPLOutput {
|
|
|
103
102
|
if (!output) return;
|
|
104
103
|
|
|
105
104
|
const lines = output.split('\n');
|
|
106
|
-
const maxLines =
|
|
105
|
+
const maxLines = 20;
|
|
107
106
|
const display = lines.slice(0, maxLines);
|
|
108
107
|
|
|
109
108
|
for (const line of display) {
|
|
@@ -120,7 +119,7 @@ export class REPLOutput {
|
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
printToolEnd(): void {
|
|
123
|
-
console.log(
|
|
122
|
+
console.log();
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
// ── Thinking ────────────────────────────────────────────
|
|
@@ -167,11 +166,11 @@ export class REPLOutput {
|
|
|
167
166
|
|
|
168
167
|
error(msg: string): void {
|
|
169
168
|
console.log();
|
|
170
|
-
console.log(chalk.red('
|
|
169
|
+
console.log(chalk.red(' Error'));
|
|
170
|
+
console.log(chalk.red(' ' + '─'.repeat(40)));
|
|
171
171
|
for (const line of msg.split('\n')) {
|
|
172
|
-
console.log(chalk.red('
|
|
172
|
+
console.log(chalk.red(' ') + line);
|
|
173
173
|
}
|
|
174
|
-
console.log(chalk.red(' └─'));
|
|
175
174
|
console.log();
|
|
176
175
|
}
|
|
177
176
|
|
|
@@ -202,9 +201,9 @@ export class REPLOutput {
|
|
|
202
201
|
section(title: string, items: Array<{ label: string; value: string }>): void {
|
|
203
202
|
console.log();
|
|
204
203
|
console.log(chalk.bold(' ' + title));
|
|
205
|
-
|
|
204
|
+
console.log(chalk.gray(' ' + '─'.repeat(40)));
|
|
206
205
|
for (const item of items) {
|
|
207
|
-
console.log(' ' + chalk.gray(item.label.padEnd(14)) +
|
|
206
|
+
console.log(' ' + chalk.gray(item.label.padEnd(14)) + item.value);
|
|
208
207
|
}
|
|
209
208
|
console.log();
|
|
210
209
|
}
|
|
@@ -214,7 +213,7 @@ export class REPLOutput {
|
|
|
214
213
|
printHelp(): void {
|
|
215
214
|
console.log();
|
|
216
215
|
console.log(chalk.bold(' Commands'));
|
|
217
|
-
|
|
216
|
+
console.log(chalk.gray(' ' + '─'.repeat(40)));
|
|
218
217
|
const cmds: [string, string][] = [
|
|
219
218
|
['help', 'Show this help'],
|
|
220
219
|
['tools', 'List available tools'],
|
|
@@ -227,7 +226,7 @@ export class REPLOutput {
|
|
|
227
226
|
}
|
|
228
227
|
console.log();
|
|
229
228
|
console.log(chalk.bold(' Keyboard'));
|
|
230
|
-
|
|
229
|
+
console.log(chalk.gray(' ' + '─'.repeat(40)));
|
|
231
230
|
console.log(' ' + chalk.cyan('↑ / ↓'.padEnd(14)) + chalk.gray('Browse command history'));
|
|
232
231
|
console.log(' ' + chalk.cyan('Tab'.padEnd(14)) + chalk.gray('Auto-complete'));
|
|
233
232
|
console.log(' ' + chalk.cyan('Ctrl+C'.padEnd(14)) + chalk.gray('Exit'));
|
package/src/tui/repl.ts
CHANGED
|
@@ -106,44 +106,56 @@ export class REPL {
|
|
|
106
106
|
let hasStartedOutput = false;
|
|
107
107
|
|
|
108
108
|
try {
|
|
109
|
-
const stream = this.app.
|
|
109
|
+
const stream = this.app.streamResponse();
|
|
110
110
|
|
|
111
111
|
for await (const chunk of stream) {
|
|
112
112
|
this.output.stopThinking();
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
// Check for structured tool messages
|
|
115
|
+
if (chunk.includes('@@TOOL@@')) {
|
|
116
|
+
const parts = chunk.split('\n');
|
|
117
|
+
for (const part of parts) {
|
|
118
|
+
if (part.startsWith('@@TOOL@@')) {
|
|
119
|
+
try {
|
|
120
|
+
const data = JSON.parse(part.slice(8));
|
|
121
|
+
if (data.action === 'call') {
|
|
122
|
+
if (hasStartedOutput) {
|
|
123
|
+
this.output.endAssistant();
|
|
124
|
+
hasStartedOutput = false;
|
|
125
|
+
}
|
|
126
|
+
this.output.printToolCall(data.name, data.args || '');
|
|
127
|
+
this.output.startExecuting(data.name);
|
|
128
|
+
} else if (data.action === 'result') {
|
|
129
|
+
this.output.stopThinking();
|
|
130
|
+
this.output.printToolResult(data.output || data.error || '', !!data.error);
|
|
131
|
+
this.output.printToolEnd();
|
|
124
132
|
}
|
|
125
|
-
|
|
126
|
-
//
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
} catch {
|
|
134
|
+
// If parse fails, treat as regular text
|
|
135
|
+
if (part) {
|
|
136
|
+
if (!hasStartedOutput) {
|
|
137
|
+
this.output.beginAssistant();
|
|
138
|
+
hasStartedOutput = true;
|
|
139
|
+
}
|
|
140
|
+
this.output.writeChunk(part);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
} else if (part) {
|
|
144
|
+
// Regular text between tool messages
|
|
145
|
+
if (!hasStartedOutput) {
|
|
146
|
+
this.output.beginAssistant();
|
|
147
|
+
hasStartedOutput = true;
|
|
132
148
|
}
|
|
133
|
-
} catch {
|
|
134
149
|
this.output.writeChunk(part + '\n');
|
|
135
150
|
}
|
|
136
|
-
continue;
|
|
137
151
|
}
|
|
138
|
-
|
|
139
|
-
//
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
hasStartedOutput = true;
|
|
144
|
-
}
|
|
145
|
-
this.output.writeChunk(part + '\n');
|
|
152
|
+
} else {
|
|
153
|
+
// Pure text chunk - just output it
|
|
154
|
+
if (!hasStartedOutput) {
|
|
155
|
+
this.output.beginAssistant();
|
|
156
|
+
hasStartedOutput = true;
|
|
146
157
|
}
|
|
158
|
+
this.output.writeChunk(chunk);
|
|
147
159
|
}
|
|
148
160
|
|
|
149
161
|
fullResponse += chunk;
|
|
@@ -153,7 +165,6 @@ export class REPL {
|
|
|
153
165
|
this.output.endAssistant();
|
|
154
166
|
}
|
|
155
167
|
|
|
156
|
-
// Don't save empty responses
|
|
157
168
|
if (fullResponse.trim()) {
|
|
158
169
|
this.app.session.addMessage('assistant', fullResponse);
|
|
159
170
|
this.app.session.truncate();
|
package/src/tui/welcome.ts
CHANGED
|
@@ -18,7 +18,7 @@ export class WelcomeScreen {
|
|
|
18
18
|
if (hasApiKey) return;
|
|
19
19
|
|
|
20
20
|
console.log();
|
|
21
|
-
console.log(chalk.cyan.bold(' ⚡ Thatgfsj Code') + chalk.gray(' v0.
|
|
21
|
+
console.log(chalk.cyan.bold(' ⚡ Thatgfsj Code') + chalk.gray(' v0.5.0'));
|
|
22
22
|
console.log(chalk.gray(' AI Coding Assistant'));
|
|
23
23
|
console.log(line);
|
|
24
24
|
console.log();
|