Skip to content

Commit 87bd1e2

Browse files
authored
Merge branch 'main' into feat-splash-detection
2 parents e7e111b + 108ad48 commit 87bd1e2

File tree

24 files changed

+254
-3701
lines changed

24 files changed

+254
-3701
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## v0.11.1
4+
5+
### Features
6+
- Add tooltips for buttons
7+
- Autofocus message box on user's turn
8+
- Add msgfmt logic for amp module
9+
- Update msgfmt for latest version in opencode
10+
311
## v0.11.0
412

513
### Features

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AgentAPI
22

3-
Control [Claude Code](https://github.com/anthropics/claude-code), [AmazonQ](https://aws.amazon.com/developer/learning/q-developer-cli/), [Opencode](https://opencode.ai/), [Goose](https://github.com/block/goose), [Aider](https://github.com/Aider-AI/aider), [Gemini](https://github.com/google-gemini/gemini-cli), [GitHub Copilot](https://github.com/github/copilot-cli), [Sourcegraph Amp](https://github.com/sourcegraph/amp-cli), [Codex](https://github.com/openai/codex), [Auggie](https://docs.augmentcode.com/cli/overview), and [Cursor CLI](https://cursor.com/en/cli) with an HTTP API.
3+
Control [Claude Code](https://github.com/anthropics/claude-code), [AmazonQ](https://aws.amazon.com/developer/learning/q-developer-cli/), [Opencode](https://opencode.ai/), [Goose](https://github.com/block/goose), [Aider](https://github.com/Aider-AI/aider), [Gemini](https://github.com/google-gemini/gemini-cli), [GitHub Copilot](https://github.com/github/copilot-cli), [Sourcegraph Amp](https://ampcode.com/), [Codex](https://github.com/openai/codex), [Auggie](https://docs.augmentcode.com/cli/overview), and [Cursor CLI](https://cursor.com/en/cli) with an HTTP API.
44

55
![agentapi-chat](https://github.com/user-attachments/assets/57032c9f-4146-4b66-b219-09e38ab7690d)
66

chat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@
4848
"start": "next start",
4949
"storybook": "storybook dev -p 6006"
5050
},
51-
"version": "0.11.0"
51+
"version": "0.11.1"
5252
}

chat/src/components/message-input.tsx

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,18 @@ export default function MessageInput({
112112
return () => clearInterval(interval);
113113
}, [sentChars]);
114114

115+
// Autofocus on the message input box on user's turn
116+
useEffect(() => {
117+
if (
118+
serverStatus === "stable" &&
119+
!disabled &&
120+
inputMode === "text" &&
121+
textareaRef.current
122+
) {
123+
textareaRef.current.focus();
124+
}
125+
}, [serverStatus, disabled, inputMode]);
126+
115127
const addSentChar = (char: string) => {
116128
const newChar: SentChar = {
117129
char,
@@ -261,22 +273,25 @@ export default function MessageInput({
261273
</TabsList>
262274

263275
<div className={"flex flex-row gap-3"}>
264-
<Button
265-
type="submit"
266-
size="icon"
267-
className="rounded-full"
268-
onClick={handleUploadClick}
276+
{serverStatus !== "running" && <Button
277+
type="submit"
278+
size="icon"
279+
className="rounded-full"
280+
onClick={handleUploadClick}
281+
title={"Upload File"}
269282
>
270-
<Upload/>
271-
<span className="sr-only">Upload</span>
283+
<Upload/>
284+
<span className="sr-only">Upload</span>
272285
</Button>
286+
}
273287

274288
{inputMode === "text" && serverStatus !== "running" && (
275289
<Button
276290
type="submit"
277291
disabled={disabled || !message.trim()}
278292
size="icon"
279293
className="rounded-full"
294+
title={"Send Message"}
280295
>
281296
<SendIcon/>
282297
<span className="sr-only">Send</span>
@@ -291,6 +306,7 @@ export default function MessageInput({
291306
onClick={() => {
292307
onSendMessage(specialKeys.Escape, "raw");
293308
}}
309+
title={"Interrupt"}
294310
>
295311
<Square/>
296312
<span className="sr-only">Stop</span>
@@ -332,20 +348,20 @@ export default function MessageInput({
332348
);
333349
}
334350

335-
function Char({ char }: { char: string }) {
351+
function Char({char}: { char: string }) {
336352
switch (char) {
337353
case "ArrowUp":
338-
return <ArrowUpIcon className="h-4 w-4" />;
354+
return <ArrowUpIcon className="h-4 w-4"/>;
339355
case "ArrowDown":
340-
return <ArrowDownIcon className="h-4 w-4" />;
356+
return <ArrowDownIcon className="h-4 w-4"/>;
341357
case "ArrowRight":
342-
return <ArrowRightIcon className="h-4 w-4" />;
358+
return <ArrowRightIcon className="h-4 w-4"/>;
343359
case "ArrowLeft":
344-
return <ArrowLeftIcon className="h-4 w-4" />;
360+
return <ArrowLeftIcon className="h-4 w-4"/>;
345361
case "⏎":
346-
return <CornerDownLeftIcon className="h-4 w-4" />;
362+
return <CornerDownLeftIcon className="h-4 w-4"/>;
347363
case "Backspace":
348-
return <DeleteIcon className="h-4 w-4" />;
364+
return <DeleteIcon className="h-4 w-4"/>;
349365
default:
350366
return char;
351367
}

internal/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
package version
44

5-
var Version = "0.11.0"
5+
var Version = "0.11.1"

lib/msgfmt/message_box.go

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,40 @@ func removeCodexInputBox(msg string) string {
6363

6464
func removeOpencodeMessageBox(msg string) string {
6565
lines := strings.Split(msg, "\n")
66-
// Check the last 3 lines for
6766
//
68-
// ┃ ┃
69-
// ┃ > ┃
70-
// ┃ ┃
71-
// We only check for the first ┃ and then an empty line above it - as sometimes the full input block does not load within a snapshot,
72-
// this leads to displaying a bunch of newlines.
73-
for i := len(lines) - 1; i >= 2; i-- {
74-
if strings.ReplaceAll(lines[i-2], " ", "") != "┃┃" &&
75-
strings.ReplaceAll(lines[i], " ", "") == "┃┃" {
76-
lines = lines[:i-1]
67+
// ┃
68+
// ┃
69+
// ┃
70+
// ┃ Build Anthropic Claude Sonnet 4
71+
// ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
72+
// tab switch agent ctrl+p commands
73+
//
74+
for i := len(lines) - 1; i >= 4; i-- {
75+
if strings.HasPrefix(strings.TrimSpace(lines[i]), "╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀") {
76+
lines = lines[:i-4]
7777
break
7878
}
7979
}
8080
return strings.Join(lines, "\n")
8181
}
82+
83+
func removeAmpMessageBox(msg string) string {
84+
lines := strings.Split(msg, "\n")
85+
msgBoxEndFound := false
86+
msgBoxStartIdx := len(lines)
87+
for i := len(lines) - 1; i >= 0; i-- {
88+
line := strings.TrimSpace(lines[i])
89+
if !msgBoxEndFound && strings.HasPrefix(line, "╰") && strings.HasSuffix(line, "╯") {
90+
msgBoxEndFound = true
91+
}
92+
if msgBoxEndFound && strings.HasPrefix(line, "╭") && strings.HasSuffix(line, "╮") {
93+
msgBoxStartIdx = i
94+
break
95+
}
96+
}
97+
formattedMsg := strings.Join(lines[:msgBoxStartIdx], "\n")
98+
if len(formattedMsg) == 0 {
99+
return "Welcome to Amp"
100+
}
101+
return formattedMsg
102+
}

lib/msgfmt/msgfmt.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,13 @@ func formatOpencodeMessage(message string, userInput string) string {
268268
return message
269269
}
270270

271+
func formatAmpMessage(message string, userInput string) string {
272+
message = RemoveUserInput(message, userInput, AgentTypeAmp)
273+
message = removeAmpMessageBox(message)
274+
message = trimEmptyLines(message)
275+
return message
276+
}
277+
271278
func FormatAgentMessage(agentType AgentType, message string, userInput string) string {
272279
switch agentType {
273280
case AgentTypeClaude:
@@ -283,7 +290,7 @@ func FormatAgentMessage(agentType AgentType, message string, userInput string) s
283290
case AgentTypeCopilot:
284291
return formatGenericMessage(message, userInput, agentType)
285292
case AgentTypeAmp:
286-
return formatGenericMessage(message, userInput, agentType)
293+
return formatAmpMessage(message, userInput)
287294
case AgentTypeCursor:
288295
return formatGenericMessage(message, userInput, agentType)
289296
case AgentTypeAuggie:
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
Welcome to Amp
1+
..............
2+
.....:::::.......... Welcome to Amp
3+
....:::::::::::..........
4+
....::::----::::::::.......
5+
...::::---------:::::::::..... Ctrl+O to execute commands
6+
...::::------------:::::::::... Type @ to mention files
7+
....::----=======-----::::::::... Ctrl+C to exit
8+
...:::---==========-----::::::...
9+
...::---====++++====-----:::::...
10+
...::--====++++++====----:::::.. Use the amp: help command for more information
11+
..::---===++++++====----::::...
12+
..:::--====+++++====----:::...
13+
..:::---==========---::::.. Smart mode now uses Gemini 3 Pro.
14+
..:::----===-----::::...
15+
...::::----:::::...
16+
............
Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
1-
Welcome to Amp
21

3-
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
4-
│ │
5-
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
2+
3+
4+
5+
..............
6+
.....:::::.......... Welcome to Amp
7+
....:::::::::::..........
8+
....::::----::::::::.......
9+
...::::---------:::::::::..... Ctrl+O to execute commands
10+
...::::------------:::::::::... Type @ to mention files
11+
....::----=======-----::::::::... Ctrl+C to exit
12+
...:::---==========-----::::::...
13+
...::---====++++====-----:::::...
14+
...::--====++++++====----:::::.. Use the amp: help command for more information
15+
..::---===++++++====----::::...
16+
..:::--====+++++====----:::...
17+
..:::---==========---::::.. Smart mode now uses Gemini 3 Pro.
18+
..:::----===-----::::...
19+
...::::----:::::...
20+
............
21+
22+
23+
24+
25+
26+
╭─smart (click or Ctrl+S to switch)─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
27+
│ │
28+
│ │
29+
│ │
30+
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────~/Documents/work/agentapi (fix-amp-formatting)─╯
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
∴ Thinking
2-
The user is asking me to identify which file contains this specific TypeScript code snippet. The code shows a useEffect hook that sets up polling
3-
for messages and server status. I need to search for this code in the codebase to find the file it belongs to.
1+
✓ Thinking ▶
42

5-
I should use the Grep tool to search for some unique parts of this code to locate the file.
3+
Grep const messageInterval = setInterval\(fetchMessages, 1000
64

7-
✓ Grep Set up polling for messages and server status
5+
✓ Thinking ▶
86

9-
✓ Grep const messageInterval = setInterval\(fetchMessages, 1000\)
10-
11-
✓ List Directory /mnt/c/Users/Username/test-amp
12-
13-
No files found in the workspace containing this code.
7+
✓ Grep setInterval in chat

0 commit comments

Comments
 (0)