npcsh 1.1.17__py3-none-any.whl → 1.1.18__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/_state.py +114 -91
- npcsh/alicanto.py +2 -2
- npcsh/benchmark/__init__.py +8 -2
- npcsh/benchmark/npcsh_agent.py +46 -12
- npcsh/benchmark/runner.py +85 -43
- npcsh/benchmark/templates/install-npcsh.sh.j2 +35 -0
- npcsh/build.py +2 -4
- npcsh/completion.py +2 -6
- npcsh/config.py +1 -3
- npcsh/conversation_viewer.py +389 -0
- npcsh/corca.py +0 -1
- npcsh/execution.py +0 -1
- npcsh/guac.py +0 -1
- npcsh/mcp_helpers.py +2 -3
- npcsh/mcp_server.py +5 -10
- npcsh/npc.py +10 -11
- npcsh/npc_team/jinxs/bin/benchmark.jinx +1 -1
- npcsh/npc_team/jinxs/lib/core/search/db_search.jinx +321 -17
- npcsh/npc_team/jinxs/lib/core/search/file_search.jinx +312 -67
- npcsh/npc_team/jinxs/lib/core/search/kg_search.jinx +366 -44
- npcsh/npc_team/jinxs/lib/core/search/mem_review.jinx +73 -0
- npcsh/npc_team/jinxs/lib/core/search/mem_search.jinx +328 -20
- npcsh/npc_team/jinxs/lib/core/search/web_search.jinx +242 -10
- npcsh/npc_team/jinxs/lib/core/sleep.jinx +22 -11
- npcsh/npc_team/jinxs/lib/core/sql.jinx +10 -6
- npcsh/npc_team/jinxs/lib/research/paper_search.jinx +387 -76
- npcsh/npc_team/jinxs/lib/research/semantic_scholar.jinx +372 -55
- npcsh/npc_team/jinxs/lib/utils/jinxs.jinx +299 -144
- npcsh/npc_team/jinxs/modes/alicanto.jinx +356 -0
- npcsh/npc_team/jinxs/modes/arxiv.jinx +720 -0
- npcsh/npc_team/jinxs/modes/corca.jinx +430 -0
- npcsh/npc_team/jinxs/modes/guac.jinx +544 -0
- npcsh/npc_team/jinxs/modes/plonk.jinx +379 -0
- npcsh/npc_team/jinxs/modes/pti.jinx +357 -0
- npcsh/npc_team/jinxs/modes/reattach.jinx +291 -0
- npcsh/npc_team/jinxs/modes/spool.jinx +350 -0
- npcsh/npc_team/jinxs/modes/wander.jinx +455 -0
- npcsh/npc_team/jinxs/{bin → modes}/yap.jinx +13 -7
- npcsh/npcsh.py +7 -4
- npcsh/plonk.py +0 -1
- npcsh/pti.py +0 -1
- npcsh/routes.py +1 -3
- npcsh/spool.py +0 -1
- npcsh/ui.py +0 -1
- npcsh/wander.py +0 -1
- npcsh/yap.py +0 -1
- npcsh-1.1.18.data/data/npcsh/npc_team/alicanto.jinx +356 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/arxiv.jinx +720 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/benchmark.jinx +1 -1
- npcsh-1.1.18.data/data/npcsh/npc_team/corca.jinx +430 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/db_search.jinx +348 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/file_search.jinx +339 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/guac.jinx +544 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/jinxs.jinx +331 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/kg_search.jinx +418 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/mem_review.jinx +73 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/mem_search.jinx +388 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/paper_search.jinx +412 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/plonk.jinx +379 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/pti.jinx +357 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/reattach.jinx +291 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/semantic_scholar.jinx +386 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/sleep.jinx +22 -11
- npcsh-1.1.18.data/data/npcsh/npc_team/spool.jinx +350 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/sql.jinx +20 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/wander.jinx +455 -0
- npcsh-1.1.18.data/data/npcsh/npc_team/web_search.jinx +283 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/yap.jinx +13 -7
- {npcsh-1.1.17.dist-info → npcsh-1.1.18.dist-info}/METADATA +90 -1
- npcsh-1.1.18.dist-info/RECORD +235 -0
- {npcsh-1.1.17.dist-info → npcsh-1.1.18.dist-info}/WHEEL +1 -1
- {npcsh-1.1.17.dist-info → npcsh-1.1.18.dist-info}/entry_points.txt +0 -3
- npcsh/npc_team/jinxs/bin/spool.jinx +0 -161
- npcsh/npc_team/jinxs/bin/wander.jinx +0 -242
- npcsh/npc_team/jinxs/lib/research/arxiv.jinx +0 -76
- npcsh-1.1.17.data/data/npcsh/npc_team/arxiv.jinx +0 -76
- npcsh-1.1.17.data/data/npcsh/npc_team/db_search.jinx +0 -44
- npcsh-1.1.17.data/data/npcsh/npc_team/file_search.jinx +0 -94
- npcsh-1.1.17.data/data/npcsh/npc_team/jinxs.jinx +0 -176
- npcsh-1.1.17.data/data/npcsh/npc_team/kg_search.jinx +0 -96
- npcsh-1.1.17.data/data/npcsh/npc_team/mem_search.jinx +0 -80
- npcsh-1.1.17.data/data/npcsh/npc_team/paper_search.jinx +0 -101
- npcsh-1.1.17.data/data/npcsh/npc_team/semantic_scholar.jinx +0 -69
- npcsh-1.1.17.data/data/npcsh/npc_team/spool.jinx +0 -161
- npcsh-1.1.17.data/data/npcsh/npc_team/sql.jinx +0 -16
- npcsh-1.1.17.data/data/npcsh/npc_team/wander.jinx +0 -242
- npcsh-1.1.17.data/data/npcsh/npc_team/web_search.jinx +0 -51
- npcsh-1.1.17.dist-info/RECORD +0 -219
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/add_tab.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/alicanto.npc +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/alicanto.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/browser_action.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/browser_screenshot.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/build.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/chat.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/click.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/close_browser.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/close_pane.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/close_tab.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/cmd.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/compile.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/compress.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/confirm.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/convene.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/corca.npc +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/corca.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/corca_example.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/delegate.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/edit_file.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/focus_pane.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/frederic.npc +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/frederic4.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/guac.npc +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/guac.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/help.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/incognide.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/init.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/kadiefa.npc +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/kadiefa.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/key_press.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/launch_app.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/list_panes.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/load_file.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/navigate.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/notify.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/npcsh.ctx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/npcsh_sibiji.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/nql.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/open_browser.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/open_pane.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/ots.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/paste.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/plonk.npc +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/plonk.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/plonkjr.npc +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/plonkjr.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/python.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/read_pane.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/roll.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/run_terminal.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/sample.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/screenshot.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/search.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/send_message.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/serve.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/set.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/sh.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/shh.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/sibiji.npc +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/sibiji.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/split_pane.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/spool.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/switch.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/switch_npc.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/switch_tab.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/switches.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/sync.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/teamviz.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/trigger.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/type_text.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/usage.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/verbose.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/vixynt.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/wait.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/write_file.jinx +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/yap.png +0 -0
- {npcsh-1.1.17.data → npcsh-1.1.18.data}/data/npcsh/npc_team/zen_mode.jinx +0 -0
- {npcsh-1.1.17.dist-info → npcsh-1.1.18.dist-info}/licenses/LICENSE +0 -0
- {npcsh-1.1.17.dist-info → npcsh-1.1.18.dist-info}/top_level.txt +0 -0
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
jinx_name: jinxs
|
|
2
|
-
description: "Show available jinxs organized by folder. Use /jinxs <path> for details on a specific folder."
|
|
3
|
-
inputs:
|
|
4
|
-
- path: ""
|
|
5
|
-
steps:
|
|
6
|
-
- name: list_jinxs
|
|
7
|
-
engine: python
|
|
8
|
-
code: |
|
|
9
|
-
import os
|
|
10
|
-
from pathlib import Path
|
|
11
|
-
import yaml
|
|
12
|
-
|
|
13
|
-
filter_path = context.get('path', '').strip()
|
|
14
|
-
|
|
15
|
-
# Find jinxs directory from team or fallback
|
|
16
|
-
jinxs_dir = None
|
|
17
|
-
if hasattr(npc, 'team') and npc.team:
|
|
18
|
-
if hasattr(npc.team, 'jinxs_dir') and npc.team.jinxs_dir:
|
|
19
|
-
jinxs_dir = Path(npc.team.jinxs_dir)
|
|
20
|
-
elif hasattr(npc.team, 'team_path') and npc.team.team_path:
|
|
21
|
-
candidate = Path(npc.team.team_path) / "jinxs"
|
|
22
|
-
if candidate.exists():
|
|
23
|
-
jinxs_dir = candidate
|
|
24
|
-
|
|
25
|
-
if not jinxs_dir:
|
|
26
|
-
# Fallback to global jinxs
|
|
27
|
-
global_jinxs = Path.home() / ".npcsh" / "npc_team" / "jinxs"
|
|
28
|
-
if global_jinxs.exists():
|
|
29
|
-
jinxs_dir = global_jinxs
|
|
30
|
-
|
|
31
|
-
if not jinxs_dir or not jinxs_dir.exists():
|
|
32
|
-
output = "Error: Could not find jinxs directory"
|
|
33
|
-
exit()
|
|
34
|
-
|
|
35
|
-
def get_jinx_info(jinx_path):
|
|
36
|
-
"""Extract name and description from a jinx file."""
|
|
37
|
-
try:
|
|
38
|
-
with open(jinx_path, 'r') as f:
|
|
39
|
-
content = f.read()
|
|
40
|
-
# Parse just the header (before steps:)
|
|
41
|
-
header = content.split('steps:')[0] if 'steps:' in content else content
|
|
42
|
-
data = yaml.safe_load(header)
|
|
43
|
-
name = data.get('jinx_name', jinx_path.stem)
|
|
44
|
-
desc = data.get('description', 'No description')
|
|
45
|
-
return name, desc
|
|
46
|
-
except:
|
|
47
|
-
return jinx_path.stem, 'No description'
|
|
48
|
-
|
|
49
|
-
def get_folder_structure(base_path):
|
|
50
|
-
"""Get jinxs organized by folder."""
|
|
51
|
-
structure = {}
|
|
52
|
-
for root, dirs, files in os.walk(base_path):
|
|
53
|
-
# Skip hidden directories
|
|
54
|
-
dirs[:] = [d for d in dirs if not d.startswith('.')]
|
|
55
|
-
|
|
56
|
-
jinx_files = [f for f in files if f.endswith('.jinx')]
|
|
57
|
-
if jinx_files:
|
|
58
|
-
rel_path = Path(root).relative_to(base_path)
|
|
59
|
-
rel_str = str(rel_path) if str(rel_path) != '.' else 'root'
|
|
60
|
-
structure[rel_str] = []
|
|
61
|
-
for jf in sorted(jinx_files):
|
|
62
|
-
jinx_path = Path(root) / jf
|
|
63
|
-
name, desc = get_jinx_info(jinx_path)
|
|
64
|
-
structure[rel_str].append((name, desc, jf))
|
|
65
|
-
return structure
|
|
66
|
-
|
|
67
|
-
output_lines = []
|
|
68
|
-
|
|
69
|
-
if filter_path:
|
|
70
|
-
# Show details for a specific path
|
|
71
|
-
target_path = jinxs_dir / filter_path
|
|
72
|
-
if not target_path.exists():
|
|
73
|
-
# Try to find a matching folder
|
|
74
|
-
matches = []
|
|
75
|
-
for root, dirs, files in os.walk(jinxs_dir):
|
|
76
|
-
rel = Path(root).relative_to(jinxs_dir)
|
|
77
|
-
if filter_path in str(rel) or filter_path in Path(root).name:
|
|
78
|
-
matches.append(rel)
|
|
79
|
-
|
|
80
|
-
if matches:
|
|
81
|
-
output_lines.append(f"No exact match for '{filter_path}'. Did you mean:\n")
|
|
82
|
-
for m in matches[:5]:
|
|
83
|
-
output_lines.append(f" /jinxs {m}\n")
|
|
84
|
-
output = "".join(output_lines)
|
|
85
|
-
exit()
|
|
86
|
-
else:
|
|
87
|
-
output = f"No jinxs found at path: {filter_path}"
|
|
88
|
-
exit()
|
|
89
|
-
|
|
90
|
-
# Get jinxs in this path
|
|
91
|
-
structure = get_folder_structure(target_path)
|
|
92
|
-
if not structure:
|
|
93
|
-
# Check if it's a single folder with jinxs
|
|
94
|
-
jinx_files = list(target_path.glob("*.jinx"))
|
|
95
|
-
if jinx_files:
|
|
96
|
-
output_lines.append(f"Jinxs in {filter_path}:\n\n")
|
|
97
|
-
for jf in sorted(jinx_files):
|
|
98
|
-
name, desc = get_jinx_info(jf)
|
|
99
|
-
output_lines.append(f" /{name}\n")
|
|
100
|
-
output_lines.append(f" {desc}\n\n")
|
|
101
|
-
else:
|
|
102
|
-
output = f"No jinxs found at path: {filter_path}"
|
|
103
|
-
exit()
|
|
104
|
-
else:
|
|
105
|
-
output_lines.append(f"Jinxs in {filter_path}:\n\n")
|
|
106
|
-
for folder, jinxs in sorted(structure.items()):
|
|
107
|
-
if folder != 'root':
|
|
108
|
-
output_lines.append(f" {folder}/\n")
|
|
109
|
-
for name, desc, filename in jinxs:
|
|
110
|
-
prefix = " " if folder != 'root' else " "
|
|
111
|
-
output_lines.append(f"{prefix}/{name} - {desc}\n")
|
|
112
|
-
output_lines.append("\n")
|
|
113
|
-
|
|
114
|
-
else:
|
|
115
|
-
# Show overview organized by folder
|
|
116
|
-
structure = get_folder_structure(jinxs_dir)
|
|
117
|
-
|
|
118
|
-
output_lines.append("Available Jinxs\n")
|
|
119
|
-
output_lines.append("=" * 40 + "\n\n")
|
|
120
|
-
|
|
121
|
-
# Group by top-level folder
|
|
122
|
-
top_level = {}
|
|
123
|
-
for folder, jinxs in structure.items():
|
|
124
|
-
if folder == 'root':
|
|
125
|
-
top = 'root'
|
|
126
|
-
else:
|
|
127
|
-
top = folder.split('/')[0] if '/' in folder else folder
|
|
128
|
-
|
|
129
|
-
if top not in top_level:
|
|
130
|
-
top_level[top] = {'subfolders': {}, 'jinxs': []}
|
|
131
|
-
|
|
132
|
-
if folder == top or folder == 'root':
|
|
133
|
-
top_level[top]['jinxs'].extend(jinxs)
|
|
134
|
-
else:
|
|
135
|
-
subfolder = '/'.join(folder.split('/')[1:])
|
|
136
|
-
if subfolder not in top_level[top]['subfolders']:
|
|
137
|
-
top_level[top]['subfolders'][subfolder] = []
|
|
138
|
-
top_level[top]['subfolders'][subfolder].extend(jinxs)
|
|
139
|
-
|
|
140
|
-
# Display
|
|
141
|
-
folder_order = ['bin', 'lib', 'npc_studio', 'root']
|
|
142
|
-
sorted_folders = sorted(top_level.keys(), key=lambda x: (folder_order.index(x) if x in folder_order else 99, x))
|
|
143
|
-
|
|
144
|
-
for top in sorted_folders:
|
|
145
|
-
data = top_level[top]
|
|
146
|
-
|
|
147
|
-
if top == 'root':
|
|
148
|
-
if data['jinxs']:
|
|
149
|
-
output_lines.append("Root Jinxs:\n")
|
|
150
|
-
for name, desc, _ in data['jinxs']:
|
|
151
|
-
output_lines.append(f" /{name} - {desc}\n")
|
|
152
|
-
output_lines.append("\n")
|
|
153
|
-
else:
|
|
154
|
-
total = len(data['jinxs'])
|
|
155
|
-
for sf_jinxs in data['subfolders'].values():
|
|
156
|
-
total += len(sf_jinxs)
|
|
157
|
-
|
|
158
|
-
output_lines.append(f"{top}/ ({total} jinxs)\n")
|
|
159
|
-
|
|
160
|
-
# Show direct jinxs
|
|
161
|
-
if data['jinxs']:
|
|
162
|
-
for name, desc, _ in data['jinxs'][:3]:
|
|
163
|
-
output_lines.append(f" /{name} - {desc}\n")
|
|
164
|
-
if len(data['jinxs']) > 3:
|
|
165
|
-
output_lines.append(f" ... and {len(data['jinxs']) - 3} more\n")
|
|
166
|
-
|
|
167
|
-
# Show subfolders summary
|
|
168
|
-
if data['subfolders']:
|
|
169
|
-
for subfolder, jinxs in sorted(data['subfolders'].items()):
|
|
170
|
-
output_lines.append(f" {subfolder}/ ({len(jinxs)} jinxs)\n")
|
|
171
|
-
|
|
172
|
-
output_lines.append(f" → /jinxs {top} for details\n\n")
|
|
173
|
-
|
|
174
|
-
output_lines.append("Use /jinxs <path> for details (e.g., /jinxs lib/core)\n")
|
|
175
|
-
|
|
176
|
-
output = "".join(output_lines)
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
jinx_name: kg_search
|
|
2
|
-
description: Search the knowledge graph for facts and concepts
|
|
3
|
-
inputs:
|
|
4
|
-
- query: ""
|
|
5
|
-
- type: "facts"
|
|
6
|
-
- concept: ""
|
|
7
|
-
- npc_name: ""
|
|
8
|
-
- team_name: ""
|
|
9
|
-
- db_path: ""
|
|
10
|
-
|
|
11
|
-
steps:
|
|
12
|
-
- name: search_kg
|
|
13
|
-
engine: python
|
|
14
|
-
code: |
|
|
15
|
-
import os
|
|
16
|
-
from npcpy.memory.knowledge_graph import kg_search_facts, kg_list_concepts, kg_get_facts_for_concept, kg_get_all_facts
|
|
17
|
-
|
|
18
|
-
query = context.get('query', '').strip()
|
|
19
|
-
search_type = context.get('type', 'facts').lower()
|
|
20
|
-
concept = context.get('concept', '').strip()
|
|
21
|
-
|
|
22
|
-
if not query and search_type == 'facts' and not concept:
|
|
23
|
-
lines = [
|
|
24
|
-
"Usage: /kg_search <query> [type=facts|concepts|all]",
|
|
25
|
-
"",
|
|
26
|
-
"Options:",
|
|
27
|
-
" type - Search type (facts, concepts, all). Default is facts",
|
|
28
|
-
" concept - Get facts for a specific concept",
|
|
29
|
-
" npc_name - Filter by NPC name",
|
|
30
|
-
" team_name - Filter by team name",
|
|
31
|
-
" db_path - Path to history database",
|
|
32
|
-
"",
|
|
33
|
-
"Examples:",
|
|
34
|
-
" /kg_search python",
|
|
35
|
-
" /kg_search type=concepts",
|
|
36
|
-
" /kg_search concept=coding",
|
|
37
|
-
" /kg_search type=all",
|
|
38
|
-
]
|
|
39
|
-
context['output'] = "\n".join(lines)
|
|
40
|
-
else:
|
|
41
|
-
db_path = context.get('db_path') or os.path.expanduser("~/.npcsh/npcsh_history.db")
|
|
42
|
-
|
|
43
|
-
try:
|
|
44
|
-
cmd_history = CommandHistory(db_path)
|
|
45
|
-
engine = cmd_history.engine
|
|
46
|
-
|
|
47
|
-
team_obj = None
|
|
48
|
-
try:
|
|
49
|
-
team_obj = state.team if 'state' in dir() and state else None
|
|
50
|
-
except:
|
|
51
|
-
pass
|
|
52
|
-
npc_obj = npc if 'npc' in dir() else None
|
|
53
|
-
|
|
54
|
-
if concept:
|
|
55
|
-
facts = kg_get_facts_for_concept(engine, concept, npc=npc_obj, team=team_obj)
|
|
56
|
-
if not facts:
|
|
57
|
-
context['output'] = "No facts found for concept '" + concept + "'"
|
|
58
|
-
else:
|
|
59
|
-
lines = ["Facts for concept '" + concept + "':", ""]
|
|
60
|
-
for i, fact in enumerate(facts, 1):
|
|
61
|
-
lines.append(str(i) + ". " + str(fact))
|
|
62
|
-
context['output'] = "\n".join(lines)
|
|
63
|
-
|
|
64
|
-
elif search_type == 'concepts':
|
|
65
|
-
concepts = kg_list_concepts(engine, npc=npc_obj, team=team_obj)
|
|
66
|
-
if not concepts:
|
|
67
|
-
context['output'] = "No concepts found in knowledge graph."
|
|
68
|
-
else:
|
|
69
|
-
lines = ["Found " + str(len(concepts)) + " concepts:", ""]
|
|
70
|
-
for i, c in enumerate(concepts, 1):
|
|
71
|
-
lines.append(str(i) + ". " + str(c))
|
|
72
|
-
context['output'] = "\n".join(lines)
|
|
73
|
-
|
|
74
|
-
elif search_type == 'all':
|
|
75
|
-
facts = kg_get_all_facts(engine, npc=npc_obj, team=team_obj)
|
|
76
|
-
if not facts:
|
|
77
|
-
context['output'] = "No facts in knowledge graph."
|
|
78
|
-
else:
|
|
79
|
-
lines = ["All facts (" + str(len(facts)) + " total):", ""]
|
|
80
|
-
for i, fact in enumerate(facts, 1):
|
|
81
|
-
lines.append(str(i) + ". " + str(fact))
|
|
82
|
-
context['output'] = "\n".join(lines)
|
|
83
|
-
|
|
84
|
-
else:
|
|
85
|
-
facts = kg_search_facts(engine, query, npc=npc_obj, team=team_obj)
|
|
86
|
-
if not facts:
|
|
87
|
-
context['output'] = "No KG facts found for '" + query + "'"
|
|
88
|
-
else:
|
|
89
|
-
lines = ["Found " + str(len(facts)) + " facts:", ""]
|
|
90
|
-
for i, fact in enumerate(facts, 1):
|
|
91
|
-
lines.append(str(i) + ". " + str(fact))
|
|
92
|
-
context['output'] = "\n".join(lines)
|
|
93
|
-
|
|
94
|
-
except Exception as e:
|
|
95
|
-
import traceback
|
|
96
|
-
context['output'] = "KG search error: " + str(e) + "\n" + traceback.format_exc()
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
jinx_name: mem_search
|
|
2
|
-
description: Search memories (approved, pending, or all)
|
|
3
|
-
inputs:
|
|
4
|
-
- query: ""
|
|
5
|
-
- status: "all"
|
|
6
|
-
- npc_name: ""
|
|
7
|
-
- team_name: ""
|
|
8
|
-
- max_results: "10"
|
|
9
|
-
- db_path: ""
|
|
10
|
-
|
|
11
|
-
steps:
|
|
12
|
-
- name: search_memories
|
|
13
|
-
engine: python
|
|
14
|
-
code: |
|
|
15
|
-
import os
|
|
16
|
-
|
|
17
|
-
query = context.get('query', '').strip()
|
|
18
|
-
if not query:
|
|
19
|
-
lines = [
|
|
20
|
-
"Usage: /mem_search <query> [status=all|approved|pending]",
|
|
21
|
-
"",
|
|
22
|
-
"Options:",
|
|
23
|
-
" status - Filter by status (all, approved, pending). Default is all",
|
|
24
|
-
" npc_name - Filter by NPC name",
|
|
25
|
-
" team_name - Filter by team name",
|
|
26
|
-
" max_results - Max results to return (default 10)",
|
|
27
|
-
" db_path - Path to history database",
|
|
28
|
-
]
|
|
29
|
-
context['output'] = "\n".join(lines)
|
|
30
|
-
else:
|
|
31
|
-
status_filter = context.get('status', 'all').lower()
|
|
32
|
-
npc_name = context.get('npc_name') or (npc.name if npc else None)
|
|
33
|
-
team_name = context.get('team_name') or None
|
|
34
|
-
try:
|
|
35
|
-
team_name = team_name or (state.team.name if 'state' in dir() and state and state.team else None)
|
|
36
|
-
except:
|
|
37
|
-
pass
|
|
38
|
-
max_results = int(context.get('max_results') or 10)
|
|
39
|
-
db_path = context.get('db_path') or os.path.expanduser("~/.npcsh/npcsh_history.db")
|
|
40
|
-
current_path = os.getcwd()
|
|
41
|
-
|
|
42
|
-
try:
|
|
43
|
-
cmd_history = CommandHistory(db_path)
|
|
44
|
-
|
|
45
|
-
if status_filter == 'approved':
|
|
46
|
-
state_obj = state if 'state' in dir() else None
|
|
47
|
-
memories = get_relevant_memories(
|
|
48
|
-
command_history=cmd_history,
|
|
49
|
-
npc_name=npc_name or '__none__',
|
|
50
|
-
team_name=team_name or '__none__',
|
|
51
|
-
path=current_path,
|
|
52
|
-
query=query,
|
|
53
|
-
max_memories=max_results,
|
|
54
|
-
state=state_obj
|
|
55
|
-
)
|
|
56
|
-
else:
|
|
57
|
-
memories = cmd_history.search_memories(
|
|
58
|
-
query=query,
|
|
59
|
-
npc_name=npc_name,
|
|
60
|
-
team_name=team_name,
|
|
61
|
-
status=status_filter if status_filter != 'all' else None,
|
|
62
|
-
limit=max_results
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
if not memories:
|
|
66
|
-
context['output'] = "No memories found for '" + query + "' (status=" + status_filter + ")"
|
|
67
|
-
else:
|
|
68
|
-
lines = ["Found " + str(len(memories)) + " memories (status=" + status_filter + "):", ""]
|
|
69
|
-
for i, mem in enumerate(memories, 1):
|
|
70
|
-
if isinstance(mem, dict):
|
|
71
|
-
ts = mem.get('timestamp', 'unknown')
|
|
72
|
-
content = mem.get('final_memory') or mem.get('initial_memory') or mem.get('content', '')
|
|
73
|
-
status = mem.get('status', '')
|
|
74
|
-
lines.append(str(i) + ". [" + str(ts) + "] (" + status + ") " + str(content))
|
|
75
|
-
else:
|
|
76
|
-
lines.append(str(i) + ". " + str(mem))
|
|
77
|
-
context['output'] = "\n".join(lines)
|
|
78
|
-
except Exception as e:
|
|
79
|
-
import traceback
|
|
80
|
-
context['output'] = "Memory search error: " + str(e) + "\n" + traceback.format_exc()
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
jinx_name: paper_search
|
|
2
|
-
description: Search for academic papers across multiple sources (Semantic Scholar, arXiv, local datasets)
|
|
3
|
-
inputs:
|
|
4
|
-
- query: ""
|
|
5
|
-
- limit: 10
|
|
6
|
-
- source: "all"
|
|
7
|
-
steps:
|
|
8
|
-
- name: search_papers
|
|
9
|
-
engine: python
|
|
10
|
-
code: |
|
|
11
|
-
import os
|
|
12
|
-
import time
|
|
13
|
-
import requests
|
|
14
|
-
import urllib.request
|
|
15
|
-
import urllib.parse
|
|
16
|
-
import xml.etree.ElementTree as ET
|
|
17
|
-
|
|
18
|
-
query = context.get('query', '')
|
|
19
|
-
limit = int(context.get('limit', 10))
|
|
20
|
-
source = context.get('source', 'all').lower()
|
|
21
|
-
|
|
22
|
-
if not query:
|
|
23
|
-
context['output'] = """Usage: /paper_search <query> [--limit N] [--source SOURCE]
|
|
24
|
-
|
|
25
|
-
Sources:
|
|
26
|
-
all - Search all available sources (default)
|
|
27
|
-
s2 - Semantic Scholar only (requires S2_API_KEY)
|
|
28
|
-
arxiv - arXiv only
|
|
29
|
-
"""
|
|
30
|
-
exit()
|
|
31
|
-
|
|
32
|
-
all_results = []
|
|
33
|
-
|
|
34
|
-
# Semantic Scholar
|
|
35
|
-
if source in ['all', 's2']:
|
|
36
|
-
api_key = os.environ.get('S2_API_KEY')
|
|
37
|
-
if api_key:
|
|
38
|
-
try:
|
|
39
|
-
url = "https://api.semanticscholar.org/graph/v1/paper/search"
|
|
40
|
-
headers = {"x-api-key": api_key}
|
|
41
|
-
params = {"query": query, "limit": limit, "fields": "title,abstract,authors,year,citationCount,url"}
|
|
42
|
-
response = requests.get(url, headers=headers, params=params, timeout=30)
|
|
43
|
-
response.raise_for_status()
|
|
44
|
-
for paper in response.json().get('data', []):
|
|
45
|
-
all_results.append({
|
|
46
|
-
'source': 'Semantic Scholar',
|
|
47
|
-
'title': paper.get('title', ''),
|
|
48
|
-
'year': paper.get('year'),
|
|
49
|
-
'citations': paper.get('citationCount', 0),
|
|
50
|
-
'authors': [a.get('name', '') for a in paper.get('authors', [])],
|
|
51
|
-
'abstract': paper.get('abstract', '')[:300] if paper.get('abstract') else '',
|
|
52
|
-
'url': paper.get('url', '')
|
|
53
|
-
})
|
|
54
|
-
except Exception as e:
|
|
55
|
-
print(f"S2 error: {e}")
|
|
56
|
-
|
|
57
|
-
# arXiv
|
|
58
|
-
if source in ['all', 'arxiv']:
|
|
59
|
-
try:
|
|
60
|
-
base_url = "http://export.arxiv.org/api/query"
|
|
61
|
-
params = {"search_query": f"all:{query}", "max_results": limit}
|
|
62
|
-
url = f"{base_url}?{urllib.parse.urlencode(params)}"
|
|
63
|
-
with urllib.request.urlopen(url, timeout=30) as response:
|
|
64
|
-
data = response.read().decode('utf-8')
|
|
65
|
-
root = ET.fromstring(data)
|
|
66
|
-
ns = {'atom': 'http://www.w3.org/2005/Atom'}
|
|
67
|
-
for entry in root.findall('atom:entry', ns):
|
|
68
|
-
all_results.append({
|
|
69
|
-
'source': 'arXiv',
|
|
70
|
-
'title': entry.find('atom:title', ns).text.strip().replace('\n', ' '),
|
|
71
|
-
'year': entry.find('atom:published', ns).text[:4],
|
|
72
|
-
'citations': None,
|
|
73
|
-
'authors': [a.find('atom:name', ns).text for a in entry.findall('atom:author', ns)],
|
|
74
|
-
'abstract': entry.find('atom:summary', ns).text.strip()[:300],
|
|
75
|
-
'url': entry.find('atom:id', ns).text
|
|
76
|
-
})
|
|
77
|
-
except Exception as e:
|
|
78
|
-
print(f"arXiv error: {e}")
|
|
79
|
-
|
|
80
|
-
if not all_results:
|
|
81
|
-
context['output'] = f"No papers found for: {query}"
|
|
82
|
-
exit()
|
|
83
|
-
|
|
84
|
-
# Format output
|
|
85
|
-
results = []
|
|
86
|
-
for i, paper in enumerate(all_results[:limit], 1):
|
|
87
|
-
authors = ', '.join(paper['authors'][:3])
|
|
88
|
-
if len(paper['authors']) > 3:
|
|
89
|
-
authors += ' et al.'
|
|
90
|
-
year = paper.get('year', '?')
|
|
91
|
-
citations = f", {paper['citations']} citations" if paper.get('citations') else ""
|
|
92
|
-
|
|
93
|
-
results.append(f"{i}. [{paper['source']}] {paper['title']} ({year}{citations})")
|
|
94
|
-
results.append(f" Authors: {authors}")
|
|
95
|
-
if paper['abstract']:
|
|
96
|
-
results.append(f" Abstract: {paper['abstract']}...")
|
|
97
|
-
results.append(f" URL: {paper['url']}")
|
|
98
|
-
results.append("")
|
|
99
|
-
|
|
100
|
-
context['output'] = f"Found {len(all_results)} papers:\n\n" + "\n".join(results)
|
|
101
|
-
context['papers'] = all_results
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
jinx_name: semantic_scholar
|
|
2
|
-
description: Search Semantic Scholar for academic papers. Requires S2_API_KEY env var.
|
|
3
|
-
inputs:
|
|
4
|
-
- query: ""
|
|
5
|
-
- limit: 10
|
|
6
|
-
steps:
|
|
7
|
-
- name: search_s2
|
|
8
|
-
engine: python
|
|
9
|
-
code: |
|
|
10
|
-
import os
|
|
11
|
-
import time
|
|
12
|
-
import requests
|
|
13
|
-
|
|
14
|
-
query = context.get('query', '')
|
|
15
|
-
limit = int(context.get('limit', 10))
|
|
16
|
-
|
|
17
|
-
if not query:
|
|
18
|
-
context['output'] = "Usage: /semantic_scholar <query> [--limit N]"
|
|
19
|
-
exit()
|
|
20
|
-
|
|
21
|
-
api_key = os.environ.get('S2_API_KEY')
|
|
22
|
-
if not api_key:
|
|
23
|
-
context['output'] = "Error: S2_API_KEY environment variable not set. Get one at https://www.semanticscholar.org/product/api"
|
|
24
|
-
exit()
|
|
25
|
-
|
|
26
|
-
url = "https://api.semanticscholar.org/graph/v1/paper/search"
|
|
27
|
-
headers = {"x-api-key": api_key}
|
|
28
|
-
params = {
|
|
29
|
-
"query": query,
|
|
30
|
-
"limit": limit,
|
|
31
|
-
"fields": "title,abstract,authors,year,citationCount,url,tldr"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
try:
|
|
35
|
-
response = requests.get(url, headers=headers, params=params, timeout=30)
|
|
36
|
-
response.raise_for_status()
|
|
37
|
-
data = response.json().get('data', [])
|
|
38
|
-
|
|
39
|
-
if not data:
|
|
40
|
-
context['output'] = f"No papers found for: {query}"
|
|
41
|
-
exit()
|
|
42
|
-
|
|
43
|
-
results = []
|
|
44
|
-
for i, paper in enumerate(data, 1):
|
|
45
|
-
title = paper.get('title', 'No title')
|
|
46
|
-
year = paper.get('year', '?')
|
|
47
|
-
citations = paper.get('citationCount', 0)
|
|
48
|
-
authors = ', '.join([a.get('name', '') for a in paper.get('authors', [])[:3]])
|
|
49
|
-
if len(paper.get('authors', [])) > 3:
|
|
50
|
-
authors += ' et al.'
|
|
51
|
-
abstract = paper.get('abstract', '')[:200] + '...' if paper.get('abstract') else 'No abstract'
|
|
52
|
-
tldr = paper.get('tldr', {}).get('text', '') if paper.get('tldr') else ''
|
|
53
|
-
url = paper.get('url', '')
|
|
54
|
-
|
|
55
|
-
results.append(f"{i}. {title} ({year})")
|
|
56
|
-
results.append(f" Authors: {authors}")
|
|
57
|
-
results.append(f" Citations: {citations}")
|
|
58
|
-
if tldr:
|
|
59
|
-
results.append(f" TL;DR: {tldr}")
|
|
60
|
-
else:
|
|
61
|
-
results.append(f" Abstract: {abstract}")
|
|
62
|
-
results.append(f" URL: {url}")
|
|
63
|
-
results.append("")
|
|
64
|
-
|
|
65
|
-
context['output'] = f"Found {len(data)} papers:\n\n" + "\n".join(results)
|
|
66
|
-
context['papers'] = data
|
|
67
|
-
|
|
68
|
-
except requests.exceptions.RequestException as e:
|
|
69
|
-
context['output'] = f"Semantic Scholar API error: {e}"
|