Metadata-Version: 2.4
Name: MProcs
Version: 9.1
Summary: MProcs // Terminal Suite - MProcs, POLYHISTOR, FLU0 and JADE//WIRE in one launcher
Author-email: tderk <usvu.tech@gmail.com>
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: ddgs
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Dynamic: license-file

# MProcs

Derived from NeonBunny. A Life program by tderk, originally LPro.py and Destiny [2024].

## MProcs // Terminal Suite (11.0 / app 9.1)

MProcs is now a single, self-contained launcher for every terminal in the
suite. Nothing is looked up on PyPI, nothing is downloaded at startup, and the
companion terminals are shipped **inside** the package:

```
MProcs TERMINALS
  1 mdcci        2 NeonBunny    3 Dojical      4 bumerang
  5 alokate      6 m0nkrpg      7 Morn         8 Destiny
  9 Vanilla      0 GWF
INCLUDED TERMINALS
  P POLYHISTOR   One world. Every discipline.
  F FLU0         signal in, silence out
  J JADE//WIRE   abacus to zero-day, neon to nirvana
```

All thirteen entries are always visible. POLYHISTOR runs in the MProcs pane;
FLU0 and JADE//WIRE are vendored under `src/MProcs/modules/`.

### Original FLU0 and JADE//WIRE TUIs

Selecting `F` or `J` suspends the MProcs TUI and hands the real terminal to
that terminal's **original curses TUI**:

- `F` → FLU0's own banner, footer, operations board, sidebars, signal rails,
  17 views and **Ghost Wire**.
- `J` → JADE//WIRE's own archive launcher, framed sidebars, 10 terminals and
  **Ghost Wire**.
- The original TUI owns the full screen while it runs, so its original layout,
  banner/footer, sidebars and 256-colour palette are preserved.
- Exiting the original TUI (`^C` from its board, or its own exit path) returns
  to the MProcs launcher.

### Colours, boxes and resizing

- POLYHISTOR uses the MProcs 256-colour ANSI renderer (`38;5;n`, bold, dim,
  underline, reverse) and is sized to the live content width.
- FLU0 and JADE//WIRE run their original TUI directly, so their colours,
  sidebars and resize handling are the originals.
- JADE//WIRE's box renderer now follows the live content width on startup and
  resize (the same behaviour FLU0 already had), so its cards and sections fit
  the terminal instead of staying at a fixed 72 columns.
- The MProcs launcher and POLYHISTOR reflow with the window.

### Navigation

- In MProcs-hosted terminals: `Esc` shows the launcher, `Ctrl-G` / `F1` jumps
  to the root, `↑` / `↓`, `Enter`, `1`–`9`, `0`, `P` / `F` / `J` navigate.
- `u` opens **Update & Restart** on the launcher.
- `q` quits MProcs from the launcher.
- Inside native FLU0/JADE//WIRE, use their own keys; `^C` exits back to MProcs.

`quit` / `exit` inside a MProcs-hosted terminal returns to the launcher.

### Update check / SOP

The launcher performs a lightweight background PyPI version check when it
starts and shows an update badge when a newer release exists. It never downloads
anything on its own. Press `u` for the full update/restart screen, or set
`MPROCS_NO_UPDATE_CHECK=1` to disable even the badge check. The screen prints
the standard operating procedure:

```
1. Preferred:       python3 -m pip install --upgrade MProcs
2. PEP 668 system:  python3 -m pip install --upgrade --break-system-packages MProcs
3. Isolated:        pipx install MProcs   (or install inside a venv)
```

If pip reports `externally-managed-environment`, the flow offers to retry with
`--break-system-packages`. After a successful install it offers to restart
MProcs in place.

### Offline by design

- The terminal `version_checker` modules remain offline shims.
- The launcher's only automatic network action is the background version badge
  check (`MPROCS_NO_UPDATE_CHECK=1` disables it); it never downloads.
- Installs only happen after the explicit `u` flow and a yes answer.
- Optional network features in the terminals still use `requests` / `ddgs` as
  before.

### Module layout

