Commit Graph
17 Commits
Author SHA1 Message Date
Mao NakamotoandClaude Opus 4.7 acb81480b5 feat(orangecat): persist orangecat_service_id + render "OC ✓" badge on /money
Closes the Loop A persistence story. After
syncSubscriptionToOrangeCat() succeeds, the subscription row now stores
the OrangeCat service id back, so the /money page can render a per-row
"OC ✓" badge and future backfill jobs can target only the still-null
rows.

Schema (drizzle migration 0021):
- subscriptions.orangecat_service_id (uuid, nullable). Null = not
  mirrored (integration off, sync failed, or row predates the
  integration). Apply via `npm run migrate`.
- Partial index on (user_id) WHERE orangecat_service_id IS NULL — the
  shape the "what still needs syncing" backfill query will use; the
  column is mostly null for now.

orangecat.ts:
- syncSubscriptionToOrangeCat() now writes the back-link after a
  successful POST. The DB update is also non-fatal — OrangeCat already
  has the truth, and the next /money render still reflects the synced
  state once the column is populated.

UI (/money page SubRow):
- New "OC ✓" badge appears next to the subscription name when
  orangecatServiceId is present. Hover shows the OrangeCat service id
  for cross-system debugging.

SDK bump:
- @orangecat/sdk moved from 0.1.0 → 0.2.0 (file:vendor/). 0.2.0 adds
  .list() on every resource, which a future backfill script uses to
  enumerate what's already on the OrangeCat side before re-syncing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 16:06:15 +02:00
Mao NakamotoandClaude Opus 4.7 1e969983c0 feat(orangecat): Loop A — mirror subscriptions to OrangeCat via @orangecat/sdk
First real cross-product call from FleetCrown into OrangeCat. Whenever a
FleetCrown user adds a subscription on /money, the same record is
mirrored into OrangeCat as a `service` owned by the FleetCrown group
actor. Mao now sees FleetCrown's monthly burn inside the OrangeCat
ledger — the bitbaum studio narrative gets its first real data point.

- Adds @orangecat/sdk@0.1.0 as a file:vendor/ dep
  (vendor/orangecat-sdk-0.1.0.tgz committed; mirrors npm-install
  semantics for dev + Vercel until the SDK is published).
- src/lib/integrations/orangecat.ts: singleton client, no-ops when
  ORANGECAT_API_KEY is unset. syncSubscriptionToOrangeCat() is
  fire-and-forget — never throws, never blocks the subscription POST.
  Stable Idempotency-Key (`fleetcrown_sub_<id>`) so retries dedupe
  cleanly when server-side dedup lands.
- src/db/queries/money.ts: hook fires after the DB insert returns.
  Whether the OC sync succeeds or fails is irrelevant to the user
  response — the local subscription is already persisted.
- .env.example: documents ORANGECAT_API_KEY + ORANGECAT_API_BASE.

Reliability defaults baked in by the SDK: 20s timeout, 3 exp-backoff
retries on network / 5xx / 429 honouring Retry-After, User-Agent
identifying FleetCrown, AbortSignal-clean.

Failure modes are non-fatal and logged with enough context for backfill:
- ORANGECAT_API_KEY unset → silent no-op (most dev envs today)
- OrangeCat returns OrangeCatError → console.warn with code+status,
  subscription still saved locally
- Network error → SDK retries internally, then console.warn

Follow-ups (each its own commit, all post-this-spike):
- schema: add subscriptions.orangecat_service_id column so the link
  persists and the UI can render a "Synced ✓" badge
- once /api/v1 exposes GET via integration-key auth, run a backfill
  job for existing subscriptions
- when OrangeCat publishes the SDK to npm, replace the vendor/ tarball
  with a normal version range

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 15:27:51 +02:00
Mao NakamotoandClaude Opus 4.7 01d68b0e25 chore: regenerate package-lock.json for @fleetcrown/agent workspace
The cockpit→fleetcrown rename in e30c842 renamed packages/agent to
@fleetcrown/agent but the root lockfile still recorded it under the old
@cockpit/agent name, leaving the workspace entry missing entirely. Vercel
deploys masked this (they run `npm install`, which auto-heals the lockfile);
the desktop-release workflow uses strict `npm ci`, which surfaces it as

  npm error Missing: @fleetcrown/agent@0.1.0 from lock file

