Commit graph

481 commits

Author SHA1 Message Date
juancarlos.cavero
8c91403f22 feat(ai-act): mark dubbed and ai-actor output as machine-readable ai content
Art. 50(2) asks a provider whose system generates synthetic audio or video to
mark the output in a machine-readable way, and the terms already promised we
"label and mark" dubbed clips while nothing did either.

mark_ai_generated stamps the disclosure by stream copy, so it is a remux and
never a re-encode. The tag is `comment` because mp4 keeps only the standard
tags and ffmpeg drops a custom key without warning, which a test pins. It is
best effort by design: a missing tag must not lose someone the video they just
paid minutes for.

Deliberately narrow, on dubbing and AI actors, not on an ordinary clip whose
pixels and audio are the user's own footage. Marking everything would make the
tag mean nothing. TranslateModal says the file is tagged and that the person
publishing it owes their audience the disclosure, which is the art. 50(4) duty
and falls on them, not on us.

Still missing, and a product decision rather than an oversight: the visible
burned-in label.

Claude-Session: https://claude.ai/code/session_01WyFE2wXi8quZR6nLRRLDgE
2026-08-29 17:19:24 +02:00
juancarlos.cavero
72780441d8 feat(billing): collect terms acceptance and immediate-performance consent at checkout
The session was created without consent_collection, so nothing recorded that
the buyer accepted the terms, and nothing captured the express request for
immediate performance that lets us charge for the minutes already consumed when
someone withdraws inside the 14 days. The terms described that mechanism; the
checkout did not implement it.

Falls back to a checkout without the box if Stripe rejects it, and matches on
the message rather than the exception class: the box needs a terms of service
URL set in the dashboard, and which subclass Stripe raises for that is not
worth betting the pay button on. It switches itself on once the URL is there.

Claude-Session: https://claude.ai/code/session_01WyFE2wXi8quZR6nLRRLDgE
2026-08-29 17:19:11 +02:00
juancarlos.cavero
e21cab22fb feat(legal): dmca agent, california rights, refunds and a notice-and-action page
Five gaps in the published package, all of them things the texts either
promised or needed:

- DMCA. Section 9 implemented the DSA notice-and-action mechanism, which does
  not grant the US safe harbor. Adds the designated agent under 512(c)(2), what
  a notification must contain, the counter-notification of 512(g) and the
  misrepresentation liability of 512(f). Publishing this is only half of it:
  the designation still has to be filed at dmca.copyright.gov.
- California. The privacy policy had no CCPA/CPRA section at all. Says plainly
  that we do not sell or share, and that the reframing detects faces to know
  where to crop but never to identify anyone, which is the question a CPRA
  reader asks next.
- Refunds. New /refunds and /reembolsos: 14 days from any charge, refunded in
  full, no usage deducted. Section 12 now says the commercial policy is more
  generous than the statutory withdrawal right and is the one that applies,
  because two clauses answering differently about the same 14 days is what a
  dispute is made of.
- Notice and action. The art. 16 mechanism lived inside a terms clause, which
  reads poorly against "easy to access". Now its own page in both languages,
  linked from the footer, the hub and section 9.
- Signup. LoginModal created the account without linking the terms or the
  privacy policy: a magic-link signup never passes the footer.

docs/dsa-notice-and-action.md is the half nobody outside sees: acknowledge the
same working day, decide in 72 hours, the art. 17 statement of reasons, and a
written three-strike rule, since "reasonably implemented" is the test and an
unwritten policy fails it. It also records why arts. 15 and 20-28 do not apply
to us (hosting service, micro enterprise), so nobody builds them by mistake.

Claude-Session: https://claude.ai/code/session_01WyFE2wXi8quZR6nLRRLDgE
2026-08-29 17:19:11 +02:00
juancarlos.cavero
ad8ab59086 fix(dashboard): the score badge has to say what it is
It shipped as a bare coloured number next to "Clip 4", which on a video
thumbnail reads as a duration, a rank, a position — anything. The user's
reaction to the deployed version was "sale el número pero no se entiende qué
es", which is the whole feature failing to land.

Now it names itself and carries its scale: a trend icon, the word "viral", the
number, "/100". Only the number takes the traffic-light colour, so the label
stays quiet and the value is what the eye lands on.

Claude-Session: https://claude.ai/code/session_01KeQYCfUX2E9Q2fDgZMKEaJ
2026-08-29 03:00:13 +02:00
juancarlos.cavero
6f9c01e2c6 feat(dashboard): show each clip's score and lead with the best one
The detail pass has always returned a predicted_score per clip and the
dashboard threw it away, rendering the clips in transcript order. That buries
the strongest clip wherever it happens to fall in the video, and the first card
is the one people actually watch, publish and judge the product by.

