Skip to main content

Module deeplink_guard

Module deeplink_guard 

Source
Expand description

srv’s guard of an agent’s deep-link open (docs/specs/SPEC_DEEP_LINKS_ONE_FRAMEWORK_2026_11_20.md §4.2, R16, G1 to G3, G5, G7, G9, G12). POST /api/v1/pane/open_link reads the link with the shared parser (agentmux_common::deeplinks), applies the rules an agent’s open is held to, records the open as the agent, and hands what it let through to the window (sagas::deeplink_open), whose executor applies the rules only the window can (R5, the pane caps and the typing queue of G3, G6).

The rules here, each with its test below:

  • Only an agent, known by its token, calls this route: a person’s click goes to the app’s executor directly.
  • G1, G5: a view an agent may not open is refused; a place marked as the caller’s own must name the caller; the Audit’s sound and message rows, whose owner srv can’t tell, are refused in build 1; a container agent gets no path destination (its files open through Pane open’s snapshot).
  • G7: a path is canonicalised once, the structural checks run again on the result, and the open uses that string. A network path, one that does not exist and one of the wrong kind (a folder for the Editor) are refused.
  • G3: a window target is refused; a tab or pane outside the caller’s own tab lands in its own tab instead; ten opens a minute per agent, refused (not queued) over it.
  • G9: every open is recorded as the agent, refused and queued ones too, with the outcome and the reason.
  • G12: everything is checked now, when the open happens.

Structs§

CallerFacts 🔒
Who asks, as srv knows it: never from the request’s words.
Limiter 🔒
A sliding window per caller: at most limit in RATE_WINDOW.
OpenLinkRequest 🔒
The body of POST /api/v1/pane/open_link.
Refusal 🔒
A refusal: a reason code of the executor’s vocabulary (open-types.ts), the sentence, and what would work.

Constants§

RATE_LIMIT 🔒
Opens an agent may ask for in RATE_WINDOW (G3, D3).
RATE_WINDOW 🔒

Functions§

canonical_path 🔒
path canonicalised once, as forward slashes, or why it can’t be opened (G7). folder says which kind it must be.
check_path 🔒
G7 for the path destinations: the path is replaced by its canonical form, which the open uses.
check_place_rate 🔒
The same limit for an agent’s floating opens and its resize, move and place: they and deep-link opens share the ten a minute, so a loop of any of them is stopped. The text says when the next is allowed.
check_rate 🔒
check_rules 🔒
G1 and G5: whether this agent may open link. May fill in the caller’s own id where the place takes one and the link left it out, so a place that would show “whoever is selected” shows the caller’s own.
facts_of 🔒
The caller’s own pane, tab and window, from srv’s own store.
guard 🔒
Everything srv checks, in order, on req from who: the parsed link srv lets through, its target, and a note.
handle_pane_open_link 🔒
POST /api/v1/pane/open_link: an agent opens a deep link. Answers the outcome of R3 (200) for every open the guard decided, refused ones included, each recorded; 403 for a caller that is not an agent known by its token.
label_of 🔒
The words for where a link goes, in English: srv has no i18n of its own, so it names the view and place by id.
limiter 🔒
own_values 🔒
The values and parameters a place marks as the caller’s own (G5).
record 🔒
G9: the open, recorded as the agent.
refusal 🔒
resolve_target 🔒
Where the open lands (G3, D1): beside the caller, or a new pane in its tab. A window is refused; a tab or a pane that is not the caller’s own is not reached: the open lands in the caller’s own tab.
tab_of_block 🔒
window_of_tab 🔒