Files
2125_GCE/glyphos/__pycache__/cognitive_kernel.cpython-314.pyc
T

139 lines
12 KiB
Plaintext
Raw Normal View History

2026-05-20 18:03:25 -04:00
+
/j!ãóÂaRt0tRt^RIHtHtHtHt^RIt^RIH t ^RI
H t H t H
t
HtHtHt^RIHtHt!RR4tRs]^kRR ltR
R R R/R
RlltRRltR#)z¶GlyphOS Cognitive Kernel
Orchestrates LAIN cognition engine with Supercharged Glyph Registry.
Provides a clean service API for executing GX files and managing glyph-aware analysis.
)ÚOptionalÚDictÚAnyÚListN)ÚPath)Úexecute_gx_pathÚload_gxÚnormalize_segmentsÚ map_lanesÚbuild_envelopeÚexecute_with_lain)Úload_all_superchargedÚ super_statscóæa]tRt^toRtRR/V3RlRlltV3RlRltRR R
R /V3R lR
lltRR R
R /V3RlRlltV3RlRlt V3RlRlt
V3RlRlt V3RlRlt V3RlRlt
RtVtR #)ÚCognitiveKernelz¬System service for GlyphOS cognition pipeline.
Orchestrates:
- LAIN 8-lane symbolic cognition
- Supercharged Glyph Registry integration
- Result caching and introspection
Úauto_load_glyphsTcó <V^8„dQhRS[/#)ér)Úbool)ÚformatÚ
__classdict__s"€Ú0/home/dave/superdave/glyphos/cognitive_kernel.pyÚ __annotate__ÚCognitiveKernel.__annotate__sø€÷  .©Dñ c óXWnRVnRVnRVnRVnRVnR#)zInitialize the Cognitive Kernel.
Args:
auto_load_glyphs: If True, load Supercharged Glyphs during warmup.
Defaults to True.
NF)Ú_auto_load_glyphsÚ _last_resultÚ
_startup_timeÚ_glyph_stats_cacheÚ
_warmed_upÚ
_last_mode)Úselfrs&$rÚ__init__ÚCognitiveKernel.__init__s0ð"2ÔØ6:ˆÔØ.2ˆÔØ<@ˆÔ؈ŒØ)-ˆŽrcó<V^8„dQhRR/#)rÚreturnN©)rrs"€rrr&sø€÷ñ˜ñrc óÆVP'dR#\P!4VnVP'd \ 4\ 4VnRVnR#)zPerform one-time initialization.
Loads:
- Supercharged Glyphs (if auto_load_glyphs)
- Registry statistics
Records:
- Kernel startup time
NT)r Útimerrr
rr©r"s&rÚwarmupÚCognitiveKernel.warmup&sCð ??ˆ?Ù ä!ŸYšY›[ˆÔà × #.£-ˆÔàˆŽrÚmodeÚanalyzeÚcontextNc
ón<V^8„dQhRS[RS[RS[S[S[S[3,,RS[S[S[3,/#©rÚgx_pathr-r/r&©Ústrrrr)rrs"€rrr=sHø€÷#ñ#áð#ñð #ñ
™$™s¡C˜x #ñ
‰c3ˆhñ
#rc óšVP'gVP4T;'g/pW$R&\WR7pWPnW nV#)Execute a .gx file through the full cognition pipeline.
Args:
gx_path: Path to .gx file
mode: Cognitive mode (e.g., "analyze", "debug")
context: Optional execution context dict
Returns:
ExecutionResult dict with:
- fused_symbol: Combined 8-lane analysis
- output_text: Rendered analysis
- cognition_trace: Step-by-step processing
- diagnostics: Performance metrics + glyph resonance
Úcognitive_mode)r/)r r+rrr!)r"r2r-r/Ú exec_contextÚresults&&$$ rÚ
execute_gxÚCognitiveKernel.execute_gx=sJð*ˆØ K‰KŒMð—}} "ˆ Ø)-ÐÔðØŒàˆ
rcó¶<V^8„dQhRS[S[S[3,RS[S[S[S[3,,RS[RS[RS[S[S[S[3,,RS[S[S[3,/#)rÚmanifestÚsegmentsÚpayloadr-r/r&)rr4rrÚbytesr)rrs"€rrrbsqø€÷,ñ,á‘s™Cx•.ð,ñt™C¡˜H•~Õ,ñð ,ñ ð
,ñ™$™s¡C˜x,ñ
‰c3ˆhñ,rc óÜVP'gVP4T;'g/pWFR&\W#4p\W4p\ W4p \ WW†4p
W nW@nV
#)aExecute cognition on in-memory GX components (no filesystem).
Args:
manifest: GX manifest dict
segments: GX segments list
payload: Compressed GX payload bytes
mode: Cognitive mode
context: Optional execution context
Returns:
ExecutionResult dict
r6)r r+r r
r r rr!) r"r<r=r>r-r/r7Únormalized_segsÚlane_assignmentsÚenveloper8s &&&&$$ rÚexecute_symbolicÚ CognitiveKernel.execute_symbolicbsrð*ˆØ K‰KŒMð—}} "ˆ Ø)-Ð-¨XÓ?ˆô% ô" <ˆô# 8Ð7GÓðØŒàˆ
rcó6<V^8„dQhRS[S[S[3,/#©rr&©rr4r)rrs"€rrrsø€÷ñ¡¡c©3 h¥ñrc ó¤VP'gVP4VP;'g \4pVPVR&V#)aVGet Supercharged Glyph Registry statistics.
Returns:
Dict with:
- total_glyphs: 600
- categories: List of category names
- fields_present: All fields in registry
- sample_ids: First 5 glyph IDs
- loaded: Whether registry is loaded
- load_path: Path to data file
- kernel_startup_time: Kernel warmup timestamp
Úkernel_startup_time)r r+rrr)r"Ústatss& rÚget_glyph_statsÚCognitiveKernel.get_glyph_statssCðˆØ K‰KŒMà×'×8¬;«=ˆð(,×'9Ñ'9ˆÐˆ rcóF<V^8„dQhRS[S[S[S[3,,/#rG©rrr4r)rrs"€rrr§s!ø€÷©$©s±C¨x­.Õ!9ñ!rc óVP#)zYReturn the last ExecutionResult, if any.
Returns:
Full ExecutionResult dict or None
)rr*s&rÚget_last_resultÚCognitiveKernel.get_last_result§sð × Ñ Ð rcóV<V^8„dQhRS[S[S[S[S[3,,,/#rG)rrrr4r)rrs"€rrr¯s&ø€÷©©d±3¹°8­nÕ)=Õ >ñ8rc óXVPfR#VPPR4#)zhReturn cognition_trace from last ExecutionResult, if present.
Returns:
List of trace steps or None
cognition_trace©rÚgetr*s&rÚget_last_traceÚCognitiveKernel.get_last_trace¯s+ð × Ñ Ò Ø× Ñ ×$Ð%6Ó7rcóF<V^8„dQhRS[S[S[S[3,,/#rGrO)rrs"€rrr¹s!ø€÷5¡x±±S¹#°XµÕ'?ñ5rc óXVPfR#VPPR4#)zcReturn fused_symbol from last ExecutionResult, if present.
Returns:
Fused symbol dict or None
fused_symbolrVr*s&rÚget_last_fused_symbolÚ%CognitiveKernel.get_last_fused_symbol¹s*ð × Ñ Ò Ø× Ñ ×$ ^Ó4rcóF<V^8„dQhRS[S[S[S[3,,/#rGrO)rrs"€rrrÃs!ø€÷
ñ
¡H©T±#±s°(­^Õ$<ñ
rc óÄVPfR#VPPR/4pRVPR4RVPR4RVPR4/#)zìReturn resonance metrics from last ExecutionResult, if present.
Returns:
Dict with:
- resonance: Overall resonance metrics (if present)
- glyph_resonance: Glyph-specific metrics (if glyph was used)
Or None if no result
diagnosticsÚ resonanceÚglyph_resonanceÚelapsedrV)r"ras& rÚget_last_resonanceÚ"CognitiveKernel.get_last_resonanceÃsbð × Ñ Ò à×'×+¨M¸>ˆ ð
˜Ÿ¨Ó ˜{ŸÐ/@Ó {— yÓ
ð
r)rrr!rrr )Ú__name__Ú
__module__Ú __qualname__Ú__firstlineno__Ú__doc__r#r+r9rDrLrQrXr]reÚ__static_attributes__Ú__classdictcell__)rs@rrrs•ø‡ñð .°4÷  ðð.#ðð #ð
-1÷ #ò#ðJ,ð ð
,ð-1÷,ò,÷\ð÷.
ö
rrcó$V^8„dQhR\/#rG)r)rs"rrrÜs÷ñ”Oñrcó^\f!\RR7s\P4\#)z½Get or create the singleton CognitiveKernel instance.
On first call:
- Creates a new CognitiveKernel
- Calls warmup() to initialize glyphs
Returns:
Singleton CognitiveKernel instance
T)r)Ú_GLOBAL_KERNELrr+r'rrÚ
get_kernelrqÜs&ôÒÜ(¸$ÔÜ×ÑÔä Ðrr-r.r/c
ó¢V^8„dQhR\R\R\\\\3,,R\\\3,/#r1r3)rs"rrrïsM÷BñBÜ
ðBô ðBô”dœ3¤˜8•nÕ
Bô

Œ#Œsˆ(…^ñ Brcó<\4pVPWVR7#)aConvenience function: execute .gx through the global kernel.
Equivalent to: get_kernel().execute_gx(gx_path, mode=mode, context=context)
Args:
gx_path: Path to .gx file
mode: Cognitive mode
context: Optional execution context