100 Commits
Author SHA1 Message Date
Alex Gleason 2036903918 release: v9.16.4 2026-09-16 00:34:10 -05:00
Alex Gleason 1ca1a4e4ea Stop writing a relay tag NIP-5A never defined
The nsite manifest tag table has `path`, `x`, `d`, `a`, `A`, `server`,
`title`, `description`, and `source`, and nothing for saying which relays
the event went to. Ours went out with one per configured relay anyway,
apparently by symmetry with `server` — but a `server` tag answers a
question the host server actually asks when fetching a blob, and nothing
in the spec or in this codebase ever read the relay hints back.

So they are gone from the deploy path, and gone from the two places the
npanel migration re-signs somebody else's manifest: republishing no
longer strips the archive's relay tags only to write its own in their
place, and retitling no longer passes through whatever an older deploy
of ours left behind. Re-signing an event is the moment to stop carrying
a tag that does not exist.

Where to find the manifest stays the reader's problem and the author's
kind 10002, which is where NIP-5A leaves it.
2026-09-15 22:40:20 -05:00
Alex Gleason 710cf8b6ef release: v9.16.3 2026-09-14 14:02:35 -05:00
Alex Gleason 502fa612e0 Let somebody keep three sites and throw the other thirty-seven away
The migration dialog had one button and it did one thing to everything: Migrate
all. That reads as convenience until you look at what people are actually
holding. Two thousand one hundred and thirty-three names are still outstanding on
the gateway, a great many of them to the same few pubkeys, because the service
this replaced was where people deployed an afternoon's work to see it on a
domain. Somebody with forty names on file does not want forty sites back. They
want three, and they want the rest to stop existing under their old addresses —
and the only thing the dialog would do was hand them all forty.

So every row has its own controls now. Publish or Claim takes one name back,
worded as the work it does rather than as a category — a name whose site is
already published under this key publishes nothing, and calling that Publish was
a small lie the badge beside it was already contradicting. The badge is gone,
since the button now says what it said.

Delete calls the new DELETE /api/claims/:hostname: the gateway stops serving the
name, stops holding it, and it goes back to being anybody's. The confirmation
says only what is true, and says a different true thing depending on the row —
a site published under your own key survives the name going away, an archived one
stays on Nostr under the key that published it. Neither sentence claims the site
is gone, because nothing here can make that happen and a dialog should not offer
to.

Show is the one that makes the rest usable. None of these decisions can be made
from a hostname and a line of explanation, and the site has to be looked at —
which is why the link goes to nsite.lol rather than to the name in question. An
address outlives both the things wrong with a hostname here: it still resolves
after the name is deleted, and it works for a name too deep for a wildcard
certificate, which has answered a TLS error since the day it arrived. About a
quarter of these identifiers are longer than a DNS label leaves room for, so
those fall back to the hostname, and a name that is neither servable nor
addressable gets no button rather than a link to an error.

Two smaller things follow from having per-row actions. The stray retraction now
takes the gateway record down along with the manifest — there was never a useful
middle state where a name that can never load keeps its row — and single-row
actions do not refetch the list, which for someone clearing out twenty sites
would have been twenty signatures and twenty relay round trips to learn what the
row already said. The lists are marked stale on close instead, and the query is
disabled while the dialog is shut, so nothing is asked until it is opened again.
2026-09-14 10:01:19 -05:00
Alex Gleason 90d6bc50b9 chore: sync package-lock version to 9.16.2 2026-09-14 10:00:23 -05:00
Alex Gleason 9c48425c01 release: v9.16.2 2026-09-13 23:59:56 -05:00
Alex Gleason 344a73c6c3 Bring up the migration where somebody runs into it
Taking back a site had one way in: a button in Settings under Deploy, which said
the same thing to everybody and could not say whether anything was actually
waiting. On the gateway this was built for, two people out of eight hundred and
seven have used it.

The moment it is needed is the one somebody types a name they used to own, and
until now that moment did the opposite — the name came back taken and the button
went dead, because a name being held for its previous owner looks exactly like a
stranger's to anyone who does not ask. The gateway can now be asked, so the field
says the name is being held for them and offers the step that gets it back, in
place of a refusal with nowhere to go. The deploy dialog owns that list rather
than the field, because one recognised name is rarely all somebody has waiting.

npanel also refuses to add a name it is holding, saying to take it back instead —
a sentence that was being shown as a flat red alert with no way to act on it.
That refusal now carries the same offer.

And the settings card asks how many are waiting instead of guessing. It costs a
signature on a page nobody asked to sign on, which is the thing this deliberately
did not do before; the difference is that it is now two counted rows rather than
a read of every claimed deploy, and that the card says nothing at all unless
there is something to say. A card that cannot tell whether it applies to you is
one most people learn to ignore before it ever does.
2026-09-13 22:27:18 -05:00
Alex Gleason 4928819a0e ci: remove the ssh deploy job
deploy-nsite covers deployment now, and the rsync-over-ssh job was broken.
2026-09-13 21:33:48 -05:00
Alex Gleason 9d91542ec6 chore: sync package-lock version to 9.16.1 2026-09-13 21:25:45 -05:00
Alex Gleason 28d53e0100 release: v9.16.1 2026-09-13 21:24:10 -05:00
Alex Gleason dbb90df240 Let somebody deploy to a name they already own
The deploy form asked the gateway whether a name was free, which is not the
question it needed answered. A name somebody recovered in the migration is
theirs, is already serving their site, and came back "taken" — so the button
went dead with "That name is taken on shakespeare.wtf. Try another." about their
own site. Every name anyone took back was in this state: a hundred and four of
them for one person.

