oc_chat
Loading...
Searching...
No Matches
oc_chat.registry._legacy_queue Namespace Reference

Functions

str entry_plan_id (str entry)
tuple[str|None, str|None, str|None] parse_entry_overrides (str entry)
dict[str, dict[str, list[str]]] load_legacy_queue (Path path)

Variables

Path DEFAULT_AGENT_QUEUE = Path("oc_chat/plans/agent_queue.md")
dict LEGACY_AGENT_POOLS
 _SECTION_HEADER_RE
 _BULLET_RE
 _ENTRY_OVERRIDE_RE
 _VALID_SESSION = frozenset({"fresh", "continue", "either"})

Detailed Description

Read-only reader for the retired Markdown agent queue.

Purpose
-------
Plan 223 P3 retired the queue machinery: ``oc_chat.core.agent_queue`` and
``oc_chat.scripts.queue_manage`` are deleted and ``agent_queue.md`` is
archived. The M11 legacy migration (:mod:`oc_chat.registry.migrate`) still
has to be able to READ that historical format, so the minimum parser it
needs lives here, with the migration that owns it, rather than keeping a
whole queue subsystem alive for one caller.

This is a legacy-format reader and nothing else: it parses, it never
writes, it has no slot dataclass, no suggester, no pool sidecar, and no
CLI. The queue ``AgentSlot`` dataclass is gone for good (plan 223 W3);
sections here are plain dicts.

Responsibilities
----------------
- :data:`LEGACY_AGENT_POOLS` — the frozen committed roster the migration
  projects into registry ``agents`` rows.
- :func:`load_legacy_queue` — parse a queue Markdown file into
  ``{label: {"pending": [...], "completed": [...]}}``.
- :func:`entry_plan_id` / :func:`parse_entry_overrides` — decode a single
  pending bullet, bare or annotated.

Diagnostics
-----------
Domain: OC_CHAT.MAIN
Levels:
    L2 - parse lifecycle events
    L3 - semantic details
    L4 - per-entry tracing

Contracts
---------
- Read-only over every input; a missing file yields empty sections rather
  than raising, matching the retired parser's behaviour so the migration's
  projection is unchanged.
- Parsing is byte-compatible with the retired ``agent_queue.load_queue``
  for the section/bullet grammar the archived file actually uses.

Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)

Function Documentation

◆ entry_plan_id()

str oc_chat.registry._legacy_queue.entry_plan_id ( str entry)
Return the bare plan id from a bare or annotated pending entry.

Definition at line 130 of file _legacy_queue.py.

Here is the caller graph for this function:

◆ load_legacy_queue()

dict[str, dict[str, list[str]]] oc_chat.registry._legacy_queue.load_legacy_queue ( Path path)
Parse *path* into ``{label: {"pending": [...], "completed": [...]}}``.

Sections are ``## Agent X Queue`` and ``## Agent X Queue, Completed
Tasks``; ``- <entry>`` bullets inside one are collected and every other
line is ignored. A label carrying a section but absent from
:data:`LEGACY_AGENT_POOLS` is still returned, because the archived file
may hold a section for a slot whose registration only ever lived in the
retired sidecar. Completed bullets are stored as bare plan ids.

A missing or unreadable file yields the empty roster rather than
raising: a migration run in a tree without the archived queue projects
no queue entries, which is a true statement about that tree.

Definition at line 166 of file _legacy_queue.py.

Here is the call graph for this function:

◆ parse_entry_overrides()

tuple[str | None, str | None, str | None] oc_chat.registry._legacy_queue.parse_entry_overrides ( str entry)
Return ``(model, thinking, session)`` for an annotated pending entry.

An entry reads ``<plan-id> [model=M, thinking=L, session=S]``; any
subset of the annotations may be absent, and an unrecognised session
value is dropped rather than raising, exactly as the retired parser
did (a malformed historical annotation must not fail a migration).

Definition at line 137 of file _legacy_queue.py.

Variable Documentation

◆ _BULLET_RE

oc_chat.registry._legacy_queue._BULLET_RE
protected
Initial value:
1= re.compile(
2 # OCT-LINT: disable=no_hardcoded_secrets reason="Prompt templates, regexes, and model IDs are not secrets (waiver carried with the code from core/agent_queue.py, plan 223)"
3 r"^-\s+(?P<entry>[A-Za-z0-9][A-Za-z0-9_\-./]*(?:\s+\‍[[^\‍]]+\‍])?)\s*$"
4)

Definition at line 118 of file _legacy_queue.py.

◆ _ENTRY_OVERRIDE_RE

oc_chat.registry._legacy_queue._ENTRY_OVERRIDE_RE
protected
Initial value:
1= re.compile(
2 # OCT-LINT: disable=no_hardcoded_secrets reason="Prompt templates, regexes, and model IDs are not secrets (waiver carried with the code from core/agent_queue.py, plan 223)"
3 r"^(?P<plan_id>[A-Za-z0-9][A-Za-z0-9_\-./]*)(?:\s+\‍[(?P<annotations>[^\‍]]+)\‍])?\s*$"
4)

Definition at line 122 of file _legacy_queue.py.

◆ _SECTION_HEADER_RE

oc_chat.registry._legacy_queue._SECTION_HEADER_RE
protected
Initial value:
1= re.compile(
2 # OCT-LINT: disable=no_hardcoded_secrets reason="Prompt templates, regexes, and model IDs are not secrets (waiver carried with the code from core/agent_queue.py, plan 223)"
3 r"^##\s+Agent\s+([A-Z])\s+Queue(?P<completed>,\s*Completed\s+Tasks)?\s*$"
4)

Definition at line 114 of file _legacy_queue.py.

◆ _VALID_SESSION

oc_chat.registry._legacy_queue._VALID_SESSION = frozenset({"fresh", "continue", "either"})
protected

Definition at line 127 of file _legacy_queue.py.

◆ DEFAULT_AGENT_QUEUE

Path oc_chat.registry._legacy_queue.DEFAULT_AGENT_QUEUE = Path("oc_chat/plans/agent_queue.md")

Definition at line 64 of file _legacy_queue.py.

◆ LEGACY_AGENT_POOLS

dict oc_chat.registry._legacy_queue.LEGACY_AGENT_POOLS

Definition at line 70 of file _legacy_queue.py.