crystalwindow 4.1__tar.gz → 4.3__tar.gz
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.
- {crystalwindow-4.1/crystalwindow.egg-info → crystalwindow-4.3}/PKG-INFO +1 -1
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/ai.py +112 -58
- {crystalwindow-4.1 → crystalwindow-4.3/crystalwindow.egg-info}/PKG-INFO +1 -1
- {crystalwindow-4.1 → crystalwindow-4.3}/setup.py +1 -1
- {crystalwindow-4.1 → crystalwindow-4.3}/LICENSE +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/MANIFEST.in +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/README.md +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/FileHelper.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/Icons/default_icon.png +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/__init__.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/animation.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/assets.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/camera.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/clock.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/collision.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/color_handler.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/crystal3d.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/docs/getting_started.md +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/docs/index.md +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/draw_helpers.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/draw_rects.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/draw_text_helper.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/draw_tool.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/fun_helpers.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gametests/3dsquare.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gametests/__init__.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gametests/__main__.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gametests/gravitytest.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gametests/guitesting.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gametests/sandbox.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gametests/squaremove.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gametests/windowtesting.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gravity.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gui.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/gui_ext.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/math.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/player.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/sprites.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/tilemap.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/ver_warner.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow/window.py +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow.egg-info/SOURCES.txt +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow.egg-info/dependency_links.txt +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/crystalwindow.egg-info/top_level.txt +0 -0
- {crystalwindow-4.1 → crystalwindow-4.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crystalwindow
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3
|
|
4
4
|
Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
|
|
5
5
|
Home-page: https://pypi.org/project/crystalwindow/
|
|
6
6
|
Author: CrystalBallyHereXD
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
# ==========================================================
|
|
2
|
-
# CrystalAI v0.
|
|
2
|
+
# CrystalAI v0.7 — Self-Contained Symbolic Engine
|
|
3
3
|
# ----------------------------------------------------------
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# -
|
|
7
|
-
# -
|
|
4
|
+
# Focus: Pure Python 'thinking' (Knowledge Graph/Rule-Based)
|
|
5
|
+
# Changes:
|
|
6
|
+
# - Refactored _local_ai to _symbolic_engine
|
|
7
|
+
# - Added a simple knowledge base (K-Graph)
|
|
8
|
+
# - Added context/intent matching for 'thinking'
|
|
9
|
+
# - Removed Groq/External API integration
|
|
8
10
|
# ==========================================================
|
|
9
11
|
|
|
10
12
|
import os
|
|
11
13
|
import ast
|
|
12
14
|
import difflib
|
|
13
|
-
from typing import Optional, Dict, Any
|
|
14
|
-
|
|
15
|
+
from typing import Optional, Dict, Any, List
|
|
16
|
+
# Removed requests and groq imports as they are no longer needed
|
|
17
|
+
# Removed import groq (if it was present)
|
|
15
18
|
|
|
16
19
|
# ==========================================================
|
|
17
20
|
# Response Wrapper
|
|
@@ -29,42 +32,34 @@ class CrystalAIResponse:
|
|
|
29
32
|
# MAIN ENGINE
|
|
30
33
|
# ==========================================================
|
|
31
34
|
class AI:
|
|
32
|
-
DEFAULT_MODEL = "
|
|
35
|
+
DEFAULT_MODEL = "PURE_SYMBOLIC"
|
|
33
36
|
DEFAULT_PERSONALITY = (
|
|
34
|
-
"You are
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
+
"You are CrystalMind AI, a completely self-coded, symbolic engine. "
|
|
38
|
+
"I process information using an internal rule-base and knowledge graph. "
|
|
39
|
+
"I can reason about simple code and defined concepts."
|
|
37
40
|
)
|
|
38
|
-
|
|
41
|
+
# Key is ignored in this self-contained mode, but kept for signature consistency
|
|
42
|
+
PLACEHOLDER_KEY = "PURE_SYMBOLIC_KEY_IGNORED"
|
|
39
43
|
|
|
40
44
|
# ------------------------------------------------------
|
|
41
45
|
def __init__(self, key=None, model=None):
|
|
42
|
-
# --- KEY
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
self.key = self.PLACEHOLDER_KEY
|
|
46
|
-
else:
|
|
47
|
-
self.key = key
|
|
48
|
-
|
|
49
|
-
# --- MODEL VALIDATION ---
|
|
50
|
-
if not model or not isinstance(model, str) or len(model) < 3:
|
|
51
|
-
print("[CrystalAI] Unknown model → using default.")
|
|
52
|
-
self.model = self.DEFAULT_MODEL
|
|
53
|
-
else:
|
|
54
|
-
self.model = model
|
|
55
|
-
|
|
56
|
-
# Persona
|
|
46
|
+
# --- KEY/MODEL SETUP (for consistency, though ignored) ---
|
|
47
|
+
self.key = self.PLACEHOLDER_KEY
|
|
48
|
+
self.model = self.DEFAULT_MODEL
|
|
57
49
|
self.personality = self.DEFAULT_PERSONALITY
|
|
58
50
|
|
|
59
|
-
#
|
|
60
|
-
self.
|
|
51
|
+
# --- PURE AI KNOWLEDGE BASE (The 'Thinking' Core) ---
|
|
52
|
+
self.knowledge_graph: Dict[str, Any] = self._build_knowledge_graph()
|
|
61
53
|
|
|
62
54
|
# v0.4 memory system (optional)
|
|
63
|
-
self.memory = []
|
|
55
|
+
self.memory: List[Dict[str, str]] = []
|
|
64
56
|
self.use_memory = True
|
|
65
57
|
|
|
66
58
|
# v0.4 toggle for forcing local engine
|
|
67
|
-
self.force_local =
|
|
59
|
+
self.force_local = True # Always True for a self-contained AI
|
|
60
|
+
|
|
61
|
+
# Library knowledge (loaded .py files)
|
|
62
|
+
self.library_context = ""
|
|
68
63
|
|
|
69
64
|
# ==========================================================
|
|
70
65
|
# PERSONALITY
|
|
@@ -88,6 +83,7 @@ class AI:
|
|
|
88
83
|
def index_library(self, folder):
|
|
89
84
|
"""
|
|
90
85
|
Load all Python files as context for smarter answers.
|
|
86
|
+
(Context is used in prompt but processed by local engine's rules)
|
|
91
87
|
"""
|
|
92
88
|
out = []
|
|
93
89
|
if not os.path.exists(folder):
|
|
@@ -149,45 +145,102 @@ class AI:
|
|
|
149
145
|
self.memory.pop(0)
|
|
150
146
|
|
|
151
147
|
# ==========================================================
|
|
152
|
-
#
|
|
148
|
+
# PURE AI KNOWLEDGE BASE (Self-Contained 'Knowledge')
|
|
149
|
+
# ==========================================================
|
|
150
|
+
def _build_knowledge_graph(self) -> Dict[str, Any]:
|
|
151
|
+
"""
|
|
152
|
+
Defines the internal knowledge the pure AI can reason with.
|
|
153
|
+
"""
|
|
154
|
+
return {
|
|
155
|
+
"python": {
|
|
156
|
+
"desc": "A high-level, interpreted programming language.",
|
|
157
|
+
"keywords": ["language", "interpreted", "high-level"],
|
|
158
|
+
"syntax": {
|
|
159
|
+
"if_statement": "if condition: ... else: ...",
|
|
160
|
+
"loop": "for item in iterable: ..."
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"ast": {
|
|
164
|
+
"desc": "Abstract Syntax Tree. Used for parsing code structure.",
|
|
165
|
+
"keywords": ["parsing", "code", "structure", "tree"]
|
|
166
|
+
},
|
|
167
|
+
"fix_code": {
|
|
168
|
+
"rule": "look for SyntaxError, especially missing colons or mismatched brackets",
|
|
169
|
+
"keywords": ["fix", "error", "bug", "syntax"]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# ==========================================================
|
|
174
|
+
# PURE AI 'THINKING' ENGINE (Replaces _local_ai)
|
|
153
175
|
# ==========================================================
|
|
154
|
-
def
|
|
176
|
+
def _symbolic_engine(self, prompt: str, file_data: Optional[str]) -> str:
|
|
155
177
|
"""
|
|
156
|
-
|
|
157
|
-
gives real syntax help + fallback personality text.
|
|
178
|
+
Simulates 'thinking' using only internal rules and the knowledge graph.
|
|
158
179
|
"""
|
|
180
|
+
output = ["[SymbolicEngine] Processing request..."]
|
|
181
|
+
lower_prompt = prompt.lower()
|
|
182
|
+
|
|
183
|
+
# --- Stage 1: File Analysis (Real Python AST) ---
|
|
159
184
|
if file_data and not file_data.startswith("[CrystalAI]"):
|
|
185
|
+
output.append("\n[Stage 1: Code Parsing]")
|
|
160
186
|
try:
|
|
161
187
|
ast.parse(file_data)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return "
|
|
188
|
+
output.append("✅ **No Syntax Errors Detected** (via AST).")
|
|
189
|
+
output.append("The code is structurally sound. Ask for refactoring or explanation.")
|
|
190
|
+
return "\n".join(output)
|
|
165
191
|
except SyntaxError as se:
|
|
166
|
-
#
|
|
192
|
+
# Use the built-in fix rule from the knowledge graph
|
|
193
|
+
fix_rule = self.knowledge_graph["fix_code"]["rule"]
|
|
167
194
|
lineno = se.lineno or 0
|
|
168
195
|
offset = se.offset or 0
|
|
169
|
-
msg =
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
196
|
+
msg = (
|
|
197
|
+
f"❌ **SyntaxError Detected** (via AST):\n"
|
|
198
|
+
f"• Message: {se.msg}\n"
|
|
199
|
+
f"• Line: {lineno}\n"
|
|
200
|
+
f"• Column: {offset}\n"
|
|
201
|
+
f"• Rule suggestion: {fix_rule}"
|
|
202
|
+
)
|
|
203
|
+
output.append(msg)
|
|
204
|
+
output.append(self._snippet(file_data, lineno))
|
|
205
|
+
return "\n".join(output)
|
|
206
|
+
|
|
207
|
+
# --- Stage 2: Knowledge Graph Lookup (Rule-Based Reasoning) ---
|
|
208
|
+
output.append("\n[Stage 2: Symbolic Lookup]")
|
|
209
|
+
|
|
210
|
+
# Check for concepts the AI 'knows'
|
|
211
|
+
found_concept = False
|
|
212
|
+
for key, knowledge in self.knowledge_graph.items():
|
|
213
|
+
if key in lower_prompt or any(k in lower_prompt for k in knowledge.get("keywords", [])):
|
|
214
|
+
if key == "fix_code": continue # Already handled in Stage 1
|
|
215
|
+
|
|
216
|
+
output.append(f"🧠 Found Concept: **{key.upper()}**")
|
|
217
|
+
output.append(f"Description: {knowledge.get('desc', 'No detailed description.')}")
|
|
218
|
+
|
|
219
|
+
# Simple reasoning about related syntax
|
|
220
|
+
if 'syntax' in knowledge:
|
|
221
|
+
output.append("Related Syntax:")
|
|
222
|
+
for syn, code in knowledge['syntax'].items():
|
|
223
|
+
output.append(f" - {syn.replace('_', ' ')}: `{code}`")
|
|
224
|
+
|
|
225
|
+
found_concept = True
|
|
226
|
+
break
|
|
227
|
+
|
|
228
|
+
if not found_concept:
|
|
229
|
+
output.append("❓ Concept Unknown: I am limited to my internal knowledge base (Python, AST, Fix Code).")
|
|
230
|
+
output.append("Please ask about a defined concept or provide a file for AST analysis.")
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
return "\n".join(output)
|
|
178
234
|
|
|
179
235
|
# ==========================================================
|
|
180
|
-
# ASK
|
|
236
|
+
# ASK (Pure Symbolic Engine)
|
|
181
237
|
# ==========================================================
|
|
182
238
|
def ask(self, text, file=None):
|
|
183
239
|
file_data = self._read_file(file)
|
|
184
240
|
prompt = self._build_prompt(text, file_data)
|
|
185
|
-
|
|
186
|
-
#
|
|
187
|
-
|
|
188
|
-
raise Exception("simulate offline")
|
|
189
|
-
except:
|
|
190
|
-
resp = self._local_ai(prompt, file_data)
|
|
241
|
+
|
|
242
|
+
# We skip the external API call entirely, relying on the symbolic engine
|
|
243
|
+
resp = self._symbolic_engine(prompt, file_data)
|
|
191
244
|
|
|
192
245
|
self._save_memory(text, resp)
|
|
193
246
|
return CrystalAIResponse(resp)
|
|
@@ -267,9 +320,10 @@ class AI:
|
|
|
267
320
|
out = []
|
|
268
321
|
for i in range(start, end):
|
|
269
322
|
mark = "->" if (i + 1) == lineno else " "
|
|
270
|
-
|
|
323
|
+
# Adjusted line formatting for clarity
|
|
324
|
+
out.append(f"{mark} {i+1:<4}: {lines[i]}")
|
|
271
325
|
return "\n".join(out)
|
|
272
326
|
|
|
273
327
|
# ==========================================================
|
|
274
|
-
# END OF ENGINE
|
|
275
|
-
# ==========================================================
|
|
328
|
+
# END OF PURE SYMBOLIC ENGINE
|
|
329
|
+
# ==========================================================
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crystalwindow
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3
|
|
4
4
|
Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
|
|
5
5
|
Home-page: https://pypi.org/project/crystalwindow/
|
|
6
6
|
Author: CrystalBallyHereXD
|
|
@@ -7,7 +7,7 @@ with open("README.md", encoding="utf-8") as f:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="crystalwindow",
|
|
10
|
-
version="4.
|
|
10
|
+
version="4.3", # Force metadata refresh
|
|
11
11
|
packages=find_packages(include=["crystalwindow", "crystalwindow.*"]),
|
|
12
12
|
|
|
13
13
|
include_package_data=True, # include package_data files
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|