@agent-webui/ai-desk-daemon 1.0.30 → 1.0.32
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/README.md +22 -4
- package/bin/cli.js +78 -5
- package/lib/cli-anything-manager.js +218 -0
- package/lib/config.js +66 -10
- package/lib/daemon-manager.js +1 -2
- package/lib/harness-manager.js +178 -0
- package/lib/platform.js +71 -3
- package/lib/runtime-manager.js +320 -0
- package/lib/workspace-packages.js +172 -0
- package/package.json +20 -6
- package/python-runtime/cli_anything/__init__.py +3 -0
- package/python-runtime/cli_anything/__main__.py +5 -0
- package/python-runtime/cli_anything/_compat.py +195 -0
- package/python-runtime/cli_anything/analyze.py +10 -0
- package/python-runtime/cli_anything/design.py +10 -0
- package/python-runtime/cli_anything/generate.py +10 -0
- package/python-runtime/cli_anything/map.py +10 -0
- package/python-runtime/cli_anything/model.py +10 -0
- package/python-runtime/setup.py +14 -0
- package/scripts/postinstall.js +23 -4
- package/dist/darwin-arm64/ai-desk-daemon +0 -0
- package/dist/darwin-x64/ai-desk-daemon +0 -0
- package/dist/linux-arm64/ai-desk-daemon +0 -0
- package/dist/linux-x64/ai-desk-daemon +0 -0
- package/dist/win32-x64/ai-desk-daemon.exe +0 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
KNOWN_AI_CLIS = [
|
|
11
|
+
{
|
|
12
|
+
"name": "Claude CLI",
|
|
13
|
+
"type": "claude",
|
|
14
|
+
"commands": ["claude"],
|
|
15
|
+
"capabilities": ["chat", "completion"],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Gemini CLI",
|
|
19
|
+
"type": "gemini",
|
|
20
|
+
"commands": ["gemini"],
|
|
21
|
+
"capabilities": ["chat", "completion"],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "Cursor Agent CLI",
|
|
25
|
+
"type": "cursor",
|
|
26
|
+
"commands": ["agent", "cursor-agent"],
|
|
27
|
+
"capabilities": ["chat", "completion"],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "Codex CLI",
|
|
31
|
+
"type": "codex",
|
|
32
|
+
"commands": ["codex"],
|
|
33
|
+
"capabilities": ["chat", "completion"],
|
|
34
|
+
},
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _resolve_command(commands):
|
|
39
|
+
for command in commands:
|
|
40
|
+
path = shutil.which(command)
|
|
41
|
+
if path:
|
|
42
|
+
return command, path
|
|
43
|
+
return "", ""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _read_version(path):
|
|
47
|
+
for flag in ("--version", "-v", "version"):
|
|
48
|
+
try:
|
|
49
|
+
result = subprocess.run(
|
|
50
|
+
[path, flag],
|
|
51
|
+
capture_output=True,
|
|
52
|
+
text=True,
|
|
53
|
+
timeout=2,
|
|
54
|
+
check=False,
|
|
55
|
+
)
|
|
56
|
+
except Exception:
|
|
57
|
+
continue
|
|
58
|
+
|
|
59
|
+
output = (result.stdout or result.stderr or "").strip()
|
|
60
|
+
if output:
|
|
61
|
+
return output.splitlines()[0][:200]
|
|
62
|
+
return ""
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _detect_known_ai_clis():
|
|
66
|
+
clis = []
|
|
67
|
+
for item in KNOWN_AI_CLIS:
|
|
68
|
+
command, path = _resolve_command(item["commands"])
|
|
69
|
+
if not path:
|
|
70
|
+
continue
|
|
71
|
+
clis.append(
|
|
72
|
+
{
|
|
73
|
+
"name": item["name"],
|
|
74
|
+
"type": item["type"],
|
|
75
|
+
"command": command,
|
|
76
|
+
"path": path,
|
|
77
|
+
"version": _read_version(path),
|
|
78
|
+
"capabilities": item["capabilities"],
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
return clis
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _detect_cli_anything_tools():
|
|
85
|
+
tools = []
|
|
86
|
+
seen = set()
|
|
87
|
+
for path_entry in os.environ.get("PATH", "").split(os.pathsep):
|
|
88
|
+
if not path_entry:
|
|
89
|
+
continue
|
|
90
|
+
path = Path(path_entry)
|
|
91
|
+
if not path.exists() or not path.is_dir():
|
|
92
|
+
continue
|
|
93
|
+
for entry in path.iterdir():
|
|
94
|
+
name = entry.name
|
|
95
|
+
if not name.startswith("cli-anything-"):
|
|
96
|
+
continue
|
|
97
|
+
if not entry.is_file() or not os.access(entry, os.X_OK):
|
|
98
|
+
continue
|
|
99
|
+
if name in seen:
|
|
100
|
+
continue
|
|
101
|
+
seen.add(name)
|
|
102
|
+
software_name = name[len("cli-anything-") :]
|
|
103
|
+
tools.append(
|
|
104
|
+
{
|
|
105
|
+
"name": f"CLI-Anything: {software_name.title()}",
|
|
106
|
+
"type": "cli-anything",
|
|
107
|
+
"command": name,
|
|
108
|
+
"path": str(entry),
|
|
109
|
+
"version": _read_version(str(entry)),
|
|
110
|
+
"capabilities": [],
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
return tools
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def cmd_detect(args):
|
|
117
|
+
if args.detect_type != "ai-cli":
|
|
118
|
+
raise SystemExit("only '--type ai-cli' is supported by the bundled runtime")
|
|
119
|
+
|
|
120
|
+
clis = _detect_known_ai_clis() + _detect_cli_anything_tools()
|
|
121
|
+
|
|
122
|
+
if args.name:
|
|
123
|
+
for cli in clis:
|
|
124
|
+
if cli["type"] == args.name or cli["command"] == args.name:
|
|
125
|
+
print(json.dumps(cli))
|
|
126
|
+
return 0
|
|
127
|
+
|
|
128
|
+
print(
|
|
129
|
+
json.dumps(
|
|
130
|
+
{
|
|
131
|
+
"name": args.name.title(),
|
|
132
|
+
"type": args.name,
|
|
133
|
+
"path": "",
|
|
134
|
+
"version": "",
|
|
135
|
+
"capabilities": [],
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
)
|
|
139
|
+
return 0
|
|
140
|
+
|
|
141
|
+
print(json.dumps({"clis": clis}))
|
|
142
|
+
return 0
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def cmd_list_models(args):
|
|
146
|
+
sys.stderr.write(
|
|
147
|
+
"bundled cli_anything runtime does not implement model discovery; "
|
|
148
|
+
"AI Desk daemon should fall back to native model listing\n"
|
|
149
|
+
)
|
|
150
|
+
return 2
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def cmd_execute(args):
|
|
154
|
+
command = shutil.which(args.cli) or args.cli
|
|
155
|
+
if not shutil.which(args.cli) and not os.path.isabs(args.cli):
|
|
156
|
+
sys.stderr.write(f'command not found: {args.cli}\n')
|
|
157
|
+
return 127
|
|
158
|
+
|
|
159
|
+
child_args = list(args.command_args or [])
|
|
160
|
+
if child_args and child_args[0] == "--":
|
|
161
|
+
child_args = child_args[1:]
|
|
162
|
+
|
|
163
|
+
proc = subprocess.Popen([command] + child_args, cwd=args.cwd or None)
|
|
164
|
+
return proc.wait()
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def build_parser():
|
|
168
|
+
parser = argparse.ArgumentParser(prog="cli-anything")
|
|
169
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
170
|
+
|
|
171
|
+
detect_parser = subparsers.add_parser("detect")
|
|
172
|
+
detect_parser.add_argument("--type", dest="detect_type", required=True)
|
|
173
|
+
detect_parser.add_argument("--format", default="json")
|
|
174
|
+
detect_parser.add_argument("--name")
|
|
175
|
+
detect_parser.set_defaults(handler=cmd_detect)
|
|
176
|
+
|
|
177
|
+
list_models_parser = subparsers.add_parser("list-models")
|
|
178
|
+
list_models_parser.add_argument("--cli", required=True)
|
|
179
|
+
list_models_parser.add_argument("--format", default="json")
|
|
180
|
+
list_models_parser.set_defaults(handler=cmd_list_models)
|
|
181
|
+
|
|
182
|
+
execute_parser = subparsers.add_parser("execute")
|
|
183
|
+
execute_parser.add_argument("--cli", required=True)
|
|
184
|
+
execute_parser.add_argument("--cwd", default="")
|
|
185
|
+
execute_parser.add_argument("--stream", action="store_true")
|
|
186
|
+
execute_parser.add_argument("command_args", nargs=argparse.REMAINDER)
|
|
187
|
+
execute_parser.set_defaults(handler=cmd_execute)
|
|
188
|
+
|
|
189
|
+
return parser
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def main(argv=None):
|
|
193
|
+
parser = build_parser()
|
|
194
|
+
args = parser.parse_args(argv)
|
|
195
|
+
return args.handler(args)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from setuptools import find_packages, setup
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
setup(
|
|
5
|
+
name="ai-desk-cli-anything-runtime",
|
|
6
|
+
version="0.1.0",
|
|
7
|
+
description="Compatibility runtime used by AI Desk daemon for CLI-Anything mode",
|
|
8
|
+
packages=find_packages(),
|
|
9
|
+
entry_points={
|
|
10
|
+
"console_scripts": [
|
|
11
|
+
"cli-anything=cli_anything.__main__:main",
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
)
|
package/scripts/postinstall.js
CHANGED
|
@@ -7,10 +7,29 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const chalk = require('chalk');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const { ensureRuntime } = require('../lib/runtime-manager');
|
|
12
|
+
const { installHarnessesForPackageRoot } = require('../lib/harness-manager');
|
|
13
|
+
const { syncCLIAnythingConfig } = require('../lib/cli-anything-manager');
|
|
10
14
|
|
|
11
15
|
console.log('');
|
|
12
|
-
console.log(chalk.green('✓ @agent-webui/ai-desk-daemon installed successfully'));
|
|
13
|
-
console.log('');
|
|
14
|
-
console.log('Run ' + chalk.cyan('aidesk --help') + ' to get started');
|
|
15
|
-
console.log('');
|
|
16
16
|
|
|
17
|
+
try {
|
|
18
|
+
const cliAnything = syncCLIAnythingConfig(path.join(__dirname, '..'));
|
|
19
|
+
const runtime = ensureRuntime();
|
|
20
|
+
const installResult = installHarnessesForPackageRoot(path.join(__dirname, '..'));
|
|
21
|
+
|
|
22
|
+
console.log(chalk.green('✓ @agent-webui/ai-desk-daemon installed successfully'));
|
|
23
|
+
console.log(chalk.cyan(`Runtime: ${runtime.pythonPath}`));
|
|
24
|
+
if (cliAnything.runtimeInfo?.cliAnythingPath) {
|
|
25
|
+
console.log(chalk.cyan(`CLI-Anything runtime: ${cliAnything.runtimeInfo.cliAnythingPath}`));
|
|
26
|
+
}
|
|
27
|
+
console.log(chalk.cyan(`Harnesses installed: ${installResult.harnessCount}`));
|
|
28
|
+
console.log('');
|
|
29
|
+
console.log('Run ' + chalk.cyan('aidesk --help') + ' to get started');
|
|
30
|
+
console.log('');
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.log(chalk.yellow('! AI Desk daemon installed with runtime warnings'));
|
|
33
|
+
console.log(chalk.yellow(error.message));
|
|
34
|
+
console.log('');
|
|
35
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|