Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
!e2e/
!e2e/thunderbird/
!e2e/thunderbird/**
!fixtures/
!fixtures/provider-trials/
!fixtures/provider-trials/newsletter.json
8 changes: 0 additions & 8 deletions .env.example

This file was deleted.

74 changes: 33 additions & 41 deletions .github/workflows/publish-thunderbird-addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ on:
required: false
type: boolean
default: false
reviewer_source_attached:
required: false
type: boolean
default: false
reviewer_testing_notes_entered:
required: false
type: boolean
default: false
secrets:
ATN_JWT_ISSUER:
required: true
Expand All @@ -30,17 +22,7 @@ on:
required: true
type: string
verify_metadata_only:
description: Verify public XPI and release notes after the Developer Hub handoff
required: false
type: boolean
default: false
reviewer_source_attached:
description: Confirm the exact reviewer source ZIP was attached manually
required: false
type: boolean
default: false
reviewer_testing_notes_entered:
description: Confirm private reviewer testing notes were entered manually
description: Verify the existing public XPI and report release-note status
required: false
type: boolean
default: false
Expand Down Expand Up @@ -70,25 +52,37 @@ jobs:
exit 1
}

- name: Check out the tagged publication automation
- name: Check out reviewed publication automation
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ inputs.tag }}
ref: ${{ github.sha }}
fetch-depth: 0
persist-credentials: false

- name: Check out the immutable tagged source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ inputs.tag }}
path: release-source
fetch-depth: 1
persist-credentials: false

- name: Verify publication tag commit belongs to main
env:
RELEASE_TAG: ${{ inputs.tag }}
shell: bash
run: |
set -euo pipefail
commit=$(git rev-parse "refs/tags/$RELEASE_TAG^{commit}")
test "$(git rev-parse HEAD)" = "$commit" || {
test "$(git -C release-source rev-parse HEAD)" = "$commit" || {
echo "Checked out source must match the publication tag commit" >&2
exit 1
}
git fetch --no-tags origin '+refs/heads/main:refs/remotes/origin/main'
git merge-base --is-ancestor HEAD refs/remotes/origin/main || {
echo "Publication automation commit must be contained in origin/main" >&2
exit 1
}
git merge-base --is-ancestor "$commit" refs/remotes/origin/main || {
echo "Release tag commit must be contained in origin/main" >&2
exit 1
Expand All @@ -113,7 +107,7 @@ jobs:
mkdir -p release/assets
mkdir release/canonical
gh release download "$RELEASE_TAG" --dir release/assets
mise exec -- node scripts/release-metadata.mjs --tag "$RELEASE_TAG" --notes-output release/canonical/release-notes.md
mise exec -- node scripts/release-metadata.mjs --root release-source --tag "$RELEASE_TAG" --notes-output release/canonical/release-notes.md
gh release view "$RELEASE_TAG" --json body --jq .body > release/github-release-notes.md
mise exec -- node --input-type=module <<'NODE'
import { readFile } from "node:fs/promises";
Expand Down Expand Up @@ -146,29 +140,23 @@ jobs:
THUNDERCLAW_XPI: ${{ github.workspace }}/release/assets/thunderclaw-thunderbird-${{ steps.release.outputs.version }}.xpi
run: mise exec -- node scripts/submit-thunderbird-addon.mjs | tee "$RUNNER_TEMP/atn-submission.json"

- name: Record mandatory Developer Hub handoff
- name: Record accepted upload and next verification
if: ${{ !inputs.verify_metadata_only && success() }}
env:
RELEASE_TAG: ${{ inputs.tag }}
RELEASE_VERSION: ${{ steps.release.outputs.version }}
shell: bash
run: |
{
echo "### Mandatory ATN Developer Hub handoff — publication incomplete"
echo "### ATN accepted the XPI — public verification pending"
echo
echo "The signing API accepted the XPI, but it cannot set ATN release notes, attach reviewer source, or enter private reviewer testing notes for ${RELEASE_TAG}. This workflow is not a completed marketplace publication."
echo "In Developer Hub: (1) set release notes from the canonical GitHub release; (2) attach thunderclaw-thunderbird-source-${RELEASE_VERSION}.zip; and (3) enter the reviewer testing notes for exact-byte reproduction and the bounded Generate/Preview/Apply/Undo smoke procedure."
echo "Verify all three fields before treating this release as submitted for review."
echo "The signing API accepted ${RELEASE_TAG}. ATN may publish automatically; inspect Developer Hub for this version's actual reviewer requirements."
echo "If ATN requests source or private testing notes, supply thunderclaw-thunderbird-source-${RELEASE_VERSION}.zip and the canonical reviewer instructions for this same version."
echo "Run verify_metadata_only for this existing tag to verify the public XPI and report release-note status. Do not upload again while waiting for review."
} >> "$GITHUB_STEP_SUMMARY"

- name: Require manual handoff confirmations for metadata verification
if: ${{ inputs.verify_metadata_only && (!inputs.reviewer_source_attached || !inputs.reviewer_testing_notes_entered) }}
run: |
echo "Confirm both the exact reviewer source archive and private reviewer testing notes in Developer Hub before verification" >&2
exit 1

- name: Verify and download public ATN-signed XPI and canonical release notes
if: ${{ inputs.verify_metadata_only && inputs.reviewer_source_attached && inputs.reviewer_testing_notes_entered }}
- name: Verify and download public ATN XPI and report release notes
if: ${{ inputs.verify_metadata_only }}
run: |
mise exec -- node scripts/verify-atn-release.mjs \
--version '${{ steps.release.outputs.version }}' \
Expand All @@ -178,7 +166,7 @@ jobs:
| tee "$RUNNER_TEMP/atn-submission.json"

- name: Verify public XPI is identical or adds only signature metadata
if: ${{ inputs.verify_metadata_only && inputs.reviewer_source_attached && inputs.reviewer_testing_notes_entered }}
if: ${{ inputs.verify_metadata_only }}
env:
RELEASE_VERSION: ${{ steps.release.outputs.version }}
run: |
Expand All @@ -188,24 +176,28 @@ jobs:
| tee "$RUNNER_TEMP/atn-payload-verification.json"

- name: Smoke-test the exact public ATN-signed XPI
if: ${{ inputs.verify_metadata_only && inputs.reviewer_source_attached && inputs.reviewer_testing_notes_entered }}
if: ${{ inputs.verify_metadata_only }}
env:
THUNDERCLAW_E2E_ARTIFACTS: ${{ runner.temp }}/atn-smoke
THUNDERCLAW_E2E_VERSIONS: 153.0.3
THUNDERCLAW_E2E_EXPECTED_VERSION: ${{ steps.release.outputs.version }}
THUNDERCLAW_E2E_XPI: ${{ runner.temp }}/thunderclaw-atn-signed-${{ steps.release.outputs.version }}.xpi
run: mise exec -- npm run test:e2e:thunderbird

- name: Record verified ATN metadata
if: ${{ inputs.verify_metadata_only && inputs.reviewer_source_attached && inputs.reviewer_testing_notes_entered && success() }}
if: ${{ inputs.verify_metadata_only && success() }}
env:
RELEASE_TAG: ${{ inputs.tag }}
RELEASE_VERSION: ${{ steps.release.outputs.version }}
shell: bash
run: |
{
echo "### Verified ATN submission metadata"
echo "### Verified public ATN artifact"
echo
echo "ATN exposes the public XPI for ${RELEASE_TAG}; its payload matches the qualified XPI and that exact public artifact passed Generate/Preview/Apply/Undo smoke. Reviewer source and private testing-note requirements must be checked in Developer Hub if ATN requests them."
echo
echo "ATN exposes the signed XPI and canonical release notes for ${RELEASE_TAG}; its unsigned payload matches the qualified XPI, the signed XPI passed Generate/Preview/Apply/Undo smoke, and the maintainer confirmed both reviewer source and private testing notes in Developer Hub."
notes_status=$(jq -r .releaseNotesStatus "$RUNNER_TEMP/atn-submission.json")
echo "Public release notes: ${notes_status}. Release-note metadata can be maintained separately; it does not block artifact verification."
} >> "$GITHUB_STEP_SUMMARY"

- name: Retain ATN result
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Environment files and local secrets
.env
.env.*
!.env.example

# Required repository configuration (overrides common global ignore rules)
!.mise.toml
Expand All @@ -22,7 +21,7 @@ venv/
__pycache__/
*.py[cod]

# Local OpenClaw test environment
# Private local state retained after backend retirement
.spike/

# Editor and OS metadata
Expand All @@ -34,3 +33,6 @@ __pycache__/
*~
.DS_Store
Thumbs.db

# Recovery backups from interrupted local release preparation
.thunderclaw-release-prepare-*/
156 changes: 62 additions & 94 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,62 @@
# Project agent instructions