The form had an escape hatch for exactly this, and it was too narrow. It knew a
name was the user's own only if this project had deployed to it before, read out
of the project's own deploy record. A name recovered through the migration dialog
has no such record — the site was published, the hostname repointed, and nothing
about it ever went through this form.

So the question is asked properly instead. The anonymous ask happens first and is
usually the end of it, because a name somebody is picking is usually free. Only a
name that comes back taken is asked about again with a signature, which is the
one branch where the distinction exists and the one place worth spending a remote
signer on. A gateway too old to answer the second question leaves the first
answer standing, which is the behavior as it was.

The deploy itself never needed fixing: bindHostname asks for the host, is given
it, finds it already points where it is about to point, and returns. The form was
the only thing in the way.

Also compares the saved name trimmed, since that is what gets deployed — a
trailing space is not a different name, and typing one told people their own site
was somebody else's.
2026-09-13 19:25:30 -05:00
Alex Gleason 29b3ca178a release: v9.16.0 2026-09-13 17:13:52 -05:00
Alex Gleason d06b9235a8 Give a name back under the title its site chose, and say which relays took it
Three things the migration got wrong, all of them the same shape: something was
known and not said.

The archive titled every site it carried after the site's hostname, because an
address was all it knew about a site it had only ever seen at one. Handing that
back hands back an address where a name should be — a site called "Arguable"
comes home titled "arguable.shakespeare.wtf". The gateway can now read the name
the site was carrying all along, out of its webmanifest or the metadata it
publishes for link previews, and that is what gets signed. A site that never
said what it is called gets no title, which is what a manifest without one has
always meant. Its `alt` goes too: it says the site is archived so that it keeps
working, which is a true sentence about the archive and stops being true here.

Names already taken back are listed and fixed the same way, rebuilt from the
event as relays hold it rather than from the gateway's copy — a site redeployed
since the migration ran has moved on, and rebuilding it from what the gateway
fetched would quietly restore an older version of it.

Publishing to relays went through a pool that resolves on the first acceptance
and discards every other answer, so a manifest that reached one relay out of
five was reported exactly like one that reached all five, and the reasons the
other four refused were received and thrown away. Of 102 manifests published
this way in one sitting, one relay held every one and another held none, and
nothing anywhere said so. Every relay is now published to on its own and
reported on by name. One acceptance is still a success — the event exists and
whoever reads that relay will find it — so this is a note, not a failure.

The gaps that leaves are closed without signing anything: the events go out
again exactly as they are, ids and signatures unchanged, to the relays whose own
answer says they are missing them. A relay that already has one says duplicate
and nothing happens; a relay that refused before finally says why, which is the
only way to hear a reason that was discarded at the time.

Ordinary nsite deploys published the same blind way, so they use the same
helper and carry the same coverage.

Lastly, names more than one label under the gateway's domain are refused rather
than published for. A wildcard certificate covers one label, so `a.b.example.com`
can be claimed, published for, and will still fail its handshake for everyone
forever. Five are on file, inherited from a host that accepted them; one already
has a manifest published for it, which can now be retracted.
2026-09-13 16:40:33 -05:00
Alex Gleason cb5561ba69 Let people take back the sites they had before the gateway
The domains Shakespeare Deploy published to are now served by a gateway that
took them over, and the sites already under those names had to keep working, so
they were republished under an archive key rather than left to break. That key
is not theirs. This is how it stops speaking for them: the gateway holds a
record of who each name is waiting for, they publish their own copy of the site,
and the name is repointed at it.

All of it at once, because the person with one name to recover is not the person
this is for. Doing it a site at a time through the deploy button would mean
re-deploying a hundred projects, most of which are no longer checked out
anywhere, to recover sites whose files the gateway already has.

The list is only reached by asking, never on page load: finding out what is
waiting costs a signature, and a signing prompt nobody asked for is worse than a
button that sometimes opens an empty list.

A name whose site was always published under its owner's key needs nothing
republished — the record is the whole migration. The rest need the archived
manifest signed again, which reproduces the site exactly, since a manifest is
its tags and the blobs are addressed by hash and already sit where the server
tags say. Publishing happens before claiming, so the name never points at an
event the gateway has not fetched.

What a name must never do is come back at the cost of a live one. Kind 35128 is
addressable, so republishing an archived snapshot at a `d` tag someone already
publishes under would replace the current site with an old copy of itself —
which is not hypothetical: two of the first hundred names looked at were exactly
that. Those are claimed straight to the site that already exists, so both names
end up serving it. Working that out needs relays to answer, so silence from them
is treated as silence and not as "publishes nothing": a user whose own sites the
gateway is already serving must see at least those come back, or nothing is
planned at all.

Also fixes ProviderConfigDialog, which had grown a relay list and a server list
and no height limit, and was pushing its own Save button off the bottom of the
screen with no way to scroll to it.
2026-09-13 15:05:37 -05:00
Alex Gleason fc26a8b27b Deploy to the gateway that actually serves shakespeare.wtf now
Shakespeare Deploy uploaded a zip to a host that kept the files itself. That
host has been replaced: those domains are served out of nsite manifests, so a
deploy through the old API has been succeeding and changing nothing anyone can
see. This replaces it.

NpanelAdapter is NsiteAdapter plus a name. The site is an ordinary nsite under
the user's own key — same event, readable by any nsite client, gateway or no
gateway — and the second half of the deploy asks the gateway to point a hostname
at it. Its predecessor claimed names implicitly, by watching relays and
reserving whichever d tag it saw first; this one keeps an explicit row, which is
what makes a name something its owner holds rather than something they won a
race for. The hostname is asked about before it is claimed, because "nobody
holds this", "I already hold this" and "somebody else holds this" are three
different acts and creating-then-reading-the-409 cannot tell the last two apart.