```
src/MProcs/
├── scripts/                 # original MProcs core
│   ├── main.py              # launcher entry point
│   ├── tui.py               # suite launcher
│   ├── wrappers.py          # every terminal entry
│   └── version_checker.py   # launcher update check
└── modules/
    ├── polyhistor/          # POLYHISTOR // GLOBAL KNOWLEDGE TERMINAL
    ├── flu0/                # FLU0 // CAMELTOE.NET
    └── hmptunnel/           # hmptunnel // JADE//WIRE
```

The companions keep their original data, corpora, themes and command sets; only
their package wiring and version/update shims were adapted for embedding.

## Rebuildable & Uploadable PIP Project

This folder is a rebuildable pip project restored from PyPI `MProcs==8.8.4.4` (sdist `mprocs-8.8.4.4.tar.gz`).

### Structure
```
MProcs/
├── pyproject.toml       # PEP 517/621 build-system & project metadata (fixed dependencies placement)
├── setup.cfg            # egg_info config
├── MANIFEST.in          # sdist file inclusion
├── LICENSE              # MIT
├── README.md
└── src/
    └── MProcs/
        ├── __init__.py
        ├── scripts/
        │   ├── main.py, tui.py, wrappers.py, lpro.py, lpro_s.py, gwf.py, etc.
        │   ├── version_checker.py     # launcher update check + restart
        │   └── data/*.json
        └── modules/
            ├── polyhistor/            # data/, content/, py.typed
            ├── flu0/scripts/          # data/, lexicon, shells
            └── hmptunnel/scripts/     # data/, shells
```

Fix applied vs. original PyPI sdist: moved `dependencies = ["requests","ddgs"]` from `[tool.setuptools.package-data]` into `[project].dependencies` so `Requires-Dist` is correctly emitted on build.

### Rebuild

```bash
# from this directory (/home/kredt/BDCS/MProcs)
pip install --upgrade build twine
python -m build              # creates dist/mprocs-9.1.tar.gz + .whl
# or
pip wheel . --no-deps
pip install dist/mprocs-*.whl  # test install
MProcs --help
mprocs --help
lpro --help
```

### Upload

```bash
twine check dist/*
twine upload dist/*           # to PyPI (requires API token)
# test upload
twine upload --repository testpypi dist/*
pip install --index-url https://test.pypi.org/simple/ MProcs
```

### Original artifacts saved
- `orig_sdist/mprocs-8.8.4.4.tar.gz` (PyPI sdist)
- `orig_wheel/mprocs-8.8.4.4-py3-none-any.whl` (PyPI wheel)
- `pyproject.toml.orig` (original buggy file for reference)

Installed entry points: `MProcs`, `mprocs`, `lpro`, `lpro-s`, `gwf`
Requires-Python: >=3.8

---
## Update 8.8.4.5 — A-HB (Agent Handbook) feature

**Source:** decrypted `A-HB.html` (password `BREEZYSOUND`) — 54 chapters (~10670 passages) across Volumes 1-7:
- Volume 1 Criminology (15 chapters), Volume 2 Military Studies (9), Volume 3 Police Studies (6),
  Volume 4 Intelligence (5), Volume 5 Agent Operations (6), Volume 6 Normal Activities (8), Volume 7 Buddhist Reflections (5)

**Data:** `src/MProcs/scripts/data/ahb.json` (4.7 MB) loaded via `data_loader.ahb` (exposed as `ahb_data` in `lpro.py`). Passages extracted from HTML (`p|li|h1-h4|blockquote|th|td`) and stripped via regex; full article reconstructed as joined passages.

**Function:** `ahb()` in `src/MProcs/scripts/lpro.py:7597` (inside `mp()`, closure over `z` and `usr`):
1. Asks `Indicate number of (A-HB) results:`
2. Builds pool of `(passage, title, vol, id)` and samples `n` via `random.sample`
3. For each displays `A-HB: {passage}` + `[{title} | {vol}]` and logs `print(usr + f" A-HB: ...", file=z)` + `print(line+header+ct, file=z)` to `MProcs-logs.txt` (file `z`)
4. Asks `Display full article from source header? (enter header/title/id or n):` — if header/id/vol substring matches, displays full article (`=== title ===` + all passages) and logs to `z`; else lists available headers.

**Invocation:**
- Interactive: `ahb` | `A-HB` | `a-hb` | `AHB` | `Agent Handbook` (in `choice()` at `lpro.py:8321`)
- CLI flag: `lpro -ahb` / `lpro -A-HB` / `lpro -agent-handbook` (argparse at `lpro.py:8501`, handler at `9117`)
- Help listed in `commands()` at `lpro.py:443`