## Project identity

This project is named **ThunderClaw**. Use `ThunderClaw` in user-facing text
and `thunderclaw` in package names, routes, environment variables,
Docker resources, and generated artifacts.

## Runtime and verification

This project uses `mise` for managed runtimes. In non-interactive shells, run
Node.js and package tools with `mise exec --`.

For ordinary changes, run:

```text
mise exec -- npm test
mise exec -- npm run typecheck
```

When changing the Thunderbird extension, also run:

```text
mise exec -- npm run build:extension
```

## Repository layout

- `packages/thunderbird-extension/`: Thunderbird extension source and icons
- `test/`: deterministic unit, contract, lifecycle, and boundary tests
- `e2e/`: real Thunderbird and protected qualification tooling
- `fixtures/`: cross-boundary conformance fixtures
- `scripts/`: build and repeatable qualification entry points
- `docs/`: evergreen product, protocol, security, release, and brand material
- `docs/roadmap.md`: the authoritative unfinished priority list

The background and Thunderbird mutation boundaries independently validate product
data. Use conformance fixtures; do not collapse their validation responsibilities.

## Product and architecture invariants

- ThunderClaw is a standalone Thunderbird MailExtension that calls a user-configured
OpenAI-compatible inference endpoint. Do not add a mandatory relay, native helper,
agent framework, or core application patch. Retained legacy source is not part
of the standalone runtime.
- Thunderbird owns message and compose DOM mutation. Never insert
model-produced HTML, let a model send mail, or let it change recipients,
attachments, or headers.
- Inference uses the explicitly configured endpoint/model, stateless requests,
disabled model-callable tools, and strict JSON validation. The current Thunderbird
snapshot is authoritative; request/run/hash identities remain locally owned.
- Preserve separate Generate/Preview, Apply, Undo, and normal Send decisions.
- Treat email as untrusted input. Preserve request and run identity,
generation, target/context hashes, output limits, exact segment IDs, and
stale-result validation on both sides of the boundary.
- Provider configuration and persistent user-supplied API keys belong to the extension
background. Bind keys to the configured endpoint; never synchronize or expose them
to email scripts, diagnostics, or public settings. Do not claim local storage is encrypted.
- Keep the stable extension ID `thunderclaw@addons.thunderbird.net` unless a
planned migration updates every dependent boundary.

