llm(三协议 Provider)/ session(JSONL 持久化)/ tools(Registry、围栏、 builtin、computer)/ cdp(browser)/ skills / mcp / agent(循环、两级压缩、 编排、审批门控)+ 底座 jsonl/textx/execx/diag/scratch/spill/imagecache。 产品装配代码(config 桥接、schedule 工具、memory/plan/retro/prompt) 留在 AutoGo,宿主接入方式见 MIGRATION.md。
39 lines
969 B
Go
39 lines
969 B
Go
//go:build darwin
|
|
|
|
package tools
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestOSAQuote(t *testing.T) {
|
|
if got := osaQuote(`he said "hi" \ ok`); got != `"he said \"hi\" \\ ok"` {
|
|
t.Fatalf("osaQuote: %q", got)
|
|
}
|
|
}
|
|
|
|
func TestOSAKeyChord(t *testing.T) {
|
|
cases := map[string]string{
|
|
"enter": "key code 36",
|
|
"cmd+c": `keystroke "c" using {command down}`,
|
|
"cmd+shift+t": "keystroke \"t\" using {command down, shift down}",
|
|
"pageup": "key code 116",
|
|
"ctrl+alt+delete": "key code 51 using {control down, option down}",
|
|
"fn+left": "key code 123 using {fn down}",
|
|
}
|
|
for in, want := range cases {
|
|
got, err := osaKeyChord(in)
|
|
if err != nil {
|
|
t.Fatalf("%s: %v", in, err)
|
|
}
|
|
if got != want {
|
|
t.Fatalf("%s: got %q want %q", in, got, want)
|
|
}
|
|
}
|
|
for _, bad := range []string{"", "cmd", "cmd+a+b", "cmd+notaoption+q", "foo"} {
|
|
if _, err := osaKeyChord(bad); err == nil {
|
|
t.Fatalf("%q should be rejected", bad)
|
|
}
|
|
}
|
|
}
|