The cards are now ordered by score, and each one carries its number. The
ORIGINAL array position is what still travels down as `index`: it is the clip's
identity in clip_index on /api/subtitle, /api/edit and publishing, in the
clip-N.mp4 download name and in the saved per-clip project state. Sorting the
array itself would have repointed all of that at the wrong clip, silently.

So the badge keeps saying "Clip 4" at the top of the list rather than "Clip 1" —
the number identifies the file you download, the position tells you what to post
first. Ties and clips with no score keep transcript order.

Claude-Session: https://claude.ai/code/session_01KeQYCfUX2E9Q2fDgZMKEaJ
2026-08-29 02:53:32 +02:00
juancarlos.cavero
2a84049c4a test(alerts): bring the proxy watcher tests onto the two-strike rule
5807217 made a route miss two probes before paging and re-worded the
alerts by impact, but only added tests for the new behaviour — the older
file still asserted the old contract and CI has been red since.

A single tick no longer opens an incident, so the specs now tick
`_PROXY_STRIKES` times; the statics-down alert says "down" rather than
"DOWN" because with the paid proxy still answering it is a cost warning,
not an outage; and the nag repeats the headline with the elapsed hours
instead of "STILL down".

The fixture also cleared every piece of watcher state except the strike
counter that commit introduced, which leaked between tests.

Claude-Session: https://claude.ai/code/session_01AzDnEa5EREFyibXEwsRCW9
2026-08-29 01:51:32 +02:00
juancarlos.cavero
9c7cae2173 fix(social): say that a tiktok draft carries no caption, and say it when scheduling a week
ResultCard warned that tiktok arrives as a draft; ScheduleWeekModal, which
queues a whole week at once and has tiktok on by default, said nothing. That
is the worse of the two: a silent drawer of drafts and a profile that stays
empty for seven days reads as a broken integration.

Both notices were also missing the actionable half. TikTok's upload-to-inbox
endpoint takes only source_info — there is no post_info anywhere in the
request — so the title and description we send are dropped for a video draft,
whether the user typed them in ResultCard or the AI wrote them for the weekly
queue. The user has to write them in the app, and neither screen said so.

Extracted to one component so the two copies cannot drift.

Claude-Session: https://claude.ai/code/session_01KeQYCfUX2E9Q2fDgZMKEaJ
2026-08-29 01:42:45 +02:00
juancarlos.cavero
4a137005ca fix(selection): trim the detail pass by score, not by position
The detail pass returns its clips in transcript order, batch after batch, and
the overflow was cut with shorts[:max_clips] — which keeps the EARLIEST clips
and drops the tail. On a 9m19s walkthrough, three runs of the same source put
every surviving clip inside the first 2m40s, 4m39s and 8m55s respectively; the
demo, the MCP walkthrough and the close were simply the part of the list that
fell off the end. The failure scales the wrong way, too: the more clips the
model proposes, the more of the video disappears (output tokens 2067 -> 8m55s
of coverage, 3407 -> 2m40s).

It also undoes the windowing. get_viral_clips builds scoring windows precisely
because "a single call over the whole transcript clusters picks near the
start", and a positional slice puts that clustering straight back. Pass 1
already sorts by score before its own cut; pass 2 just never did.

trim_to_best ranks by predicted_score, which the detail prompt has always
asked for and nothing here was reading, and returns the survivors in
transcript order so clip numbering still runs front to back.

Claude-Session: https://claude.ai/code/session_01KeQYCfUX2E9Q2fDgZMKEaJ
2026-08-29 01:42:45 +02:00
juancarlos.cavero
b4be92cb63 fix(reframe): a source already shot vertical is passed through untouched
The scene classifier sends every face-less shot to GENERAL, and GENERAL scales
the content to 42% of the frame height. That ratio buys presence on a LANDSCAPE
source by overflowing the sides; on a 1080x1920 upload the same number is a
shrink, leaving a 453px sliver floating over a blurred copy of itself. A user's
already-vertical video came back with its screen-recording scenes rendered that
way while its talking-head scenes (TRACK, whose crop is the whole frame) looked
right, so a single clip alternated between correct and ruined.

source_already_fits() gates the whole thing: a source at or past the target
aspect has no width to buy back, so the classifier, the SPLIT detection and the
screencast/inset upgrades are all skipped and every scene renders TRACK. The
layout picker is skipped too, saving a Gemini call per upload that the render
would have ignored anyway.

general_filtergraph() additionally floors the foreground at the height where the
source fills the output width, so the editor's explicit GENERAL override on a
portrait clip cannot reproduce the shrink. A 16:9 source keeps the 0.42 ratio
untouched.

Two siblings of the same bug, both only reachable on a source TALLER than the
target: the TRACK crop pinned y=0 and threw away the bottom of the frame instead
of trimming both ends, and v1's create_general_frame indexed the output with a
negative offset, which raises rather than renders.

