{% extends "utilities/_base.html" %} {% from "components/chat_dialog.html" import chat_dialog %} {% from "components/page_header.html" import page_header %} {% from "components/modal.html" import render_modal with context %} {% from "utilities/_sign_in_fields.html" import api_key_field, server_address_field %} {# The service builder: a chat that writes a custom sync adapter, beside five tabs (plain links, so each tab is its own page load): Overview, Test account, Web access, Code, Test. Publish approves the endpoint list on Web access. #} {% block title %}{{ _("%(name)s - Services - Yaffo", name=row.name) }}{% endblock %} {% block utility_styles %} {% endblock %} {% set draft = service.draft %} {% set provider = service.provider %} {% set metadata = draft.metadata if draft else {} %} {% macro tab_link(key, label) %} {{ label }} {% endmacro %} {# An info hover, a section heading (with an optional hover and status chip), and a field label (with an optional hover): explanations live in hovers, not paragraphs. #} {% macro help_tip(text) %}{% endmacro %} {% macro section_heading(title, help=none, status=none) %}
{{ _("Publishing makes this draft the version syncs run. It may call only these:") }}
{{ endpoint.url }}
{{ _("reads") if endpoint.risk == 'read' else _("changes things") }}{{ ngettext("%(num)d sync uses this service. If the new version can call more than before, it asks for your approval again before it runs.", "%(num)d syncs use this service. If the new version can call more than before, they ask for your approval again before they run.", service.used_by) }}
{% endif %} {% endmacro %} {% block utility_content %} {% set header_actions %} {% if service.regenerate %} {% endif %} {% if service.can_publish %} {% endif %} {% endset %} {% call page_header(row.name, actions=header_actions) %} {% if service.regenerate %}{{ _("Needs updating") }} {% elif row.published %}{{ _("Published") }} {% else %}{{ _("Draft") }}{% endif %} {{ _("A service Yaffo can import from or send to. Describe it in the chat; the builder writes and tests it, and you publish it.") }} {% endcall %} {% if service_error %}{{ _("Nothing yet. The builder fills this in as it writes the service.") }}
{% endif %} {% elif tab == 'account' %} {% if not provider %}{{ _("Appears once the builder knows how this service signs in.") }}
{% else %} {% if service.needs_app %} {{ section_heading(_("App credentials"), _("%(service)s needs to know which app is asking: register Yaffo with it once, and every sync using this service reuses it. Kept in your system's keychain, never in Yaffo's database, never sent to the AI model. Saving new ones signs every sync using this service out.", service=provider.label), _("Saved") if service.app_saved else none) }} {% endif %} {{ section_heading(_("Test account"), _("The account Test reads from while you build. It's saved like any sign-in, so a sync set up with this service finds it already signed in.")) }} {% if service.test_account %}{{ endpoint.url }}
{{ _("Reads") if endpoint.risk == 'read' else _("Writes") }}
{{ _("No web calls yet.") }}
{% endif %} {% elif tab == 'code' %} {% if row.working_code %} {% if row.published and row.published_code != row.working_code %}{{ _("Differs from the published version.") }}
{% endif %}{{ row.working_code }}
{% else %}
{{ _("No code yet.") }}
{% endif %} {% elif tab == 'test' %} {% if draft %} {{ section_heading(_("Test the draft"), _("Runs the draft once: reads go to the test account for real, and nothing is ever sent or changed. The builder sees the result with your next message.")) }} {% else %}{{ _("Nothing to test yet.") }}
{% endif %} {% endif %}