Unblocks fleet-runner-v0.2.0 release build. No source/runtime changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 13:55:26 +02:00
Georgy Butaev e30c842869 feat(desktop) + fix(design,lint): project selection + auto-sync + Sync to Web (ck_* token); canonical injectIntoTab + real appendEvent bridge.dispatch/worker.started in Fleet Runner runtime (replaces fake in-memory); hardened zellij.ts (session resolution + -- write-chars); ui-public-download-* + --public-accent (zero design violations); full cockpit->fleetcrown rebrand in desktop/scripts/docs/thoughts/marketing/home; update desktop README + docs/desktop-app.md with capabilities + gaps (in-memory vs real log)
- desktop build clean, tsc clean, lint 0, home/ 89/89
- advances desktop-2/3: dispatches now produce durable events in ~/.fleetcrown/events.jsonl with proper runId/sentinel so stop-hooks and web control plane treat them as first-class
- still no embedded watcher (idle via co-running home/watcher.ts for now)

Refs: desktop-app.md phases, Cockpit.roadmap T1/T2, prior landing 2d98638
2026-06-02 14:54:51 +02:00
g-butandCursor 60f0cff749 feat(push): web push subscriptions and stop-hook notifications
Adds VAPID-backed subscribe/notify API, service worker, top-bar pill,
and Stop hook push_notify_stop for ambient agent-done signals on mobile.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 21:05:35 +02:00
g-but f6dc058459 chore(repo): sharpen public repo surface 2026-05-28 12:47:41 +02:00
g-butandCursor ec6f423b0f feat(infra): Postgres portability, Oracle cutover scripts, and DB kill-switch essay
Vendor-neutral DATABASE_URL helpers, dump/restore/sync tooling, and one-command
Oracle migration after a single console VM step. Publishes the studio-stack
thoughts article and hardens build (dynamic layout, resilient sitemap).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 11:24:20 +02:00
g-butandClaude Sonnet 4.6 d2ee8b993a feat(auth): resend SDK + styled emails, email verification, Groq fallback for Ivy
- Upgrade email.ts to resend SDK with sendEmailFire (fire-and-forget) and sendEmail (awaitable)
- Add styled HTML templates for verification, welcome, and password reset emails
- Add email_verification_tokens table + queries (mirrors password-reset-tokens pattern)
- Register route now sends verification + welcome emails after sign-up
- Add /verify-email/[token] page and /api/auth/verify-email/[token] route to consume tokens
- Add /verify-email page (success, expired-link, and resend states)
- Add /api/auth/resend-verification route with rate limiting
- Add verify-email to proxy public route exclusions
- Add Groq (llama-3.3-70b-versatile) fallback to /api/ivy when openclaw is unavailable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 14:56:15 +02:00
g-butandClaude Sonnet 4.6 048a66b8c7 fix(queue): clear selection on reorder, atomic remove() via setQueue updater
- After drag-to-reorder, selected Set still held old indices — item X selected
  could now refer to a different item at that position. Clear on drop instead.
- remove() was reading from localStorage which may lag behind React state when
  called immediately after enqueue(). Switch to setQueue updater form so next
  is derived from the authoritative React state, then write localStorage and
  file synchronously inside the updater before returning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 16:43:59 +02:00
g-butandClaude Sonnet 4.6 c47a22eb5f feat(billing): Stripe subscription infrastructure — schema, routes, BillingSettings UI
Adds complete ready-to-activate payment infrastructure:
- DB: plan/planStatus/stripeCustomerId/stripeSubscriptionId on users table
- src/lib/stripe.ts: Stripe client + price ID config (returns null until keys added)
- /api/stripe/checkout: creates checkout session for personal/pro/team plans
- /api/stripe/portal: redirects to Stripe billing portal for subscription management
- /api/stripe/webhook: handles subscription lifecycle (activated, updated, canceled)
- BillingSettings component: shows current plan, monthly/annual toggle, upgrade cards
- Settings page: BillingSettings wired in above ProjectsSettings
- Landing: pricing CTAs pass ?plan= param when Stripe is ready