Claude-Session: https://claude.ai/code/session_01KeQYCfUX2E9Q2fDgZMKEaJ
2026-08-29 00:06:15 +02:00
juancarlos.cavero
5807217f00 fix(alerts): proxy watcher says what is affected, and needs two misses
'paid proxy DOWN: YouTube-URL jobs will keep failing' fired on a single
ReadTimeout while the three static proxies were fine, and read as an
outage. Severity now follows the actual impact: fallback down with the
statics up is informational (no impact), statics down is a cost warning
(jobs run on the per-GB proxy), both down is the red one. A route has to
miss two probes 30 min apart before anyone is paged.
2026-08-28 01:21:06 +02:00
juancarlos.cavero
3e74fe47f7 feat(mcp): burn the hook line by default, auto_hook=false opts out
Matches the dashboard: an agent user expects the same clips they get in
the app. The REST endpoint keeps absent=off for older integrations.
2026-08-27 20:26:57 +02:00
juancarlos.cavero
8251f4f02a feat(mcp): auto_hook and hook_style on process_video
The dashboard burns the AI hook line by default; API/MCP callers never
could because the field is off when absent. Exposed as an explicit opt-in
so existing integrations keep their output byte-for-byte.
2026-08-27 19:37:23 +02:00
juancarlos.cavero
3d637f51ce test(selection): fix the expected bisect trace 2026-08-27 19:15:36 +02:00
juancarlos.cavero
443c7980a5 fix(selection): bisect a Gemini policy block instead of failing the job
PROHIBITED_CONTENT fired on the scoring batch of a plain software
walkthrough: windows 5+6 together blocked 3/3 on lite, 3.7-flash and
2.5-flash, each alone passed, and a neutral prompt over the same text
passed. The filter reacts to combinations, so it cannot be predicted or
sanitized. Both selection passes now run through _run_stage_split: on a
block the batch is halved until the combination is isolated, and only a
window that blocks on its own is dropped. The affected job now yields 2
clips instead of dying.
2026-08-27 19:14:44 +02:00
juancarlos.cavero
22c991d22b fix(download): direct file URLs bypass the proxy chain
The ISP/paid proxies exist to dodge YouTube's ban on the server IP. A
direct mp4 (catbox, tmpfiles, a CDN, an R2 link) has nothing to dodge and
crawled at ~9 KB/s through the static proxy (6 MB in 11 min on 27-aug)
while the server's own IP pulls 17 MB/s. Non-YouTube hosts now download
direct, with one static proxy as the only fallback and never the per-GB
one.
2026-08-27 18:57:37 +02:00
juancarlos.cavero
15195f591a fix(metering): size direct video URLs with ffprobe when yt-dlp reports no duration
Cloud metering probed the source with yt-dlp only; its generic extractor
never returns a duration for a plain mp4 URL, so every direct-file job
(agent uploads on tmpfiles/uguu, a CDN link) died at submit with 'Could
not determine the video duration'. On a generic hit the probe now stops
walking proxies and reads the container header over HTTP with ffprobe
(range requests, browser UA, 30 s timeout); tmpfiles links are refreshed
first. Reported by a user driving the MCP from claude.ai.
2026-08-27 17:10:13 +02:00
juancarlos.cavero
f4c227e624 feat(mcp): tmpfiles.org fallback for agent uploads, 6 h slot expiry, DELETE /api/uploads
claude.ai's sandbox can upload to tmpfiles.org but their /dl/ links are
signed with a short-lived stamp and 302 to an HTML page once stale, which
yt-dlp cannot use. file_hosts.resolve() reads the page and takes the
fresh /dl/ link before download. create_upload now tells the agent to try
our upload_url first and fall back to tmpfiles.org. Unused slots expire
after 6 h (was 24) via _sweep_pending_uploads, and DELETE drops one early.
2026-08-27 16:36:46 +02:00
juancarlos.cavero
0a21de29a2 feat(mcp): create_upload for local files, captions switch per job
process_video now takes captions:false for sources that already carry
burned-in subtitles (maps to AUTO_CAPTIONS=0 for that job only) and
accepts upload_id as an alternative to source_url. create_upload reserves
a slot (POST /api/uploads) and returns a PUT URL the agent streams the raw
bytes to (curl -T works from any runtime); the owner recorded at reserve
time is checked at process time, files sit in UPLOAD_DIR under the usual
sweep, slots expire after 24 h. Tool count is 8 everywhere it is quoted.
2026-08-27 16:32:05 +02:00
juancarlos.cavero
ecf9b0bfec feat(thumbnail): topic-first concepts, likeness-preserving references, refine follows the requested language
Feedback from a real run: thumbnails were 'face + two words' and the
person did not look like the presenter. The concept planner now has to
show the subject (product, number, result) with props and depth, and may
use the plain face only once. Frames are kept at native resolution so the
face crop sent as reference is ~800px instead of ~500px, and the image
prompt demands the exact same real person (no idealizing, no caricature).
Refining titles in another language now updates the session language and
returns paired thumbnail texts, so the thumbnail follows the title.
2026-08-27 15:52:34 +02:00
juancarlos.cavero
fe4e256cc4 fix(thumbnail): byte-part references, public-figure fallback, frames effect race
Browser run on a real video surfaced three defects:
- references were one PIL Image shared by the worker threads; the SDK's
  encoder raced and every generation died. Now each reference is an
  immutable JPEG byte part.
