ntfy — local Store package

Runtime and installation
Linux x86_64 and Node.js >=22 are required. runtime/ntfy is rebuilt from the retained
ntfy Go/SQLite source with the original embedded React UI. It is an executable,
statically linked ELF64 binary; there is no install-time application build or
network download. The wrapper has no npm dependencies. Install the package root
with npm install --omit=dev --no-audit --no-fund, then npm start.

The default public listener is 127.0.0.1:4432. PORT takes precedence, followed by
CLAWBOX_PORT; inherited values of 3005 are ignored because that is the desktop
host port. PORT=0 requests an ephemeral test port. Both variables are synchronized
at the public listener and again for the private ntfy child. Invalid values fail.
The private port is retained in external local-port.json when available; an
occupied retained port is replaced with a free port. An occupied explicit public
port fails startup instead of selecting an unrelated service.

For a disposable manual test, create a separate state directory beside the
extracted package, then run from the package root:
  mkdir -p ../ntfy-test-state
  CLAWBOX_DATA_DIR="$(realpath ../ntfy-test-state)" PORT=0 node launch.mjs
Use newly created synthetic state and spare ports for all verification.

Entry and supported browser path
The installed entry remains /apps/ntfy-clawbox/ (stripBasePath=false). The manifest
opts into the supported launch:"window" path. In a top-level browser document,
Open ntfy navigates that same document to the public loopback root, where browser
storage works. An embedded sandbox instead displays an honest update warning and
hides this button; it does not attempt an iframe escape or silently claim success.
Loopback URLs on a different computer point to that computer, not this device.
Foreign/opaque API and WebSocket origins are rejected; Host validation and upstream
authentication remain enforced. No CSP, CORS or desktop sandbox is relaxed.

The shared host repair was merged as PR1600, but remains UNDEPLOYED on this device.
Actual installed desktop launch is NOT accepted until the authorized updated host
is deployed and the real icon click verified. The standalone handoff fixture is
only a normal-document versus opaque-frame routing test, not desktop proof.

Accounts and external state
State defaults to $XDG_DATA_HOME/ntfy-clawbox or $HOME/.local/share/ntfy-clawbox.
CLAWBOX_DATA_DIR must be an absolute path outside the replaceable package; symlink
resolution is checked. Back up that entire directory with the server stopped.
The launcher never imports ambient NTFY_* configuration or owner credentials.

Fresh state gets a unique admin password in initial-password, mode 0600, after
ntfy creates its own database schema. Read that file locally, sign in as admin,
and change the password in Account settings. The initial file is not updated when
you change your password and is never used to reset an existing account. Existing
accounts without an initial-password file remain intact; use their existing login.
No passwords are printed in readiness output or service logs.

Concurrent launches sharing state fail under a kernel-managed lock. Interrupted
fresh setup uses .initial-password.pending and resumes only if the pending password
matches the admin account. Inconsistent completed or pending setup fails closed;
it never deletes databases, resets accounts or invents replacement credentials.
Investigate and back up inconsistent state before an explicit owner recovery.
Upstream account management is available with the SAME state environment:
  node scripts/clawbox/user.mjs list
  node scripts/clawbox/user.mjs change-pass admin
  node scripts/clawbox/user.mjs add --role=admin USERNAME
Password changes use the upstream interactive prompt. There is no signup screen.

Readiness and lifecycle contract
node launch.mjs (also npm start) starts an IPC guardian which owns the state lock,
public gateway and upstream process. STORE_READY is emitted exactly once only
after upstream health and any first-run credential verification succeed. It is a
JSON object with port, url (installed entry), localURL (public root), backendURL
(private upstream), dataDir, pid (launcher), guardianPid, backendPid, backendPort.
Private backend values are diagnostic only; clients must use localURL.

Startup/backend failure exits nonzero and closes the public listener. SIGINT and
SIGTERM stop all children; losing the launcher IPC connection also stops ntfy.
The guardian escalates an unresponsive child after 5 seconds, and the launcher
allows 10 seconds for the guardian. Persistent auth, cache and attachments survive
normal restart. API publishing/subscribing requires authentication and deny-all is
the default. Message history is cached for 168 hours. Remote access, mobile push
providers and delivery with the browser closed are not configured here.

