npcsh 1.1.4__py3-none-any.whl → 1.1.5__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 +47 -63
- npcsh/npc_team/corca_example.png +0 -0
- npcsh/npc_team/jinxs/{python_executor.jinx → code/python.jinx} +1 -1
- npcsh/npc_team/jinxs/{bash_executer.jinx → code/sh.jinx} +1 -1
- npcsh/npc_team/jinxs/code/sql.jinx +18 -0
- npcsh/npc_team/jinxs/modes/alicanto.jinx +88 -0
- npcsh/npc_team/jinxs/modes/corca.jinx +28 -0
- npcsh/npc_team/jinxs/modes/guac.jinx +46 -0
- npcsh/npc_team/jinxs/modes/plonk.jinx +57 -0
- npcsh/npc_team/jinxs/modes/pti.jinx +28 -0
- npcsh/npc_team/jinxs/modes/spool.jinx +40 -0
- npcsh/npc_team/jinxs/modes/wander.jinx +81 -0
- npcsh/npc_team/jinxs/modes/yap.jinx +25 -0
- npcsh/npc_team/jinxs/utils/breathe.jinx +20 -0
- npcsh/npc_team/jinxs/utils/core/build.jinx +65 -0
- npcsh/npc_team/jinxs/utils/core/compile.jinx +50 -0
- npcsh/npc_team/jinxs/utils/core/help.jinx +52 -0
- npcsh/npc_team/jinxs/utils/core/init.jinx +41 -0
- npcsh/npc_team/jinxs/utils/core/jinxs.jinx +32 -0
- npcsh/npc_team/jinxs/utils/core/set.jinx +40 -0
- npcsh/npc_team/jinxs/{edit_file.jinx → utils/edit_file.jinx} +1 -1
- npcsh/npc_team/jinxs/utils/flush.jinx +39 -0
- npcsh/npc_team/jinxs/utils/npc-studio.jinx +82 -0
- npcsh/npc_team/jinxs/utils/ots.jinx +92 -0
- npcsh/npc_team/jinxs/utils/plan.jinx +33 -0
- npcsh/npc_team/jinxs/utils/roll.jinx +66 -0
- npcsh/npc_team/jinxs/utils/sample.jinx +56 -0
- npcsh/npc_team/jinxs/utils/search/brainblast.jinx +51 -0
- npcsh/npc_team/jinxs/utils/search/rag.jinx +70 -0
- npcsh/npc_team/jinxs/utils/search/search.jinx +192 -0
- npcsh/npc_team/jinxs/utils/serve.jinx +29 -0
- npcsh/npc_team/jinxs/utils/sleep.jinx +116 -0
- npcsh/npc_team/jinxs/utils/trigger.jinx +36 -0
- npcsh/npc_team/jinxs/utils/vixynt.jinx +129 -0
- npcsh/npcsh.py +13 -11
- npcsh/routes.py +80 -1420
- npcsh-1.1.5.data/data/npcsh/npc_team/alicanto.jinx +88 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/brainblast.jinx +51 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/breathe.jinx +20 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/build.jinx +65 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/compile.jinx +50 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/corca.jinx +28 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/corca_example.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/edit_file.jinx +1 -1
- npcsh-1.1.5.data/data/npcsh/npc_team/flush.jinx +39 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/guac.jinx +46 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/help.jinx +52 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/init.jinx +41 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/jinxs.jinx +32 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/npc-studio.jinx +82 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/ots.jinx +92 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/plan.jinx +33 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/plonk.jinx +57 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/pti.jinx +28 -0
- npcsh-1.1.4.data/data/npcsh/npc_team/python_executor.jinx → npcsh-1.1.5.data/data/npcsh/npc_team/python.jinx +1 -1
- npcsh-1.1.5.data/data/npcsh/npc_team/rag.jinx +70 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/roll.jinx +66 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/sample.jinx +56 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/search.jinx +192 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/serve.jinx +29 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/set.jinx +40 -0
- npcsh-1.1.4.data/data/npcsh/npc_team/bash_executer.jinx → npcsh-1.1.5.data/data/npcsh/npc_team/sh.jinx +1 -1
- npcsh-1.1.5.data/data/npcsh/npc_team/sleep.jinx +116 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/spool.jinx +40 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/sql.jinx +18 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/trigger.jinx +36 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/vixynt.jinx +129 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/wander.jinx +81 -0
- npcsh-1.1.5.data/data/npcsh/npc_team/yap.jinx +25 -0
- {npcsh-1.1.4.dist-info → npcsh-1.1.5.dist-info}/METADATA +1 -1
- npcsh-1.1.5.dist-info/RECORD +132 -0
- npcsh/npc_team/jinxs/image_generation.jinx +0 -29
- npcsh/npc_team/jinxs/internet_search.jinx +0 -31
- npcsh/npc_team/jinxs/screen_cap.jinx +0 -25
- npcsh-1.1.4.data/data/npcsh/npc_team/image_generation.jinx +0 -29
- npcsh-1.1.4.data/data/npcsh/npc_team/internet_search.jinx +0 -31
- npcsh-1.1.4.data/data/npcsh/npc_team/screen_cap.jinx +0 -25
- npcsh-1.1.4.dist-info/RECORD +0 -78
- /npcsh/npc_team/jinxs/{kg_search.jinx → utils/search/kg_search.jinx} +0 -0
- /npcsh/npc_team/jinxs/{memory_search.jinx → utils/search/memory_search.jinx} +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/alicanto.npc +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/alicanto.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/corca.npc +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/corca.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/foreman.npc +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/frederic.npc +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/frederic4.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/guac.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/kadiefa.npc +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/kadiefa.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/kg_search.jinx +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/memory_search.jinx +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/npcsh.ctx +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/npcsh_sibiji.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/plonk.npc +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/plonk.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/plonkjr.npc +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/plonkjr.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/sibiji.npc +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/sibiji.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/spool.png +0 -0
- {npcsh-1.1.4.data → npcsh-1.1.5.data}/data/npcsh/npc_team/yap.png +0 -0
- {npcsh-1.1.4.dist-info → npcsh-1.1.5.dist-info}/WHEEL +0 -0
- {npcsh-1.1.4.dist-info → npcsh-1.1.5.dist-info}/entry_points.txt +0 -0
- {npcsh-1.1.4.dist-info → npcsh-1.1.5.dist-info}/licenses/LICENSE +0 -0
- {npcsh-1.1.4.dist-info → npcsh-1.1.5.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
jinx_name: "vixynt"
|
|
2
|
+
description: "Generates images from text descriptions or edits existing ones."
|
|
3
|
+
inputs:
|
|
4
|
+
- prompt # Required, the text description for image generation or editing.
|
|
5
|
+
- output_file_base: "" # Optional string, e.g., './my_image', used as base for output file name.
|
|
6
|
+
- attachments: "" # Optional string, comma-separated image paths for editing existing images.
|
|
7
|
+
- n_images: 1 # Optional integer, number of images to generate.
|
|
8
|
+
- height: 1024 # Optional integer, height of the generated image.
|
|
9
|
+
- width: 1024 # Optional integer, width of the generated image.
|
|
10
|
+
- model: "" # Optional string, specific model to use for image generation. Defaults to NPC's model or 'runwayml/stable-diffusion-v1-5'.
|
|
11
|
+
- provider: "" # Optional string, specific provider for image generation. Defaults to NPC's provider or 'diffusers'.
|
|
12
|
+
steps:
|
|
13
|
+
- name: "generate_or_edit_image"
|
|
14
|
+
engine: "python"
|
|
15
|
+
code: |
|
|
16
|
+
import os
|
|
17
|
+
import base64
|
|
18
|
+
from io import BytesIO
|
|
19
|
+
from datetime import datetime
|
|
20
|
+
from PIL import Image
|
|
21
|
+
from npcpy.llm_funcs import gen_image
|
|
22
|
+
|
|
23
|
+
# Extract inputs from context (Jinx execution environment passes them here)
|
|
24
|
+
image_prompt = context.get('prompt', '').strip()
|
|
25
|
+
output_file_base = context.get('output_file_base')
|
|
26
|
+
attachments_str = context.get('attachments')
|
|
27
|
+
n_images = int(context.get('n_images', 1)) # Ensure it's an integer
|
|
28
|
+
height = int(context.get('height', 1024)) # Ensure it's an integer
|
|
29
|
+
width = int(context.get('width', 1024)) # Ensure it's an integer
|
|
30
|
+
model = context.get('model')
|
|
31
|
+
provider = context.get('provider')
|
|
32
|
+
|
|
33
|
+
input_images = []
|
|
34
|
+
if attachments_str and attachments_str.strip():
|
|
35
|
+
input_images = [p.strip() for p in attachments_str.split(',')]
|
|
36
|
+
|
|
37
|
+
# Use NPC's model/provider as fallback if not explicitly provided in jinx inputs
|
|
38
|
+
if not model and npc and npc.model:
|
|
39
|
+
model = npc.model
|
|
40
|
+
if not provider and npc and npc.provider:
|
|
41
|
+
provider = npc.provider
|
|
42
|
+
|
|
43
|
+
# Final fallbacks if still not set
|
|
44
|
+
if not model:
|
|
45
|
+
model = "runwayml/stable-diffusion-v1-5"
|
|
46
|
+
if not provider:
|
|
47
|
+
provider = "diffusers"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
output_messages = context.get('messages', [])
|
|
51
|
+
|
|
52
|
+
if not image_prompt:
|
|
53
|
+
context['output'] = "Usage: /vixynt <prompt> [--output_file path] [--attachments path] [--n_images num]"
|
|
54
|
+
context['messages'] = output_messages
|
|
55
|
+
exit() # Exit the jinx execution early
|
|
56
|
+
|
|
57
|
+
try:
|
|
58
|
+
# Generate image(s) or edit
|
|
59
|
+
images_list = gen_image(
|
|
60
|
+
prompt=image_prompt,
|
|
61
|
+
model=model,
|
|
62
|
+
provider=provider,
|
|
63
|
+
npc=npc,
|
|
64
|
+
height=height,
|
|
65
|
+
width=width,
|
|
66
|
+
n_images=n_images,
|
|
67
|
+
input_images=input_images if input_images else None
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
saved_files = []
|
|
71
|
+
compressed_images = []
|
|
72
|
+
|
|
73
|
+
if not isinstance(images_list, list):
|
|
74
|
+
images_list = [images_list] if images_list is not None else []
|
|
75
|
+
|
|
76
|
+
for i, image in enumerate(images_list):
|
|
77
|
+
if image is None:
|
|
78
|
+
continue
|
|
79
|
+
|
|
80
|
+
# Determine output filename
|
|
81
|
+
if output_file_base and output_file_base.strip():
|
|
82
|
+
base_name, ext = os.path.splitext(os.path.expanduser(output_file_base))
|
|
83
|
+
if not ext: # No extension provided, default to .png
|
|
84
|
+
ext = ".png"
|
|
85
|
+
current_output_file = f"{base_name}_{i}{ext}" if len(images_list) > 1 else f"{base_name}{ext}"
|
|
86
|
+
else:
|
|
87
|
+
os.makedirs(os.path.expanduser("~/.npcsh/images/"), exist_ok=True)
|
|
88
|
+
current_output_file = (
|
|
89
|
+
os.path.expanduser("~/.npcsh/images/")
|
|
90
|
+
+ f"image_{datetime.now().strftime('%Y%m%d_%H%M%S')}_{i}.png"
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
# Save image to file
|
|
94
|
+
image.save(current_output_file)
|
|
95
|
+
saved_files.append(current_output_file)
|
|
96
|
+
|
|
97
|
+
# Create compressed base64 image for HTML rendering
|
|
98
|
+
img_buffer = BytesIO()
|
|
99
|
+
img_copy = image.copy()
|
|
100
|
+
img_copy.thumbnail((800, 600), Image.Resampling.LANCZOS)
|
|
101
|
+
img_copy.save(img_buffer, format='PNG', optimize=True, quality=85)
|
|
102
|
+
img_buffer.seek(0)
|
|
103
|
+
|
|
104
|
+
img_base64 = base64.b64encode(img_buffer.getvalue()).decode('utf-8')
|
|
105
|
+
compressed_images.append(f"data:image/png;base64,{img_base64}")
|
|
106
|
+
|
|
107
|
+
if saved_files:
|
|
108
|
+
if input_images:
|
|
109
|
+
output = f"Image(s) edited and saved to: {', '.join(saved_files)}"
|
|
110
|
+
else:
|
|
111
|
+
output = f"Image(s) generated and saved to: {', '.join(saved_files)}"
|
|
112
|
+
|
|
113
|
+
html_images = ""
|
|
114
|
+
for img_b64 in compressed_images:
|
|
115
|
+
html_images += f'<img src="{img_b64}" style="max-width: 400px; margin: 10px;" /><br/>'
|
|
116
|
+
|
|
117
|
+
output += f"\n\nGenerated Images:\n{html_images}"
|
|
118
|
+
else:
|
|
119
|
+
output = "No images generated."
|
|
120
|
+
|
|
121
|
+
except Exception as e:
|
|
122
|
+
import traceback
|
|
123
|
+
traceback.print_exc()
|
|
124
|
+
output = f"Error {'editing' if input_images else 'generating'} image: {str(e)}"
|
|
125
|
+
|
|
126
|
+
context['output'] = output # Store output in context
|
|
127
|
+
context['messages'] = output_messages # Ensure messages are returned
|
|
128
|
+
context['model'] = model
|
|
129
|
+
context['provider'] = provider
|
npcsh/npcsh.py
CHANGED
|
@@ -21,7 +21,6 @@ from npcpy.memory.knowledge_graph import (
|
|
|
21
21
|
kg_evolve_incremental
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
from npcsh.routes import router
|
|
25
24
|
try:
|
|
26
25
|
import readline
|
|
27
26
|
except:
|
|
@@ -46,10 +45,6 @@ from npcsh._state import (
|
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
def print_welcome_message():
|
|
49
|
-
'''
|
|
50
|
-
function for printing npcsh graphic
|
|
51
|
-
'''
|
|
52
|
-
|
|
53
48
|
print(
|
|
54
49
|
"""
|
|
55
50
|
___________________________________________
|
|
@@ -75,8 +70,9 @@ Begin by asking a question, issuing a bash command, or typing '/help' for more i
|
|
|
75
70
|
)
|
|
76
71
|
|
|
77
72
|
|
|
78
|
-
def run_repl(command_history: CommandHistory, initial_state: ShellState):
|
|
73
|
+
def run_repl(command_history: CommandHistory, initial_state: ShellState, router):
|
|
79
74
|
state = initial_state
|
|
75
|
+
|
|
80
76
|
print_welcome_message()
|
|
81
77
|
|
|
82
78
|
render_markdown(f'- Using {state.current_mode} mode. Use /agent, /cmd, or /chat to switch to other modes')
|
|
@@ -85,7 +81,7 @@ def run_repl(command_history: CommandHistory, initial_state: ShellState):
|
|
|
85
81
|
|
|
86
82
|
is_windows = platform.system().lower().startswith("win")
|
|
87
83
|
try:
|
|
88
|
-
completer = make_completer(state)
|
|
84
|
+
completer = make_completer(state, router)
|
|
89
85
|
readline.set_completer(completer)
|
|
90
86
|
except:
|
|
91
87
|
pass
|
|
@@ -157,7 +153,7 @@ def run_repl(command_history: CommandHistory, initial_state: ShellState):
|
|
|
157
153
|
state.messages = [{"role": "system", "content": f"Session context: {compressed_state}"}]
|
|
158
154
|
|
|
159
155
|
try:
|
|
160
|
-
completer = make_completer(state)
|
|
156
|
+
completer = make_completer(state, router)
|
|
161
157
|
readline.set_completer(completer)
|
|
162
158
|
except:
|
|
163
159
|
pass
|
|
@@ -229,6 +225,8 @@ def run_repl(command_history: CommandHistory, initial_state: ShellState):
|
|
|
229
225
|
|
|
230
226
|
|
|
231
227
|
def main() -> None:
|
|
228
|
+
from npcsh.routes import router
|
|
229
|
+
|
|
232
230
|
parser = argparse.ArgumentParser(description="npcsh - An NPC-powered shell.")
|
|
233
231
|
parser.add_argument(
|
|
234
232
|
"-v", "--version", action="version", version=f"npcsh version {VERSION}"
|
|
@@ -239,13 +237,17 @@ def main() -> None:
|
|
|
239
237
|
args = parser.parse_args()
|
|
240
238
|
|
|
241
239
|
command_history, team, default_npc = setup_shell()
|
|
240
|
+
|
|
241
|
+
if team and hasattr(team, 'jinxs_dict'):
|
|
242
|
+
for jinx_name, jinx_obj in team.jinxs_dict.items():
|
|
243
|
+
router.register_jinx(jinx_obj)
|
|
242
244
|
|
|
243
245
|
initial_state.npc = default_npc
|
|
244
246
|
initial_state.team = team
|
|
245
247
|
if args.command:
|
|
246
248
|
state = initial_state
|
|
247
249
|
state.current_path = os.getcwd()
|
|
248
|
-
final_state, output = execute_command(args.command, state)
|
|
250
|
+
final_state, output = execute_command(args.command, state, router=router, command_history=command_history)
|
|
249
251
|
if final_state.stream_output:
|
|
250
252
|
for chunk in output:
|
|
251
253
|
print(str(chunk), end='')
|
|
@@ -253,7 +255,7 @@ def main() -> None:
|
|
|
253
255
|
elif output is not None:
|
|
254
256
|
print(output)
|
|
255
257
|
else:
|
|
256
|
-
run_repl(command_history, initial_state)
|
|
257
|
-
|
|
258
|
+
run_repl(command_history, initial_state, router)
|
|
259
|
+
|
|
258
260
|
if __name__ == "__main__":
|
|
259
261
|
main()
|