codegpt-ai 1.17.0 → 1.19.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.
package/chat.py CHANGED
@@ -507,72 +507,99 @@ def save_permissions():
507
507
  }, indent=2))
508
508
 
509
509
 
510
- # Actions that need confirmation
510
+ # Actions that need confirmation — (description, risk level)
511
+ # Risk: CRITICAL, HIGH, MEDIUM, LOW
511
512
  RISKY_ACTIONS = {
512
- "shell": "Run a shell command",
513
- "code_exec": "Execute Python code",
514
- "tool_launch": "Launch an external AI tool",
515
- "tool_install": "Install a new tool",
516
- "file_read": "Read a file into context",
517
- "export": "Export conversation to file",
518
- "connect": "Connect to a remote server",
519
- "train_build": "Build a custom AI model",
520
- "train_collect": "Collect conversation as training data",
521
- "mem_clear": "Clear all AI memories",
522
- "mem_save": "Save to AI memory",
523
- "pin_set": "Set a login PIN",
524
- "save_chat": "Save conversation to disk",
525
- "delete_chat": "Delete a saved conversation",
526
- "model_change": "Switch AI model",
527
- "persona_change": "Change AI persona",
528
- "system_prompt": "Modify system prompt",
529
- "broadcast": "Send message to all tools",
530
- "agent_run": "Run an AI agent",
531
- "swarm": "Run agent swarm pipeline",
532
- "all_agents": "Ask all agents at once",
533
- "race": "Race all models",
534
- "team_chat": "Start team chat with AIs",
535
- "compact": "Summarize and compact conversation",
536
- "fork": "Fork conversation",
537
- "qr": "Generate QR code with your IP",
538
- "open_url": "Open a URL in browser",
539
- "spotify": "Control Spotify",
540
- "volume": "Change system volume",
541
- "brightness": "Change screen brightness",
542
- "github": "Access GitHub",
513
+ # CRITICAL can damage system, leak data, or run arbitrary code
514
+ "shell": ("Run a shell command", "CRITICAL"),
515
+ "code_exec": ("Execute Python code", "CRITICAL"),
516
+ "tool_install": ("Install a new tool", "CRITICAL"),
517
+ "connect": ("Connect to a remote server", "CRITICAL"),
518
+ "pin_set": ("Set a login PIN", "CRITICAL"),
519
+ # HIGH external access, data modification
520
+ "tool_launch": ("Launch an external AI tool", "HIGH"),
521
+ "open_url": ("Open a URL in browser", "HIGH"),
522
+ "github": ("Access GitHub", "HIGH"),
523
+ "delete_chat": ("Delete a saved conversation", "HIGH"),
524
+ "mem_clear": ("Clear all AI memories", "HIGH"),
525
+ "train_build": ("Build a custom AI model", "HIGH"),
526
+ "qr": ("Generate QR code with your IP", "HIGH"),
527
+ "broadcast": ("Send message to all tools", "HIGH"),
528
+ "system_prompt": ("Modify system prompt", "HIGH"),
529
+ # MEDIUM uses resources, changes settings
530
+ "file_read": ("Read a file into context", "MEDIUM"),
531
+ "export": ("Export conversation to file", "MEDIUM"),
532
+ "save_chat": ("Save conversation to disk", "MEDIUM"),
533
+ "train_collect": ("Collect conversation as training", "MEDIUM"),
534
+ "mem_save": ("Save to AI memory", "MEDIUM"),
535
+ "agent_run": ("Run an AI agent", "MEDIUM"),
536
+ "swarm": ("Run agent swarm pipeline", "MEDIUM"),
537
+ "all_agents": ("Ask all agents at once", "MEDIUM"),
538
+ "race": ("Race all models", "MEDIUM"),
539
+ "team_chat": ("Start team chat with AIs", "MEDIUM"),
540
+ "spotify": ("Control Spotify", "MEDIUM"),
541
+ "volume": ("Change system volume", "MEDIUM"),
542
+ "brightness": ("Change screen brightness", "MEDIUM"),
543
+ # LOW — safe changes
544
+ "model_change": ("Switch AI model", "LOW"),
545
+ "persona_change": ("Change AI persona", "LOW"),
546
+ "compact": ("Summarize and compact conversation","LOW"),
547
+ "fork": ("Fork conversation", "LOW"),
548
+ }
549
+
550
+ RISK_COLORS = {
551
+ "CRITICAL": "bold red",
552
+ "HIGH": "red",
553
+ "MEDIUM": "yellow",
554
+ "LOW": "green",
555
+ }
556
+
557
+ RISK_ICONS = {
558
+ "CRITICAL": "☠",
559
+ "HIGH": "⚠",
560
+ "MEDIUM": "◇",
561
+ "LOW": "△",
543
562
  }