**Build:** `pyproject.toml` version bumped `8.8.4.4` → `8.8.4.5`, `twine check` PASSED, wheel includes `ahb.json`.

**Test:**
```bash
PYTHONPATH=src python -m MProcs.scripts.lpro -ahb <<< $'3\nn\n'
# or interactive
lpro
> ahb
Indicate number of (A-HB) results: 2
A-HB: ... [Chapter 1: Fundamentals of Agent Tradecraft | Volume 5: Agent Operations]
Display full article from source header? (enter header/title/id or n): agent-tradecraft
=== Chapter 1: Fundamentals of Agent Tradecraft ===
...
# log verified in MProcs-logs.txt via print(..., file=z)
```


---
## Update 8.8.4.6 — lpro_s non-recording + tsearch integration

**lpro_s.py variant:** mirrored `ahb()` at `src/MProcs/scripts/lpro_s.py:5544` (inside `mp()`, no `z` file logging) — same pool sampling `A-HB: {passage}` + header, asks `Display full article from source header?` and prints full passages without `file=z`. Prevents shadowing by importing `ahb as ahb_data` at `lpro_s.py:20`. Registered in `commands()` at `lpro_s.py:425`, dispatch `choice()` at `lpro_s.py:6193`, flag `parser.add_argument("-ahb"...)` at `lpro_s.py:6355`, handler `if args.ahb: ahb()` at `lpro_s.py:6908`. No recording — prints only via `print()` (bypasses `file=z`).

**tsearch on both:** extended `tsearch()` at `lpro.py:671` and `lpro_s.py:591` to build `ahb_flat = [title + passages as "A-HB: {p} [{title} | {vol}]"]` and pass as extra list to `search_in_lists(search_term, proverbs, ..., strains, ahb_flat)`. Verified `printf "tsearch\ntradecraft\n" | python -m MProcs.scripts.lpro` returns 337 matches including `A-HB:` entries on both.

**Build:** `pyproject.toml` bumped `8.8.4.5` → `8.8.4.6`, rebuilt `dist/mprocs-8.8.4.6*` (`twine check` PASSED), reinstall validated `from MProcs.scripts.data_loader import ahb` 54 articles.

---
## Update 8.8.4.7 — fix whole-volume display → separate-header sections

**Issue:** `ahb()` full-article display previously printed `full_passages` flat (all 223 passages for `agent-tradecraft`), which when invoked via a header that matched a `vol` could appear to dump an entire volume's concatenated text without header separation.

**Fix:** regenerated `src/MProcs/scripts/data/ahb.json` to include `sections` grouping ( `pat = <h1-h4|p|li|blockquote|th|td>` ordered, headers `h1-h4` start new section, following `p|li|...` become `paragraphs`). New size 9.9 MB (9925069 chars), still `twine check` PASSED (wheel 5.3 MB).

**Logic change** `lpro.py:7597` and `lpro_s.py:5544` (`ahb()`):
- First searches `sections` globally for `needle in header.lower()` → if found, displays single matched section `=== {header} === [{title}|{vol}|{aid}]` + its `paragraphs` only (e.g., `1.1 Defining Tradecraft` → 5 paragraphs, verified via `printf "1\n1.1 Defining Tradecraft\n" | python -m MProcs.scripts.lpro -ahb`).
- Else falls back to article-level match (`title|id|vol`) and then renders full article grouped by sections `--- {header} ---` + paragraphs (e.g., `agent-tradecraft` → 45 sections, `Volume 5: Agent Operations` → single article `agent-case-officer` with 40+ sections, not 6-chapter volume).
- Retains recording (`file=z`) for `lpro` and non-recording for `lpro_s`.

**Verification:** `printf "1\nagent-tradecraft\n" | python -m MProcs.scripts.lpro -ahb` now prints `--- 1.1 Defining Tradecraft ---` etc. separately, not intermixed volume dump; `printf "1\nVolume 5: Agent Operations\n" | ...` shows single chapter (371 lines) vs previous whole-volume dump.

**Build:** `pyproject.toml` `8.8.4.6` → `8.8.4.7`, `dist/mprocs-8.8.4.7*` rebuilt, installed `Version: 8.8.4.7`.

