Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

ci: add the ext-v* browser extension release workflow

shukieshahae30cba0395a
diff --git a/.github/workflows/release-extension.yml b/.github/workflows/release-extension.yml
new file mode 100644
index 00000000..4ad35ff7
--- /dev/null
+++ b/.github/workflows/release-extension.yml
@@ -0,0 +1,169 @@
+name: Release Browser Extension
+
+# Publishes the unpacked Chrome MV3 build as a zip on a pushed `ext-v*` tag.
+#
+# Independent of the CLI's `v*` release on purpose: the extension versions on its
+# own cadence and shares no assets with the binary. GitHub tag patterns anchor at
+# the start, so the `v*` filter in release.yml does not match `ext-v0.1.0` and the
+# two never collide.
+#
+# No `environment: release`. That environment exists to gate the Apple signing
+# secrets; this job has none -- it uses github.token only -- so putting it behind
+# the same approval would add friction without protecting anything. Same
+# reasoning as the windows-package job in release.yml.
+#
+# Chrome Web Store publication is deferred. Until then the artifact is a zip you
+# load unpacked, and its .sha256 is the only integrity check it has.
+
+on:
+ workflow_dispatch:
+ push:
+ tags:
+ - "ext-v*"
+
+concurrency:
+ group: release-extension-${{ github.ref }}
+ cancel-in-progress: false
+
+permissions:
+ contents: write
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ env:
+ REPO: ${{ github.repository }}
+ TAG: ${{ github.ref_name }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ cache: npm
+ cache-dependency-path: browser-extension/package-lock.json
+
+ - name: Install extension dependencies
+ working-directory: browser-extension
+ run: npm ci
+
+ # Mirrors the sdk-js tag gate, with one addition: manifest.json carries the
+ # version Chrome actually shows, and package.json is the one humans bump.
+ # Requiring all three to agree makes drift impossible rather than merely
+ # discouraged.
+ - name: Verify tag matches the extension version
+ if: startsWith(github.ref, 'refs/tags/')
+ working-directory: browser-extension
+ shell: bash
+ run: |
+ set -euo pipefail
+ tag="${GITHUB_REF_NAME#ext-v}"
+ manifest_version="$(node -p "require('./src/manifest.json').version")"
+ pkg_version="$(node -p "require('./package.json').version")"
+ if [ "$tag" != "$manifest_version" ]; then
+ echo "Tag version ($tag) does not match src/manifest.json version ($manifest_version)"
+ exit 1
+ fi
+ if [ "$pkg_version" != "$manifest_version" ]; then
+ echo "package.json version ($pkg_version) does not match src/manifest.json version ($manifest_version)"
+ exit 1
+ fi
+ echo "version=$tag"
+
+ - name: Type-check extension
+ working-directory: browser-extension
+ run: npm run check
+
+ - name: Unit-test extension
+ working-directory: browser-extension
+ run: npm run test:unit
+
+ - name: Build extension
+ working-directory: browser-extension
+ run: npm run build
+
+ - name: Package the unpacked extension
+ id: pack
+ working-directory: browser-extension
+ shell: bash
+ run: |
+ set -euo pipefail
+ version="${GITHUB_REF_NAME#ext-v}"
+ name="agent-beacon-browser-extension-${version}-chrome.zip"
+
+ # esbuild emits sourcemaps. Chrome ignores them, they roughly double the
+ # archive, and shipping them publishes unminified sources as a
+ # downloadable asset.
+ find dist -name '*.map' -delete
+
+ # -X drops extra file attributes so the archive is reproducible.
+ ( cd dist && zip -q -r -X "../$name" . )
+ shasum -a 256 "$name" > "$name.sha256"
+
+ unzip -l "$name"
+ cat "$name.sha256"
+ echo "name=$name" >> "$GITHUB_OUTPUT"
+
+ # Verify the bytes that are about to be published, not the directory they
+ # came from. Same principle as the MSI job proving its package installs
+ # before attaching it: verification by execution over verification by
+ # assumption.
+ - name: Verify the archive contains a loadable MV3 extension
+ working-directory: browser-extension
+ shell: bash
+ run: |
+ set -euo pipefail
+ tmp="$(mktemp -d)"
+ unzip -q "${{ steps.pack.outputs.name }}" -d "$tmp"
+ node -e '
+ const fs = require("fs");
+ const dir = process.argv[1], want = process.argv[2];
+ const m = JSON.parse(fs.readFileSync(dir + "/manifest.json", "utf8"));
+ if (m.manifest_version !== 3) throw new Error("not MV3");
+ if (m.version !== want) throw new Error("manifest version " + m.version + " != " + want);
+ for (const f of ["sw.js", "content.js", "interceptor.js",
+ "popup.html", "popup.js", "options.html", "options.js"]) {
+ if (!fs.existsSync(dir + "/" + f)) throw new Error("missing " + f);
+ }
+ for (const f of fs.readdirSync(dir)) {
+ if (f.endsWith(".map")) throw new Error("sourcemap leaked into the archive: " + f);
+ }
+ console.log("archive ok: MV3 " + m.version);
+ ' "$tmp" "${GITHUB_REF_NAME#ext-v}"
+
+ - name: Publish the GitHub release
+ working-directory: browser-extension
+ env:
+ GH_TOKEN: ${{ github.token }}
+ shell: bash
+ run: |
+ set -euo pipefail
+ version="${TAG#ext-v}"
+
+ printf '%s\n' \
+ "Unpacked Chrome MV3 build of the Agent Beacon browser collector (\`browser-extension/\`)." \
+ "" \
+ "**Install:** download and unzip, then Chrome -> Extensions -> Developer mode -> Load unpacked -> select the unzipped folder." \
+ "" \
+ "Requires a running Beacon endpoint: the extension POSTs OTLP GenAI logs to \`http://127.0.0.1:4318/v1/logs\`." \
+ "" \
+ "**Retention defaults to \`full\`**, meaning complete prompt and response text from claude.ai and chatgpt.com is written to the local runtime log. Change it in the extension's options page before enabling it on a machine where you use those sites personally." \
+ "" \
+ "The archive is unsigned. Verify it against the \`.sha256\` published beside it:" \
+ "" \
+ '```' \
+ "shasum -a 256 -c agent-beacon-browser-extension-${version}-chrome.zip.sha256" \
+ '```' \
+ > /tmp/ext-release-notes.md
+
+ if ! gh release view "$TAG" --repo "$REPO" >/dev/null 2>&1; then
+ gh release create "$TAG" --repo "$REPO" \
+ --title "Browser extension $TAG" \
+ --notes-file /tmp/ext-release-notes.md \
+ --verify-tag
+ fi
+
+ gh release upload "$TAG" \
+ "${{ steps.pack.outputs.name }}" \
+ "${{ steps.pack.outputs.name }}.sha256" \
+ --repo "$REPO" --clobber
diff --git a/browser-extension/.gitignore b/browser-extension/.gitignore
index 681eeef9..7b68e2f2 100644
--- a/browser-extension/.gitignore
+++ b/browser-extension/.gitignore
@@ -32,6 +32,12 @@ fixtures/**/diag-*.sse
*.log
.DS_Store
+# Release archives. Built by .github/workflows/release-extension.yml, but the
+# same `zip` step is runnable locally, and a committed binary here would be a
+# stale copy of a published asset.
+*.zip
+*.zip.sha256
+
# Note for future work: the repo-root .gitignore ignores `*.jsonl` everywhere,
# with per-destination `!` negations. If a future integration test needs a
# committed golden runtime.jsonl under this directory, add the negation HERE --