bub 0.4.3__tar.gz → 0.5.0__tar.gz

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 (116) hide show
  1. {bub-0.4.3 → bub-0.5.0}/PKG-INFO +48 -22
  2. {bub-0.4.3 → bub-0.5.0}/README.md +25 -6
  3. {bub-0.4.3 → bub-0.5.0}/pyproject.toml +27 -21
  4. {bub-0.4.3 → bub-0.5.0}/src/bub/__main__.py +21 -4
  5. {bub-0.4.3 → bub-0.5.0}/src/bub/_version.py +2 -2
  6. bub-0.5.0/src/bub/builtin/__init__.py +3 -0
  7. bub-0.5.0/src/bub/builtin/agent.py +596 -0
  8. {bub-0.4.3 → bub-0.5.0}/src/bub/builtin/auth.py +65 -29
  9. {bub-0.4.3 → bub-0.5.0}/src/bub/builtin/cli.py +50 -2
  10. bub-0.5.0/src/bub/builtin/codemode/__init__.py +310 -0
  11. bub-0.5.0/src/bub/builtin/codemode/code_runner.py +142 -0
  12. bub-0.5.0/src/bub/builtin/codemode/code_runner_child.py +176 -0
  13. bub-0.5.0/src/bub/builtin/commands.py +20 -0
  14. {bub-0.4.3 → bub-0.5.0}/src/bub/builtin/context.py +3 -11
  15. bub-0.5.0/src/bub/builtin/environment.py +145 -0
  16. {bub-0.4.3 → bub-0.5.0}/src/bub/builtin/hook_impl.py +109 -122
  17. {bub-0.4.3 → bub-0.5.0}/src/bub/builtin/model_runner.py +148 -16
  18. bub-0.5.0/src/bub/builtin/onboarding.py +278 -0
  19. {bub-0.4.3 → bub-0.5.0}/src/bub/builtin/settings.py +52 -4
  20. bub-0.5.0/src/bub/builtin/shell_manager.py +235 -0
  21. bub-0.5.0/src/bub/builtin/spill.py +336 -0
  22. {bub-0.4.3 → bub-0.5.0}/src/bub/builtin/tools.py +218 -133
  23. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/cli/__init__.py +52 -11
  24. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/cli/renderer.py +5 -5
  25. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/handler.py +1 -1
  26. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/manager.py +17 -4
  27. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/message.py +29 -1
  28. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/telegram.py +11 -8
  29. bub-0.5.0/src/bub/environment.py +140 -0
  30. {bub-0.4.3 → bub-0.5.0}/src/bub/errors.py +2 -2
  31. {bub-0.4.3 → bub-0.5.0}/src/bub/framework.py +134 -23
  32. bub-0.5.0/src/bub/gateway_installer.py +227 -0
  33. {bub-0.4.3 → bub-0.5.0}/src/bub/hooks/interception.py +9 -4
  34. {bub-0.4.3 → bub-0.5.0}/src/bub/hooks/runtime.py +5 -3
  35. {bub-0.4.3 → bub-0.5.0}/src/bub/hooks/specs.py +30 -5
  36. bub-0.5.0/src/bub/sidecars.py +20 -0
  37. {bub-0.4.3 → bub-0.5.0}/src/bub/skills.py +9 -4
  38. {bub-0.4.3 → bub-0.5.0}/src/bub/store.py +44 -21
  39. bub-0.5.0/src/bub/streaming.py +92 -0
  40. {bub-0.4.3 → bub-0.5.0}/src/bub/tape.py +152 -13
  41. {bub-0.4.3 → bub-0.5.0}/src/bub/tools.py +177 -31
  42. bub-0.5.0/src/bub/tracing.py +256 -0
  43. {bub-0.4.3 → bub-0.5.0}/tests/test_agent_hooks.py +13 -0
  44. {bub-0.4.3 → bub-0.5.0}/tests/test_builtin_agent.py +101 -6
  45. {bub-0.4.3 → bub-0.5.0}/tests/test_builtin_cli.py +188 -10
  46. {bub-0.4.3 → bub-0.5.0}/tests/test_builtin_codex.py +98 -8
  47. {bub-0.4.3 → bub-0.5.0}/tests/test_builtin_hook_impl.py +26 -14
  48. bub-0.5.0/tests/test_builtin_model_runner.py +405 -0
  49. {bub-0.4.3 → bub-0.5.0}/tests/test_builtin_tools.py +178 -20
  50. {bub-0.4.3 → bub-0.5.0}/tests/test_channels.py +142 -13
  51. bub-0.5.0/tests/test_cli_help.py +30 -0
  52. bub-0.5.0/tests/test_codemode.py +452 -0
  53. bub-0.5.0/tests/test_environment.py +169 -0
  54. bub-0.5.0/tests/test_errors.py +19 -0
  55. {bub-0.4.3 → bub-0.5.0}/tests/test_file_tape_store_entry_ids.py +10 -0
  56. {bub-0.4.3 → bub-0.5.0}/tests/test_framework.py +67 -16
  57. bub-0.5.0/tests/test_gateway_installer.py +159 -0
  58. {bub-0.4.3 → bub-0.5.0}/tests/test_image_message.py +124 -4
  59. bub-0.5.0/tests/test_install_scripts.py +411 -0
  60. bub-0.5.0/tests/test_onboarding.py +601 -0
  61. bub-0.5.0/tests/test_otlp.py +177 -0
  62. bub-0.5.0/tests/test_sdk_isolation.py +180 -0
  63. bub-0.5.0/tests/test_session_settings.py +47 -0
  64. {bub-0.4.3 → bub-0.5.0}/tests/test_settings.py +39 -0
  65. bub-0.5.0/tests/test_shell_manager.py +321 -0
  66. {bub-0.4.3 → bub-0.5.0}/tests/test_skills.py +1 -1
  67. bub-0.5.0/tests/test_spill.py +352 -0
  68. {bub-0.4.3 → bub-0.5.0}/tests/test_subagent_tool.py +2 -1
  69. {bub-0.4.3 → bub-0.5.0}/tests/test_tape.py +47 -1
  70. {bub-0.4.3 → bub-0.5.0}/tests/test_tape_search_output.py +3 -2
  71. {bub-0.4.3 → bub-0.5.0}/tests/test_tools.py +102 -1
  72. bub-0.5.0/tests/test_tracing.py +472 -0
  73. bub-0.4.3/src/bub/builtin/__init__.py +0 -0
  74. bub-0.4.3/src/bub/builtin/agent.py +0 -437
  75. bub-0.4.3/src/bub/builtin/shell_manager.py +0 -118
  76. bub-0.4.3/src/bub/streaming.py +0 -38
  77. bub-0.4.3/tests/test_builtin_model_runner.py +0 -212
  78. bub-0.4.3/tests/test_cli_help.py +0 -16
  79. {bub-0.4.3 → bub-0.5.0}/.gitignore +0 -0
  80. {bub-0.4.3 → bub-0.5.0}/LICENSE +0 -0
  81. {bub-0.4.3 → bub-0.5.0}/src/bub/__init__.py +0 -0
  82. {bub-0.4.3 → bub-0.5.0}/src/bub/builtin/codex_provider.py +0 -0
  83. {bub-0.4.3 → bub-0.5.0}/src/bub/builtin/steering.py +0 -0
  84. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/__init__.py +0 -0
  85. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/admission.py +0 -0
  86. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/base.py +0 -0
  87. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/cli/ansi_bridge.py +0 -0
  88. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/cli/terminal_output.py +0 -0
  89. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/cli/writers.py +0 -0
  90. {bub-0.4.3 → bub-0.5.0}/src/bub/channels/contracts.py +0 -0
  91. {bub-0.4.3 → bub-0.5.0}/src/bub/configure.py +0 -0
  92. {bub-0.4.3 → bub-0.5.0}/src/bub/envelope.py +0 -0
  93. {bub-0.4.3 → bub-0.5.0}/src/bub/hooks/__init__.py +0 -0
  94. {bub-0.4.3 → bub-0.5.0}/src/bub/inquirer.py +0 -0
  95. {bub-0.4.3 → bub-0.5.0}/src/bub/model_selection.py +0 -0
  96. {bub-0.4.3 → bub-0.5.0}/src/bub/turn.py +0 -0
  97. {bub-0.4.3 → bub-0.5.0}/src/bub/types.py +0 -0
  98. {bub-0.4.3 → bub-0.5.0}/src/bub/utils.py +0 -0
  99. {bub-0.4.3 → bub-0.5.0}/src/skills/README.md +0 -0
  100. {bub-0.4.3 → bub-0.5.0}/src/skills/gh/SKILL.md +0 -0
  101. {bub-0.4.3 → bub-0.5.0}/src/skills/skill-creator/SKILL.md +0 -0
  102. {bub-0.4.3 → bub-0.5.0}/src/skills/skill-creator/license.txt +0 -0
  103. {bub-0.4.3 → bub-0.5.0}/src/skills/skill-creator/scripts/init_skill.py +0 -0
  104. {bub-0.4.3 → bub-0.5.0}/src/skills/skill-creator/scripts/quick_validate.py +0 -0
  105. {bub-0.4.3 → bub-0.5.0}/src/skills/telegram/SKILL.md +0 -0
  106. {bub-0.4.3 → bub-0.5.0}/src/skills/telegram/scripts/telegram_edit.py +0 -0
  107. {bub-0.4.3 → bub-0.5.0}/src/skills/telegram/scripts/telegram_rich.py +0 -0
  108. {bub-0.4.3 → bub-0.5.0}/src/skills/telegram/scripts/telegram_send.py +0 -0
  109. {bub-0.4.3 → bub-0.5.0}/tests/conftest.py +0 -0
  110. {bub-0.4.3 → bub-0.5.0}/tests/test_cli_renderer.py +0 -0
  111. {bub-0.4.3 → bub-0.5.0}/tests/test_configure.py +0 -0
  112. {bub-0.4.3 → bub-0.5.0}/tests/test_envelope.py +0 -0
  113. {bub-0.4.3 → bub-0.5.0}/tests/test_fork_store_merge_back.py +0 -0
  114. {bub-0.4.3 → bub-0.5.0}/tests/test_hook_runtime.py +0 -0
  115. {bub-0.4.3 → bub-0.5.0}/tests/test_types.py +0 -0
  116. {bub-0.4.3 → bub-0.5.0}/tests/test_utils.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bub
