bone-agent 1.3.2 → 1.4.0

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.
Files changed (87) hide show
  1. package/README.md +19 -2
  2. package/config.yaml.example +13 -2
  3. package/package.json +3 -2
  4. package/prompts/main/ask_questions.md +31 -0
  5. package/prompts/main/batch_independent_calls.md +5 -0
  6. package/prompts/main/casual_interactions.md +11 -0
  7. package/prompts/main/code_references.md +8 -0
  8. package/prompts/main/communication_style.md +12 -0
  9. package/prompts/main/context_reliability.md +12 -0
  10. package/prompts/main/conversational_tool_calling.md +15 -0
  11. package/prompts/main/dream.md +50 -0
  12. package/prompts/main/editing_pattern.md +13 -0
  13. package/prompts/main/error_handling.md +6 -0
  14. package/prompts/main/exploration_pattern.md +21 -0
  15. package/prompts/main/intro.md +1 -0
  16. package/prompts/main/obsidian.md +16 -0
  17. package/prompts/main/obsidian_project.md +79 -0
  18. package/prompts/main/professional_objectivity.md +3 -0
  19. package/prompts/main/skills.md +3 -0
  20. package/prompts/main/targeted_searching.md +10 -0
  21. package/prompts/main/task_lists_pattern.md +8 -0
  22. package/prompts/main/temp_folder.md +9 -0
  23. package/prompts/main/think_before_acting.md +10 -0
  24. package/prompts/main/tone_and_style.md +4 -0
  25. package/prompts/main/tool_preferences.md +24 -0
  26. package/prompts/main/trust_subagent_context.md +21 -0
  27. package/prompts/main/when_to_use_sub_agent.md +7 -0
  28. package/prompts/micro/ask_questions.md +1 -0
  29. package/prompts/micro/batch_independent_calls.md +1 -0
  30. package/prompts/micro/casual_interactions.md +1 -0
  31. package/prompts/micro/code_references.md +1 -0
  32. package/prompts/micro/communication_style.md +1 -0
  33. package/prompts/micro/context_reliability.md +1 -0
  34. package/prompts/micro/conversational_tool_calling.md +1 -0
  35. package/prompts/micro/editing_pattern.md +1 -0
  36. package/prompts/micro/error_handling.md +1 -0
  37. package/prompts/micro/exploration_pattern.md +1 -0
  38. package/prompts/micro/intro.md +1 -0
  39. package/prompts/micro/obsidian.md +4 -0
  40. package/prompts/micro/obsidian_project.md +5 -0
  41. package/prompts/micro/professional_objectivity.md +1 -0
  42. package/prompts/micro/skills.md +1 -0
  43. package/prompts/micro/targeted_searching.md +1 -0
  44. package/prompts/micro/task_lists_pattern.md +1 -0
  45. package/prompts/micro/temp_folder.md +1 -0
  46. package/prompts/micro/think_before_acting.md +5 -0
  47. package/prompts/micro/tone_and_style.md +1 -0
  48. package/prompts/micro/tool_preferences.md +1 -0
  49. package/prompts/micro/trust_subagent_context.md +1 -0
  50. package/prompts/micro/when_to_use_sub_agent.md +1 -0
  51. package/src/core/agentic.py +134 -106
  52. package/src/core/chat_manager.py +60 -12
  53. package/src/core/config_manager.py +14 -1
  54. package/src/core/cron.py +57 -6
  55. package/src/core/memory.py +3 -90
  56. package/src/core/metadata.py +75 -0
  57. package/src/core/skills.py +463 -0
  58. package/src/core/sub_agent.py +93 -43
  59. package/src/core/tool_feedback.py +87 -76
  60. package/src/llm/client.py +7 -2
  61. package/src/llm/codex_provider.py +350 -0
  62. package/src/llm/config.py +74 -4
  63. package/src/llm/prompts.py +261 -502
  64. package/src/llm/providers.py +28 -7
  65. package/src/llm/token_tracker.py +32 -1
  66. package/src/tools/__init__.py +24 -85
  67. package/src/tools/create_file.py +1 -1
  68. package/src/tools/directory.py +1 -1
  69. package/src/tools/edit.py +13 -7
  70. package/src/tools/file_reader.py +1 -1
  71. package/src/tools/helpers/__init__.py +1 -7
  72. package/src/tools/helpers/base.py +65 -16
  73. package/src/tools/helpers/loader.py +2 -88
  74. package/src/tools/helpers/path_resolver.py +70 -13
  75. package/src/tools/helpers/plugin_manifest.py +99 -70
  76. package/src/tools/review_sub_agent.py +2 -1
  77. package/src/tools/rg_search.py +119 -35
  78. package/src/tools/search_plugins.py +140 -72
  79. package/src/tools/shell.py +3 -3
  80. package/src/ui/commands.py +470 -33
  81. package/src/ui/displays.py +27 -1
  82. package/src/ui/main.py +1 -4
  83. package/src/ui/tool_confirmation.py +16 -5
  84. package/src/utils/editor.py +88 -39
  85. package/src/utils/settings.py +25 -4
  86. package/src/utils/user_message_logger.py +120 -0
  87. package/src/utils/validation.py +10 -0
