PiBrowserTaskbarPhoenix.Runtime (pi_browser_taskbar_phoenix v0.1.0)

Copy Markdown

Owns one persistent Pi RPC process and serializes task admission for a host project.

Summary

Functions

Requests idempotent cancellation of the retained task.

Returns a specification to start this module under a supervisor.

Returns the startup-fixed access configuration.

Starts and confirms a fresh Pi session while preserving rejected state.

Returns the canonical current snapshot.

Starts a project-scoped Pi runtime.

Atomically admits one task or returns the current busy snapshot.

Types

snapshot()

@type snapshot() :: %{contract_version: 1, session: map(), task: map() | nil}

Functions

cancel(server, task_id)

@spec cancel(GenServer.server(), String.t()) ::
  {:ok, :accepted | :cancelled, snapshot()}
  | {:error, :not_found | :not_cancellable | :unavailable, snapshot()}

Requests idempotent cancellation of the retained task.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

config(server)

@spec config(GenServer.server()) :: %{allowed_hosts: [String.t()]}

Returns the startup-fixed access configuration.

reset(server)

@spec reset(GenServer.server()) ::
  {:ok, snapshot()}
  | {:error, :reset_while_busy | :session_reset_rejected | :unavailable,
     snapshot()}

Starts and confirms a fresh Pi session while preserving rejected state.

snapshot(server)

@spec snapshot(GenServer.server()) :: snapshot()

Returns the canonical current snapshot.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts a project-scoped Pi runtime.

submit(server, task)

@spec submit(GenServer.server(), PiBrowserTaskbarPhoenix.Task.t()) ::
  {:ok, snapshot()} | {:error, :busy | :unavailable, snapshot()}

Atomically admits one task or returns the current busy snapshot.