3
- Version: 0.4.3
4
- Summary: A common shape for agents that live alongside people.
3
+ Version: 0.5.0
4
+ Summary: A tiny agent runtime, composable with plugins.
5
5
  Project-URL: Homepage, https://bub.build
6
6
  Project-URL: Repository, https://github.com/bubbuild/bub
7
7
  Project-URL: Documentation, https://bub.build
@@ -16,24 +16,31 @@ Classifier: Programming Language :: Python :: 3.13
16
16
  Classifier: Programming Language :: Python :: 3.14
17
17
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
18
  Requires-Python: <4.0,>=3.12
19
- Requires-Dist: aiohttp>=3.13.3
20
- Requires-Dist: any-llm-sdk[anthropic]
19
+ Requires-Dist: aiohttp>=3.14.3
20
+ Requires-Dist: any-llm-sdk[anthropic]>=1.22.1
21
21
  Requires-Dist: authlib>=1.7.2
22
22
  Requires-Dist: httpx[socks]>=0.28.1
23
- Requires-Dist: inquirer-textual>=0.5.1
24
- Requires-Dist: loguru>=0.7.2
23
+ Requires-Dist: inquirer-textual>=0.8.0
24
+ Requires-Dist: loguru>=0.7.3
25
25
  Requires-Dist: pluggy>=1.6.0
