nimbie-shell 0.0.2.dev0__tar.gz → 0.0.3.dev0__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.
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/PKG-INFO +2 -2
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/pyproject.toml +2 -2
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/v2/repl_app.py +42 -24
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/v3/repl_app.py +3 -2
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/README.md +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/__init__.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/browser_gateway.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/cli.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/command_policy.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/config.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/model.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/summary_entry.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/system.md +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/system_prompt.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/tools/__init__.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/tools/internal/__init__.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/tools/internal/file_patcher.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/tools/internal/selection_prompt.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/tools/internal/set_result.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/tools/internal/shell_runner.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/tools/tool_runtime.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/gateway_textual.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/incremental_markdown.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/process_overview_textual.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/selection_panel_textual.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/session_history_inspector_textual.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/shared/remote_shell_support.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/streaming_tail.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/terminal_markdown.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/v2/output_hub.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/v2/renderer.py +0 -0
- {nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/v2/slash_commands.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nimbie-shell
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3.dev0
|
|
4
4
|
Summary: Lightweight agent loop and context manager (standalone)
|
|
5
5
|
Requires-Dist: click>=8.1.7
|
|
6
6
|
Requires-Dist: httpx[http2]>=0.28.1
|
|
7
7
|
Requires-Dist: litellm>=1.81.11
|
|
8
8
|
Requires-Dist: chronml>=0.1.0
|
|
9
9
|
Requires-Dist: oturn>=0.1.0
|
|
10
|
-
Requires-Dist: nimbie-flash>=0.0.
|
|
10
|
+
Requires-Dist: nimbie-flash>=0.0.3.dev0
|
|
11
11
|
Requires-Dist: prompt-toolkit>=3.0.39
|
|
12
12
|
Requires-Dist: rich>=13.7.0
|
|
13
13
|
Requires-Dist: textual>=0.80.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "nimbie-shell"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.3.dev0"
|
|
4
4
|
description = "Lightweight agent loop and context manager (standalone)"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -10,7 +10,7 @@ dependencies = [
|
|
|
10
10
|
"litellm>=1.81.11",
|
|
11
11
|
"chronml>=0.1.0",
|
|
12
12
|
"oturn>=0.1.0",
|
|
13
|
-
"nimbie_flash>=0.0.
|
|
13
|
+
"nimbie_flash>=0.0.3.dev0",
|
|
14
14
|
"prompt_toolkit>=3.0.39",
|
|
15
15
|
"rich>=13.7.0",
|
|
16
16
|
"textual>=0.80.0",
|
|
@@ -31,7 +31,6 @@ from ...tools import registry as nimbie_tool_registry
|
|
|
31
31
|
from ...tools.internal.shell_runner import get_background_registry_snapshot
|
|
32
32
|
from ..process_overview_textual import ProcessOverviewApp
|
|
33
33
|
from ..session_history_inspector_textual import SessionHistoryInspectorApp
|
|
34
|
-
from ..selection_panel_textual import SelectionPanelApp
|
|
35
34
|
try:
|
|
36
35
|
import termios as _termios
|
|
37
36
|
import tty as _tty
|
|
@@ -423,11 +422,11 @@ class ShellAdapter(RemoteShellSupport):
|
|
|
423
422
|
try:
|
|
424
423
|
from prompt_toolkit.styles.pygments import style_from_pygments_cls
|
|
425
424
|
from pygments.styles import get_style_by_name
|
|
426
|
-
style_name = os.getenv('SHELL_COLOR_STYLE', os.getenv('XONSH_COLOR_STYLE', '
|
|
425
|
+
style_name = os.getenv('SHELL_COLOR_STYLE', os.getenv('XONSH_COLOR_STYLE', 'friendly'))
|
|
427
426
|
try:
|
|
428
427
|
style_cls = get_style_by_name(style_name)
|
|
429
428
|
except Exception:
|
|
430
|
-
style_cls = get_style_by_name('
|
|
429
|
+
style_cls = get_style_by_name('friendly')
|
|
431
430
|
return style_from_pygments_cls(style_cls)
|
|
432
431
|
except Exception:
|
|
433
432
|
return None
|
|
@@ -672,7 +671,9 @@ class ShellAdapter(RemoteShellSupport):
|
|
|
672
671
|
try:
|
|
673
672
|
payload = ''.join(pending_input)
|
|
674
673
|
pending_input = []
|
|
675
|
-
|
|
674
|
+
sender = getattr(executor, 'send_stdin', None)
|
|
675
|
+
if callable(sender):
|
|
676
|
+
sender(active_run_id, payload)
|
|
676
677
|
except Exception:
|
|
677
678
|
pass
|
|
678
679
|
|
|
@@ -1285,19 +1286,9 @@ class ReplApp:
|
|
|
1285
1286
|
self.renderer.print_warning(message)
|
|
1286
1287
|
if reasons:
|
|
1287
1288
|
self.renderer.print_info('Reasons:\n' + '\n'.join([f' - {r}' for r in reasons]))
|
|
1288
|
-
|
|
1289
|
+
prompt = f"[approval] {name or 'tool'} | Allow? [y/N]: "
|
|
1290
|
+
approved = await asyncio.to_thread(self._prompt_yes_no, prompt)
|
|
1289
1291
|
decision = 'ALLOW'
|
|
1290
|
-
try:
|
|
1291
|
-
result = await SelectionPanelApp.ask_async(
|
|
1292
|
-
f'Approval required for {name}',
|
|
1293
|
-
['Run'],
|
|
1294
|
-
hint='Use ↑/↓ to select, Enter confirm (Esc/C/N cancel)',
|
|
1295
|
-
subtitle=_format_approval_subtitle(message, args),
|
|
1296
|
-
show_cancel=True,
|
|
1297
|
-
)
|
|
1298
|
-
approved = bool(result.get('confirmed') and result.get('selected') == 'Run')
|
|
1299
|
-
except Exception:
|
|
1300
|
-
approved = False
|
|
1301
1292
|
if not approved:
|
|
1302
1293
|
decision = 'DENIED'
|
|
1303
1294
|
self.renderer.print_warning('[tool] denied')
|
|
@@ -1313,14 +1304,7 @@ class ReplApp:
|
|
|
1313
1304
|
fut = ev.get('future')
|
|
1314
1305
|
self.renderer.enter_prompt()
|
|
1315
1306
|
self.esc_cancel.stop()
|
|
1316
|
-
selected =
|
|
1317
|
-
confirmed = False
|
|
1318
|
-
try:
|
|
1319
|
-
result = await SelectionPanelApp.ask_async(prompt, list(map(str, choices)))
|
|
1320
|
-
selected = result.get('selected')
|
|
1321
|
-
confirmed = bool(result.get('confirmed'))
|
|
1322
|
-
except Exception:
|
|
1323
|
-
pass
|
|
1307
|
+
selected, confirmed = await asyncio.to_thread(self._prompt_choice, prompt, list(map(str, choices)))
|
|
1324
1308
|
if confirmed and selected is not None:
|
|
1325
1309
|
self.renderer.print_info(f'[choice] 你选择了: {selected}')
|
|
1326
1310
|
else:
|
|
@@ -1456,6 +1440,40 @@ class ReplApp:
|
|
|
1456
1440
|
grid.add_row(Spinner('arrow2'), Text(text))
|
|
1457
1441
|
return grid
|
|
1458
1442
|
|
|
1443
|
+
@staticmethod
|
|
1444
|
+
def _prompt_yes_no(prompt: str) -> bool:
|
|
1445
|
+
try:
|
|
1446
|
+
reply = input(prompt)
|
|
1447
|
+
except (EOFError, KeyboardInterrupt):
|
|
1448
|
+
return False
|
|
1449
|
+
return str(reply or '').strip().lower() in {'y', 'yes'}
|
|
1450
|
+
|
|
1451
|
+
@staticmethod
|
|
1452
|
+
def _prompt_choice(prompt: str, choices: list[str]) -> tuple[Optional[str], bool]:
|
|
1453
|
+
items = [str(choice) for choice in (choices or [])]
|
|
1454
|
+
if not items:
|
|
1455
|
+
return (None, False)
|
|
1456
|
+
try:
|
|
1457
|
+
print(prompt)
|
|
1458
|
+
for idx, item in enumerate(items, start=1):
|
|
1459
|
+
print(f' {idx}. {item}')
|
|
1460
|
+
print(' 0. Cancel')
|
|
1461
|
+
reply = input('Select an option [0]: ')
|
|
1462
|
+
except (EOFError, KeyboardInterrupt):
|
|
1463
|
+
return (None, False)
|
|
1464
|
+
raw = str(reply or '').strip()
|
|
1465
|
+
if not raw:
|
|
1466
|
+
return (None, False)
|
|
1467
|
+
try:
|
|
1468
|
+
index = int(raw)
|
|
1469
|
+
except ValueError:
|
|
1470
|
+
return (None, False)
|
|
1471
|
+
if index == 0:
|
|
1472
|
+
return (None, False)
|
|
1473
|
+
if 1 <= index <= len(items):
|
|
1474
|
+
return (items[index - 1], True)
|
|
1475
|
+
return (None, False)
|
|
1476
|
+
|
|
1459
1477
|
def _set_future(self, fut: Any, payload: Any) -> None:
|
|
1460
1478
|
if fut is None:
|
|
1461
1479
|
return
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
import asyncio
|
|
3
3
|
import json
|
|
4
|
+
import os
|
|
4
5
|
import queue
|
|
5
6
|
import sys
|
|
6
7
|
import time
|
|
@@ -462,11 +463,11 @@ class ShellAdapter(RemoteShellSupport):
|
|
|
462
463
|
try:
|
|
463
464
|
from prompt_toolkit.styles.pygments import style_from_pygments_cls
|
|
464
465
|
from pygments.styles import get_style_by_name
|
|
465
|
-
style_name = os.getenv('SHELL_COLOR_STYLE', os.getenv('XONSH_COLOR_STYLE', '
|
|
466
|
+
style_name = os.getenv('SHELL_COLOR_STYLE', os.getenv('XONSH_COLOR_STYLE', 'friendly'))
|
|
466
467
|
try:
|
|
467
468
|
style_cls = get_style_by_name(style_name)
|
|
468
469
|
except Exception:
|
|
469
|
-
style_cls = get_style_by_name('
|
|
470
|
+
style_cls = get_style_by_name('friendly')
|
|
470
471
|
return style_from_pygments_cls(style_cls)
|
|
471
472
|
except Exception:
|
|
472
473
|
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/tools/internal/file_patcher.py
RENAMED
|
File without changes
|
{nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/tools/internal/selection_prompt.py
RENAMED
|
File without changes
|
|
File without changes
|
{nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/tools/internal/shell_runner.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/process_overview_textual.py
RENAMED
|
File without changes
|
{nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/selection_panel_textual.py
RENAMED
|
File without changes
|
|
File without changes
|
{nimbie_shell-0.0.2.dev0 → nimbie_shell-0.0.3.dev0}/src/nimbie/ui/shared/remote_shell_support.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|