- Gemini's image model refuses recognisable public figures, by reference
  photo and by name alike (IMAGE_OTHER). The concept planner no longer
  writes real names or brands into scene prompts, and a blocked render is
  retried once without the person; the card says so.
- the frames effect listed its own state as a dependency, so setting it
  re-ran the effect and the cleanup discarded the response in flight.
2026-08-27 12:21:01 +02:00
juancarlos.cavero
8c477e090d config(thumbnail): default the title model to gemini-3.7-flash
Same transcript, three models: 3.5-flash 34 s, 3.7-flash 14 s, 3.1-pro 105 s.
3.7 gave the most specific thumbnail hooks (the ones that quote a figure from
the video rather than a stock phrase) at the lowest latency.
2026-08-27 11:03:23 +02:00
juancarlos.cavero
eb6ef13bba feat(thumbnail): concept-driven thumbnails, crisp burned text, face frames from the video, scored titles
Titles: transcript + 10 frames instead of uploading the whole video (an hour
was ~1M tokens), a brainstorm across fixed styles then a critic that scores,
dedupes by angle and pairs each title with a 1-4 word thumbnail hook. Mobile
rules: payoff inside 50 chars, keyword first. Text model moves to
GEMINI_MODEL_THUMBNAIL (default gemini-3.5-flash); flash-lite is the weakest
tier and this is the one creative step.

