The mirror reads every machine's /ask-form/health each 10 min (check_embed): its embedOrigins land on the records the API serves, and a machine that doesn't list the hub's two hosts (AI_AGENT_VIEW_URL, GUEST_PUBLIC_URL) is asked to add them (POST /ask-form/embed). A new form's push then opens the app on its conversation with the form over it (/conversation/<cid>?form=<id>; a guest's on their host) when its machine lets the app frame it, its own page otherwise. openapi.json re-dumped (also catches up on the tag endpoints) + orval. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
2.1 KiB
Python
58 lines
2.1 KiB
Python
"""The standalone ask-form tool's forms as the hub mirrors them (``askform/``)."""
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Optional
|
|
|
|
from .base import Schema
|
|
|
|
__all__ = [
|
|
"AskFormRecord",
|
|
"AskFormsResponse",
|
|
]
|
|
|
|
|
|
class AskFormRecord(Schema):
|
|
"""One form of the standalone ask-form tool, as the hub mirrors it. Ids
|
|
are ask-form's (``<kebab-title>_<6 chars>``); ``status`` is one of
|
|
``pending | submitted | declined | revoked | expired | closed``."""
|
|
id: str
|
|
machine: str # "lab" or a worker id ("" until met)
|
|
title: str
|
|
status: str
|
|
description: Optional[str] = None
|
|
createdAt: Optional[str] = None
|
|
expiresAt: Optional[str] = None
|
|
closedAt: Optional[str] = None
|
|
# The respondent link (token included): the machine's own page, and the
|
|
# one that works from any device. Known from the events webhook or a
|
|
# transcript — the admin API never returns it.
|
|
url: Optional[str] = None
|
|
publicUrl: Optional[str] = None
|
|
# The sites its machine's ask-form lets frame the form's pages (serve
|
|
# --embed-origins): the viewer opens it over the conversation when its
|
|
# own origin is one of them.
|
|
embedOrigins: Optional[list[str]] = None
|
|
sessionId: Optional[str] = None
|
|
conversationId: Optional[str] = None
|
|
forYou: Optional[bool] = None
|
|
multi: Optional[bool] = None
|
|
maxAnswers: Optional[int] = None
|
|
hideCount: Optional[bool] = None
|
|
answerCount: Optional[int] = None
|
|
answers: Optional[dict[str, Any]] = None
|
|
# A declined form: why, in the respondent's words, and the files they
|
|
# added to it ({name,size,contentType,sha256,path} on their machine).
|
|
reason: Optional[str] = None
|
|
reasonFiles: Optional[list[dict[str, Any]]] = None
|
|
responses: Optional[list[dict[str, Any]]] = None
|
|
fields: Optional[list[dict[str, Any]]] = None
|
|
fieldCount: Optional[int] = None
|
|
pushed: Optional[bool] = None
|
|
seenAt: Optional[str] = None
|
|
warning: Optional[str] = None
|
|
|
|
|
|
class AskFormsResponse(Schema):
|
|
forms: list[AskFormRecord]
|
|
count: int
|