package/src/llm/config.py CHANGED
@@ -32,6 +32,7 @@ ENV_API_KEYS = {
32
32
  'MINIMAX_PLAN_API_KEY': os.environ.get('MINIMAX_PLAN_API_KEY'),
33
33
  'MINIMAX_API_KEY': os.environ.get('MINIMAX_API_KEY'),
34
34
  'BONE_PROXY_API_KEY': os.environ.get('BONE_PROXY_API_KEY'),
35
+ 'CODEX_PLAN_API_KEY': os.environ.get('CODEX_PLAN_API_KEY'),
35
36
  }
36
37
 
37
38
  # Detect platform for llama.cpp paths
@@ -73,6 +74,24 @@ def _load_config():
73
74
 
74
75
  _CONFIG = _load_config()
75
76
 
77
+
78
+ def _get_codex_token() -> str:
79
+ """Read access token from Codex CLI's cached auth (~/.codex/auth.json).
80
+
81
+ Returns the access_token if available, empty string otherwise.
82
+ Codex CLI stores OAuth tokens here after `codex login`.
83
+ """
84
+ try:
85
+ auth_path = Path.home() / ".codex" / "auth.json"
86
+ if not auth_path.exists():
87
+ return ""
88
+ import json
89
+ data = json.loads(auth_path.read_text(encoding="utf-8"))
90
+ return data.get("tokens", {}).get("access_token", "")
91
+ except Exception:
92
+ return ""
93
+
94
+
76
95
  # Cache for provider registry (built once at module load)
77
96
  _provider_registry_cache = None
78
97
  _cached_provider = None
@@ -134,8 +153,8 @@ def _get_provider_registry():
134
153
  },
135
154
  "default_temperature": 0.1,
136
155
  "default_top_p": 0.9,
137
- "allow_top_p": True,
138
- "allow_temperature": True,
156
+ "allow_top_p": False,
157
+ "allow_temperature": False,
139
158
  "cost_in": 0.0,
140
159
  "cost_out": 0.0
141
160
  },
@@ -311,6 +330,22 @@ def _get_provider_registry():
311
330
  "allow_temperature": True,
312
331
  **_model_cost("KIMI_MODEL"),
313
332
  },