Thumbnails: a text call designs N different concepts, one image call each in
parallel. Default burns the hook text with PIL (Anton, black stroke) over
negative space the image model is told to leave, so accents are never wrong;
'AI painted' toggle keeps the old behaviour. Outputs cover-cropped to
1280x720 under YouTube's 2 MB. GET /api/thumbnail/frames/{session} picks
frames with a large, sharp face spread across the runtime and the dashboard
offers them as the person reference. Phone-size preview row in the UI.
JSON parsing now uses raw_decode: flash appended a stray ]} once.
2026-08-27 10:57:34 +02:00
juancarlos.cavero
05ef151bb1 fix(mcp): tell clients to hand the video URL straight to process_video
Connected from claude.ai, Claude tried to open the YouTube URL itself and
then web-searched it before ever calling process_video. The server
instructions and the tool/parameter descriptions now say the URL is passed
through as written and that OpenShorts does the downloading; fetching or
inspecting it first is neither possible nor needed.
2026-08-27 01:37:43 +02:00
juancarlos.cavero
83ad817a31 feat(mcp): OAuth 2.1 for claude.ai/ChatGPT, and a "connect an agent" panel
claude.ai and ChatGPT connect to a remote MCP server by URL and expect the
server to run the login: RFC 9728/8414 discovery under /.well-known/,
dynamic client registration (public clients, PKCE S256 mandatory), an
authorization endpoint and a token endpoint. The consent screen is the
dashboard (#/oauth/authorize) because the session JWT lives in localStorage
on the frontend host; the API bounces there and mints the code on a
session-authenticated POST. Redeeming the code mints an ordinary osk_ API
key named after the client and returns it as the access token, so every
existing auth, quota and ownership rule applies unchanged and the user
disconnects an app by revoking that key. The /mcp 401 now carries
WWW-Authenticate: Bearer resource_metadata=... so clients find the flow.

Dashboard: a "Connect an agent" card (Account in cloud, Settings when
self-hosted) with copy-ready setup for claude.ai, ChatGPT, Claude Code,
Claude Desktop, Cursor, n8n and curl; the clip generator links to it. The
/mcp page, README and CLAUDE.md describe the URL-only connection.
2026-08-27 01:17:49 +02:00
juancarlos.cavero
006c9ad8b4 docs(readme): open with the stacked two-speaker layout, original beside the result 2026-08-26 22:31:05 +02:00
juancarlos.cavero
d9152221fd docs(dashboard): name Gemini 3.1 Flash-Lite in landing, pricing and SEO copy 2026-08-26 00:30:51 +02:00
juancarlos.cavero
ed2aeb53c4 docs: name the real Gemini model and list all 7 MCP tools in README/CLAUDE.md 2026-08-26 00:27:06 +02:00
juancarlos.cavero
08e0eca92d chore(dashboard): make npm run lint work again
eslint.config.js was written for ESLint 9's flat config but package.json
pinned ESLint 8 and the script still passed --ext, so lint had not run in
months. Upgrade to ESLint 9 with @eslint/js and globals, keep
eslint-plugin-react-hooks on v5 (v7 ships the React Compiler rules, which
flag 21 places that would be a refactor, not a lint fix), drop the unused
eslint-plugin-react, and tune the rules to the house style: ignored catch
bindings, constant exports next to components, node globals for the build
scripts, and the entry point exempt from fast-refresh checks.

The findings that remained were fixed at the source: two unused Icon
destructures, an unused footer argument, two dead state pairs, one
useCallback dependency memoised, and six run-once effects marked as such.
2026-08-25 19:24:46 +02:00
juancarlos.cavero
fd0e39862c feat(layouts): dashboard layout selector, layouts=none, ranges survive a fast recut
- Advanced options gain "vertical layout": auto (server default, AI picks
  per video), two speakers stacked, screen over presenter, or single crop
  only. Only a deliberate choice travels as `layouts`; remembered in
  localStorage like the hook settings.
- `layouts=none` switches the picker off for one job even though the
  deployment runs AUTO_LAYOUT=1.
- The fast rerender (cut without reframe) wrote no layout sidecar, so a
  stacked clip fell back to bottom captions after a trim. It now carries the
  canonical clip's ranges through the new cut (layout_ranges.remap).
2026-08-25 15:45:19 +02:00
juancarlos.cavero
b308f6e00e fix(deploy): keep serving until the proxy drops us, then exit for real
- PROXY_DRAIN_SECONDS (20): after the jobs are drained, keep the socket
  open with /health/ready at 503 so Traefik pulls the instance out of
  rotation while it can still answer. Coolify builds the container's
  HEALTHCHECK from its own interval*retries, so closing earlier was up to
  60 s of alternating 502/200 per deploy (retries lowered to 3 as well).
- HARD_EXIT_SECONDS (30): uvicorn finishing does not end the interpreter
  while an executor thread hangs in a network probe (a /api/process cut
  off mid-shutdown left yt-dlp running), which kept a drained container
  alive for the full 900 s grace and the deploy in "Removing old
  containers". Exit outright a little after handing uvicorn the signal.
2026-08-25 15:11:55 +02:00
juancarlos.cavero
e2df4c1f0c feat(captions): put subtitles on the seam of SPLIT scenes
On a stacked two-shot the seam between the halves is the one place the
text covers nobody (OpusClip does the same), so every word event inside a
SPLIT stretch is anchored mid-frame with an inline \an5; other layouts keep
the style's alignment, and the text moves with the cut.

The render records which stretches use which layout in a <clip>.layout.json
sidecar (layout_ranges.py). The job pipeline, rerender and manual reframe
copy it into the clip's metadata as layout_ranges, so /api/subtitle finds it
on a restyle too. auto_caption_clip reads the sidecar when not told, which
is how recut hands it over.

Only the ASS path can do this; SRT burns keep one alignment per file.

Checked on the 45-clip corpus with SPLIT on: 45/45 render, 0 caption
errors, 42 with no split at all, and the 3 that split are real two-shots.
2026-08-25 14:35:46 +02:00
juancarlos.cavero
17b8ce476b fix(deploy): ship curl so Coolify's health check can reach /health/ready
With health checks enabled Coolify swaps the Dockerfile HEALTHCHECK for its
own curl/wget probe; without either binary deploy 10856 reported unhealthy
on every attempt and rolled back.
2026-08-25 12:51:21 +02:00
juancarlos.cavero
2935aca896 fix(deploy): pull a stopping container out of Traefik before its socket closes
- uvicorn --timeout-graceful-shutdown 15: after the drain, stop waiting
  forever on open range downloads. The old container lived the full 900 s
  stop grace with its port already closed, so Traefik alternated 502/200
  for 15 minutes on 2026-08-25.
- /health/ready answers 503 once SIGTERM arrives, and a Dockerfile
  HEALTHCHECK on it lets Traefik drop the instance within ~10 s while it
  can still serve. Coolify's health check now waits on the same path
  before stopping the old container. The marker drain does not flip it:
  the new container is still booting at that point.
- ignore .worktrees
2026-08-25 12:45:13 +02:00
juancarlos.cavero
27b120093b docs(readme): add optional NVIDIA GPU setup section 2026-08-25 11:48:10 +02:00
juancarlos.cavero
b8ee43570e feat(api): drain on deploy and hand running jobs over between instances
Coolify starts the new container before stopping the old one and both share
output/, so the new one used to re-enqueue at startup the very jobs the old
one was still rendering, and the old one had 30 s to live regardless.

- Each instance stamps output/.instance; an instance that sees another id
  drains: finishes what it runs, starts nothing, leaves queued manifests.
- A running job heartbeats its manifest every 10 s; the resume scan (startup
  and every 30 s) adopts only manifests nobody heartbeated for 60 s, so no
  job runs twice and none is lost. Reservations of live-elsewhere jobs are
  kept out of the orphan refund; poison jobs stay refundable.
- SIGTERM drains too (up to DRAIN_TIMEOUT_SECONDS, default 840) before the
  signal reaches uvicorn, so the socket stays open and Traefik keeps getting
  answers. The app's Coolify stop grace period is now 900 s.
- /api/status answers from disk for a job this instance never held, so a
  poll landing on either container during the handover works.

Verified in the local stack: SIGTERM mid-job -> job finished its clips,
'Drained', exit 0; status polled 200 throughout an 8 min drain; a job
submitted during the drain was left for, and resumed by, the next instance.
2026-08-25 02:39:51 +02:00
juancarlos.cavero
2e9d6a8001 fix(pipeline): clip wordless footage by vision instead of failing on an empty transcript
The vision path only fired when the source had no audio track. A nursery
rhyme or a dashcam drive has audio, so it went through transcription, came
back as one segment, built one scoring window and Gemini returned no clips:
three failed jobs on 25-aug-2026, one user twice. Below 8 words or 5 words
per minute the transcript cannot drive selection, so route it like a silent
video (vision, no captions). Thresholds env-overridable.
2026-08-25 01:12:50 +02:00
juancarlos.cavero
150a2953a1 feat(pipeline): keep the transcript across a redeploy so a resumed job does not transcribe twice
A job interrupted by a container restart is re-enqueued from its resume
manifest and re-run from scratch in the same output directory. Transcription
is the slow, paid stage that had already finished, so main.py now leaves it
there as .transcript_checkpoint.json and the re-run picks it up (same shape
and validation as --transcript). Removed when the job completes so a later
run in a reused directory never inherits it.

Verified locally: run killed after transcription, re-run in the same
directory logged 'Reusing the transcript from the interrupted run' and
delivered both clips.
2026-08-24 22:05:40 +02:00
juancarlos.cavero
7531ed88ff test(ci): skip the Stripe cancel test when the stripe package is absent 2026-08-24 20:47:23 +02:00
juancarlos.cavero
11d4bc76d2 fix(reframe): cut instead of pan when the source changes shot
At every scene boundary the tracker kept the previous shot's speaker (sticky
bonus + 30-frame cooldown returning None) and the cameraman's jump damping
held the new face for JUMP_CONFIRM_FRAMES detections, so the frame started
on the old subject and slid across at pan speed. Seen on a two-camera
podcast as a headless torso for 1.5s after each cut.