---
## Update 8.8.4.8 — numbered selection prompt

**Change:** `ahb()` prompt `Display full article from source header? (enter header/title/id or n)` updated to number-based selection per output count.

- Single result (`number==1`): `Display full article from source header? (y/n):` → `y/yes` displays that passage's source article (grouped sections), `n` exits.
- Multiple results (`number==3` → 1,2,3): `Display full article from source header? Enter number (1-3) or n:` → validates `1-N` integer, displays selected indexed article's full sections. Invalid input shows `Invalid number` / `Invalid input` and returns.
- Display now numbered: `1: A-HB: ...` + `   [title | vol]` for both `lpro.py:7597` and `lpro_s.py:5544`; logging in `lpro` retains `usr + f" {idx}: {line} {header} {ct}"` to `MProcs-logs.txt` (`z`).
- Verified via `printf "3\n2\n" | python -m MProcs.scripts.lpro -ahb` → picks #2, `printf "1\ny\n" | ...` → y branch, and `lpro_s` non-recording variant mirrors without `file=z`.

**Build:** `8.8.4.7` → `8.8.4.8`, `dist/mprocs-8.8.4.8*` rebuilt, `twine check` PASSED.

---
## Update 8.8.4.9 — number selection shows only headered section

**Issue:** Choosing number (1,2,3) displayed whole volume/article (all 45 sections for `agent-tradecraft`) instead of just the separate headered part.

**Fix:** `ahb()` at `lpro.py:7597` / `lpro_s.py:5544` now maps selected passage to its specific `sections` entry. After `selected[sel_idx]` is chosen, `aid_sel` resolves article, then `target_sec` is found where `header == passage_sel` or `passage_sel in paragraphs`. Display is `=== {header} === [{title}|{vol}|{aid}]` + only that section's `paragraphs` (with `file=z` logging for `lpro`), not all `sections`. Example `printf "1\ny\n" | lpro -ahb` where passage `North Korea specialization...` → `=== 6.2.4 Training Curriculum Comparison... ===` (40 lines) vs previous 400+ lines; `printf "3\n2\n" | lpro -ahb` where `2: 15. Forensic Nursing` → only that header's paragraphs. Numbered display `1: A-HB: ...` retained, prompt `Enter number (1-N) or n` for N>1, `(y/n)` for N==1.

**Build:** `8.8.4.8` → `8.8.4.9`, `dist/mprocs-8.8.4.9*` rebuilt, `twine check` PASSED.

---
## Update 8.8.4.10 — loop until n for numbered selection

**Change:** `ahb()` at `lpro.py:7597` / `lpro_s.py:5544` now loops for multiple passages until `n`. Single (`1`) remains `(y/n)` → displays selected headered section once. Multiple (`3` → 1,2,3): `Enter number (1-N) or n:` validates `1-N`, displays that number's headered section (`=== {header} === [{title}|{vol}|{aid}]` + `paragraphs` with `file=z` for `lpro`), then re-prompts `Enter number (1-N) or n:` to display another number until `n`/`q`/`exit`. Verified `printf "3\n1\n2\nn\n" | lpro -ahb` → `=== 14.2 South Korea... ===` then `=== 7.3 Parole... ===` then exit; `printf "1\ny\n"` still single-section. Invalid `0` or non-numeric shows `Invalid number`/`Invalid input` and continues loop.

**Build:** `8.8.4.9` → `8.8.4.10`, `dist/mprocs-8.8.4.10*` rebuilt, `twine check` PASSED.

---
## Update 8.9.0 — Terminal Suite

**Rebuilt from the fresh `BDCS/backup/MProcs` copy.**

- Vendored POLYHISTOR, FLU0 and JADE//WIRE under `src/MProcs/modules/`; the
  wheel no longer depends on `polyhistor`, `flu0net` or `hmptunnel`.
- Rewrote the included FLU0 / JADE//WIRE sibling imports to package-relative
  imports and removed their `sys.path` side effects.
- Replaced all version checkers with offline shims: no PyPI lookups, archive
  checks, update downloads, pip installs or restart handlers.
- All thirteen terminals are always visible in the launcher; archive /
  availability filtering was removed.
