@musashishao/agent-kit 1.11.1 → 1.11.2
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.
|
@@ -43,7 +43,7 @@ def get_platform_info() -> Dict[str, Path]:
|
|
|
43
43
|
"vscode_config": home / ".vscode/mcp.json",
|
|
44
44
|
"agent_kit_config": cwd / ".agent/mcp/config/mcp-config.json",
|
|
45
45
|
"antigravity_config": home / ".gemini/antigravity/mcp_config.json",
|
|
46
|
-
"codex_config": home / ".codex/
|
|
46
|
+
"codex_config": home / ".codex/config.toml", # Codex uses TOML format
|
|
47
47
|
"python_exe": "python",
|
|
48
48
|
"pip_exe": "pip",
|
|
49
49
|
}
|
|
@@ -56,7 +56,7 @@ def get_platform_info() -> Dict[str, Path]:
|
|
|
56
56
|
"vscode_config": home / ".vscode/mcp.json",
|
|
57
57
|
"agent_kit_config": cwd / ".agent/mcp/config/mcp-config.json",
|
|
58
58
|
"antigravity_config": Path(os.environ.get("LOCALAPPDATA", home)) / "Google/Antigravity/mcp_config.json",
|
|
59
|
-
"codex_config": Path(os.environ.get("LOCALAPPDATA", home)) / "Codex/
|
|
59
|
+
"codex_config": Path(os.environ.get("LOCALAPPDATA", home)) / "Codex/config.toml", # Codex uses TOML
|
|
60
60
|
"python_exe": "python.exe",
|
|
61
61
|
"pip_exe": "pip.exe",
|
|
62
62
|
}
|
|
@@ -231,6 +231,65 @@ def update_json_config(file_path: Path, server_name: str, config_data: Dict) ->
|
|
|
231
231
|
return False
|
|
232
232
|
|
|
233
233
|
|
|
234
|
+
def update_toml_config(file_path: Path, server_name: str, python_path: str, wrapper_path: str, profile: str) -> bool:
|
|
235
|
+
"""Update a TOML config file with server config (for Codex CLI)."""
|
|
236
|
+
try:
|
|
237
|
+
file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
238
|
+
|
|
239
|
+
# Read existing content
|
|
240
|
+
lines = []
|
|
241
|
+
if file_path.exists():
|
|
242
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
243
|
+
lines = f.readlines()
|
|
244
|
+
|
|
245
|
+
# Check if server already exists
|
|
246
|
+
server_header = f'[mcp_servers.{server_name}]'
|
|
247
|
+
server_exists = any(server_header in line for line in lines)
|
|
248
|
+
|
|
249
|
+
if server_exists:
|
|
250
|
+
# Remove existing server config
|
|
251
|
+
new_lines = []
|
|
252
|
+
skip_section = False
|
|
253
|
+
for line in lines:
|
|
254
|
+
if server_header in line:
|
|
255
|
+
skip_section = True
|
|
256
|
+
continue
|
|
257
|
+
elif skip_section and line.strip().startswith('['):
|
|
258
|
+
skip_section = False
|
|
259
|
+
|
|
260
|
+
if not skip_section:
|
|
261
|
+
new_lines.append(line)
|
|
262
|
+
lines = new_lines
|
|
263
|
+
|
|
264
|
+
# Build TOML config for server
|
|
265
|
+
# Escape backslashes for Windows paths
|
|
266
|
+
py_path_escaped = python_path.replace('\\', '\\\\')
|
|
267
|
+
wrapper_escaped = wrapper_path.replace('\\', '\\\\')
|
|
268
|
+
|
|
269
|
+
toml_config = f'''
|
|
270
|
+
[mcp_servers.{server_name}]
|
|
271
|
+
command = "{py_path_escaped}"
|
|
272
|
+
args = ["-u", "-W", "ignore", "{wrapper_escaped}"]
|
|
273
|
+
env = {{ "PYTHONUNBUFFERED" = "1", "PYTHONWARNINGS" = "ignore", "NOTEBOOKLM_PROFILE" = "{profile}" }}
|
|
274
|
+
startup_timeout_sec = 60
|
|
275
|
+
'''
|
|
276
|
+
|
|
277
|
+
# Append new config
|
|
278
|
+
content = ''.join(lines)
|
|
279
|
+
if not content.endswith('\n'):
|
|
280
|
+
content += '\n'
|
|
281
|
+
content += toml_config
|
|
282
|
+
|
|
283
|
+
with open(file_path, 'w', encoding='utf-8') as f:
|
|
284
|
+
f.write(content)
|
|
285
|
+
|
|
286
|
+
return True
|
|
287
|
+
|
|
288
|
+
except Exception as e:
|
|
289
|
+
print(f" ⚠️ Không thể cập nhật {file_path.name}: {e}")
|
|
290
|
+
return False
|
|
291
|
+
|
|
292
|
+
|
|
234
293
|
def run_auth_check(python_path: str) -> bool:
|
|
235
294
|
"""Check if NotebookLM auth is configured."""
|
|
236
295
|
try:
|
|
@@ -310,15 +369,15 @@ def main():
|
|
|
310
369
|
# 8. Update client configs
|
|
311
370
|
print("\n🔗 Đang cấu hình các app AI...")
|
|
312
371
|
|
|
313
|
-
|
|
372
|
+
# JSON-based configs
|
|
373
|
+
json_configs = [
|
|
314
374
|
(platform_info["claude_config"], "notebooklm-mcp", "Claude"),
|
|
315
375
|
(platform_info["cursor_config"], "notebooklm-mcp", "Cursor"),
|
|
316
376
|
(platform_info["vscode_config"], "notebooklm-mcp", "VS Code"),
|
|
317
377
|
(platform_info.get("antigravity_config"), "notebooklm", "Antigravity"),
|
|
318
|
-
(platform_info.get("codex_config"), "notebooklm", "Codex"),
|
|
319
378
|
]
|
|
320
379
|
|
|
321
|
-
for config_path, server_name, app_name in
|
|
380
|
+
for config_path, server_name, app_name in json_configs:
|
|
322
381
|
if not config_path:
|
|
323
382
|
continue
|
|
324
383
|
if update_json_config(config_path, server_name, server_config):
|
|
@@ -326,6 +385,14 @@ def main():
|
|
|
326
385
|
else:
|
|
327
386
|
print(f" ⚠️ {app_name} (bỏ qua)")
|
|
328
387
|
|
|
388
|
+
# TOML-based configs (Codex CLI)
|
|
389
|
+
codex_config = platform_info.get("codex_config")
|
|
390
|
+
if codex_config:
|
|
391
|
+
if update_toml_config(codex_config, "notebooklm", python_path, wrapper_path, profile):
|
|
392
|
+
print(f" ✅ Codex CLI")
|
|
393
|
+
else:
|
|
394
|
+
print(f" ⚠️ Codex CLI (bỏ qua)")
|
|
395
|
+
|
|
329
396
|
# 9. Update Agent Kit config
|
|
330
397
|
ak_config = platform_info["agent_kit_config"]
|
|
331
398
|
if ak_config.exists():
|