Skip to main content

Chat-stream HTML widgets for ifuri and urirun (widget://)

Project description

urirun-widgets

AI Cost Tracking

PyPI Version Python License AI Cost Human Time Model

  • 🤖 LLM usage: $0.1050 (6 commits)
  • 👤 Human dev: ~$1795 (17.9h @ $100/h, 30min dedup)

Generated on 2026-07-05 using openrouter/qwen/qwen3-coder-next


Chat-stream HTML widgets — connector ekosystemu ifURI / urirun. Schemat URI: widget://

Widoki HTML, które okno czatu (chat-main) renderuje w chatStreamList podczas skanowania — teraz jako wspólny, adresowany przez URI katalog, zamiast funkcji wklejonych w dashboard hosta. Źródłem prawdy dla przeglądarki są samodzielne moduły ES w assets/widgets/. Connector listuje katalog, serwuje JS pojedynczego widgetu, serwuje cały katalog jako jeden import (bundle) oraz renderuje widok po stronie serwera (mirror w Pythonie) dla powierzchni bez DOM.

The HTML views chatStreamList renders in chat-main when scanning, collected into one URI-addressable catalogue.

Widgety

id obsługuje view plik
scanner-stream scanner-stream assets/widgets/scanner-stream.js
scanner-status scanner-status assets/widgets/scanner-status.js
table table assets/widgets/table.js
image image, image-list assets/widgets/image.js
video video assets/widgets/video.js
iframe iframe, page, web assets/widgets/iframe.js
form form assets/widgets/form.js
graph graph assets/widgets/graph.js
generic (fallback) assets/widgets/generic.js

Wspólne helpery: assets/render-helpers.js · Dyspozytor renderServiceView: assets/render.js · Style: assets/widgets.css.

Widgety dashboardowe są renderowane jawnie po nazwie, a nie po polu view:

id użycie plik
attachment pojedynczy załącznik czatu assets/widgets/attachment.js
chat-message wiadomość czatu z timeline URI i załącznikami assets/widgets/chat-message.js
artifact-grid tabela/grid artefaktów z preview, metadata i akcjami assets/widgets/artifact-grid.js
widget-card karta usługi z live view assets/widgets/widget-card.js
metrics, task-table, nodes, routes, contacts panele dashboardu assets/widgets/dashboard.js

Dyspozytor dashboardowy: assets/dashboard-render.js (renderDashboardWidget(name, data)).

Trasy

  • widget://host/registry/query/list — katalog widgetów (id, obsługiwane view, kształt data).
  • widget://host/widget/query/get?name=table — metadane + źródło ES jednego widgetu (name może być też kluczem view, np. pageiframe).
  • widget://host/bundle/query/js — helpery + wszystkie widgety + dyspozytory renderServiceView(view) i renderDashboardWidget(name, data) sklejone w jeden moduł ES.
  • widget://host/bundle/query/css — wspólny arkusz stylów (samowystarczalny; zmienne motywu host może nadpisać).
  • widget://host/widget/query/render?view=table — render widoku do HTML po stronie serwera (mirror w Pythonie) dla e-maila/SVG/testów. Podaj view + data (JSON) albo pełny obiekt widoku w data.

Użycie w chacie

// załaduj cały katalog widgetów z connectora
import { renderServiceView } from 'widget://host/bundle/query/js';
chatStreamList.innerHTML = views.map(renderServiceView).join('');
// dashboard: artefakty albo wiadomości czatu po nazwie widgetu
import { renderDashboardWidget } from 'widget://host/bundle/query/js';
artifactFileGrid.innerHTML = renderDashboardWidget('artifact-grid', { items, selectedIds });
# render po stronie serwera (headless)
urirun-widget render --view table --data '{"rows":[{"nip":"7781422455","gross":1230.0}]}'
urirun-widget render --widget artifact-grid --data '{"items":[{"id":"a1","path":"/tmp/FV.pdf"}]}'

Źródło prawdy a render serwerowy

Moduły JS (assets/) to źródło prawdy dla przeglądarki. render.py to ich wierny odpowiednik w Pythonie używany przez widget/query/render — przy zmianie widgetu aktualizuj oba. Testy pilnują osobno pokrycia view (RENDERERS) i dashboard widgets (DASHBOARD_RENDERERS).

Trzecia kopia: host (do skasowania)

Host (urirun/host/) wciąż wendoruje te renderery — niewidoczna trzecia kopia, która z umowy „aktualizuj oba" wypada:

  • dashboard.js — rodzina render*ServiceView / renderWidget* (fallback inline; konsumpcja bundla widget://host/bundle/query/js jest już wpięta przez loadWidgetBundleViaUri)
  • widgets.pyselect_service_view, service_widget_summary
  • html_templates.pyservice_widget_html, service_widget_svg

Burn-down (ratchet): ci/check_render_single_source.py <host-dir> --baseline ci/render_baseline.json liczy te kopie i blokuje NOWE; cel = --strict zielony, gdy bundle jest jedynym źródłem. Plan: (1) dashboard.js ładuje bundle i NIC nie renderuje inline; (2) serwer woła urirun-widgets render.py zamiast html_templates.service_widget_*; (3) skasuj inline'owe renderery hosta; (4) zaciśnij baseline → 0.

NIE migruje do widgetów: kontroler dashboardu (renderNodeCard, renderChatHistory, renderUrlState, formularze CRUD node'ów, submit czatu, polling, wybór targetów) — to app operatora (urirun-service-chat), nie katalog widgetów. Widget renderuje widok, nie prowadzi dashboard.

Wymagania

  • python: urirun

Instalacja (dev)

pip install -e .
pytest -q

Powiązane


Kategoria: UI · Słowa kluczowe: widget, html, chat, chatstreamlist, scanner, view, dashboard, ui · Wydawca: if-uri

License

Licensed under Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

urirun_widgets-0.1.1.tar.gz (51.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

urirun_widgets-0.1.1-py3-none-any.whl (51.4 kB view details)

Uploaded Python 3

File details

Details for the file urirun_widgets-0.1.1.tar.gz.

File metadata

  • Download URL: urirun_widgets-0.1.1.tar.gz
  • Upload date:
  • Size: 51.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for urirun_widgets-0.1.1.tar.gz
Algorithm Hash digest
SHA256 634ae11121a1e345fa101d9ad86f023c104b82d16a0166121c81e0155c6db9f5
MD5 a7095cfc78778f1c2a2edb89e38914d7
BLAKE2b-256 151f2832593bceecaedc3a104994afd5c6b10b4f014f85283e88172d70b40558

See more details on using hashes here.

File details

Details for the file urirun_widgets-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: urirun_widgets-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 51.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for urirun_widgets-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dbebb387656e0575cfaa98426fd62d6a586c935862053d7ca1529137f809cde4
MD5 50c3ca75aece54b15079342d102c6f00
BLAKE2b-256 9918a023d0704b97c0c2fa08471ae96288ee7629eaedafeb0e3be81c8c1e8726

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page