26
- Requires-Dist: prompt-toolkit>=3.0.0
27
- Requires-Dist: pydantic-settings>=2.0.0
28
- Requires-Dist: pydantic>=2.0.0
29
- Requires-Dist: python-telegram-bot>=21.0
30
- Requires-Dist: pyyaml>=6.0.0
31
- Requires-Dist: rapidfuzz>=3.14.3
32
- Requires-Dist: rich>=13.0.0
33
- Requires-Dist: typer>=0.9.0
34
- Requires-Dist: typing-extensions>=4.13.0
26
+ Requires-Dist: prompt-toolkit>=3.0.52
27
+ Requires-Dist: pydantic-settings>=2.14.2
28
+ Requires-Dist: pydantic>=2.12.5
29
+ Requires-Dist: python-telegram-bot>=22.7
30
+ Requires-Dist: pyyaml>=6.0.3
31
+ Requires-Dist: rapidfuzz>=3.14.5
32
+ Requires-Dist: rich>=14.3.4
33
+ Requires-Dist: typer>=0.24.1
34
+ Requires-Dist: typing-extensions>=4.15.0
35
35
  Provides-Extra: logfire
36
- Requires-Dist: logfire>=4.31.0; extra == 'logfire'
36
+ Requires-Dist: logfire>=4.32.0; extra == 'logfire'
37
+ Requires-Dist: opentelemetry-api>=1.39.0; extra == 'logfire'
38
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.39.0; extra == 'logfire'
39
+ Requires-Dist: opentelemetry-sdk>=1.39.0; extra == 'logfire'
40
+ Provides-Extra: trace
41
+ Requires-Dist: opentelemetry-api>=1.39.0; extra == 'trace'
42
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.39.0; extra == 'trace'
43
+ Requires-Dist: opentelemetry-sdk>=1.39.0; extra == 'trace'
37
44
  Description-Content-Type: text/markdown
