Remote API — API reference¶
Errors¶
CardNotFound
¶
Bases: Exception
Raised by mutations when no card has the given id.
RelationError
¶
Bases: ValueError
Raised when a kind, parent or link change would break a board invariant.
The invariants: a card is an epic exactly when its project is
:data:EPIC_PROJECT; a parent is always an epic and an epic has no parent;
epics take no blocks links and bind no sessions; blocks links form
no loops. The message says which one, ready to show a user.
RemoteError
¶
Bases: Exception
Base class for errors raised by the remote API.
SchemaMismatch
¶
Bases: RemoteError
A database's schema version is not the one this release expects.
Raised instead of migrating: the host pins its own mait-code release, so a newer or older instance needs the host upgrading (or the instance), not a schema change made by the host.
| ATTRIBUTE | DESCRIPTION |
|---|---|
database |
The database file name, e.g.
|
expected |
The schema version this release of mait-code expects.
|
found |
The version recorded in the database (
|
TransitionRefused
¶
Bases: RemoteError
A refine asked for a card or column outside backlog/refined.
| ATTRIBUTE | DESCRIPTION |
|---|---|
card_id |
The card the refine targeted.
|
status |
The column involved - the card's current one, or the requested target.
|
Board¶
create_card
¶
create_card(
data_dir: Path,
*,
client: str,
project: str,
title: str,
description: str | None = None,
priority: str = "medium",
origin_id: int | None = None,
inherit_epic: bool = True,
) -> dict
Create a card in backlog, recording client as its creator.
There is no way to create a card anywhere but backlog.
With origin_id, the card joins the origin's epic and gets a from ->
#<origin_id> reference, in one transaction. An epic that is done or
archived is refused rather than joined, since nothing would surface the
card under it; pass inherit_epic=False to keep the reference and join
no epic. Without an origin, inherit_epic=True has nothing to inherit
and changes nothing.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
The instance's data directory.
TYPE:
|
client
|
Name of the calling client, stored as
TYPE:
|
project
|
Project the card belongs to.
TYPE:
|
title
|
Card title.
TYPE:
|
description
|
Optional markdown description.
TYPE:
|
priority
|
TYPE:
|
origin_id
|
The card this one was split from or raised as a follow-up of, in any project.
TYPE:
|
inherit_epic
|
Whether to join the origin's epic.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
The new card, with its (empty) comments. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If client, project or title is blank, client is
too long, priority is unknown, or inherit_epic is |
CardNotFound
|
If no card has the id origin_id. |
RelationError
|
If the origin is an epic, or its epic is done or
archived and inherit_epic is |
get_card
¶
Return one card with its comments.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
The instance's data directory.
TYPE:
|
card_id
|
The card's id.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
The card dict with a |
| RAISES | DESCRIPTION |
|---|---|
CardNotFound
|
If no card has that id. |
get_epic
¶
Return one epic with its members, progress and comments.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
The instance's data directory.
TYPE:
|
epic_id
|
The epic's id.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
The epic in the |
dict
|
plus |
dict
|
|
| RAISES | DESCRIPTION |
|---|---|
CardNotFound
|
If no card has that id. |
RelationError
|
If the card isn't an epic. |
list_cards
¶
list_cards(
data_dir: Path,
*,
project: str | None = None,
statuses: Iterable[str] | None = None,
tag: str | None = None,
search: str | None = None,
) -> list[dict]
Return cards ordered priority-then-oldest.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
The instance's data directory.
TYPE:
|
project
|
Restrict to one project, or
TYPE:
|
statuses
|
Restrict to these columns;
TYPE:
|
tag
|
Restrict to cards carrying this tag.
TYPE:
|
search
|
Case-insensitive substring of the title.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[dict]
|
Card dicts in the |
list[dict]
|
comments. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If statuses names an unknown column. |
list_epics
¶
Return epics with their member progress, priority-then-oldest.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
The instance's data directory.
TYPE:
|
include_done
|
Also return finished epics (archived ones never are).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[dict]
|
Epic dicts in the |
list[dict]
|
dict plus |
list[dict]
|
|
list_projects
¶
Return the distinct projects that have cards, sorted.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
The instance's data directory.
TYPE:
|
refine_card
¶
refine_card(
data_dir: Path,
card_id: int,
*,
client: str,
description: str | None = None,
acceptance: str | None = None,
to: str = REFINED,
) -> dict
Edit a card's description/acceptance and place it in backlog or refined.
The card must currently sit in backlog or refined, and to must
be one of those two. The change and a comment authored by client
recording it are written in one transaction, after re-checking the
card's column under the write lock.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
The instance's data directory.
TYPE:
|
card_id
|
The card to refine.
TYPE:
|
client
|
Name of the calling client, recorded as the comment author.
TYPE:
|
description
|
New description, or
TYPE:
|
acceptance
|
New acceptance criteria, or
TYPE:
|
to
|
Target column,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
The card after the change, with its comments. |
| RAISES | DESCRIPTION |
|---|---|
CardNotFound
|
If no card has that id. |
RelationError
|
If the card is an epic. |
TransitionRefused
|
If the card is outside backlog/refined, or to is any other column. |
ValueError
|
If client is blank or too long, or the call would change nothing. |
Memory¶
memory_search_status
¶
Report whether memory search can use the instance's vectors.
The check :func:search_memories makes on every query, asked up front:
the provider, model and width the host is configured to embed with,
against the record of what built the instance's vectors. When they
disagree, search runs keyword-only. Nothing is embedded and the
embedding provider is never loaded, so this is cheap enough for a
health check.
Note
Like :func:search_memories, the configured side comes from the
host's environment and settings file - see the module docstring.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
The instance's data directory.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dict with |
dict
|
|
dict
|
|
dict
|
|
dict
|
when the instance has no record). |
dict
|
usable; |
dict
|
|
dict
|
that the provider will load: a missing model download, |
dict
|
AWS credentials still leaves search keyword-only. |
| RAISES | DESCRIPTION |
|---|---|
FileNotFoundError
|
If the instance has no |
SchemaMismatch
|
If its schema version is not this release's. |
search_memories
¶
search_memories(
data_dir: Path,
query: str,
*,
limit: int = 10,
entry_type: str | None = None,
project: str | None = None,
) -> list[dict]
Search memories (keyword plus vector) and rank them.
The same hybrid search and composite ranking as mc-tool-memory
search. Superseded and retired entries are excluded.
Note
Unlike the rest of this module, the embedding provider and the ranking weights come from the host's environment and settings file - see the module docstring for exactly what to pin.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
The instance's data directory.
TYPE:
|
query
|
Search text.
TYPE:
|
limit
|
Maximum number of results.
TYPE:
|
entry_type
|
Restrict to one entry type (e.g.
TYPE:
|
project
|
Project context: global entries plus that project's are
searched, and the project's own rank higher.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[dict]
|
Memory entry dicts, best first, each with a |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If query is blank or limit is not positive. |
Reminders¶
list_reminders
¶
Return active (undismissed) reminders, ordered by due time.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
The instance's data directory.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[dict]
|
Dicts with |
list[dict]
|
|