Activate by adding to .env.local:
  STRIPE_SECRET_KEY=sk_live_...
  STRIPE_WEBHOOK_SECRET=whsec_...
  STRIPE_PRICE_PERSONAL_MONTHLY=price_...
  STRIPE_PRICE_PERSONAL_ANNUAL=price_...
  STRIPE_PRICE_PRO_MONTHLY=price_...
  STRIPE_PRICE_PRO_ANNUAL=price_...
  STRIPE_PRICE_TEAM_MONTHLY=price_...
  STRIPE_PRICE_TEAM_ANNUAL=price_...

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 14:08:06 +02:00
g-butandClaude Sonnet 4.6 27d9ce0171 feat(thoughts): add image and Mermaid diagram support to parser and renderer
- Parser: new 'image' block (![alt](src)) and 'code' block (fenced backtick blocks)
  Paragraph accumulator breaks on backtick fences and ![ so neither leaks into prose
- MermaidDiagram client component: dynamic mermaid import, dark theme matching
  Cockpit surface colors; SVG inline; falls back to raw text on render error
- Page: Next.js Image for image blocks with figcaption; MermaidDiagram for mermaid
  fenced blocks; pre/code for all other lang tags
- Images convention: /public/thoughts/{slug}/, referenced as /thoughts/{slug}/file

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 17:42:45 +02:00
g-butandClaude Sonnet 4.6 e84b6d4f0a feat: GitHub OAuth, design system rebuild, reliability fixes (M1-M7)
Auth & multi-user:
- GitHub OAuth via next-auth DrizzleAdapter; signIn callback absorbs first
  login into is_default=true user so all pre-auth data stays accessible
- getCurrentUserId() helper; onboarding + profile pages
- normalizeUsername() extracted to lib/username.ts (DRY fix)

Design system:
- All public pages (landing, sign-in, onboarding, settings) rebuilt to use
  ui-* classes and semantic tokens only — zero raw Tailwind color violations
- ui-input, ui-btn-*, ui-panel, bg-surface-*, text-text-* throughout

Reliability (M1–M7):
- M1: Stale claude-stop-active lock cleanup on stop hook entry
- M2: /api/inject validates tab exists in Zellij before writing /tmp
- M3: Prompt SSOT unified — claude-prompts.json single array format
- M4: DBUS UID hardcode removed (already in dotfiles)
- M5: auth.ts signIn callback + AdapterAccountType cast
- M6: project_states DB table — persists ready/closing/closed/session/prompt
  across reboots; stop.sh PATCHes on stop/close; control falls back to DB
  when /tmp is empty (24h window); inject writes currentPrompt to DB
- M7: scheduleOpenClawWorker now async; waits for spawn event (2s timeout);
  marks run as error in DB if worker fails to start

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 18:20:46 +02:00
g-butandClaude Sonnet 4.6 3a56dbc748 chore: seed scripts, crons, sessions, docs, gitignore, package updates
- scripts/seed.ts + seed-goals.ts — updated entity/attribute seeding
- src/app/api/crons/route.ts — cron schedule updates
- src/app/api/sessions/route.ts — session handling fix
- docs/ — openclaw orchestration plan document
- .gitignore — added .next/logs to ignore list
- package.json/lock — dependency updates
- next-env.d.ts — auto-generated update

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:50:29 +02:00
g-butandClaude Opus 4.7 b53421dfb5 chore(deps): bump next 16.2.2 → 16.2.4 (high-severity DoS CVE)
Patch-level bump within the 16.x line. npm flagged it as outside the
stated dep range only because package.json pinned exactly "16.2.2";
relaxing to "16.2.4" lets the security patch land without --force.

Fixes the high-severity advisory:
  next  Denial of Service with Server Components
  GHSA-q4gf-8mx6-v5v3

Vulnerability count: 6 (5 moderate, 1 high) → 6 (all moderate).
The remaining moderates are transitive (esbuild via @esbuild-kit
inside drizzle-kit, postcss-via-next on a different branch) and need
larger major-version bumps that aren't safe to do automatically.

Bumps eslint-config-next in lockstep (same 16.2.2 → 16.2.4) since
they're released together and stay version-synced.

Verified: tsc clean, eslint clean, smoke 18/18.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 20:42:42 +02:00
g-butandClaude Opus 4.7 851b6b8509 chore(deps): npm audit fix — patches @hono, hono, postcss CVEs
Non-breaking semver-range updates to three transitive deps that had
moderate-severity advisories. All transitive — no direct package.json
change needed.

  @hono/node-server  1.19.12 → 1.19.14   GHSA-92pp-h63x-v22m
  hono               4.12.10 → 4.12.15   (multiple GHSAs in chain)
  postcss            8.5.8   → 8.5.10    GHSA-qx2v-qp2m-jg93

Vulnerability count drops from 8 → 6. The remaining 6 (5 moderate, 1
high — Next.js DoS via Server Components, GHSA-q4gf-8mx6-v5v3) need
`npm audit fix --force` which is a breaking dep upgrade (next major)
and warrants the user's call before shipping.

Verified: tsc clean, eslint clean, prod build passes, smoke 18/18.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:52:45 +02:00
g-butandClaude Opus 4.7 bceacc8222 chore(husky): add pre-commit hook running tsc + eslint
Adds husky as a dev dep and wires .husky/pre-commit to run:
  npx tsc --noEmit
  npx eslint src/

Both must pass for the commit to land. Smoke is intentionally NOT in
the hook because it needs a live dev server — run `npm run smoke`
manually before opening a PR.

Catches the regressions a 100-commit refactor sweep can introduce
(broken zod schema, missed import, accidentally-disabled rule)
before they reach origin/main, complementing the human / cron /
agent commit flow we've established.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:35:54 +02:00
g-but 0e0852330a feat: initial commit 2026-04-04 22:47:22 +02:00