The name field checks availability as you type, against an endpoint that takes
no credentials: somebody choosing a name has not decided to make an account yet.
A name this project already deployed to is not reported as taken — it is theirs.
An unreachable gateway reports available, because being wrong that way costs a
clear error at deploy time, and being wrong the other way tells someone a free
name is taken and they settle for worse.

Also fixes readDeploySettings, which swallowed a missing file and an unreadable
one alike and answered "no providers" to both. The default provider it was meant
to hand new users had therefore never reached anybody: it was written, saved
back as an empty list on the next render, and gone. The two cases are now
distinct, because inventing defaults for a file that exists but will not parse
would silently replace whatever the user had.

Providers and per-project deploy records saved under the old type are migrated
on load rather than dropped. The project file holds one record per provider a
project ever deployed to, so rejecting one entry would take a Netlify site id
and a Vercel project id with it.

Verified end to end against the live gateway: a fresh key self-enrolled,
uploaded a blob, published a manifest, claimed a name, and the site served
publicly with the SPA fallback working on a deep path.

The package-lock version bump is npm reconciling it with package.json, which
had drifted before this work.
2026-09-13 12:54:30 -05:00
Alex Gleason 4d36e2d3ff Require nsyte 0.28.0 or newer, rather than merely present
The runner image turned out to carry no nsyte at all, so every deploy
took the download fallback and ran 0.27.2, whose nostr-tools refuses to
NIP-44 encrypt a payload over 64 KiB. Signing a site manifest through
the bunker fails outright there. 0.28.0 is the first release with the
fix, and it is now baked into the image.

`command -v nsyte` also left the pin unenforceable: a baked binary of
any vintage won silently, which is how deploys kept running 0.27.2 long
after the pin moved. The check now compares versions and treats the pin
as a floor, so a newer image still wins but an older one is replaced.
2026-08-22 18:40:07 -05:00
Alex Gleason fd23c10f20 Use the nsyte baked into the runner image
Falls back to downloading it, so the workflow still runs on a coordinator
whose image does not carry it.
2026-08-17 10:36:27 -05:00
Alex Gleason 0d73c79d4c Retry the whole nsyte download until the binary runs
From this coordinator the 115 MB release download fails about half the
time, mid-transfer, with an SSL record-mac error; curl's own --retry does
not help because each attempt breaks identically. Loop the fetch, force
HTTP/1.1, and run the binary before accepting it.

The durable fix is baking nsyte into the CI image.
2026-08-17 02:55:03 -05:00
Alex Gleason f951f21535 Retry the nsyte download
It has failed here with "SSL_read: decryption failed or bad record mac",
which curl does not treat as retryable. Also -f, so an HTTP error page is
never saved as the binary, and a version check to catch a truncated one.
2026-08-17 02:22:05 -05:00
Alex Gleason a20fab1ab4 Publish shakespeare.diy as an nsite from ngit-ci
Replaces the GitLab deploy and deploy-nsite jobs. The old nsite job published
under a personal npub; the signing pubkey is the site address, so this one
lives in the Team Soapbox namespace and is served by npanel.
2026-08-17 01:33:45 -05:00
Alex Gleason 97714079d3 Merge branch 'feat/meridian-provider' into 'main'
Feat/meridian provider

See merge request soapbox-pub/shakespeare!119
2026-07-24 01:12:13 +00:00
Alex Gleason a824677fe2 Merge branch 'pr/git-gc' into 'main'
Add Git garbage collection to rescue bloated repositories

