Phoson-engine-minimal

Latest version: v0.52.0

Safety actively analyzes 1035937 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 16

0.52.0

Fix

- **cli**: a turn is now persisted *while* it runs, not only when it ends, so a hard kill
(crash, `taskkill`, power loss) no longer takes the whole turn with it. The session used to
be written exclusively by its terminal paths (`_finalize_run` / `_append_partial_history` /
`_abort_turn`), and a killed process runs none of them: the user's prompt and every step the
model had already produced vanished. The controller now mirrors the engine's in-flight
history into the tree and saves — once before the first LLM call (the user turn plus an
`active` status, so the session is resumable and orphan-checkable, 129) and after every
`AgentToolStartEvent` / `AgentStepDoneEvent` (the engine has appended the assistant
`tool_use` and is about to dispatch a possibly long handler, so a kill mid-tool leaves a
resumable orphan instead of silently dropping the model's call). A monotonic sync counter
keeps the mirroring idempotent — the mid-turn checkpoints and the terminal paths never
duplicate a message, including on the cancel path — and a mid-run compaction is rebased onto
a fresh branch before its tail is appended. Cost: every checkpoint rewrites the session file
(`fsync` + `os.replace`, off the event loop), so a turn now pays one write per step.
A checkpoint also runs inside the front end's persistence barrier, so a cancellation that lands
*during* the write defers the exit instead of interrupting it, and a checkpoint that **fails**
is reported as a persistence failure (`Could not save session`) rather than as a generic
operation error — the barrier is released as soon as the save lands, so Ctrl+C keeps cancelling
an ordinary mid-turn turn.
- **tests**: 7 regression tests in `tests/phoson_cli/test_hard_kill_durability.py` assert the
**on-disk JSONL** (through a fresh `JsonlStorage`, i.e. what a new process would see) rather
than the in-memory tree: the prompt is durable before the first LLM call, every finished step
lands as it completes, a kill mid-turn keeps the completed work, the killed session resumes
in a new controller with its orphaned `tool_use` repaired, and neither the success, error nor
cancel path stores a message twice.

0.51.0

Feat

- **llm**: explicit prompt caching for Alibaba Model Studio (Qwen). The shared
OpenAI-compatible loop tags the stable prefix (system prompt — tool
definitions ride along with it for caching) and the last message with
`cache_control: {"type": "ephemeral"}` content parts, so the cached prefix
advances each turn. Explicit cache is mutually exclusive with Model Studio's
implicit cache and takes effect once a cached block reaches 1024 tokens. It is
applied only for the models that document the marker (`supports_explicit_cache`
— Qwen Max / Plus / Flash / Coder / VL and some DeepSeek/Kimi/GLM ids);
unsupported models stay on the implicit path. Usage is read from
`cache_creation_input_tokens` (write) / `cached_tokens` (read) and priced via
the new `alibaba/*` cache rates (write ≈ 1.25x input, read ≈ 0.10x input).

Fix

- **llm**: OpenAI-compatible cost no longer double-counts cached tokens. The
provider reports `prompt_tokens` as a *gross* total that already includes the
cache-read and cache-write tokens, but `calculate_cost` priced the full count
as uncached input and added the cache rates on top. The net (uncached) input
is now handed to the cost callback; the gross count is still reported for
display.
- **llm**: correct Alibaba `qwen3.8-max` / `qwen3.8-flash` explicit-cache
prices. These models do not bill cache hits at the usual 10% of input, so
their `cache_read` values were wrong (and `qwen3.8-flash`'s `cache_write`
too); they now use the true per-model rates from the Singapore / international
pricing pages.
- **cli**: session titles no longer inherit the compaction summary banner
(`[Conversation summary …]`); a rebuilt history is titled from the first real
user turn, and stored banner titles are repaired or cleared.
- **agent**: process probing and termination is centralised in the new
`phoson_agent.procutil`, because the two operations look portable and are not.
Liveness is now probed with `OpenProcess` + `GetExitCodeProcess` on Windows
instead of `os.kill(pid, 0)`: that is a probe on POSIX but hands the value to
`TerminateProcess` on Windows, so probing a *recycled* pid could terminate an
unrelated process — a `CRITICAL_PROCESS_DIED` bluescreen when it names a
system image. Every kill that reaches a process *by number* (Windows
`taskkill /T /F`) now first refuses a pid that is not running or that is one
of those images. `os.killpg` / `os.getpgid` / `os.setsid` — POSIX-only, and
raising `AttributeError`, which `except OSError` does not catch (269) — are
reached only through `pid_alive`, `process_group_of`, `process_group_alive`,
`kill_process_group` and `session_kwargs`, which degrade to the pid-based
primitives where there is no process-group concept.
- **cli**, **bgjobs**: the shell tool and the background-jobs plugin use those
helpers instead of their own copies, so both kill through one audited path
(the group on POSIX, `taskkill /T /F` on Windows). The bgjobs plugin now
records the id it can actually kill by and leaves it unset when the child's
group could not be resolved, rather than keeping a pid that is not a group.

0.50.1

Fix

- **bgjobs**: guard POSIX-only os.killpg/os.getpgid on Windows
- **llm**: scrub lone surrogates before OpenAI-compatible serialization
- **lock**: regenerate uv.lock for 0.50.0 version bump

0.50.0

Feat

- **cli**: modernize setup wizard with plugin selection and animations
- **providers**: add Alibaba Cloud (DashScope) adapter

Fix

- **engine**: git must never hang the event loop (Windows)

0.49.1

Fixed

- **cli**: harden self-update with PEP 440 version ordering, validated PyPI
responses, controlled subprocess launch errors, bounded output capture,
and cleanup on timeout or cancellation (including child process groups on
POSIX). Cancellation stops the installer but cannot roll back changes.
- **cli**: verify installed metadata in a fresh interpreter before reporting
upgrade success. Distinguish unchanged, constrained and unverified installs;
use explicit exit statuses instead of parsing messages.
- **cli**: preserve cached update hints across launches until the running
version catches up, and correct `uvx` guidance to explicitly request latest.

Changed

- **cli**: compact, colored Rich self-update messages and an interactive
installation spinner. REPL/TUI progress uses existing themed notices;
short diagnostics and recovery instructions appear only on failure.
- **tests**: add 37 self-update regression tests covering process cleanup,
verification, version ordering, cached hints and output integration.

0.49.0

Added

- **peers**: named agents across CLI windows (`phoson_plugin_peers`).
`phoson-cli --name <agent> [--team <team>]` makes a window a named agent
that others can message with `peer_ask` (request + wait for the answer),
`peer_send` (fire-and-forget) and `peer_list`, plus `/peers` and
`/tell <agent> <text>`. Incoming messages wake the recipient, render as
`📨 <sender> asks you` cards in its window, and the final answer of that
turn is sent back automatically as the reply. Maildir-style
one-file-per-message transport under `~/.phoson/peers/<team>/` with read
receipts, heartbeat presence, a `peers_max_hops` loop guard and deadlock
detection. New host hook: plugins may implement `on_turn_end(outcome)`.

Page 1 of 16

© 2026 Safety CLI Cybersecurity Inc. All Rights Reserved.