npcpy 1.3.9__py3-none-any.whl → 1.3.10__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.
npcpy/serve.py CHANGED
@@ -42,7 +42,8 @@ class SilentUndefined(Undefined):
42
42
  return ""
43
43
 
44
44
  # Import ShellState and helper functions from npcsh
45
- from npcsh._state import ShellState
45
+ from npcsh._state import ShellState, initialize_base_npcs_if_needed
46
+ from npcsh.config import NPCSH_DB_PATH
46
47
 
47
48
 
48
49
  from npcpy.memory.knowledge_graph import load_kg_from_db
@@ -2354,39 +2355,37 @@ def init_project_team():
2354
2355
 
2355
2356
  @app.route("/api/npcsh/check", methods=["GET"])
2356
2357
  def check_npcsh_folder():
2357
- """Check if ~/.npcsh folder exists and has a valid npc_team."""
2358
+ """Check if npcsh has been initialized by looking for actual npc_team content."""
2358
2359
  try:
2359
2360
  npcsh_path = os.path.expanduser("~/.npcsh")
2360
2361
  npc_team_path = os.path.join(npcsh_path, "npc_team")
2361
-
2362
- exists = os.path.exists(npcsh_path)
2363
- has_npc_team = os.path.exists(npc_team_path)
2364
- has_forenpc = os.path.exists(os.path.join(npc_team_path, "forenpc.npc")) if has_npc_team else False
2365
-
2362
+ # Check if npc_team exists and has .npc files (actual initialization)
2363
+ initialized = os.path.isdir(npc_team_path) and any(
2364
+ f.endswith('.npc') for f in os.listdir(npc_team_path)
2365
+ ) if os.path.exists(npc_team_path) else False
2366
2366
  return jsonify({
2367
- "exists": exists,
2368
- "has_npc_team": has_npc_team,
2369
- "has_forenpc": has_forenpc,
2367
+ "initialized": initialized,
2370
2368
  "path": npcsh_path,
2371
2369
  "error": None
2372
2370
  })
2373
2371
  except Exception as e:
2374
- print(f"Error checking npcsh folder: {e}")
2372
+ print(f"Error checking npcsh: {e}")
2375
2373
  return jsonify({"error": str(e)}), 500
2376
2374
 
2377
2375
  @app.route("/api/npcsh/init", methods=["POST"])
2378
2376
  def init_npcsh_folder():
2379
- """Initialize the ~/.npcsh folder with a default npc_team."""
2377
+ """Initialize npcsh with config and default npc_team."""
2380
2378
  try:
2381
- npcsh_path = os.path.expanduser("~/.npcsh")
2382
- result = initialize_npc_project(directory=npcsh_path)
2379
+ db_path = os.path.expanduser(NPCSH_DB_PATH)
2380
+ os.makedirs(os.path.dirname(db_path), exist_ok=True)
2381
+ initialize_base_npcs_if_needed(db_path)
2383
2382
  return jsonify({
2384
- "message": result,
2385
- "path": npcsh_path,
2383
+ "message": "npcsh initialized",
2384
+ "path": os.path.expanduser("~/.npcsh"),
2386
2385
  "error": None
2387
2386
  })
2388
2387
  except Exception as e:
2389
- print(f"Error initializing npcsh folder: {e}")
2388
+ print(f"Error initializing npcsh: {e}")
2390
2389
  return jsonify({"error": str(e)}), 500
2391
2390
 
2392
2391
  @app.route("/api/context/websites", methods=["GET"])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: npcpy
3
- Version: 1.3.9
3
+ Version: 1.3.10
4
4
  Summary: npcpy is the premier open-source library for integrating LLMs and Agents into python systems.
5
5
  Home-page: https://github.com/NPC-Worldwide/npcpy
6
6
  Author: Christopher Agostino
@@ -7,7 +7,7 @@ npcpy/npc_array.py,sha256=fVTxcMiXV-lvltmuwaRnTU9D3ikPq3-7k5wzp7MA5OY,40224
7
7
  npcpy/npc_compiler.py,sha256=9U6_F7qweURaL2nQgrF7I9OQEmYjOENmkBV-YChr3oM,118402
8
8
  npcpy/npc_sysenv.py,sha256=VH7le3xwxHvO55ZYCG1e-gj8X5YTSIqbIiU6ifSqhss,38917
9
9
  npcpy/npcs.py,sha256=eExuVsbTfrRobTRRptRpDm46jCLWUgbvy4_U7IUQo-c,744
10
- npcpy/serve.py,sha256=rl1SFx5F2W3ejJTwz3BfvMj8acEoPKCpHZzacjs-aGw,203964
10
+ npcpy/serve.py,sha256=pNrjo2Jk9CuvLizBIHUCVvEgGxJWKX1wqT5omtaMhOE,204093
11
11
  npcpy/tools.py,sha256=A5_oVmZkzGnI3BI-NmneuxeXQq-r29PbpAZP4nV4jrc,5303
12
12
  npcpy/data/__init__.py,sha256=1tcoChR-Hjn905JDLqaW9ElRmcISCTJdE7BGXPlym2Q,642
13
13
  npcpy/data/audio.py,sha256=3qryGXnWHa4JFMonjuX-lf0fCrF8jmbHe7mHAuOdua0,12397
@@ -53,8 +53,8 @@ npcpy/work/browser.py,sha256=p2PeaoZdAXipFuAgKCCB3aXXLE_p3yIRqC87KlZKZWc,679
53
53
  npcpy/work/desktop.py,sha256=F3I8mUtJp6LAkXodsh8hGZIncoads6c_2Utty-0EdDA,2986
54
54
  npcpy/work/plan.py,sha256=QyUwg8vElWiHuoS-xK4jXTxxHvkMD3VkaCEsCmrEPQk,8300
55
55
  npcpy/work/trigger.py,sha256=P1Y8u1wQRsS2WACims_2IdkBEar-iBQix-2TDWoW0OM,9948
56
- npcpy-1.3.9.dist-info/licenses/LICENSE,sha256=j0YPvce7Ng9e32zYOu0EmXjXeJ0Nwawd0RA3uSGGH4E,1070
57
- npcpy-1.3.9.dist-info/METADATA,sha256=aQk_TjR_0MsXFWx5UU-ZN_Ze3s2PPd9m6EPL678WMps,37884
58
- npcpy-1.3.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
59
- npcpy-1.3.9.dist-info/top_level.txt,sha256=g1pbSvrOOncB74Bg5-J0Olg4V0A5VzDw-Xz5YObq8BU,6
60
- npcpy-1.3.9.dist-info/RECORD,,
56
+ npcpy-1.3.10.dist-info/licenses/LICENSE,sha256=j0YPvce7Ng9e32zYOu0EmXjXeJ0Nwawd0RA3uSGGH4E,1070
57
+ npcpy-1.3.10.dist-info/METADATA,sha256=_BcYfu_xY5b9TeksWeL0h8XI4JSPm8fzfZ5mtfX1qeE,37885
58
+ npcpy-1.3.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
59
+ npcpy-1.3.10.dist-info/top_level.txt,sha256=g1pbSvrOOncB74Bg5-J0Olg4V0A5VzDw-Xz5YObq8BU,6
60
+ npcpy-1.3.10.dist-info/RECORD,,
File without changes