## Local state and sensitive data

Persistent local state under `.spike/`, populated environment files, generated
`build/` output, and retained qualification evidence are ignored but may contain credentials,
message content, and environment details.

- Do not print, commit, document, copy, or package populated values.
- Do not delete, recreate, or overwrite ignored state unless the task
explicitly requires a clean environment.
- Inspect running services before restarting them; avoid destructive Compose
commands and restart only the service required by the change.
- Use synthetic data in tests and sanitize retained evidence.

## Distribution

Before creating tags, publishing, approving release jobs, or recovering a failed
release, read `docs/release.md` and `docs/release-operations.md`. Use the
repo-owned skill at `docs/skills/thunderclaw-release-operations/SKILL.md` for
release operations; it routes to those authoritative documents.

Internal automation, publishing-tool, test-harness, documentation, and skill
changes do not require a product version bump, tag, or release. Validate them
with ordinary CI, executable workflow regressions, or a sandbox as appropriate.
For recovery, establish the publication stage from evidence before choosing an
action. Preserve qualified bytes and immutable public release identity.

Only the standalone Thunderbird extension is published. Its manifest version,
component-scoped root changelog entry, `thunderbird-extension-vX.Y.Z` tag, and
GitHub release identify one XPI and one allowlisted Mozilla reviewer source ZIP.
Build candidates once, record their digests, qualify those exact bytes, and
promote them without rebuilding. No companion artifact belongs to this release
path. Preserve historical releases, immutable tags, retained validation tools, and
private local state during separately scoped legacy cleanup.
# ThunderClaw agent instructions

## Runtime and checks

Use Node/package tools through `mise exec --`. Start with `mise exec -- npm ci`.
Run `mise exec -- npm run check` for sequential tests, typecheck, extension build,
reviewer source packaging, and site build. Use documented narrower scopes for
focused edits; avoid concurrent default builds/tests sharing `build/`.

## Source map