Reset both at the cut, force a detection on the cut frame, and snap the
camera to the first target accepted in the new shot. SCENE_CUT_RESET=0
restores the old behaviour.

Measured on the 45-clip corpus plus the reported clip (123 TRACK scenes):
first-frame framing error 97 -> 34 px, frames to settle 18.9 -> 3.8,
in-scene reversals unchanged (0.02/s), camera travel 12 -> 7 px/s.
2026-08-24 20:41:29 +02:00
juancarlos.cavero
b4bf211b7b fix(cloud): close the gaps the account-deletion review turned up
Eight findings from re-reading the erasure path, each one something that would
have shown up in production rather than in a test:

- The local purge missed two stores. SaaSShorts outputs (output/saas_<id>) and
  generated thumbnails record ownership in their own in-memory dicts, not in
  the .owner file, so neither was erased. Thumbnails are the serious half: the
  hourly sweep deliberately skips their directory, so a deleted user's
  generated images stayed on disk forever, publicly served at /thumbnails/.
- The purge ran on the event loop. rmtree over gigabytes of video stalled every
  other request on the process; it goes through asyncio.to_thread now.
- Paths from those dicts are now resolved through _safe_under, so a session id
  or output_dir containing ".." deletes nothing.
- Deleting a user made a webhook path reachable that never was: _apply_topup
  takes the user id from Stripe metadata, so a top-up completing around the
  deletion inserted a row pointing at a user that no longer exists. The FK
  violation 500s the webhook, and since the event is only recorded after
  handle_event returns, Stripe retries the same doomed insert for three days.
  It confirms the row exists first.
- The "why are you leaving" box was free text stored in a record that
  deliberately outlives the account, which is how personal data ends up in one
  by accident. It is a closed list now, which also makes twenty deletions a
  month countable instead of readable.
- Two concurrent deletes wrote two erasure records and sent two goodbye emails.
  The DELETE's rowcount now decides which call is the real one; the UI holds a
  ref so a double click doesn't fire a second Stripe cancel and R2 purge.
- The delete button armed itself when the confirm box was empty, if the page
  ever rendered before /api/me resolved.