38
45
 
39
46
  # Bub
@@ -45,7 +52,7 @@ Description-Content-Type: text/markdown
45
52
  <img alt="Bub logo" src="https://raw.githubusercontent.com/bubbuild/bub/refs/heads/main/website/src/assets/bub-logo.png" width="200">
46
53
  </picture>
47
54
 
48
- <p><strong>A hook-first runtime for agents that live alongside people.</strong></p>
55
+ <p><strong>A tiny agent runtime, composable with plugins.</strong></p>
49
56
 
50
57
  </div>
51
58
 
@@ -57,8 +64,26 @@ Built on [agents.md](https://agents.md/) and [Agent Skills](https://agentskills.
57
64
 
58
65
  ## Quick Start
59
66
 
67
+ macOS and Linux:
68
+
69
+ ```bash
70
+ curl -fsSL https://bub.build/install.sh | bash
71
+ ```
72
+
73
+ Windows PowerShell:
74
+
75
+ ```powershell
76
+ powershell -ExecutionPolicy ByPass -c "irm https://bub.build/install.ps1 | iex"
77
+ ```
78
+
79
+ The interactive installer uses a colored preset picker, accepts additional plugin dependencies, and runs `bub onboard` after installation. For automation, select a preset explicitly; non-interactive installs skip onboarding:
80
+
60
81
  ```bash
61
- pip install bub
82
+ curl -fsSL https://bub.build/install.sh | bash -s -- --preset recommended --dependency extra-plugin
83
+ ```
84
+
85
+ ```powershell
86
+ powershell -ExecutionPolicy ByPass -c "& ([scriptblock]::Create((irm https://bub.build/install.ps1))) --preset recommended --dependency extra-plugin"
62
87
  ```
63
88
 
64
89
  Or from source:
@@ -72,14 +97,14 @@ uv sync # enough to run Bub from source
72
97
  For local development, use `make install` instead so the website toolchain and `prek` hooks are installed too.
73
98
 
74
99
  ```bash
75
- uv run bub chat # interactive session
76
- uv run bub run "summarize this repo" # one-shot task
77
- uv run bub gateway # channel listener mode
100
+ bub chat # interactive session
101
+ bub run "summarize this repo" # one-shot task
102
+ bub gateway # channel listener mode
78
103
  ```
79
104
 
80
105
  ## Why Bub
81
106
 
82
- - **Hook-first runtime.** Every turn stage is a hook. Override one stage or replace the whole flow without forking the runtime.
107
+ - **Composable by design.** Every turn stage is a plugin hook. Override one stage or replace the whole flow without forking the runtime.
83
108
  - **Tape context.** Context is rebuilt from append-only records, not carried around as mutable session state. Easier to inspect, replay, and hand off.
84
109
  - **One runtime across surfaces.** The same inbound pipeline runs across CLI, Telegram, and custom channels. Adapters change the surface, not the runtime model.
85
110
  - **Batteries included.** CLI, Telegram, tools, skills, and model execution ship with the core runtime. Use the defaults first, replace them later.
@@ -158,6 +183,7 @@ Lines starting with `,` enter internal command mode (`,help`, `,skill name=my-sk
158
183
  | `BUB_MAX_STEPS` | unlimited | Tool-use loop limit; must be a positive integer |
159
184
  | `BUB_MAX_TOKENS` | `16384` | Max tokens per model call |
160
185
  | `BUB_MODEL_TIMEOUT_SECONDS` | — | Model call timeout (seconds) |
186
+ | `BUB_SPILL_THRESHOLD` | `4096` | Estimated tokens before tool output spills; `0` disables |
161
187
 
162
188
  ## Background
163
189
 
@@ -7,7 +7,7 @@
7
7
  <img alt="Bub logo" src="https://raw.githubusercontent.com/bubbuild/bub/refs/heads/main/website/src/assets/bub-logo.png" width="200">
8
8
  </picture>
9
9
 
10
- <p><strong>A hook-first runtime for agents that live alongside people.</strong></p>
10
+ <p><strong>A tiny agent runtime, composable with plugins.</strong></p>
11
11
 
12
12
  </div>
13
13
 
@@ -19,8 +19,26 @@ Built on [agents.md](https://agents.md/) and [Agent Skills](https://agentskills.
19
19
 
20
20
  ## Quick Start
21
21
 
22
+ macOS and Linux:
23
+
24
+ ```bash
25
+ curl -fsSL https://bub.build/install.sh | bash
26
+ ```
27
+
28
+ Windows PowerShell:
29
+
30
+ ```powershell
31
+ powershell -ExecutionPolicy ByPass -c "irm https://bub.build/install.ps1 | iex"
32
+ ```
33
+
34
+ The interactive installer uses a colored preset picker, accepts additional plugin dependencies, and runs `bub onboard` after installation. For automation, select a preset explicitly; non-interactive installs skip onboarding:
35
+
22
36
  ```bash
23
- pip install bub
37
+ curl -fsSL https://bub.build/install.sh | bash -s -- --preset recommended --dependency extra-plugin
38
+ ```
39
+
40
+ ```powershell
41
+ powershell -ExecutionPolicy ByPass -c "& ([scriptblock]::Create((irm https://bub.build/install.ps1))) --preset recommended --dependency extra-plugin"
24
42
  ```
25
43
 
26
44
  Or from source:
@@ -34,14 +52,14 @@ uv sync # enough to run Bub from source
34
52
  For local development, use `make install` instead so the website toolchain and `prek` hooks are installed too.
35
53
 
36
54
  ```bash
37
- uv run bub chat # interactive session
38
- uv run bub run "summarize this repo" # one-shot task
39
- uv run bub gateway # channel listener mode
55
+ bub chat # interactive session
56
+ bub run "summarize this repo" # one-shot task
57
+ bub gateway # channel listener mode
40
58
  ```
41
59
 
42
60
  ## Why Bub
43
61
 
44
- - **Hook-first runtime.** Every turn stage is a hook. Override one stage or replace the whole flow without forking the runtime.
62
+ - **Composable by design.** Every turn stage is a plugin hook. Override one stage or replace the whole flow without forking the runtime.
45
63
  - **Tape context.** Context is rebuilt from append-only records, not carried around as mutable session state. Easier to inspect, replay, and hand off.
46
64
  - **One runtime across surfaces.** The same inbound pipeline runs across CLI, Telegram, and custom channels. Adapters change the surface, not the runtime model.
47
65
  - **Batteries included.** CLI, Telegram, tools, skills, and model execution ship with the core runtime. Use the defaults first, replace them later.
@@ -120,6 +138,7 @@ Lines starting with `,` enter internal command mode (`,help`, `,skill name=my-sk
120
138
  | `BUB_MAX_STEPS` | unlimited | Tool-use loop limit; must be a positive integer |
121
139
  | `BUB_MAX_TOKENS` | `16384` | Max tokens per model call |
122
140
  | `BUB_MODEL_TIMEOUT_SECONDS` | — | Model call timeout (seconds) |
141
+ | `BUB_SPILL_THRESHOLD` | `4096` | Estimated tokens before tool output spills; `0` disables |
123
142
 
124
143
  ## Background
125
144
 
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "bub"
3
3
  dynamic = ["version"]
4
- description = "A common shape for agents that live alongside people."
4
+ description = "A tiny agent runtime, composable with plugins."
5
5
  authors = [
6
6
  { name = "Chojan Shang", email = "psiace@apache.org" },
7
7
  { name = "Frost Ming", email = "me@frostming.com" },
@@ -21,22 +21,22 @@ classifiers = [
21
21
  ]
22
22
 
23
23
  dependencies = [
24
- "pydantic>=2.0.0",
25
- "pydantic-settings>=2.0.0",
26
- "pyyaml>=6.0.0",
24
+ "pydantic>=2.12.5",
25
+ "pydantic-settings>=2.14.2",
26
+ "pyyaml>=6.0.3",
27
27
  "pluggy>=1.6.0",
28
- "inquirer-textual>=0.5.1",
29
- "typer>=0.9.0",
28
+ "inquirer-textual>=0.8.0",
29
+ "typer>=0.24.1",
30
30
  "authlib>=1.7.2",
31
- "any-llm-sdk[anthropic]",
32
- "rich>=13.0.0",
33
- "prompt-toolkit>=3.0.0",
34
- "python-telegram-bot>=21.0",
35
- "loguru>=0.7.2",
36
- "rapidfuzz>=3.14.3",
37
- "aiohttp>=3.13.3",
31
+ "any-llm-sdk[anthropic]>=1.22.1",
32
+ "rich>=14.3.4",
33
+ "prompt-toolkit>=3.0.52",
34
+ "python-telegram-bot>=22.7",
35
+ "loguru>=0.7.3",
36
+ "rapidfuzz>=3.14.5",
37
+ "aiohttp>=3.14.3",
38
38
  "httpx[socks]>=0.28.1",
39
- "typing-extensions>=4.13.0",
39
+ "typing-extensions>=4.15.0",
40
40
  ]
41
41
 
42
42
  [project.urls]
@@ -48,18 +48,24 @@ Documentation = "https://bub.build"
48
48
  bub = "bub.__main__:app"
49
49
 
50
50
  [project.optional-dependencies]
51
+ trace = [
52
+ "opentelemetry-api>=1.39.0",
53
+ "opentelemetry-sdk>=1.39.0",
54
+ "opentelemetry-exporter-otlp-proto-http>=1.39.0",
55
+ ]
51
56
  logfire = [
52
- "logfire>=4.31.0",
57
+ "bub[trace]",
58
+ "logfire>=4.32.0",
53
59
  ]
54
60
 
55
61
  [dependency-groups]
56
62
  dev = [
57
- "pytest>=7.2.0",
58
- "tox-uv>=1.11.3",
59
- "types-PyYAML>=6.0.12",
60
- "mypy>=0.991",
61
- "ruff>=0.11.5",
62
- "prek>=0.3.1",
63
+ "pytest>=9.0.3",
64
+ "tox-uv>=1.35.1",
65
+ "types-PyYAML>=6.0.12.20260408",
66
+ "mypy>=1.20.0",
67
+ "ruff>=0.15.10",
68
+ "prek>=0.3.8",
63
69
  "pytest-asyncio>=1.3.0",
64
70
  ]
65
71
 
@@ -2,32 +2,49 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import os
5
6
  import sys
6
7
 
7
8
  import typer
8
9
 
10
+ from bub.builtin.settings import load_settings
9
11
  from bub.framework import BubFramework
10
12
 
13
+ LOG_LEVEL = {
14
+ 0: "INFO",
15
+ 1: "DEBUG",
16
+ 2: "TRACE",
17
+ }
11
18
 
12
- def _instrument_bub() -> None:
19
+
20
+ def _instrument_bub(level: str) -> None:
13
21
  from loguru import logger
14
22
 
15
23
  logger.remove()
16
- logger.add(sys.stderr, colorize=True)
24
+ logger.add(sys.stderr, level=level, colorize=True, diagnose=False)
25
+
26
+ if os.getenv("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT") or os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT"):
27
+ from bub.tracing import configure_otlp
28
+
29
+ try:
30
+ configure_otlp()
31
+ except Exception as exc:
32
+ logger.warning("OTLP instrumentation disabled: {}", exc)
33
+ return
17
34
 
18
35
  try:
19
36
  import logfire
20
37
  from logfire.integrations.loguru import LogfireHandler
21
38
 
22
39
  logfire.configure()
23
- logger.add(LogfireHandler(), format="{message}")
40
+ logger.add(LogfireHandler(), level=level, format="{message}", diagnose=False)
24
41
  except Exception as exc:
25
42
  logger.debug("logfire instrumentation disabled: {}", exc)
26
43
 
27
44
 
28
45
  def create_cli_app() -> typer.Typer:
29
- _instrument_bub()
30
46
  framework = BubFramework()
47
+ _instrument_bub(LOG_LEVEL[load_settings().verbose])
31
48
  framework.load_hooks()
32
49
  app = framework.create_cli_app()
33
50
 
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.4.3'
22
- __version_tuple__ = version_tuple = (0, 4, 3)
21
+ __version__ = version = '0.5.0'
22
+ __version_tuple__ = version_tuple = (0, 5, 0)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -0,0 +1,3 @@
1
+ from .agent import Agent
2
+
3
+ __all__ = ["Agent"]