- `Esc` / `Ctrl-G` / `F1` recalls the launcher from every terminal. `quit` /
  `exit` inside a terminal returns to the launcher.
- The launcher shows per-terminal accents and descriptions, plus a selected
  terminal summary.
- `MProcs --list`, `MProcs --version` and `MProcs --help` are available without
  starting the TUI.
- `pyproject.toml` application version `9.1` (suite version `11.0`); package data includes every terminal data
  directory.

**Layout:** `src/MProcs/modules/{polyhistor,flu0,hmptunnel}`.

**Verified:** launcher shows all 13 terminals; POLYHISTOR, FLU0, JADE//WIRE,
Morn and GWF launch; Esc/Ctrl-G return to the launcher; switching directly from
one terminal to another works; `quit` returns to the launcher; `twine check`
PASSED.

---
## Update 9.0.0 — Original TUI handoff, colours and launcher maintenance

- **POLYHISTOR colour/formatting:** added 256-colour ANSI parsing (`38;5;n`),
  bold/dim/underline/reverse support and per-cell extended curses pairs. The
  institutional navy/gold/ivory/crimson/teal palette now renders intact, and
  polyhistor is sized to the live content width (including resize).
- **FLU0 board restored:** the root `F` entry opens `FLU0 // OPERATIONS BOARD`
  with all 17 of its own views (Field Shell, Full Capture, Officer Files,
  Engagement, Tasking, Drill, Program Brief, Org Chart, Stations, Training,
  Oversight, Metrics, Doctrine, Chronology, Codex, Lexicon and Ghost Wire).
- **JADE//WIRE board restored:** the root `J` entry opens
  `JADE//WIRE // ARCHIVE LAUNCHER` with all 10 of its terminals, including its
  own Ghost Wire.
- **Separate GWFs:** FLU0 Ghost Wire, JADE//WIRE Ghost Wire and the original
  MProcs GWF are all available as distinct entries.
- **Nested launcher navigation:** `Esc` returns one level (app -> board ->
  root), `Ctrl-G` / `F1` jumps to the root from anywhere, and long boards
  scroll with a position indicator. `a`–`g` are direct shortcuts for entries
  11–17.
- **Responsive layout:** polyhistor gets `theme.set_width`, FLU0 and JADE//WIRE
  get `theme.set_layout_width` (added to the JADE//WIRE renderer), and GWF
  follows host dimensions every frame. Boards and boxes reflow on resize.
- **Launcher update action:** `u` on the launcher checks PyPI, offers install,
  prints the `--break-system-packages` SOP, retries with that flag when needed,
  and offers an in-place restart. A lightweight background badge check may run
  at launcher start (`MPROCS_NO_UPDATE_CHECK=1` disables it); it never downloads.
- **Original FLU0/JADE//WIRE TUIs:** selecting either root entry suspends the
  MProcs TUI and hands the terminal to the terminal's original curses TUI
  (`MProcs.scripts.native`). The original banner, footer, operations board,
  sidebars, signal rails, 17 FLU0 views, 10 JADE//WIRE entries, both Ghost Wire
  views and original 256-colour palettes are preserved. Exiting returns to the
  MProcs launcher.
- **JADE//WIRE responsive boxes:** `theme.set_layout_width`/`layout_width`
  were added to the JADE//WIRE renderer, and its TUI updates the width on
  startup and every resize. Cards and sections now fit the content pane.
- **POLYHISTOR spacing:** a blank line now follows every command output in the
  interactive shell (and non-interactive output).
- **CLI flags:** `MProcs` forwards unknown flags to the core shells, so
  `MProcs --user alice`, `-nano`, `--charset`, etc. work as before.
- **Launcher proverb:** the root launcher shows a random proverb from
  hmptunnel's themed `data/themed/proverbs.json` collection, preferring entries
  that hmptunnel actually transformed from the raw source. It is displayed
  between blank lines.
- **Wording:** removed previous integration labels from the UI, package description and
  documentation.
- **Versions:** MProcs `11.0`; application package `9.1`.

**Verified:** 256-colour POLYHISTOR output and spacing, FLU0/JADE//WIRE boards
with rails/frame, both GWFs, nested Esc/Ctrl-G navigation, update screen and
SOP, `MProcs --user`, responsive resize, and `twine check`.