544
563
 
545
564
 
546
565
  def ask_permission(action, detail=""):
547
- """Ask user for permission before performing a risky action.
566
+ """Ask user for permission before performing an action.
548
567
  Returns True if allowed, False if denied."""
549
568
 
550
569
  # Already permanently approved
551
570
  if action in PERMISSION_ALWAYS_ALLOW:
552
571
  return True
553
572
 
554
- # Build the prompt
555
- action_desc = RISKY_ACTIONS.get(action, action)
573
+ # Get action info
574
+ action_info = RISKY_ACTIONS.get(action, (action, "MEDIUM"))
575
+ if isinstance(action_info, str):
576
+ action_desc, risk = action_info, "MEDIUM"
577
+ else:
578
+ action_desc, risk = action_info
579
+
580
+ risk_color = RISK_COLORS.get(risk, "yellow")
581
+ risk_icon = RISK_ICONS.get(risk, "?")
556
582
  compact = is_compact()
557
583
 
558
584
  if compact:
559
585
  console.print(Panel(
560
586
  Text.from_markup(
561
- f"[bold yellow]Permission[/]\n"
587
+ f"[{risk_color}]{risk_icon} {risk}[/]\n"
562
588
  f" {action_desc}\n"
563
- + (f" [dim]{detail[:40]}[/]\n" if detail else "")
589
+ + (f" [dim]{detail[:35]}[/]\n" if detail else "")
564
590
  ),
565
- border_style="yellow", padding=(0, 1), width=tw(),
591
+ border_style=risk_color.replace("bold ", ""), padding=(0, 1), width=tw(),
566
592
  ))
567
593
  else:
568
594
  console.print(Panel(
569
595
  Text.from_markup(
570
- f"[bold yellow]Permission Required[/]\n\n"
596
+ f"[{risk_color}]{risk_icon} Risk: {risk}[/]\n\n"
571
597
  f" Action: [bright_cyan]{action_desc}[/]\n"
572
598
  + (f" Detail: [dim]{detail[:60]}[/]\n" if detail else "")
573
599
  + f"\n [dim](y)es (n)o (a)lways allow this[/]"
574
600
  ),
575
- border_style="yellow", padding=(0, 2), width=tw(),
601
+ title=f"[{risk_color}]Permission[/]",
602
+ border_style=risk_color.replace("bold ", ""), padding=(0, 2), width=tw(),
576
603
  ))
577
604
 
578
605
  try:
@@ -6381,10 +6408,17 @@ def main():
6381
6408
  title_style="bold yellow", show_header=True, header_style="bold")
6382
6409
  table.add_column("Action", style="bright_cyan", width=16)
6383
6410
  table.add_column("Description", style="dim")
6411
+ table.add_column("Risk", width=10)
6384
6412
  table.add_column("Status", width=10)
6385
- for action, desc in RISKY_ACTIONS.items():
6413
+ for action, info in RISKY_ACTIONS.items():
6414
+ if isinstance(info, tuple):
6415
+ desc, risk = info
6416
+ else:
6417
+ desc, risk = info, "MEDIUM"
6418
+ rc = RISK_COLORS.get(risk, "yellow")
6419
+ ri = RISK_ICONS.get(risk, "?")
6386
6420
  status = "[green]allowed[/]" if action in PERMISSION_ALWAYS_ALLOW else "[yellow]ask[/]"
6387
- table.add_row(action, desc, status)
6421
+ table.add_row(action, desc, f"[{rc}]{ri} {risk}[/]", status)
6388
6422
  console.print(table)
6389
6423
  console.print(Text(" /permissions reset — revoke all", style="dim"))
6390
6424
  console.print()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codegpt-ai",
3
- "version": "1.17.0",
3
+ "version": "1.19.0",
4
4
  "description": "Local AI Assistant Hub — 80+ commands, 29 tools, 8 agents, training, security",
5
5
  "author": "ArukuX",
6
6
  "license": "MIT",
@@ -34,5 +34,8 @@
34
34
  "ai_cli/",
35
35
  "CLAUDE.md",
36
36
  "README.md"
37
- ]
37
+ ],
38
+ "dependencies": {
39
+ "codegpt-ai": "^1.18.0"
40
+ }
38
41
  }