What ships
- Source-readiness checks.
- Meeting summary draft outlines.
- Optional draft persistence with
CIVICCOMMS_DRAFT_DB_URL. - Ordinance explainer drafts.
- Newsletter and FAQ scaffolds.
- Audience variant drafts.
- Public sample UI at
/civiccomms.
diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index b10b3c4..f9e4f8e 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -46,14 +46,17 @@ jobs: verify: needs: changes if: needs.changes.outputs.code == 'true' - runs-on: ubuntu-latest + runs-on: windows-latest + defaults: + run: + shell: bash steps: - uses: actions/checkout@v5 - uses: actions/setup-python@v6 with: - python-version: "3.11" - - name: Install CivicCore release wheel - run: python -m pip install https://github.com/CivicSuite/civiccore/releases/download/v0.3.0/civiccore-0.3.0-py3-none-any.whl + python-version: "3.13" + - name: Install Townlight Core pinned revision + run: python -m pip install "git+https://github.com/townlight/core.git@2f6ba9be4a95e3772dc47a3682ac780c5283b626" - name: Install package run: python -m pip install -e ".[dev]" - name: Run release gate diff --git a/AGENTS.md b/AGENTS.md index 64acad8..54af85e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,27 +2,31 @@ # Townlight Communications Agent Board -## Operating Contract +## Current contract -- Upstream suite spec: `townlight/townlight/docs/CivicSuiteUnifiedSpec.md`, especially the Townlight Communications catalog entry and suite-wide non-negotiables. -- Townlight Communications supports source-backed public explainers, meeting summaries, ordinance summaries, newsletters, FAQs, and audience-specific draft variants. -- AGPL-3.0-only for code (with the TownLight Public Institution Exception for qualifying deployments), CC BY 4.0 for documentation. -- Every change must keep docs, tests, browser QA evidence, and version surfaces in sync. +- Townlight Communications `0.2.0` is a development candidate. Scope is defined by `COMMUNICATIONS-DESIGN.md`; this file replaces superseded `0.1.1` prototype mandates. +- Windows only. Hold software tag and software publication until explicitly authorized. +- Canonical verification is the Windows suite runtime plus the named affected checks. Do not add extra gates. +- The standalone `main.py` is a prototype, not the production workflow server. -## Hard Boundaries +## Publication authority -- Townlight Communications never publishes autonomously, creates campaign or advocacy content, provides legal advice, certifies translations, posts to social media, or updates a communications system of record. -- Townlight Communications v0.1.1 must not call live LLMs or live publishing/social-media/communications systems. -- Every generated artifact is a draft requiring staff review, citation verification, approval, and publication through official city channels. -- Townlight Communications depends on Townlight Core; Townlight Core must never depend on Townlight Communications. -- Townlight Communications may reference Townlight Meetings, Townlight Code, and Townlight Access concepts only through released APIs or deterministic sample data in v0.1.1. +- Unattended publication is authorized ONLY for the exact staff-approved revision, through the host, to website and email. +- Do not add social, advertising/campaign, legal-advice, or translation-certification capabilities. +- No silent fallback: missing, private, stale, mismatched, or unapproved content must remain blocked and visibly reported. +- Reuse existing administrator, city-staff, and clerk roles and native authentication. -## Verification +## Source and history boundaries -Run before push or release: +- Preserve the private/public source boundary. Source eligibility is verified at runtime against the actual module; user-supplied eligibility flags cannot authorize publication. +- Revisions are immutable with SHA256 provenance. Editing clears approval and correction preserves prior revisions. +- Records archive must contain the exact published revision, source references, attachments, and receipts, and return a real identifier before any correction. +- Use explicit migrations and preserve existing affected headless checks. +- Preserve ordered correction and withdrawal sequences; stale content must not be resurrected. -```bash -bash scripts/verify-release.sh -``` +## Architecture and workflow -Browser QA evidence is required for `docs/index.html` and `/civiccomms` whenever visible UI changes. +- Preserve dependency direction: Townlight Core never depends on Townlight Communications. +- DeepSeek1017 performs low-risk implementation; Codex coordinates integration and review. +- Keep documentation, tests, and version surfaces synchronized with approved scope. +- Code is AGPL-3.0-only with the TownLight Public Institution Exception; documentation is CC BY 4.0. diff --git a/CHANGELOG.md b/CHANGELOG.md index 122b603..f7b845a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to CivicComms will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [Unreleased] + +### 0.2.0 candidate + +- Added editorial immutable revision approval and correction/withdrawal without reviving stale revisions. +- Added approved source snapshot and public attachment capture. +- Added scheduled website and email publication through the host service. +- Added subscriber confirmation, preference management, and unsubscribe support. +- Added Records archive storage for published bytes and receipts behind the separate Records permission. +- Not included in the released Windows 1.9.3.2 suite; installed candidate acceptance is still pending. + ## [0.1.1] - 2026-04-28 ### Added diff --git a/COMMUNICATIONS-DESIGN.md b/COMMUNICATIONS-DESIGN.md new file mode 100644 index 0000000..981cab7 --- /dev/null +++ b/COMMUNICATIONS-DESIGN.md @@ -0,0 +1,19 @@ +# Communications implementation design — approved scope + +Owner: Scott. Windows only. Build after311 source integration; installed acceptance in one combined signed candidate. No software tag/publication approval yet. + +## Interface and roles +Reuse staff shell/navigation, native session and existing administrator/city-staff/clerk grants. New Communications workspace: saved draft list/filter, source picker, editor, exact-revision preview, Access review, review/approval, schedule, delivery status, correction/withdrawal and Records archive. Resident portal: approved article list/detail, subscriptions/preferences/unsubscribe. No resident account exposes staff drafts or private source data. Keyboard navigation, labelled controls, errors beside fields, visible queued/delivered/failed states, destructive actions confirmed. + +## Durable domain contract +Use townlight-comms0.2.0 / townlight_comms, current townlight-core1.3.0.dev2. SQLAlchemy schema townlight_comms. Explicit migration; SQLite tests use schema translation, production bootstrap false. Immutable revisions with SHA256 canonical public content and source snapshots. Articles retain current revision/state, approval hash/actor/time, schedule and publication history. Edit clears approval; correction preserves old revision. Optimistic revision and database transactions prevent two-PC lost updates. HTML is not trusted: store/render plain text and escaped paragraphs. Attachments have actual bytes/hash/limits and public-review status. + +Source references carry kind,id,revision,title,public URL,digest and public eligibility verified by runtime against actual module. User-supplied eligibility flags cannot authorize publication. Supported kinds meetings/code/notice/311 aggregate/parks; parks connector completed in Parks phase. Missing/private/stale source blocks approval; manual authored source-backed content does not need AI. Access report and translations retain exact source/output and revision provenance; staff approval remains explicit. + +Publication task atomically snapshots exact approved revision, channels website/email and due time. Host claims due tasks with leases; native app need not stay open. Website manifest kind article travels through existing PublisherQueue/portal authenticated receiver, actual receipt URL/hash captured. Correction/withdrawal use ordered sequence, cannot resurrect stale content. Email uses existing311 SMTPTransport with separate Comms durable outbox: deterministic message ID, retries only known unsent, uncertain send is visible and not automatically retried. Subscriptions are opt-in, private tokens hashed, preferences/unsubscribe exclude future mail. No social/ad campaign channels. + +## Boundaries +Runtime /desktop/v1/communications under native staff auth; browser commands use fixed native allowlist and shared-host gateway, no arbitrary URL. Portal incoming resident operations use encrypted authenticated inbox/pump patterns; desktop service stays private. Records archive contains actual published revisions/source refs/attachments/receipts and returns real identifier; Data only explicit approved aggregate publication metrics if required by existing plan, no subscriber list. Reuse existing city configuration and encrypted SMTP settings, no new auth provider. + +## Meaningful acceptance +Domain tests prove edit invalidation, stale review, private source rejection, atomic concurrent edits, schedule leases, exact bytes, correction/withdrawal, subscriber privacy and safe retry. HTTP tests trace real receiving contracts and portal receiver, UI tests actual visible controls with explicit native doubles. Final installed Windows candidate proves staff two-PC sourced author/edit/approve/schedule, app closed host publishes to portal and controlled SMTP, correction/withdrawal/history/Records retrieval, restart survival. Source tests are not installed acceptance. diff --git a/README.md b/README.md index 60ced9d..b890a9d 100644 --- a/README.md +++ b/README.md @@ -1,65 +1,23 @@ -> **Parked foundation — outside the released Windows suite.** This repository contains exploratory/support code, not a completed Townlight product. It is not installed or supported by Windows 1.8.1.1. Historical examples, package names and dependency pins below describe this foundation and must not be used as current suite installation instructions. Use the [released Windows suite, current modules and acceptance limits](https://townlight.github.io/versions.html). +# Townlight Communications 0.2.0 development candidate - +Townlight Communications is the development candidate for the Townlight Windows staff Communications screen. It is not included in the released Windows 1.9.3.2 suite. Distribution name: `townlight-comms`; import name: `townlight_comms`; current dependency: Townlight Core 1.3.0.dev2 (`townlight-core 1.3.0.dev2`). -# Townlight Communications +The canonical application is the Communications workspace in the Townlight Windows staff shell, using existing administrator, city-staff and clerk roles, plus a separate Records permission for archive access. The repository's standalone `main.py` remains a prototype for draft helpers. It is not a secured workflow server, and its commands are not production deployment instructions. -Townlight Communications is the Townlight module for source-backed public explainers, meeting summaries, ordinance summaries, newsletters, FAQs, and audience-specific draft variants. +## Workflow -Current state: **v0.1.1 public communications foundation plus draft persistence release**. This repo ships a FastAPI package, health/root endpoints, documentation gates, deterministic source-readiness review, meeting summary draft outlines, optional database-backed source review and meeting summary draft records, ordinance explainer drafts, newsletter scaffolds, FAQ prompts, audience-variant drafts, and accessible public sample UI at `/civiccomms`. It does **not** ship autonomous publication, campaign or advocacy content, legal advice, certified translation, live LLM calls, social media posting, or communications system-of-record integrations. +- Draft and save content from selected Meetings, Code, Notice or 311 sources. The Parks adapter remains pending until the Parks phase. +- Run an Access check, review and approve one exact revision, then schedule website and email publication. +- Archive the published revision to Records BEFORE editing, correcting, or withdrawing it; Records access requires the separate Records permission. +- Correct or withdraw published content without reviving stale revisions. +- Capture approved source snapshots and public attachments. Private source content cannot be published. - +Publication is transactional: approved revision snapshots, website and email tasks, and status are durable in PostgreSQL. A host service claims due work with leases, so the native app need not stay open. The website path uses the existing authenticated portal receiver. -## What Townlight Communications Does +Website publication uses the host-configured portal credential and origin. Normal operation uses an unattended host service, not an operator's open window. Email uses city settings shared with 311 SMTP. Subscribers must confirm email and can manage preferences or unsubscribe. Queued means pending, not SMTP accepted. Only sent means SMTP accepted the message, not human receipt; failed and uncertain sends are shown separately, and uncertain sends are never retried automatically. -- Check that draft work starts from named source material and citations. -- Create deterministic meeting summary draft outlines. -- Persist source review and meeting summary draft records when `CIVICCOMMS_DRAFT_DB_URL` is configured. -- Create plain-language ordinance explainer draft scaffolds. -- Build newsletter and FAQ draft structures from source items. -- Produce audience-specific variants without changing source facts. -- Demonstrate a public communications-support UI at `/civiccomms`. +The Records archive stores actual published bytes and receipts and returns a real identifier. It requires the separate Records role permission. - +Status: source-level checks passed for this development candidate, but installed Windows candidate acceptance is still pending. Do not describe this module as completed or released. The existing download at https://github.com/townlight/townlight/releases/latest explicitly does not include Communications. -## What Townlight Communications Does Not Do - -- It does not publish or post autonomously. -- It does not produce campaign, advocacy, or partisan content. -- It does not provide legal advice. -- It does not certify translations or accessibility compliance. -- It does not call live LLMs in v0.1.1. -- It does not replace a communications system of record. - -## API Surface - -- `GET /` returns the shipped/planned boundary. -- `GET /health` returns package and Townlight Core versions. -- `GET /civiccomms` returns the accessible public sample UI. -- `POST /api/v1/civiccomms/source-review` returns source-readiness checks. -- `GET /api/v1/civiccomms/source-review/{review_id}` retrieves a persisted source review when `CIVICCOMMS_DRAFT_DB_URL` is configured. -- `POST /api/v1/civiccomms/meeting-summary` returns a meeting summary draft outline and a `summary_id` when persistence is configured. -- `GET /api/v1/civiccomms/meeting-summary/{summary_id}` retrieves a persisted meeting summary when `CIVICCOMMS_DRAFT_DB_URL` is configured. -- `POST /api/v1/civiccomms/ordinance-summary` returns a plain-language explainer draft. -- `POST /api/v1/civiccomms/newsletter` returns a newsletter draft outline. -- `POST /api/v1/civiccomms/faq` returns source-backed FAQ prompts. -- `POST /api/v1/civiccomms/audience-variant` returns an audience-specific draft variant. - -## Optional Persistence - -Set `CIVICCOMMS_DRAFT_DB_URL` to enable local SQLAlchemy-backed source review and meeting summary records. Without that variable, Townlight Communications remains deterministic and stateless. Retrieval endpoints return actionable `503` responses that name the required configuration. - -## Local Development - -Townlight Communications v0.1.1 is pinned to `civiccore==0.3.0`. - -```bash -python -m pip install -e ".[dev]" -python -m pytest -q -bash scripts/verify-release.sh -``` - -## License - -Code: AGPL-3.0-only, with the TownLight Public Institution Exception for qualifying deployments. See [LICENSE](LICENSE) and [LICENSE-EXCEPTION.md](LICENSE-EXCEPTION.md). -Documentation is CC BY 4.0. +License: code AGPL-3.0-only with the TownLight Public Institution Exception; documentation CC BY 4.0. diff --git a/README.txt b/README.txt index 690e0a0..b890a9d 100644 --- a/README.txt +++ b/README.txt @@ -1,56 +1,23 @@ - Parked foundation — outside the released Windows suite. This repository contains exploratory/support code, not a completed Townlight product. It is not installed or supported by Windows 1.8.1.1. Historical examples, package names and dependency pins below describe this foundation and must not be used as current suite installation instructions. Use the released Windows suite, current modules and acceptance limits. +# Townlight Communications 0.2.0 development candidate -Townlight Communications +Townlight Communications is the development candidate for the Townlight Windows staff Communications screen. It is not included in the released Windows 1.9.3.2 suite. Distribution name: `townlight-comms`; import name: `townlight_comms`; current dependency: Townlight Core 1.3.0.dev2 (`townlight-core 1.3.0.dev2`). -Townlight Communications is the Townlight module for source-backed public explainers, meeting summaries, ordinance summaries, newsletters, FAQs, and audience-specific draft variants. +The canonical application is the Communications workspace in the Townlight Windows staff shell, using existing administrator, city-staff and clerk roles, plus a separate Records permission for archive access. The repository's standalone `main.py` remains a prototype for draft helpers. It is not a secured workflow server, and its commands are not production deployment instructions. -Current state: v0.1.1 public communications foundation plus draft persistence release. This repo ships a FastAPI package, health/root endpoints, documentation gates, deterministic source-readiness review, meeting summary draft outlines, optional database-backed source review and meeting summary draft records, ordinance explainer drafts, newsletter scaffolds, FAQ prompts, audience-variant drafts, and accessible public sample UI at /civiccomms. It does not ship autonomous publication, campaign or advocacy content, legal advice, certified translation, live LLM calls, social media posting, or communications system-of-record integrations. +## Workflow -What Townlight Communications Does +- Draft and save content from selected Meetings, Code, Notice or 311 sources. The Parks adapter remains pending until the Parks phase. +- Run an Access check, review and approve one exact revision, then schedule website and email publication. +- Archive the published revision to Records BEFORE editing, correcting, or withdrawing it; Records access requires the separate Records permission. +- Correct or withdraw published content without reviving stale revisions. +- Capture approved source snapshots and public attachments. Private source content cannot be published. -- Check that draft work starts from named source material and citations. -- Create deterministic meeting summary draft outlines. -- Persist source review and meeting summary draft records when CIVICCOMMS_DRAFT_DB_URL is configured. -- Create plain-language ordinance explainer draft scaffolds. -- Build newsletter and FAQ draft structures from source items. -- Produce audience-specific variants without changing source facts. -- Demonstrate a public communications-support UI at /civiccomms. +Publication is transactional: approved revision snapshots, website and email tasks, and status are durable in PostgreSQL. A host service claims due work with leases, so the native app need not stay open. The website path uses the existing authenticated portal receiver. -What Townlight Communications Does Not Do +Website publication uses the host-configured portal credential and origin. Normal operation uses an unattended host service, not an operator's open window. Email uses city settings shared with 311 SMTP. Subscribers must confirm email and can manage preferences or unsubscribe. Queued means pending, not SMTP accepted. Only sent means SMTP accepted the message, not human receipt; failed and uncertain sends are shown separately, and uncertain sends are never retried automatically. -- It does not publish or post autonomously. -- It does not produce campaign, advocacy, or partisan content. -- It does not provide legal advice. -- It does not certify translations or accessibility compliance. -- It does not call live LLMs in v0.1.1. -- It does not replace a communications system of record. +The Records archive stores actual published bytes and receipts and returns a real identifier. It requires the separate Records role permission. -API Surface +Status: source-level checks passed for this development candidate, but installed Windows candidate acceptance is still pending. Do not describe this module as completed or released. The existing download at https://github.com/townlight/townlight/releases/latest explicitly does not include Communications. -- GET / returns the shipped/planned boundary. -- GET /health returns package and Townlight Core versions. -- GET /civiccomms returns the accessible public sample UI. -- POST /api/v1/civiccomms/source-review returns source-readiness checks. -- GET /api/v1/civiccomms/source-review/{review_id} retrieves a persisted source review when CIVICCOMMS_DRAFT_DB_URL is configured. -- POST /api/v1/civiccomms/meeting-summary returns a meeting summary draft outline and a summary_id when persistence is configured. -- GET /api/v1/civiccomms/meeting-summary/{summary_id} retrieves a persisted meeting summary when CIVICCOMMS_DRAFT_DB_URL is configured. -- POST /api/v1/civiccomms/ordinance-summary returns a plain-language explainer draft. -- POST /api/v1/civiccomms/newsletter returns a newsletter draft outline. -- POST /api/v1/civiccomms/faq returns source-backed FAQ prompts. -- POST /api/v1/civiccomms/audience-variant returns an audience-specific draft variant. - -Optional Persistence - -Set CIVICCOMMS_DRAFT_DB_URL to enable local SQLAlchemy-backed source review and meeting summary records. Without that variable, Townlight Communications remains deterministic and stateless. Retrieval endpoints return actionable 503 responses that name the required configuration. - -Local Development - -Townlight Communications v0.1.1 is pinned to civiccore==0.3.0. - - python -m pip install -e ".[dev]" - python -m pytest -q - bash scripts/verify-release.sh - -License - -Code: AGPL-3.0-only, with the TownLight Public Institution Exception for qualifying deployments. See LICENSE and LICENSE-EXCEPTION.md. Documentation is CC BY 4.0. +License: code AGPL-3.0-only with the TownLight Public Institution Exception; documentation CC BY 4.0. diff --git a/USER-MANUAL.md b/USER-MANUAL.md index 1cc31ba..e0be4ee 100644 --- a/USER-MANUAL.md +++ b/USER-MANUAL.md @@ -1,49 +1,51 @@ - +# Townlight Communications 0.2.0 User Manual -# Townlight Communications User Manual +## Status and scope -## For Non-Technical Users +Townlight Communications 0.2.0 is a development candidate for the Townlight Windows staff Communications screen. It is not part of the released Windows 1.9.3.2 suite. Distribution name: `townlight-comms`; import name: `townlight_comms`; current dependency: Townlight Core 1.3.0.dev2 (`townlight-core 1.3.0.dev2`). -Townlight Communications helps staff turn city source material into public-facing draft communications. It can review whether sources and citations are present, outline meeting summaries, draft ordinance explainers, structure newsletters, suggest FAQ prompts, and create audience-specific variants. +The canonical application is the Communications workspace in the Townlight Windows staff shell with existing administrator, city-staff and clerk roles. A separate Records permission controls archive retrieval. The standalone `main.py` in this repository remains a prototype for draft helpers; it is not a secured workflow server or production deployment procedure. -Current state: `0.1.1` public communications foundation plus draft persistence release. Townlight Communications can optionally save source review and meeting summary draft records when IT configures `CIVICCOMMS_DRAFT_DB_URL`. Townlight Communications does not publish or post autonomously, create campaign or advocacy content, provide legal advice, certify translations, call live LLMs, post to social media, or replace a communications system of record. Staff own every draft, citation, approval, and publication decision. +## Staff workflow -## For IT and Technical Staff +1. Create or reopen a draft. Select sources from Meetings, Code, Notice or 311. The Parks adapter stays pending until the Parks phase. +2. Save the draft and run an Access check. Review and approve one exact revision. Approval applies to that revision only; later edits clear it. +3. Schedule publication to the website and email for the approved revision. +4. Publish, then archive the published revision to Records BEFORE editing, correcting, or withdrawing it; Records access requires the separate Records permission. Corrections preserve prior revisions, and withdrawal prevents stale content from being restored. -Townlight Communications is a FastAPI Python package pinned to `civiccore==0.3.0`. The current runtime exposes: +Captured approved source snapshots, public URLs, digests and revision provenance remain with the article. Public attachments require review. Private source content cannot be published, and missing, private or stale sources block approval. -- `GET /` -- `GET /health` -- `GET /civiccomms` -- `POST /api/v1/civiccomms/source-review` -- `GET /api/v1/civiccomms/source-review/{review_id}` -- `POST /api/v1/civiccomms/meeting-summary` -- `GET /api/v1/civiccomms/meeting-summary/{summary_id}` -- `POST /api/v1/civiccomms/ordinance-summary` -- `POST /api/v1/civiccomms/newsletter` -- `POST /api/v1/civiccomms/faq` -- `POST /api/v1/civiccomms/audience-variant` +## Portal, email and delivery -Run: +The host configuration supplies the portal credential and origin. Normal operation uses an unattended host service, not an operator window, so scheduled work can complete after the staff app closes. Website tasks travel through the existing authenticated portal receiver, with receipt URL and hash retained. -```bash -python -m pip install -e ".[dev]" -python -m pytest -q -bash scripts/verify-release.sh -``` +Email uses the city email settings shared with 311 SMTP. Subscribers must confirm their email address and can manage preferences or unsubscribe. Queued means pending, not SMTP accepted. Only sent means SMTP accepted the message, not human receipt. Failed and uncertain results are shown separately, and an uncertain send is never retried automatically. Deterministic message identifiers and durable records support safe retries only when non-delivery is known. + +## Records and roles + +The Records archive stores the actual published bytes, source references, attachments and receipts, and returns a real identifier. It requires the separate Records role permission. Existing staff roles continue to control drafting, review and approval; no resident account can see staff drafts or private source data. Publication metrics are limited to explicit approved aggregate reporting, not subscriber lists. + +## Acceptance status -Set `CIVICCOMMS_DRAFT_DB_URL` to enable local SQLAlchemy-backed source review and meeting summary draft records. If the variable is not set, Townlight Communications keeps deterministic stateless behavior and retrieval endpoints return actionable configuration guidance. +Source-level checks passed for this development candidate, but installed Windows candidate acceptance remains pending. Acceptance must prove staff two-PC authoring, exact-revision approval, scheduling, app-closed host publication to the portal and controlled SMTP, correction and withdrawal, restart survival, and Records retrieval. Source tests are not installed acceptance. Do not describe this module as completed or released. The existing download at https://github.com/townlight/townlight/releases/latest explicitly does not include Communications. -## Architecture +## Technical architecture ```mermaid flowchart LR - Clerk["Clerk / communications staff"] --> CivicComms["CivicComms"] - CivicClerk["CivicClerk sources"] -. future connector .-> CivicComms - CivicCode["CivicCode sources"] -. future connector .-> CivicComms - CivicAccess["CivicAccess review"] -. future handoff .-> CivicComms - CivicComms --> CivicCore["CivicCore v0.3.0"] - CivicComms --> Drafts["Human-approved draft artifacts"] + UI["TypeScript staff UI"] --> Native["Fixed native command"] + Native --> API["Loopback staff API"] + API --> DB[("PostgreSQL durable records")] + DB --> Queue["Durable queue"] + Queue --> Worker["Host worker with task leases"] + Worker --> Portal["Authenticated portal receiver"] + Worker --> SMTP["City SMTP shared with 311"] ``` -Townlight Communications depends on Townlight Core. Townlight Core does not depend on Townlight Communications. Townlight Communications v0.1.1 uses deterministic sample source-backed drafting plus optional local draft persistence; autonomous publication, campaign or advocacy content, legal advice, certified translation, live LLM calls, social media posting, and production communications-system integrations are future work. +The desktop runtime is `/desktop/v1/communications`, protected by native staff authentication. Browser requests use a fixed native command allowlist and cannot choose arbitrary URLs. Portal inbound operations use encrypted authenticated inbox and pump patterns; the desktop service remains private. Production uses a real PostgreSQL schema with explicit migration; SQLite translation is for tests, and production bootstrap is false. Revisions are immutable and approval binds the exact public-content hash. Optimistic revisions and database transactions prevent two-PC lost updates. Plain text is stored and escaped paragraphs are rendered; HTML is not trusted. + +Source eligibility is checked at runtime against the owning module; user-supplied flags cannot authorize publication. The email outbox has durable state separate from 311, and subscriber tokens are hashed and private. The host service owns portal credentials and origin configuration. + +Back up database data, profile keys, durable queue work and Records files as one unit. The product does not provide Mac or Linux installation instructions. + +Documentation authoring and translation provenance are recorded separately from product implementation. diff --git a/USER-MANUAL.txt b/USER-MANUAL.txt index 1d99b9e..e0be4ee 100644 --- a/USER-MANUAL.txt +++ b/USER-MANUAL.txt @@ -1,39 +1,51 @@ -Townlight Communications User Manual -====================== +# Townlight Communications 0.2.0 User Manual -For Non-Technical Users ------------------------ +## Status and scope -Townlight Communications helps staff turn city source material into public-facing draft communications. It can review whether sources and citations are present, outline meeting summaries, draft ordinance explainers, structure newsletters, suggest FAQ prompts, and create audience-specific variants. +Townlight Communications 0.2.0 is a development candidate for the Townlight Windows staff Communications screen. It is not part of the released Windows 1.9.3.2 suite. Distribution name: `townlight-comms`; import name: `townlight_comms`; current dependency: Townlight Core 1.3.0.dev2 (`townlight-core 1.3.0.dev2`). -Current state: 0.1.1 public communications foundation plus draft persistence release. Townlight Communications can optionally save source review and meeting summary draft records when IT configures CIVICCOMMS_DRAFT_DB_URL. Townlight Communications does not publish or post autonomously, create campaign or advocacy content, provide legal advice, certify translations, call live LLMs, post to social media, or replace a communications system of record. Staff own every draft, citation, approval, and publication decision. +The canonical application is the Communications workspace in the Townlight Windows staff shell with existing administrator, city-staff and clerk roles. A separate Records permission controls archive retrieval. The standalone `main.py` in this repository remains a prototype for draft helpers; it is not a secured workflow server or production deployment procedure. -For IT and Technical Staff --------------------------- +## Staff workflow -Townlight Communications is a FastAPI Python package pinned to civiccore==0.3.0. The current runtime exposes: +1. Create or reopen a draft. Select sources from Meetings, Code, Notice or 311. The Parks adapter stays pending until the Parks phase. +2. Save the draft and run an Access check. Review and approve one exact revision. Approval applies to that revision only; later edits clear it. +3. Schedule publication to the website and email for the approved revision. +4. Publish, then archive the published revision to Records BEFORE editing, correcting, or withdrawing it; Records access requires the separate Records permission. Corrections preserve prior revisions, and withdrawal prevents stale content from being restored. -- GET / -- GET /health -- GET /civiccomms -- POST /api/v1/civiccomms/source-review -- GET /api/v1/civiccomms/source-review/{review_id} -- POST /api/v1/civiccomms/meeting-summary -- GET /api/v1/civiccomms/meeting-summary/{summary_id} -- POST /api/v1/civiccomms/ordinance-summary -- POST /api/v1/civiccomms/newsletter -- POST /api/v1/civiccomms/faq -- POST /api/v1/civiccomms/audience-variant +Captured approved source snapshots, public URLs, digests and revision provenance remain with the article. Public attachments require review. Private source content cannot be published, and missing, private or stale sources block approval. -Run: +## Portal, email and delivery -python -m pip install -e ".[dev]" -python -m pytest -q -bash scripts/verify-release.sh +The host configuration supplies the portal credential and origin. Normal operation uses an unattended host service, not an operator window, so scheduled work can complete after the staff app closes. Website tasks travel through the existing authenticated portal receiver, with receipt URL and hash retained. -Set CIVICCOMMS_DRAFT_DB_URL to enable local SQLAlchemy-backed source review and meeting summary draft records. If the variable is not set, Townlight Communications keeps deterministic stateless behavior and retrieval endpoints return actionable configuration guidance. +Email uses the city email settings shared with 311 SMTP. Subscribers must confirm their email address and can manage preferences or unsubscribe. Queued means pending, not SMTP accepted. Only sent means SMTP accepted the message, not human receipt. Failed and uncertain results are shown separately, and an uncertain send is never retried automatically. Deterministic message identifiers and durable records support safe retries only when non-delivery is known. -Architecture ------------- +## Records and roles -Townlight Communications depends on Townlight Core. Townlight Core does not depend on Townlight Communications. Townlight Communications v0.1.1 uses deterministic sample source-backed drafting plus optional local draft persistence; autonomous publication, campaign or advocacy content, legal advice, certified translation, live LLM calls, social media posting, and production communications-system integrations are future work. +The Records archive stores the actual published bytes, source references, attachments and receipts, and returns a real identifier. It requires the separate Records role permission. Existing staff roles continue to control drafting, review and approval; no resident account can see staff drafts or private source data. Publication metrics are limited to explicit approved aggregate reporting, not subscriber lists. + +## Acceptance status + +Source-level checks passed for this development candidate, but installed Windows candidate acceptance remains pending. Acceptance must prove staff two-PC authoring, exact-revision approval, scheduling, app-closed host publication to the portal and controlled SMTP, correction and withdrawal, restart survival, and Records retrieval. Source tests are not installed acceptance. Do not describe this module as completed or released. The existing download at https://github.com/townlight/townlight/releases/latest explicitly does not include Communications. + +## Technical architecture + +```mermaid +flowchart LR + UI["TypeScript staff UI"] --> Native["Fixed native command"] + Native --> API["Loopback staff API"] + API --> DB[("PostgreSQL durable records")] + DB --> Queue["Durable queue"] + Queue --> Worker["Host worker with task leases"] + Worker --> Portal["Authenticated portal receiver"] + Worker --> SMTP["City SMTP shared with 311"] +``` + +The desktop runtime is `/desktop/v1/communications`, protected by native staff authentication. Browser requests use a fixed native command allowlist and cannot choose arbitrary URLs. Portal inbound operations use encrypted authenticated inbox and pump patterns; the desktop service remains private. Production uses a real PostgreSQL schema with explicit migration; SQLite translation is for tests, and production bootstrap is false. Revisions are immutable and approval binds the exact public-content hash. Optimistic revisions and database transactions prevent two-PC lost updates. Plain text is stored and escaped paragraphs are rendered; HTML is not trusted. + +Source eligibility is checked at runtime against the owning module; user-supplied flags cannot authorize publication. The email outbox has durable state separate from 311, and subscriber tokens are hashed and private. The host service owns portal credentials and origin configuration. + +Back up database data, profile keys, durable queue work and Records files as one unit. The product does not provide Mac or Linux installation instructions. + +Documentation authoring and translation provenance are recorded separately from product implementation. diff --git a/docs/index.html b/docs/index.html index af73df0..d918c68 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,26 +3,216 @@
-Townlight / Townlight Communications
-Townlight Communications v0.1.1 ships a foundation for source-readiness review, meeting summary outlines, optional database-backed draft records, ordinance explainers, newsletters, FAQ prompts, and audience-specific draft variants.
-Shipping v0.1.1
+Townlight Communications is a Windows suite integration for drafting, reviewing, approving, scheduling, correcting, and archiving city communications while keeping the source trail attached.
+Development candidate 0.2.0
+Not the current release. This is a Townlight Communications 0.2.0 development candidate. The current Townlight suite release is 1.9.3.2, and that released suite does not yet include Communications.
+CIVICCOMMS_DRAFT_DB_URL./civiccomms.Townlight Communications does not publish autonomously, create campaign or advocacy content, provide legal advice, certify translations, call live LLMs, post to social media, or replace a communications system of record.
Pinned to civiccore==0.3.0. Townlight Core remains dependency-only; it never imports from Townlight Communications.
Workflow
+Each public item follows an explicit path from source selection to a durable public record. Staff approval stays human and tied to the exact revision reviewed.
+Planned product surface
+These are source-under-development capabilities, not a claim that the current 1.9.3.2 suite release contains them.
+Interface outline
+A textual inventory is used here. No screenshots or usage metrics are presented because installed acceptance is not complete.
+Saved draft list and filters, source picker, plain-text editor, exact-revision preview, Access review, approval, scheduling, delivery status, correction and withdrawal, and Records archive.
+Approved article list and article detail, plus subscription confirmation, preferences, and unsubscribe. Staff drafts and private source data are not exposed.
+Responsibility
+The design reuses the existing staff shell and existing administrator, city-staff, and clerk grants. No new authentication provider is introduced.
+Selects sources, prepares plain text, and resolves source or access issues beside the relevant field.
Reviews the exact revision and access report, records explicit approval, and schedules the approved item.
Uses the Windows suite and existing city configuration, including encrypted SMTP settings. There is no package or pip installation path for the city operator.
Confirms opt-in, manages preferences or unsubscribes, and reads only approved public articles.
Deployment
+/desktop/v1/communications; fixed allowlisted browser commands, with no arbitrary URL access.Scope boundaries
+Staff approval remains explicit. Missing, private, or stale sources block approval. Manual source-backed content does not require AI. Subscriptions are opt-in, and future mail excludes unsubscribed recipients.
+Parks source integration is pending.
+Status
+Source design and source tests are not installed acceptance. The final evidence must come from the combined signed Windows candidate.
+| Item | Status | What it proves |
|---|---|---|
| Townlight Communications 0.2.0 | Development candidate | Source and design work for Windows suite integration; not a released product. |
| Townlight suite 1.9.3.2 | Current suite release | Existing released suite does not yet include Communications. |
| Installed Windows acceptance | Pending | Must prove staff authoring, approval, scheduling, portal and SMTP delivery, correction, history, Records retrieval, and restart survival. |
| Parks source connector | Pending | Parks source integration is not complete. |
Repository
+Repository documentation is the source of record. This landing page does not publish a release or replace the project manual.
+README on GitHub blob main
+ Communications design manual on GitHub blob main