- The goodbye email claimed we keep "a one-way hash of your email and nothing
  else", which was not true of the Stripe reference beside it. Fixed in the
  email and in the privacy policy, EN and ES.

Also: skip the Upload-Post call when no managed key is configured, and say
plainly in the in-flight comment that it covers metered work only.

tests/test_account_local_purge.py covers tenant isolation across all three
stores and both traversal attempts; test_account_erasure.py gains the
confirmation gate, the API-key refusal, and the already-cancelled-at-Stripe
case that would otherwise trap a user forever.
2026-08-24 19:26:12 +02:00
juancarlos.cavero
1d9fef7445 feat(cloud): self-service account deletion (GDPR art. 17)
The privacy policy already told users that "deleting your account from the
dashboard removes your content" — there was no way to do it. This adds one:
Account -> Delete account in the dashboard, DELETE /api/account on the server.

The endpoint refuses API-key auth (a leaked osk_ must not destroy the account
it was issued from) and requires the caller to retype the account email; the UI
does the same, collapsed behind a danger zone that itemises what actually goes.
Erasure is immediate and irreversible, because after it there is nothing left
to authenticate a recovery request against.

The order of the steps is the design, each one a failure mode:

- Stripe cancel first, aborting everything if it fails, so we never erase a
  user we are still billing. An InvalidRequestError is treated as already
  cancelled: a portal cancellation whose webhook never landed leaves our row
  reading "active" forever, and the one account that could not be deleted
  would be the one Stripe already stopped charging.
- R2 before the database, because those rows are the only index of which
  objects belong to the user; dropping them first turns a failed purge into
  permanent orphans.
- The DB delete is one transaction over an explicit table list, not the
  declared ON DELETE CASCADEs: create_all never ALTERs an existing table, so a
  constraint added after a table shipped lives in the models and not in
  production. tests/test_account_erasure.py fails if a new table references
  users.id without joining that list.
- A reserved usage_ledger row blocks the delete: erasing under a running job
  would pull the output from beneath it and leave the reservation unsettled.

What survives, and why: the Stripe customer and its invoices (six years,
Spanish commercial law) and one account_deletions row holding a sha256 of the
email as proof the erasure happened, itself purged after five years by the
retention sweeper. app.py registers a callback so the working files in output/
and uploads/ go too instead of waiting for the hourly sweep.

Privacy policy sections 6 (EN + ES) now point at the button and name both
survivors; the Legal hub summary says the same in one line.
2026-08-24 19:12:05 +02:00
juancarlos.cavero
989e69ce16 Merge branch 'banksy-9e8512dd-retomado': mobile pass for the dashboard
Brings the phone navigation shell (bottom tab bar + drawer in place of the
80px icon rail, safe areas, touch targets, bottom-sheet modals) and the fix
for the clip-generation view, whose two HUD pills overlapped and interleaved
their letters on any box narrower than their combined width.
2026-08-24 16:28:15 +02:00
juancarlos.cavero
0d6cf9c6fd feat(skills): plugin manifest so the skill can be submitted to the Claude Code community marketplace 2026-08-24 16:27:04 +02:00
juancarlos.cavero
3bd1886081 fix(skills): correct the published agent skill against the current API
The skill published in 78deea2 has drifted from the code. It lists six
tools (recut_clip landed since), documents output_format as "1080p" when
it is an aspect enum, promises 3-15 clips when the model usually returns
2-6, and tells agents to poll every 10s against the MCP server's own
30-60s guidance.

Adds what an agent needs and cannot infer from the endpoints:
needs_confirmation arrives with HTTP 200, so an agent that does not know
it believes a job started when none did; the 402 and 429 shapes; when
each layout is wrong rather than only what it is; and the clip-length
and target_clips bounds.

reference.md carries the exact payloads and error shapes, README.md the
per-platform install.
2026-08-24 16:23:42 +02:00
juancarlos.cavero
b9f232366a fix(dashboard): make the clip-generation view legible on a phone
The "generating" screen was the one the user singled out, and the scan box
was the reason. Interface only; no pipeline, request or data changes.

