Skip to content

Commit 142129d

Browse files
committed
Added daemon lifecycle support, added .phi file type support
1 parent f94c2b9 commit 142129d

25 files changed

+899
-187
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ For commercial use, a paid license is required. Commercial licenses grant:
4141
- Optional technical support and maintenance
4242

4343
For details or enterprise licensing, contact: jay.bane@outlook.com.
44-
------------------------------------------------------------------------------------------
44+
------------------------------------------------------------------------------------------

README.md

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<div align="center">
22

3-
# Phicode Engine
3+
# [![Phicode](https://img.shields.io/badge/(φ)_Phicode_Runtime_Engine-v2.5.0-red.svg)](https://python.org)
44

55
<img src="https://banes-lab.com/assets/images/banes_lab/700px_Main_Animated.gif" width="100" alt="Banes Lab" />
66

77
**Python execution engine with caching and import extensions**
88

9-
[![Python](https://img.shields.io/badge/Python-3.8%2B-blue.svg)](https://python.org)
9+
[![Python](https://img.shields.io/badge/Python-v3.8%2B-blue.svg)](https://python.org)
1010
[![PyPy Supported](https://img.shields.io/badge/PyPy-Supported-green.svg)](https://pypy.org)
1111
[![License](https://img.shields.io/badge/LICENSE-Non--Commercial-blue.svg)](https://banes-lab.com/licensing)
1212

@@ -16,11 +16,13 @@
1616
[![VS Code Extension Version](https://img.shields.io/visual-studio-marketplace/v/Banes-Lab.phicode.svg?label=VS+Code+Extension)](https://marketplace.visualstudio.com/items?itemName=Banes-Lab.phicode)
1717
[![VS Code Extension Installs](https://img.shields.io/visual-studio-marketplace/i/Banes-Lab.phicode.svg?label=VS+Code+Installs)](https://marketplace.visualstudio.com/items?itemName=Banes-Lab.phicode)
1818

19+
20+
1921
</div>
2022

2123
## Overview
2224

23-
Phicode Engine runs Python modules through a runtime with bytecode caching and import system modifications. It executes standard Python code with custom syntax support.
25+
Phicode Engine runs Python modules through a runtime with robust bytecode caching, runtime management and import system modifications. It executes standard Python code with custom syntax support.
2426

2527
## Project Philosophy
2628

@@ -139,6 +141,7 @@ flowchart TB
139141
APIServer["HTTP API Server<br/>4 REST Endpoints<br/>Subprocess Isolation<br/>Code Execution Handler"]
140142
Installers["Binary Installers<br/>PhiRust & Phimmuno<br/>Download + Retry Logic<br/>Cargo Fallback"]
141143
RustBinaries["Rust Binaries<br/>phimmuno-engine<br/>phirust-transpiler<br/>Aho-Corasick Pattern Matching"]
144+
PhiemonDaemon["Phiemon Daemon<br/>Multi-Daemon Support<br/>Crash Recovery<br/>PID Tracking"]
142145
end
143146
144147
Start([CLI Entry Point]) --> AutoImport[Auto Import Discovery]
@@ -160,8 +163,14 @@ flowchart TB
160163
Route -->|--security-*| Security
161164
Route -->|--config-*| Config
162165
Route -->|--*-install| Installers
166+
Route -->|--phiemon| PhiemonDaemon
167+
Route -->|--phiemon-status| DaemonStatus[Show Daemon Status]
168+
Route -->|--phiemon-list| DaemonList[List All Daemons]
163169
Route -->|module_name| ProjectSetup[Project Setup & Discovery]
164170
171+
DaemonStatus --> End
172+
DaemonList --> End
173+
165174
ProjectSetup --> ProjRoot[Detect Project Root]
166175
ProjRoot --> AutoDiscover[Auto-Discover φ Directories]
167176
AutoDiscover --> Recommendations[Show Interpreter Recommendations]
@@ -273,6 +282,14 @@ flowchart TB
273282
ResultCapture[Output Capture & Processing]
274283
end
275284
285+
subgraph DaemonSys [Phiemon Daemon System]
286+
direction TB
287+
MultiDaemon[Multi-Daemon Support with Per-Process State Files]
288+
DaemonLoop[Restart Loop with Backoff: 1s→2s→4s→8s→16s→30s max]
289+
PIDTrack[PID Tracking & Crash Detection]
290+
StatusMgmt[Status Management & Debugging]
291+
end
292+
276293
Cache -.-> CacheSystem
277294
BatchCache -.-> CacheSystem
278295
ICheck -.-> InterpreterSys
@@ -282,6 +299,7 @@ flowchart TB
282299
APIServer -.-> ProcessSys
283300
RustTrans -.-> RustBinaries
284301
SecValidate -.-> RustBinaries
302+
PhiemonDaemon -.-> DaemonSys
285303
286304
style Start fill:#034a69
287305
style End fill:#3d5a1d
@@ -295,6 +313,8 @@ flowchart TB
295313
style RuntimeSys fill:#840f35
296314
style ProcessSys fill:#5f6512
297315
style RustBinaries fill:#826200
316+
style PhiemonDaemon fill:#6f2c00
317+
style DaemonSys fill:#6f2c00
298318
```
299319

300320
## Configuration
@@ -374,6 +394,38 @@ result = transpile_symbols("ƒ test(): ⟲ 42")
374394

375395
---
376396

397+
## Phiemon Process Management (Daemon Setup)
398+
399+
Start processes with automatic crash recovery and multi-daemon support:
400+
401+
```bash
402+
phicode my_app --phiemon # Start as daemon
403+
phicode my_app --phiemon --name myservice # Custom name
404+
phicode my_app --phiemon --max-restarts 10 # Restart limit
405+
phicode --phiemon-status # Check all daemons
406+
phicode --phiemon-status myservice # Check specific daemon
407+
```
408+
409+
**Phiemon Daemon Features:**
410+
- **Multi-daemon support** with isolated state files per process
411+
- **Automatic restart** on process crashes with configurable limits
412+
- **Exponential backoff** prevents resource exhaustion (1s→2s→4s→8s→16s→30s max)
413+
- **Per-daemon state persistence** through `phiemon_{name}.state` files
414+
- **Process tracking** with PID monitoring and crash detection
415+
- **Enhanced debugging** with detailed error logging and status reporting
416+
- **Concurrent execution** of multiple services without conflicts
417+
418+
**Status Management:**
419+
```bash
420+
phicode --phiemon-status # List all active daemons
421+
phicode --phiemon-status webapp # Check specific daemon status
422+
phicode --phiemon-list # Show daemon overview with uptimes
423+
```
424+
425+
The daemon wraps standard PhiCode execution, maintaining all security scanning and caching behavior while providing production-ready process management. Each daemon operates independently with its own state tracking and restart logic.
426+
427+
---
428+
377429
# Custom Syntax Support
378430

379431
*Phicode Engine supports custom syntax through configurable symbol mappings. This feature is completely optional - the engine works with standard Python.*

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "phicode"
7-
version = "2.5.0"
7+
version = "2.5.1"
88
description = "(φ) PHICODE Runtime Engine — Optimized production engine (CPython/PyPy Supported)"
9-
readme = "README"
9+
readme = "README.md"
1010
license = {file = "LICENSE"}
1111
authors = [
1212
{ name="Jay Baleine", email="jay@banes-lab.com" }

0 commit comments

Comments
 (0)