Reproducible publisher package
Run from a Git checkout with intended files staged/tracked. Git and Node >=22 are
the packaging prerequisites; no compiler or npm dependency installation is needed:
  node scripts/clawbox/package.mjs --output ../ntfy-package.tar.gz
Optional: --report ../ntfy-package.json (default: archive path plus .json).
Outputs must be new files outside the source tree. The builder uses git ls-files
-z, reads those tracked working-tree files, and excludes path components named
node_modules, .git, .next, dist, build, .clawbox, .env*, *.pem and *.key. Untracked
files are not silently added. Commit intended inputs before final acceptance.

The archive is deterministic USTAR/gzip with sorted paths, zero timestamps and
uid/gid, and normalized 0644/0755 modes. It rejects symlinks and special files,
checks the root manifest/start contract, static x86_64 executable and RGBA icon,
and verifies retained source/build material. Limits are <=50 MiB compressed,
<=256 MiB uncompressed tar bytes and <=10000 files. The JSON report includes every
input hash/mode/size, archive SHA-256 and exact sizes/count. A PACKAGE_READY line
means the package was built, not that publication or desktop acceptance passed.
No acceptance CLI is wired here: tests/clawbox and docs contracts belong to t2.

Source, reproducible builds and remaining publication gates
The current exact source SHA-256 is pinned at runtime/BUILD-INPUTS.json sourceArchive
and runtime/PROVENANCE.json sourceSha256. The historical retained archive SHA-256
bca979679c60fc845f4150b2bb1b70b15dddd8bb9d8a6c0f15893752478a6826 remains in Git
history and immutable external evidence. This new distribution adds prominent
modification notices to .gitignore and cmd/serve.go, and replaces four restricted
Mixkit recordings with original synthesized WAV effects, updates their imports
and discloses these changes in the source README.md. The tone generator and its
MIT license accompany the generated source assets. No Mixkit MP3 is carried in
the current source. Existing ntfy layouts, APIs and official icons are retained.
The aa97efef7e35143f52f4b5cdce4369fb5d76df2e commit is upstream lineage, not a
claim of a clean upstream checkout or historical binary correspondence.

The archive includes Go sources/sums, the original web source and npm lock,
Makefile, GoReleaser/Docker recipes and historical scripts/clawbox/build.mjs. The
authoritative replacement recipe is the current scripts/clawbox/rebuild.mjs in
this package. Historical archived wrapper/build instructions are superseded by
this README and the current readable scripts. The modified files are explicitly disclosed above; deterministic metadata,
disabled VCS discovery and a pinned musl toolchain additionally replace the
historical environment-dependent build.
The prior repair identified asynchronous Rolldown asset IDs in source maps and
unstripped C debug sections. The recipe normalizes only virtual asset
IDs in generated source-map sourcesContent to stable identifiers of equal length;
executable JavaScript, source order and mappings are untouched. It explicitly
strips the external linker output as well. The matching clean builds independently
exercise this corrected recipe; earlier run evidence is not a substitute for them.

