npcsh 1.0.10__py3-none-any.whl → 1.0.11__py3-none-any.whl

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.
npcsh/npcsh.py CHANGED
@@ -561,6 +561,15 @@ def execute_slash_command(command: str, stdin_input: Optional[str], state: Shell
561
561
  """Executes slash commands using the router or checking NPC/Team jinxs."""
562
562
  command_parts = command.split()
563
563
  command_name = command_parts[0].lstrip('/')
564
+
565
+ if command_name in ['n', 'npc']:
566
+ npc_to_switch_to = command_parts[1] if len(command_parts) > 1 else None
567
+ if npc_to_switch_to and state.team and npc_to_switch_to in state.team.npcs:
568
+ state.npc = state.team.npcs[npc_to_switch_to]
569
+ return state, f"Switched to NPC: {npc_to_switch_to}"
570
+ else:
571
+ available_npcs = list(state.team.npcs.keys()) if state.team else []
572
+ return state, colored(f"NPC '{npc_to_switch_to}' not found. Available NPCs: {', '.join(available_npcs)}", "red")
564
573
  handler = router.get_route(command_name)
565
574
  #print(handler)
566
575
  if handler:
@@ -1247,7 +1256,7 @@ def print_welcome_message():
1247
1256
  print(
1248
1257
  """
1249
1258
  Welcome to \033[1;94mnpc\033[0m\033[1;38;5;202msh\033[0m!
1250
- \033[1;94m \033[0m\033[1;38;5;202m \\\\
1259
+ \033[1;94m \033[0m\033[1;38;5;202m _ \\\\
1251
1260
  \033[1;94m _ __ _ __ ___ \033[0m\033[1;38;5;202m ___ | |___ \\\\
1252
1261
  \033[1;94m| '_ \\ | ' \\ / __|\033[0m\033[1;38;5;202m / __/ | |_ _| \\\\
1253
1262
  \033[1;94m| | | || |_) |( |__ \033[0m\033[1;38;5;202m \\_ \\ | | | | //
@@ -1392,6 +1401,7 @@ def process_result(
1392
1401
  final_output_str = None
1393
1402
  if user_input =='/help':
1394
1403
  render_markdown(output)
1404
+
1395
1405
  elif result_state.stream_output:
1396
1406
 
1397
1407
  if isinstance(output, dict):
@@ -1410,7 +1420,7 @@ def process_result(
1410
1420
 
1411
1421
  elif output is not None:
1412
1422
  final_output_str = str(output)
1413
- render_markdown('str not none: ', final_output_str)
1423
+ render_markdown( final_output_str)
1414
1424
  if final_output_str and result_state.messages and result_state.messages[-1].get("role") != "assistant":
1415
1425
  result_state.messages.append({"role": "assistant", "content": final_output_str})
1416
1426
 
@@ -1434,8 +1444,13 @@ def process_result(
1434
1444
  def run_repl(command_history: CommandHistory, initial_state: ShellState):
1435
1445
  state = initial_state
1436
1446
  print_welcome_message()
1437
- print(f'Using {state.current_mode} mode. Use /agent, /cmd, /chat, or /ride to switch to other modes')
1438
- print(f'To switch to a different NPC, type /<npc_name>')
1447
+
1448
+
1449
+ render_markdown(f'- Using {state.current_mode} mode. Use /agent, /cmd, /chat, or /ride to switch to other modes')
1450
+ render_markdown(f'- To switch to a different NPC, type /npc <npc_name> or /n <npc_name> to switch to that NPC.')
1451
+ render_markdown('\n- Here are the current NPCs available in your team: ' + ', '.join([npc_name for npc_name in state.team.npcs.keys()]))
1452
+
1453
+
1439
1454
  is_windows = platform.system().lower().startswith("win")
1440
1455
  try:
1441
1456
  completer = make_completer(state)
npcsh/routes.py CHANGED
@@ -258,27 +258,7 @@ def init_handler(command: str, **kwargs):
258
258
  traceback.print_exc()
259
259
  output = f"Error initializing project: {e}"
260
260
  return {"output": output, "messages": messages}
261
- # Add these route handlers after the existing imports (around line 50):
262
- @router.route("n")
263
- @router.route("npc")
264
- def switch_npc_handler(command: str, **kwargs) -> dict:
265
- """Switch to a different NPC"""
266
- team = kwargs.get('team')
267
- parts = command.split()
268
-
269
- if len(parts) < 2:
270
- if team:
271
- available_npcs = list(team.npcs.keys())
272
- return {"output": f"Available NPCs: {', '.join(available_npcs)}"}
273
- return {"output": "No team loaded or no NPC specified"}
274
-
275
- npc_name = parts[1]
276
- if team and npc_name in team.npcs:
277
- # We can't directly modify the state here, so return a special signal
278
- return {"output": f"SWITCH_NPC:{npc_name}"}
279
- else:
280
- available_npcs = list(team.npcs.keys()) if team else []
281
- return {"output": f"NPC '{npc_name}' not found. Available: {', '.join(available_npcs)}"}
261
+
282
262
 
283
263
 
284
264
 
@@ -289,8 +269,10 @@ def ots_handler(command: str, **kwargs):
289
269
  npc = safe_get(kwargs, 'npc')
290
270
  vision_model = safe_get(kwargs, 'model', NPCSH_VISION_MODEL)
291
271
  vision_provider = safe_get(kwargs, 'provider', NPCSH_VISION_PROVIDER)
292
- if vision_model == NPCSH_CHAT_MODEL: vision_model = NPCSH_VISION_MODEL
293
- if vision_provider == NPCSH_CHAT_PROVIDER: vision_provider = NPCSH_VISION_PROVIDER
272
+ if vision_model == NPCSH_CHAT_MODEL:
273
+ vision_model = NPCSH_VISION_MODEL
274
+ if vision_provider == NPCSH_CHAT_PROVIDER:
275
+ vision_provider = NPCSH_VISION_PROVIDER
294
276
 
295
277
  messages = safe_get(kwargs, 'messages', [])
296
278
  stream = safe_get(kwargs, 'stream', NPCSH_STREAM_OUTPUT)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: npcsh
3
- Version: 1.0.10
3
+ Version: 1.0.11
4
4
  Summary: npcsh is a command-line toolkit for using AI agents in novel ways.
5
5
  Home-page: https://github.com/NPC-Worldwide/npcsh
6
6
  Author: Christopher Agostino
@@ -6,16 +6,16 @@ npcsh/mcp_helpers.py,sha256=Ktd2yXuBnLL2P7OMalgGLj84PXJSzaucjqmJVvWx6HA,12723
6
6
  npcsh/mcp_npcsh.py,sha256=SfmplH62GS9iI6q4vuQLVUS6tkrok6L7JxODx_iH7ps,36158
7
7
  npcsh/mcp_server.py,sha256=l2Ra0lpFrUu334pvp0Q9ajF2n73KvZswFi0FgbDhh9k,5884
8
8
  npcsh/npc.py,sha256=7ujKrMQFgkeGJ4sX5Kn_dB5tjrPN58xeC91PNt453aM,7827
9
- npcsh/npcsh.py,sha256=xrDcmK3UlkTXF2tdR1Bxq7sqG62-AcUTf_IupJYt8U4,59237
9
+ npcsh/npcsh.py,sha256=_vpphATMKlM2FtUZR3RrwKoRh-eg9QiAp7axIIDAITg,59986
10
10
  npcsh/plonk.py,sha256=U2e9yUJZN95Girzzvgrh-40zOdl5zO3AHPsIjoyLv2M,15261
11
11
  npcsh/pti.py,sha256=jGHGE5SeIcDkV8WlOEHCKQCnYAL4IPS-kUBHrUz0oDA,10019
12
- npcsh/routes.py,sha256=JNlRMk8WvGlR950Bl_LQMjm_gtdpPI0XMBQlj_YjI5I,37768
12
+ npcsh/routes.py,sha256=5u23bFTbdXXJ3V7I8BJMq42wWUZFeMbzItwBf8WHlpY,36917
13
13
  npcsh/spool.py,sha256=GhnSFX9uAtrB4m_ijuyA5tufH12DrWdABw0z8FmiCHc,11497
14
14
  npcsh/wander.py,sha256=BiN6eYyFnEsFzo8MFLRkdZ8xS9sTKkQpjiCcy9chMcc,23225
15
15
  npcsh/yap.py,sha256=h5KNt9sNOrDPhGe_zfn_yFIeQhizX09zocjcPWH7m3k,20905
16
- npcsh-1.0.10.dist-info/licenses/LICENSE,sha256=IKBvAECHP-aCiJtE4cHGCE5Yl0tozYz02PomGeWS3y4,1070
17
- npcsh-1.0.10.dist-info/METADATA,sha256=kaQ9neGi6CVloTZFgFdudx_oQZ9MHhlEqnwBoUp47Os,22748
18
- npcsh-1.0.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- npcsh-1.0.10.dist-info/entry_points.txt,sha256=qxOYTm3ym3JWyWf2nv2Mk71uMcJIdUoNEJ8VYMkyHiY,214
20
- npcsh-1.0.10.dist-info/top_level.txt,sha256=kHSNgKMCkfjV95-DH0YSp1LLBi0HXdF3w57j7MQON3E,6
21
- npcsh-1.0.10.dist-info/RECORD,,
16
+ npcsh-1.0.11.dist-info/licenses/LICENSE,sha256=IKBvAECHP-aCiJtE4cHGCE5Yl0tozYz02PomGeWS3y4,1070
17
+ npcsh-1.0.11.dist-info/METADATA,sha256=kv7abgprmCXu31NjmmaYZhfLz_x1zIVlzUZAIb1RliI,22748
18
+ npcsh-1.0.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ npcsh-1.0.11.dist-info/entry_points.txt,sha256=qxOYTm3ym3JWyWf2nv2Mk71uMcJIdUoNEJ8VYMkyHiY,214
20
+ npcsh-1.0.11.dist-info/top_level.txt,sha256=kHSNgKMCkfjV95-DH0YSp1LLBi0HXdF3w57j7MQON3E,6
21
+ npcsh-1.0.11.dist-info/RECORD,,
File without changes