- `packages/thunderbird-extension/src/`: settings, inference, capture, Preview,
Apply/Undo, and received-message tools.
- `test/`: deterministic safety, lifecycle, transport, and workflow regressions.
- `e2e/thunderbird/`: real Thunderbird harnesses and synthetic fixtures.
- `scripts/`: checks, packaging, release preparation/status, and provider trials.
- `docs/roadmap.md`: unfinished work only; update it when work is completed.
- `docs/development.md`, `docs/testing.md`: executable commands and evidence limits.

The old backend and its tooling are in Git history. Some local lifecycle type
names remain historical; follow the active entry graph before removing code.
Legacy credential migration in the inference controller remains supported.

## Product boundaries

Use **ThunderClaw** in user-facing text and `thunderclaw` in identifiers/artifacts.
Keep extension ID `thunderclaw@addons.thunderbird.net` stable.

- The standalone MailExtension uses the explicitly chosen OpenAI-compatible
endpoint/model. No mandatory relay, native helper, tools, or automatic fallback.
- Thunderbird owns DOM mutation, sending, recipients, headers, and attachments.
Models return bounded typed content, never HTML or authorization metadata.
- Preserve Generate/Preview, Apply, Undo, and normal Send as separate decisions.
- Treat email, model output, preferences, and provider errors as untrusted data.
Keep strict independent inference/editor validation and local request/run,
generation, target/context/message identities. Reject stale or partial output.
- The background owns provider keys. Scope keys to the exact endpoint/provider;
never expose them to email scripts, logs, public state, or synchronized storage.
Persistent local profile storage is not an encrypted vault.

## Local state

Use synthetic mail in tests. Never print, commit, package, overwrite, or delete
populated `.spike/`, environment files, credentials, private mail, or retained
evidence during ordinary work. Ignored state can be sensitive. Inspect services
before changing them and limit changes to the task's authorized scope.

## Releases

Read `docs/release.md`, `docs/release-operations.md`, and the repo-owned
`docs/skills/thunderclaw-release-operations/SKILL.md` before release operations.
Use `release:prepare` for a new version and `release:status` for observed stages.
These helpers do not grant publication permission.

Only the extension is published: canonical `thunderbird-extension-vX.Y.Z`, one
XPI, matching reviewer ZIP, notes, checksums, and provenance. Build once, qualify
exact bytes, and promote without rebuilding. Preserve immutable public tags,
releases, and attestations. Internal tooling/docs changes need no product release.

ATN may publish automatically. Verify the public download; reviewer source/notes
are supplied when requested, not assumed to be a mandatory manual handoff.
Distinguish accepted upload, public version, verified payload, and unknown state.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
<a href="CONTRIBUTING.md">Contributing</a>
</p>

> [!NOTE]
> This checkout contains the standalone extension. It connects directly to your chosen provider or local model. The standalone candidate has not yet completed marketplace publication; check the exact version and release notes when downloading an older published build.
> Install ThunderClaw from [Thunderbird Add-ons](https://addons.thunderbird.net/en-US/thunderbird/addon/thunderclaw/). The standalone extension connects directly to your chosen provider or local model.

## AI assistance without handing over your inbox

Expand Down Expand Up @@ -92,13 +91,13 @@ See [architecture](docs/architecture.md) and [security and privacy](docs/securit

## Installation

Install the XPI through Thunderbird's **Add-ons and Themes → gear menu →
Install Add-on From File**, then open ThunderClaw settings. Choose a provider,
Install from [Thunderbird Add-ons](https://addons.thunderbird.net/en-US/thunderbird/addon/thunderclaw/), then open ThunderClaw settings. Choose a provider,
load or enter a model, save your key and connection, grant host access, and click
**Test connection**. Your key stays saved across restarts.

For this development candidate, build the XPI from the checkout using the commands
below. See [installation and connection setup](docs/installation.md) for provider
For local development, build the XPI from this checkout and install it through
Thunderbird’s **Add-ons and Themes → gear menu → Install Add-on From File**.
See [installation and connection setup](docs/installation.md) for provider
presets, local servers, troubleshooting, and upgrade guidance. Installing a newer
XPI updates the existing add-on; uninstalling first is unnecessary.

Expand All @@ -112,9 +111,7 @@ ThunderClaw uses Node.js through [`mise`](https://mise.jdx.dev/):

```bash
mise exec -- npm ci
mise exec -- npm test
mise exec -- npm run typecheck
mise exec -- npm run build
mise exec -- npm run check
```

The main source and verification paths are:
Expand Down
Loading