runtime/BUILD-INPUTS.json pins and hashes Go 1.27.4, Node 24.22.2 with npm 11.19.1,
and Zig 0.14.1 binary and source distributions. Zig supplies the C compiler,
linker, musl 1.2.5 (including Zig's bundled changes), Linux headers and compiler
runtime sources. See notices/C-RUNTIME.txt, MUSL-COPYRIGHT.txt and ZIG-LICENSE.txt.
There is no dependency on the host C compiler, static glibc or developer caches.
runtime/GO-BUILD-INPUTS.json supplements the preserved dependency inventories with
the remaining module zips and metadata, checked against archived go.sum h1 values.

Build prerequisites: Linux x86_64, Node >=22 to invoke the recipe, tar with gzip/xz
support, taskset and a POSIX shell. No system packages are installed by these
commands. Use new external build directories and allow space for two full Go
object trees, toolchains and UI caches. All child processes are limited to two
CPUs; Go, npm native jobs and UV/Rayon pools are also capped at two. The builds are
sequential. Set COMPANIONS and BUILD_A/BUILD_B to absolute paths outside this tree:
  node scripts/clawbox/sources.mjs --directory "$COMPANIONS" --fetch
  node scripts/clawbox/materials.mjs --directory "$COMPANIONS" --fetch
  node scripts/clawbox/rebuild.mjs --directory "$COMPANIONS" --work "$BUILD_A"
  node scripts/clawbox/rebuild.mjs --directory "$COMPANIONS" --work "$BUILD_B"
  node scripts/clawbox/compare-builds.mjs --first "$BUILD_A" --second "$BUILD_B" --report "$COMPANIONS/reproducibility.json"
Omit --fetch to verify supplied companions entirely offline. The build itself
always uses a local file Go proxy and an integrity-seeded offline npm cache.
Every build refuses an existing work directory and extracts its own tools and
source. It runs npm ci/build, recreates server/site and the historical docs stub,
verifies Go modules, and compiles the static SQLite backend. The source docs remain
in the archive; a full rendered MkDocs distribution was not part of this lineage.

Outputs in each build's out/ are ntfy, build.json, embedded-assets.json and
go-build-info.txt. Comparison rehashes both executables and every embedded file;
runtime/PROVENANCE.json records actual matching results, recipe/lock hashes and
the local source-delivery status. runtime/EMBEDDED-ASSETS.json indexes the embedded
UI/docs bytes. runtime/C-RUNTIME.json identifies the compiled C library inputs.
Go -work -x retains tmp/go-build* objects and link commands; zig-global retains
compiled C libraries. A full rebuild also supplies a portable relinking recipe.
After source/compiler verification and comparison, a maintainer can adopt the
replacement and record its actual provenance in this checkout:
  node scripts/clawbox/record-build.mjs --first "$BUILD_A" --second "$BUILD_B" --directory "$COMPANIONS"
This explicitly updates runtime/ntfy, runtime/PROVENANCE.json and the embedded/C
inventories. Normal offline rebuilding never changes the installed package.

To stage the complete companion delivery after creating a preliminary publisher
package (PACKAGE must be an absolute external archive path):
  node scripts/clawbox/companions.mjs --directory "$COMPANIONS" --first "$BUILD_A" --second "$BUILD_B" --package "$PACKAGE"
The companion INDEX.json/SHA256SUMS cover dependency archives, compiler/source
distributions, application source/build package, generated UI/docs assets and
relinking objects. REBUILD.sh consumes that delivery without network access; run
it from the companion directory with a new absolute workspace argument. These
large companions deliberately remain outside publisher selection. Retain build
logs, comparisons, original-byte evidence and companion index hashes externally.

favicon.png is the unchanged official ntfy PWA image, 512x512 RGBA8, verified
against the pinned upstream asset and the source archive. Its SHA-256 and URL are
in web/public/static/images/PROVENANCE.json. No owner favicon.ico is modified.
Trademark ownership remains with upstream; no endorsement is claimed.

All existing licenses, notices and dependency inventories are retained.
notices/DISTRIBUTION-SUPPLEMENT.txt adds exact-version MIT notices for two npm
dependencies, all ten font notices, CC-BY-4.0 attribution/license text for Beep,
Juntos and Pristine (volume modifications disclosed), and conservative C-input
notices. The four replacement WAVs have their own MIT notice in the source.
This record is a bounded factual distribution review, not blanket clearance. Inventory
status fields describe historical acquisition; they do not prove archives are
present in this package. To verify or acquire exact source companion inputs:
  node scripts/clawbox/sources.mjs --directory ../ntfy-dependency-sources --fetch
Omit --fetch for offline verification. Two downloads run at most concurrently.
The command verifies every inventory SHA-256, npm lockfile integrity/coverage, and
Go zip and module metadata h1 checksums against archived go.sum, writing SOURCE-DELIVERY.json.
Missing or changed archives fail the command. It does not publish anything.

The dependency archives are separate from the Store package because source
delivery must not be discarded to fit Store limits. The parent must publish the exact application source, runtime, complete notices
and pinned lock/rebuild records inside the Store package. BUILD-CONTRACT schema2
explicitly supersedes the unpublished schema1 all-SDK-public promise. The complete
900MB toolchain/dependency/relink SDK remains verified local development evidence,
not a published or promised download. The public API package and its canonical
SHA256 must be fetched and compared before delivery can pass. Local material
verification and two matching builds establish local completeness/reproducibility;
neither establishes public availability or completes independent acceptance.

Independent acceptance, the deployed actual desktop launcher, authorized public
publication/icon deployment, and retesting the exact Store-downloaded bytes remain
parent/team gates. No publication, push, merge, platform update or owner-state
migration is performed by these commands.