333
+ "codex": {
334
+ "type": "api",
335
+ "api_key": _CONFIG.get("CODEX_PLAN_API_KEY", "") or _get_codex_token(),
336
+ "model": _CONFIG.get("CODEX_PLAN_MODEL", "gpt-5.4-mini"),
337
+ "api_base": _CONFIG.get("CODEX_PLAN_API_BASE", "https://chatgpt.com/backend-api/codex"),
338
+ "endpoint": "/responses",
339
+ "error_prefix": "Codex",
340
+ "config_keys": {
341
+ "CODEX_PLAN_API_KEY": "",
342
+ "CODEX_PLAN_MODEL": "",
343
+ "CODEX_PLAN_API_BASE": "https://chatgpt.com/backend-api/codex",
344
+ },
345
+ "allow_temperature": False,
346
+ "allow_top_p": False,
347
+ **_model_cost("CODEX_PLAN_MODEL"),
348
+ },
314
349
  "bone": {
315
350
  "type": "api",
316
351
  "api_key": _CONFIG.get("BONE_PROXY_API_KEY", ""),
@@ -354,7 +389,7 @@ def reload_config():
354
389
 
355
390
  Note: This is a manual operation - call after config changes.
356
391
  """
357
- global _CONFIG, _provider_registry_cache, _cached_provider, PROVIDER_REGISTRY, LLM_PROVIDER, STATUS_BAR_SETTINGS
392
+ global _CONFIG, _provider_registry_cache, _cached_provider, PROVIDER_REGISTRY, LLM_PROVIDER, STATUS_BAR_SETTINGS, MEMORY_SETTINGS
358
393
  _CONFIG = _load_config()
359
394
  _provider_registry_cache = None
360
395
  _cached_provider = None
@@ -363,6 +398,8 @@ def reload_config():
363
398
  LLM_PROVIDER = _get_provider()
364
399
  # Rebuild status bar settings
365
400
  STATUS_BAR_SETTINGS = _build_status_bar_settings()
401
+ # Rebuild memory settings
402
+ MEMORY_SETTINGS = _build_memory_settings()
366
403
 
367
404
 
368
405
  def _build_status_bar_settings():
@@ -377,8 +414,27 @@ def _build_status_bar_settings():
377
414
  }
378
415
 
379
416
 
417
+ def _build_memory_settings():
418
+ """Build MEMORY_SETTINGS dict from current _CONFIG."""
419
+ ms = _CONFIG.get("MEMORY_SETTINGS", {})
420
+ return {
421
+ "enabled": ms.get("enabled", True),
422
+ }
423
+
424
+
425
+ def update_memory_settings(settings_dict):
426
+ """Update MEMORY_SETTINGS at runtime.
427
+
428
+ Returns:
429
+ Updated MEMORY_SETTINGS dict
430
+ """
431
+ global MEMORY_SETTINGS
432
+ MEMORY_SETTINGS.update(settings_dict)
433
+ return MEMORY_SETTINGS
434
+
435
+
380
436
  def update_status_bar_settings(settings_dict):
381
- """Update STATUS_BAR_SETTINGS at runtime and persist to config.
437
+ """Update STATUS_BAR_SETTINGS at runtime.
382
438
 
383
439
  Args:
384
440
  settings_dict: Dict of settings to update (e.g., {"show_cost": False})
@@ -400,6 +456,14 @@ def get_providers():
400
456
  return list(PROVIDER_REGISTRY.keys())
401
457
 
402
458
 
459
+ def get_provider_display_name(provider: str) -> str:
460
+ """Return the user-facing provider name for a provider key."""
461
+ display_names = {
462
+ "codex": "Codex",
463
+ }
464
+ return display_names.get(provider, provider.replace("_", " ").title())
465
+
466
+
403
467
  # ============================================================================
404
468
  # PROVIDER REGISTRY - Centralized provider configuration
405
469
  # ============================================================================
@@ -413,6 +477,7 @@ __all__ = [
413
477
  "CONFIG_PATH",
414
478
  "PROVIDER_REGISTRY",
415
479
  "get_providers",
480
+ "get_provider_display_name",
416
481
  "get_model_cost",
417
482
  "LLM_PROVIDER",
418
483
  "TOOLS_ENABLED",
@@ -426,6 +491,8 @@ __all__ = [
426
491
  "reload_config",
427
492
  "STATUS_BAR_SETTINGS",
428
493
  "update_status_bar_settings",
494
+ "MEMORY_SETTINGS",
495
+ "update_memory_settings",
429
496
  ]
430
497
 
431
498
 
@@ -445,6 +512,9 @@ WEB_SEARCH_REQUIRE_CONFIRMATION = False
445
512
  # Status bar configuration
446
513
  STATUS_BAR_SETTINGS = _build_status_bar_settings()
447
514
 
515
+ # Memory configuration
516
+ MEMORY_SETTINGS = _build_memory_settings()
517
+
448
518
  # Tool approval modes
449
519
  APPROVE_MODES = ("safe", "accept_edits", "danger")
450
520
  CYCLEABLE_APPROVE_MODES = ("safe", "accept_edits")