The visible defect: two HUD pills were pinned to opposite corners of the
preview, ~150px and ~170px wide. Any box narrower than their combined width
made them overlap and interleave their letters — "SCANNING CO|VIRAL_DETECTION:
ACTIVE". That is every phone, and the md tablet width too, where this panel is
only 55% of the viewport. They are now one flex row with justify-between and a
truncating left pill, so they degrade instead of colliding, and the right-hand
pill (which says nothing the left one doesn't) waits for lg.

The rest of the box was desktop flourish that turns to noise at phone scale,
so below sm it drops the blueprint grid, the dashed thirds guides, the ping
ring and the scissors, and the bottom telemetry bar — which was spending a
third of a 175px box on two lines that are always true. The box itself goes
2:1 instead of 16:9 (object-cover crops rather than shrinks, so no picture is
lost) and loses 16px of the margin under it.

Removing the invented telemetry leaves a phone with nothing to read, since the
log terminal starts collapsed there, so the panel now shows the real log tail
under the preview: "Transcribing with faster-whisper", "Asking Gemini to pick
the viral moments". Between that and the tighter box, "Generated Shorts" is
now on the first screen instead of a full scroll down, and its empty state
gets a min-height and a line saying clips appear one by one.

Verified at 360/390/640/768/1024/1440: no pill overlap and no horizontal
scroll at any width; the full HUD is intact from lg up.
2026-08-24 02:34:03 +02:00
juancarlos.cavero
3709d64085 feat(dashboard): make the app usable on a phone
The dashboard was a desktop layout that merely survived a narrow viewport.
The changes below are interface only; no backend behaviour, request shape or
data changes.

Navigation. Below md the 80px icon rail is gone. It cost a fifth of a 360px
screen to show seven unlabelled glyphs. In its place: a bottom tab bar with
the four everyday destinations plus "more", and a drawer behind the header's
menu button carrying the full list. All three surfaces read one `navItems`
array, so they cannot drift. The tab bar is a flex sibling of the scrolling
pane rather than a fixed overlay, so no pane needs compensating padding and
nothing hides behind it. The header gains the section name the rail used to
carry, so a phone still knows where it is.

Shell. h-dvh where supported (100vh hides its own bottom bar behind mobile
browser chrome), body overflow-x hidden, and safe-area padding for the iOS
home indicator via viewport-fit=cover.

Touch and legibility. Inputs render at 16px below sm so iOS stops zooming on
focus and never zooming back; the shared button pills get a 44px floor on
coarse pointers; the 10.5px mono labels come up to 11.5px on phones.

Density. The clip-generator hero no longer fills the fold on its own. The log
terminal starts collapsed on phones. Result cards cap the 9:16 preview so the
title, captions and actions stay on the same screen as the clip. Modals become
bottom sheets below sm — a centred dialog with 4px side margins was wasting the
only width there was. Banners, the results toolbar and the social nudge stack
instead of crushing.

Also fixes three <div>-inside-<p> blocks in Settings that the browser was
silently tearing apart.
2026-08-24 02:25:24 +02:00
juancarlos.cavero
06984906e2 fix(dashboard): show each clip with its hook and captions as soon as it is done
A job in flight published every clip as the clean reframe name, guessed by the
status poller. The hook and the captions live in derived files
(hooked_<ts>_<clean>, subtitled_<ts>_hooked_<ts>_<clean>), and only when the
WHOLE job finished did the result get rebuilt through _canonical_clip_file and
resolve to them. So a six-clip job showed clip 1 hook-less for the five clips
after it, which reads as the hook feature being broken.

main.py now prints CLIP_READY <index> <filename> at the end of each clip's
chain, after the caption step and carrying its result, so the name is the file
that will actually be delivered. app.py consumes the marker the way it already
consumes PROXY_BYTES: intercepted in enqueue_output, never shown as a log line.

The poller now serves only announced clips. That also closes the older hazard
in the code it replaces, whose own comment admitted it was guessing: presence
on disk was treated as done, so a clip could be served while ffmpeg was still
writing it. A clip whose marker never arrives (it failed) stays hidden until
the job ends and the result is rebuilt from disk, as before.
2026-08-24 00:37:24 +02:00
mutonby
054020481e
Merge pull request #74 from Chaakh/fix/windows-filter-paths
Fix four bugs that make self-hosting unusable on Windows
2026-08-23 23:34:45 +01:00
juancarlos.cavero
6e439785c6 fix: pass PYTHONIOENCODING to the job subprocess too
The stdio reconfigure only covers the API process. main.py prints an
emoji on its first line and configures nothing, so on a cp1252 console
the server now starts but every job dies before rendering.
2026-08-24 00:32:17 +02:00
juancarlos.cavero
c6ddb40630 fix(clips): precompose accented titles so the file name survives a fetch()
"canción" has two Unicode spellings: a precomposed ó, or an o followed by a
combining acute. yt-dlp hands over titles in either, and sanitize_filename let
the decomposed form through into the clip file, the R2 key and the URL path.

Measured against prod on 24-ago-2026, on a clip whose title carried the
combining form: a <video> element loads it fine, and fetch() of the very same
URL comes back 503, while curl gets 206 with the identical headers. So the
download button, which fetches, was broken on effectively every Spanish title,
and playback hid it.

Normalising at sanitize_filename fixes the whole chain at its source: one name
for both spellings, and a no-op for the ASCII names that already worked. Clips
already archived keep their decomposed name and still play.
2026-08-24 00:15:08 +02:00