See merge request soapbox-pub/shakespeare!117
2026-06-12 14:51:11 +00:00
Alex Gleason 9557356ff5 Deploy sw.js in CI 2026-06-06 10:38:58 +00:00
Alex Gleason dbbdcc32eb Revert "Edit .gitlab-ci.yml"
This reverts commit acde1d8a3a
2026-06-06 10:38:09 +00:00
Alex Gleason acde1d8a3a Edit .gitlab-ci.yml 2026-06-06 10:36:31 +00:00
Alex Gleason 5d02627cff release: v9.14.0 2026-06-05 10:38:53 -05:00
Alex Gleason 317c923532 Fix font @font-face runtime error by stripping esm.sh /* from asset URLs
Root cause of the Tailwind v4 'Missing closing } at font-face' runtime
error: font assets imported via a CSS @import (e.g. @fontsource packages)
were emitted as url(https://esm.sh/*@fontsource/...woff2). The /* from
esm.sh's wildcard ('externalize all deps') prefix sits inside an unquoted
url(), and the in-browser Tailwind v4 tokenizer misreads it as the start of
a CSS comment, scanning past the rule's closing } and throwing.

esm.sh's '*' only affects JS module builds; for raw static assets it is
meaningless and the same file is served without it. Strip the '/*' prefix
from externalized asset URLs (and ?url asset imports) so emitted CSS url()
values are parseable by all CSS parsers, not just the ones tolerant of
'/*' inside url(). JS module URLs are untouched.

Adds unit tests for stripAssetUrlWildcard.
2026-06-05 10:34:38 -05:00
Alex Gleason 18815f0649 fix: resolve all npm audit security vulnerabilities
Ran npm audit fix to resolve 19 vulnerabilities and upgraded vitest from
v3 to v4.1.8 (breaking change) to fix the critical UI server advisory
(GHSA-5xrq-8626-4rwp).

Vitest v4 no longer allows vi.fn() mocks to be used as constructors, so
converted constructor mocks (IntersectionObserver, ResizeObserver,
AbortController, NPool/NRelay1) to real classes in the test setup and
affected test files.

npm audit now reports 0 vulnerabilities.
2026-06-05 09:23:29 -05:00
Alex Gleason 98985c29de fix(build): recover from esm.sh 500 on types-only (empty-runtime) packages
esm.sh's build pipeline returns HTTP 500 for packages that ship only
TypeScript types with an effectively-empty runtime JS file (e.g.
@solana/rpc-parsed-types, pulled in transitively by @solana/kit). The
esm plugin treated this as fatal, blocking any project depending on such
a package.

When an esm.sh JS module fetch fails, fall back to jsDelivr's +esm
endpoint to inspect the package's actual runtime. If it is effectively
empty (no exports/imports/code after stripping comments, prologues, and
source-map directives), synthesize an empty ES module so the build can
proceed. Genuine non-empty failures are still re-thrown unchanged, and
the fallback is scoped to JS module requests only (asset/CSS/JSON
failures remain fatal).
2026-06-05 09:12:20 -05:00
Alex Gleason ba422b2d9e Merge branch 'nostr-connect-qr-code' into 'main'
Add nostrconnect:// QR code login for NIP-46 remote signers

See merge request soapbox-pub/shakespeare!114
2026-05-21 16:17:51 +00:00
Alex Gleason 0da339c214 Anchor rsync excludes to transfer root
--exclude=index.html matches index.html at every depth, which stripped
prerendered index.html files from subdirectories. Anchoring with a
leading slash limits the exclude to the transfer root so only the root
index.html is skipped.
2026-04-29 15:44:36 -05:00
Alex Gleason 6f3cc62e00 release: v9.13.2 2026-04-29 15:27:31 -05:00
Alex Gleason 5484a57f08 Change default preview domain to iframe.diy 2026-04-29 15:19:27 -05:00
Alex Gleason 09059d87ec Restore original CI timeout 2026-04-29 15:12:44 -05:00
Alex Gleason b9b297d832 Deploy via rsync to venus.vps instead of GitLab Pages
Uses a per-site SSH key jailed on the server via rrsync. Requires CI
variables DEPLOY_SSH_KEY and DEPLOY_TARGET (user@host).
2026-04-29 15:09:27 -05:00
Alex Gleason 4ca7e20011 Remove bundled iframe-fetch-client in favor of iframe.diy
The iframe preview sandboxing service is now maintained as a separate
project at https://gitlab.com/soapbox-pub/iframe.diy and deployed at
https://iframe.diy/. Remove the stale in-tree copy and update the
services README to point to the upstream project.
2026-04-29 14:59:05 -05:00
Alex Gleason e4c4e617c6 Revert "Default to OpenCode Zen with big-pickle model for zero-config first experience"
This reverts commit 0a2cbf4bca.
2026-04-29 13:58:02 -05:00
Alex Gleason 10edacbccb Revert "Fix default settings overriding user's recently used models"
This reverts commit 2736f71687.
2026-04-29 13:58:02 -05:00
Alex Gleason 7e93367b5f release: v9.13.1 2026-04-27 00:55:38 -05:00
Alex Gleason b3fddf6cb3 Audit and overhaul virtual shell's git command
Fix critical bugs, add extensive missing flags, and add 8 new subcommands
to bring the browser-side git command closer to parity with real git.

Critical bug fixes:
- git commit: file-count classification used impossible stageStatus=1
  comparisons, always reporting 0 files changed
- git status --porcelain: untracked files could clobber staged indicators
- git add: directory walker skipped all dotfiles (including .gitignore
  itself), ignoring real git's .gitignore-based filtering
- git pull: untracked files incorrectly blocked pulls
- git reset: target regex rejected valid refs like branch names
- git diff: path filter used substring matching; --cached read working
  directory instead of index; <commit> and <commit>..<commit> forms were
  stubbed/unimplemented; used fake JS hashes instead of git.hashBlob

Implemented git reset --soft (was returning "not implemented").

New flags added across existing subcommands:
- commit: --signoff, --no-verify, -F/--file, --author, -C/--reuse-message,
  multiple -m support
- add: -u/--update, -f/--force, -n/--dry-run, absolute paths inside repo
- log: --stat, -p/--patch, --name-only, --name-status, --author, --grep,
  --since, --until, --no-merges, --reverse, --follow, custom
  --pretty=format:, proper timezone in output
- push: -u/--set-upstream (now wired to config), --tags, --delete,
  --dry-run, refspec (local:remote)
- fetch: --all, --tags, --prune now actually passed through
- branch: -a/--all, -r/--remotes, -m/-M (rename), --show-current, -v
- checkout: -B, -f/--force, commit-hash support (detached HEAD)
- config: --unset, --get-all, --add, --local, proper --list that reads
  the whole config file
- tag: real annotated tags via git.annotatedTag, -m, -f, -n, glob patterns
- clone: -b/--branch, -o/--origin, --bare
- init: -b/--initial-branch
- show: --stat, --name-only, --name-status
- diff: --stat, --name-only, --name-status
- remote: set-url, get-url, rename, show subcommands

New subcommands:
- git rm: remove files from index (and optionally worktree)
- git mv: rename/move files with index updates
- git restore: modern replacement for checkout of files
- git switch: modern replacement for branch checkout
- git merge: wrapper over git.merge (including --abort, --ff-only)
- git revert: create an inverse commit
- git rev-parse: resolve refs, --short, --abbrev-ref, --show-toplevel,
  --git-dir, HEAD~N / HEAD^N
- git ls-files: list tracked/modified/deleted/untracked files

All existing tests updated where behavior intentionally changed; new
subcommands have dedicated test suites. Final suite: 1392 passing.
2026-04-27 00:42:10 -05:00
Alex Gleason 376a982449 Overhaul shell commands for POSIX compliance and AI-agent ergonomics
Each built-in shell command has been audited and rewritten to support the
options AI agents (and humans) typically reach for, close critical behavior
gaps, and align with POSIX/GNU conventions:

- Shared argument parser (utils.ts) handles combined short flags, long
  options with '=VALUE' or space-separated values, the '--' sentinel,
  numeric shortcuts like 'head -5', and '-' for stdin.
- cat, ls, cp, mv, rm, mkdir, touch: added missing common flags; removed
  the legacy 'absolute paths are not supported' and 'reading from stdin
  is not supported' barriers where they made agent use awkward.
- mv now overwrites destinations by default (POSIX) and supports -n.
- touch updates mtime on existing files (by rewriting content) and
  accepts -c/-a/-m/-h/-r/-d/-t options.
- find: new expression engine with -iname, -path, -regex, -type,
  -empty, -size, -maxdepth, -mindepth, -not, -or, -print/-print0,
  -delete, -quit.
- grep: -v, -c, -l, -L, -w, -x, -o, -q, -E, -F, -G, -H, -h, -A/-B/-C
  context, --include/--exclude, multiple -e, -f scriptfile.
- head/tail: -c bytes, -NUM shorthand, negative/positive line counts,
  proper multi-file headers.
- sort: -k keys, -t separator, -o output, -f/-b/-d/-s, -h/-V/-M modes.
- uniq: -i, -f, -s, -w, -D, and the [input [output]] form.
- wc: -m characters and -L longest line; -c now counts bytes (UTF-8).
- cut: open-ended ranges (3-, -5), -s, --complement, --output-delimiter.
- tr: -c/-s/-t, [:class:] character classes, escape sequences.
- sed: real multi-command parser supporting ';', addresses (N, $,
  /re/, N,M), '!' negation, proper -n quiet mode, y///, and -i[SUFFIX].
- echo: -n, -e, -E with standard backslash escapes.
- pwd/cd: -L/-P, plus cd -, cd ~, cd $HOME with OLDPWD tracking.
- diff: proper LCS algorithm producing correct normal and unified
  output; adds -q, -s, -N, -i, -w, -b, -B.
- env: -i, -u, NAME=VAL assignments; reads the live shell environment.
- date: -u, -d, -R, -I, and a full GNU-subset format specifier set.

Tests for each command were updated to reflect the corrected behavior
(e.g. absolute paths and stdin are now accepted, POSIX error messages).
All 1334 tests pass; typecheck and production build succeed.
2026-04-26 23:58:13 -05:00
Alex Gleason 258dce35d2 Replace ShellTool's ad-hoc string parser with a real shell
The old ShellTool used a flat string scanner that couldn't distinguish
quote context from operator context. In practice this produced a long
tail of surprising behaviours that confused AI agents and occasionally
corrupted the virtual filesystem:

  * `echo hi 2>&1` wrote 'hi 2' to a file named literally `&1`
  * `echo hi >&2` wrote to a file named `&2`
  * `cat < in.txt` silently produced no output (input redirection
    was unimplemented but not rejected)
  * `for f in *.tsx; do ... done` was split into three separate
    "command not found" errors
  * `echo $HOME`, `echo $(pwd)`, `echo \`pwd\`` all printed
    the unexpanded source text
  * `# comment`, backslash escapes, brace expansion, tilde, and
    arithmetic all fell through as literal characters

Introduce a proper mini-shell in src/lib/shell/:

  * tokenizer.ts — POSIX-flavoured lexer that understands single and
    double quotes, backslash escapes (including line continuations),
    comments, operators, fd-prefixed redirections (IO_NUMBER), and
    dollar-led expressions ($VAR, ${...}, $(...), $((...)), backticks).
  * parser.ts — recursive-descent parser producing an AST covering
    pipelines, and-or lists, sequences, redirections (including `<<`
    heredocs and fd duplication like `2>&1`), and the full suite of
    compound commands: if/elif/else/fi, for, while, until, case,
    subshells, and brace groups.
  * expand.ts — word expansion following POSIX ordering: brace
    expansion, tilde, parameter, command substitution, arithmetic,
    word splitting, pathname expansion, quote removal. Glob patterns
    match against the virtual filesystem; unmatched patterns pass
    through unchanged.
  * executor.ts — AST interpreter that dispatches simple commands to
    the existing ShellCommand registry, applies redirections safely
    (validateWritePath runs BEFORE any file write so bogus paths can
    no longer materialize), evaluates control flow, and tracks exit
    status in $? with a safe iteration cap on while/until loops.
  * Built-ins: true, false, :, export, unset, exit, test, [.

ShellTool.ts is now a thin integration layer that wires the registry
into a ShellExecutor and formats the final output, keeping its public
API (execute, getCurrentWorkingDirectory, setCurrentWorkingDirectory,
getAvailableCommands) unchanged so existing callers (ChatPane,
Terminal) don't need to change.

Tests:
  * All 35 existing ShellTool tests still pass (adjusted two
    assertions for the improved error messages).
  * Added 29 tokenizer, 19 parser, 24 expander, and 49 end-to-end
    tests covering the bash features listed above and confirming that
    the data-corrupting redirection bugs are gone.
  * Full suite: 1316 passed / 6 skipped, typecheck clean, lint clean,
    build clean.
2026-04-26 23:16:29 -05:00
Alex Gleason b2bd91780b Expand glob patterns in ShellTool arguments
AI agents frequently write bash-style commands like `cp *.tsx src/` or
`ls src/**/*.ts`, but ShellTool previously passed wildcard tokens through
to individual commands literally. Since the command implementations don't
do their own expansion, these invocations failed with confusing errors
like "cannot stat '*.tsx'", leading agents to retry with increasingly
complex workarounds (find -exec, for loops) that also aren't supported.

Move glob expansion into the shell itself, matching how real shells work:
unquoted arguments containing `*`, `?`, or `[...]` are expanded
against the virtual filesystem before being handed to the command. Quoted
patterns and option flags are left untouched, and patterns that match
nothing pass through literally (bash default behaviour).
2026-04-26 22:51:58 -05:00
Alex Gleason 2335395641 release: v9.13.0 2026-04-26 22:19:49 -05:00
Alex Gleason af2436a3b8 Handle bare CSS @import specifiers for Tailwind v4
Tailwind v4 projects typically include `@import "tailwindcss";` in
their CSS entry and often `@import` third-party CSS plugins like
`tw-animate-css`. Both cases were broken:

1. esbuild tried to resolve `tailwindcss` through the ESM CDN as JS,
   producing 'Cannot import <...> into a CSS file'. The existing
   CSS-importer guard used `new URL(args.importer)` to detect CSS
   importers, but esbuild passes fs-namespace importers as plain paths
   (e.g. `/projects/foo/src/index.css`) which don't parse as URLs, so
   the guard never fired.

2. `@tailwindcss/browser@4` only resolves a hardcoded set of `@import`
   specifiers (`tailwindcss`, `tailwindcss/preflight`,
   `tailwindcss/theme`, `tailwindcss/utilities`) and throws
   'The browser build does not support @import for <x>' for everything
   else, so plugin packages couldn't be preserved as external either.

Detect CSS importers with a plain string match and split behavior:
`tailwindcss` and its subpaths stay external so the v4 runtime can
handle them, while other bare CSS imports fall through to the normal
esm.sh resolution path. esm.sh redirects CSS-only packages to their
`.css` entry and `onLoad` picks `loader: "css"` via the content-type
mapping, so the dependency is bundled inline. The combined CSS then
lands in the `<style type="text/tailwindcss">` block where the v4
runtime can process v4 directives (`@custom-variant`, `@theme`, etc.)
from third-party plugins.
2026-04-26 22:17:14 -05:00
Alex Gleason 1fd3d23d4f Support Tailwind CSS v4 in project builds
Detect the Tailwind major version from the project's package.json and
branch the build pipeline accordingly. v3 projects keep loading the Play
CDN runtime and a JS tailwind.config via the existing synthetic entry.
v4 projects instead pull in @tailwindcss/browser@4, which auto-scans the
document and reads theme config from CSS (@theme / @import 'tailwindcss')
so no config shim is required.
2026-04-26 19:56:25 -05:00
Alex Gleason b2c5b1d81e release: v9.12.0 2026-04-25 18:06:46 -05:00
Alex Gleason a7d026e51a Allow ambient-light-sensor permission in preview iframe 2026-04-25 18:04:44 -05:00
Alex Gleason dd078ed17d Grant microphone and other permissions to preview iframe 2026-04-25 17:41:52 -05:00
Alex Gleason 695a697e88 Support new Worker(new URL(..., import.meta.url)) and asset URLs
Shakespeare's esbuild-wasm pipeline now handles the Vite/webpack-compatible
patterns for module workers and static asset URLs, so projects using
  new Worker(new URL('./w.ts', import.meta.url), { type: 'module' })
  new SharedWorker(new URL('./w.ts', import.meta.url), { type: 'module' })
  new URL('./logo.svg', import.meta.url)
build correctly under Shakespeare instead of emitting a 404'ing URL
that pointed at the source-file path inside the main bundle.

Mechanics:
- A new detection pass (src/lib/build/workerPlugin.ts) is invoked from
  the fs plugin's onLoad for .ts/.tsx/.js/.jsx/.mjs files. It cheaply
  regex-prefilters on 'new URL(' so 99% of files pay zero overhead,
  then strips TS/JSX via esbuild.transform and parses with acorn +
  acorn-jsx for the handful of files that actually match. The string
  literal spec inside each matched new URL() call is replaced with a
  unique placeholder token, preserving the enclosing new URL(...,
  import.meta.url) shape so runtime resolution against the main
  bundle URL still works.
- bundle() now runs a per-worker sub-build (esbuild.build) with the
  same plugin stack, producing a hashed ESM chunk alongside the main
  output. The queue drains recursively so nested workers / assets
  discovered during a sub-build are handled in the same bundle call.
- Non-source assets are copied into the output with content-hashed
  filenames (SHA-256 when SubtleCrypto is available, FNV-1a fallback
  for test environments).
- After all sub-builds finish, placeholder tokens are string-replaced
  in every JS output with the corresponding './<emitted-filename>'.
- updateCSPForEsmSh gains an emittedWorkers option; when set it
  additionally ensures worker-src and child-src exist and extends
  them with the ESM CDN so module workers can import from esm.sh.

Errors (with file:line context) are raised for classic (non-module)
workers, dynamic specifiers, and unresolvable worker specs. Plain
new URL() pointing at a source file emits a console warning and is
left untransformed.

Tests: 16 new workerPlugin unit tests cover detection, errors,
dedup, and quote-style handling; 4 new CSP tests cover the
emittedWorkers path.
2026-04-25 17:32:14 -05:00
Alex Gleason 7eab377b7f release: v9.11.4 2026-04-17 18:13:40 -05:00
Alex Gleason 6da4b63a85 Fix preview pane getting stuck during auto-refresh on rapid builds
The refresh mechanism posted a JSON-RPC `refresh` command to the nested
iframe.diy frames. During rapid build cycles, the command could be
silently dropped when the inner iframe was mid-reload, not yet mounted,
or when the outer frame's handshake was still pending \u2014 leaving the
preview stuck on a stale build with no way to recover short of reloading
the whole page.

Switch to remounting the iframe via a React key bump, which always works
regardless of handshake state. Also fix a bug in the injected preview
script where `++rpcId` (a function) silently corrupted the id generator
to NaN, breaking navigation state and uncaught error reporting.
2026-04-17 17:40:34 -05:00
Alex Gleason 565ae93aed Cache the tools array for Anthropic via OpenRouter
The tools JSON is typically 7-12K tokens, stable across every turn in
a session, and was previously re-billed at full input price on every
turn. OpenRouter explicitly supports cache_control on tool definitions
for Anthropic models (announced in their 'tool caching' release), and
the OpenAI SDK serializes the body via JSON.stringify so unknown fields
like cache_control pass through untouched.

This adds a cache_control breakpoint on the last tool, which caches the
entire tools array. Combined with the existing system + last-2-messages
breakpoints, we now use all 4 breakpoints Anthropic allows, matching
the cache hierarchy (tools -> system -> messages).

Expected savings for a 280-turn session (Opus): ~$27 for 16 tools or
~$47 for 31 tools.

Refactors the request-body transform into a named, exported
applyOpenRouterTransforms function with unit tests covering:
- cache_control placement on tools, system, and last two messages
- non-Anthropic models skip the transform
- byte-stability of the tools JSON across calls (the property the
  cache actually relies on)
- no mutation of the caller's tools array
2026-04-16 17:55:34 -05:00
Alex Gleason 429dafce92 release: v9.11.3 2026-04-12 10:52:18 -05:00
Alex Gleason 49889be240 fix: include CHANGELOG.md in ServiceWorker precache manifest for offline support 2026-04-12 10:27:13 -05:00
Alex Gleason c285dbcd05 Merge branch 'fix/app-window-not-showing-on-mobile' into 'main'
fix: render AppDialog on mobile project view

See merge request soapbox-pub/shakespeare!108
2026-04-06 14:43:27 +00:00
Alex Gleason 50f85f232d release: v9.11.2 2026-04-06 00:58:48 -05:00
Alex Gleason c5605c9be8 Derive private iframe.diy subdomains with HMAC-SHA256
The project ID used for the preview iframe subdomain is AI-generated
from user input. Using it directly as the iframe.diy subdomain lets
a crafted project name produce a subdomain that collides with another
project's origin, gaining access to its localStorage/IndexedDB.

Introduce a persistent random seed in localStorage (shakespeare:seed)
and derive the subdomain as base36(HMAC-SHA256(seed, prefix|identifier)).
The prefix ("preview") domain-separates different use-cases.
The subdomain is stable per device+project but unpredictable to
third parties.
2026-04-06 00:46:01 -05:00
Alex Gleason 33564842d0 release: v9.11.1 2026-04-05 23:59:06 -05:00
Alex Gleason 0511976688 Switch back to local-shakespeare.dev, which is now an iframe.diy instance 2026-04-05 23:47:55 -05:00
Alex Gleason 819813a000 Replace local-shakespeare.dev with iframe.diy for preview pane 2026-04-05 23:34:15 -05:00
Alex Gleason 2736f71687 Fix default settings overriding user's recently used models
Separate EMPTY_AI_SETTINGS (for initial state and error fallback) from
OPENCODE_DEFAULT_SETTINGS (for genuinely new users only). Previously,
readAISettings returned OPENCODE_DEFAULT_SETTINGS on any error, which
could overwrite an existing user's recentlyUsedModels with
['opencode/big-pickle']. Now the error path returns empty settings, and
OPENCODE defaults are only applied when no providers are configured.
2026-04-04 02:13:35 -05:00
Alex Gleason 0a2cbf4bca Default to OpenCode Zen with big-pickle model for zero-config first experience
Pre-configure OpenCode Zen as the default AI provider so new users can
submit prompts immediately without any setup. Sends x-opencode-* headers
to qualify for the higher daily rate limit tier.
2026-04-04 01:26:07 -05:00
Alex Gleason c359eda1d6 Fix showcase card clone URLs to use NostrURI for proper npub encoding 2026-04-04 00:10:55 -05:00
Alex Gleason 269047d742 Update default blossom servers and relay lists
Add blossom.ditto.pub and blossom.dreamith.to to the top of all blossom
server lists. Add relay.dreamith.to below relay.ditto.pub and remove
relay.damus.io and purplerelay.com from deploy relay lists.
2026-04-03 23:59:20 -05:00
Alex Gleason d2673effd8 Change default nsite gateway to shakespeare.to 2026-04-03 23:38:36 -05:00
Alex Gleason c49564e70d Support vanity subdomain URLs for nsite deployments
After deploying a named site, the adapter probes the gateway for vanity
subdomain support via X-Nsite-* response headers. When the gateway
confirms a vanity name (e.g. ditto.shakespeare.wtf), it is used as the
primary deploy URL. Gracefully degrades to the canonical base36 URL when
the gateway doesn't support vanity subdomains.
2026-04-03 22:49:38 -05:00
Alex Gleason 63671ea85b Fix SW excluding all /_* paths, breaking SvelteKit nsites
The fetch event handler was skipping all paths starting with `/_`,
intended to protect iframe-fetch-client system files. But this also
excluded SvelteKit asset paths like `/_app/immutable/chunks/*.js`,
causing them to bypass JSON-RPC and hit the network directly, which
returns HTML instead of JavaScript.

Narrow the exclusion to only `/_iframe-client/` — the specific
prefix used by the iframe-fetch-client's own assets.
2026-04-03 18:58:24 -05:00
Alex Gleason 46fefd5352 release: v9.11.0 2026-04-03 16:09:05 -05:00
Alex Gleason 13dd307292 Update curator list to use Shakespeare Builders list 2026-04-03 16:04:26 -05:00
Alex Gleason 271013f834 Deduplicate auto-added t-tags to prevent duplicates on re-save 2026-04-03 15:32:43 -05:00
Alex Gleason 31fcb60cd3 Show banner and icon in showcase cards, require both to appear in showcase 2026-04-03 15:20:30 -05:00
Alex Gleason 6bec129e93 Break Advanced section into General, Handlers, and Tags tabs 2026-04-03 14:29:58 -05:00
Alex Gleason 5f56652479 Add ngit repo and nsite deployment naddr fields to App dialog Advanced section 2026-04-03 14:27:34 -05:00
Alex Gleason be458ece7b Add 'All' option to web handler type dropdown so it can be reset 2026-04-03 14:20:44 -05:00
Alex Gleason 1d6ad575f6 Fix type dropdown placeholder to say 'All' 2026-04-03 14:19:24 -05:00
Alex Gleason 68c51fb48f Default web handler type dropdown to 'All' to indicate it's optional 2026-04-03 14:15:35 -05:00
Alex Gleason a81b8420f5 Add t-tag editor under Advanced in App dialog 2026-04-03 14:13:55 -05:00
Alex Gleason ddc1e02431 Add Delete App button under Advanced when editing an existing app 2026-04-03 13:56:16 -05:00
Alex Gleason 8f9ce95a43 Autofill app form from OG tags and web manifest on first publish 2026-04-03 13:50:04 -05:00
Alex Gleason d015887338 Replace per-field Required labels with a consolidated validation summary above the save button 2026-04-03 13:39:49 -05:00
Alex Gleason b7e7f5420a Only show banner pencil badge when a banner image is already set 2026-04-03 13:38:32 -05:00
Alex Gleason 9daccc1947 Show inline validation errors on submit attempt and remove Save icon from button 2026-04-03 13:38:20 -05:00
Alex Gleason c3f1cbc50a Remove website divider and require name, description, website, icon, and banner before saving 2026-04-03 13:35:10 -05:00
Alex Gleason 612759ed64 Move Website field into the app preview card 2026-04-03 13:32:44 -05:00
Alex Gleason b2cfcd7e17 Redesign App dialog banner/icon UI with overlapping avatar card layout 2026-04-03 13:30:39 -05:00
Alex Gleason 08357aa694 Add banner photo upload to App dialog 2026-04-03 13:27:02 -05:00
Alex Gleason c23a79dfb0 Remove nsec and nrelay from Web Handlers type dropdown 2026-04-03 13:21:22 -05:00
Alex Gleason 5102028f6b Replace handler type input with NIP-19 identifier type dropdown in Web Handlers 2026-04-03 13:20:53 -05:00
Alex Gleason 18191e3a27 Remove useless Nostr coordinate element from App dialog 2026-04-03 13:19:07 -05:00
Alex Gleason b1b451072b Fix bunker issue by upgrading Nostrify 2026-04-03 13:17:38 -05:00
Alex Gleason 5d9bc40f51 config: set default showcase curator to soapbox team follow pack 2026-04-03 01:09:14 -05:00
Alex Gleason a644994e93 refactor: replace showcase moderator with curator using NIP-19 event p-tags
Replace the hardcoded 'moderator' npub pattern with a 'curator' field that
accepts any note1/nevent1/naddr1 identifier. The p-tag pubkeys from the
resolved event are used as authors in a kind 31990 (#t:shakespeare) query.
Client-side filter ensures only apps with a 30617 git repo reference are
shown, guaranteeing the 'Edit with Shakespeare' button can be rendered.

All moderation controls (approve/feature/hide/etc.) are removed from
AppShowcaseCard. AppShowcase is simplified to a flat grid.
2026-04-03 01:08:46 -05:00
Alex Gleason ac0e13a09a ci: publish zsp to relay.ditto.pub and use blossom.ditto.pub; remove --publish-server-list from nsite 2026-04-03 00:18:01 -05:00
Alex Gleason 0565eb7aab release: v9.10.4 2026-04-02 21:50:49 -05:00
Alex Gleason e40504ebc6 Fix splash screen: use original colors instead of white silhouette 2026-04-02 21:42:34 -05:00
Alex Gleason 7ccf9ddcc9 release: v9.10.3 2026-04-02 21:27:47 -05:00
Alex Gleason 4976493be3 Replace all default Capacitor images with Shakespeare branding
- Regenerate launcher icon PNGs with colorful logo (not white silhouette)
- Update adaptive icon vector drawable with original logo colors
- Generate splash screen PNGs for all densities and orientations
- Update generate-icons.sh to use colorful SVG and generate splash screens
2026-04-02 21:24:53 -05:00
Alex Gleason 3192ae7f08 release: v9.10.2 2026-04-02 20:45:19 -05:00
Alex Gleason e2d615c2c1 Regenerate launcher icon PNGs with Shakespeare logo 2026-04-02 20:44:11 -05:00