-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathversion.go
More file actions
24 lines (18 loc) · 763 Bytes
/
Copy pathversion.go
File metadata and controls
24 lines (18 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package mcode
import (
"context"
"errors"
"fmt"
"github.com/MiniMax-AI/OpenAgentCore/apps/daemon/internal/agent/binpath"
"github.com/MiniMax-AI/OpenAgentCore/apps/daemon/internal/agent/versionprobe"
)
var ErrCLINotFound = errors.New("mcode CLI not found")
const SupportedVersion = "0.4.12"
func defaultBinary() string { return binpath.MCode() }
func CheckCLIAvailable(ctx context.Context, binary string) (string, error) {
version, err := versionprobe.Check(ctx, binary, versionprobe.Config{Name: "mcode", DefaultBinary: defaultBinary(), MissingError: ErrCLINotFound, TrimBinary: true})
if err == nil && version != SupportedVersion {
err = fmt.Errorf("mcode: unsupported version %s; install %s", version, SupportedVersion)
}
return version, err
}