a kernel for every random integration
  • Python 92.1%
  • HTML 3.1%
  • Go 1.6%
  • JavaScript 1.4%
  • HCL 0.9%
  • Other 0.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
John 4100ba22cf
All checks were successful
Corn Release / release-1 (push) Successful in 8s
Corn Release / release (push) Successful in 0s
Corn CI / release-check-1 (push) Successful in 14s
Corn CI / release-check (push) Successful in 0s
Corn CI / host (push) Successful in 20s
Corn CI / test (push) Successful in 4m50s
Architecture Wiki / publish architecture (push) Successful in 5m28s
Corn CI / release (push) Successful in 8m31s
Merge pull request 'remove(pinchtab): drop the PinchTab upstream (v0.2.3)' (#119) from remove/pinchtab into main
2026-11-28 16:11:23 +00:00
.forgejo/workflows chore(release): bundle the opt-in Browse driver in dev.8 2026-11-28 03:54:02 +00:00
deploy remove(pinchtab): drop the PinchTab upstream, spec, docs and tests (v0.2.3) 2026-11-28 16:04:16 +00:00
docs feat(browse): Chromium only; drop Zen/BiDi (v0.2.1) 2026-11-28 11:39:45 +00:00
scripts feat(browse): drive SealSkin agent browsers with Playwright; no registry (v0.1.1-dev.10) 2026-11-28 09:21:58 +00:00
src/corn remove(pinchtab): drop the PinchTab upstream, spec, docs and tests (v0.2.3) 2026-11-28 16:04:16 +00:00
tests remove(pinchtab): drop the PinchTab upstream, spec, docs and tests (v0.2.3) 2026-11-28 16:04:16 +00:00
yawn chore(release): bundle the opt-in Browse driver in dev.8 2026-11-28 03:54:02 +00:00
.dockerignore Make deployment Compose self-contained with inline shared environment 2026-11-08 07:37:38 +00:00
.env.example Release v0.1.0-dev.21: configurable REST CORS allowed origins 2026-11-11 23:39:19 +00:00
.gitattributes feat(upstream): REST APIs from a bundled OpenAPI spec with personal-token auth (0.1.1-dev.5) 2026-11-26 10:19:26 +00:00
.gitignore Release v0.1.0-dev.25: fix pre-hydration autocomplete race and harden release verification 2026-11-16 02:16:12 +00:00
.gitleaksignore ci(security): nightly + PR security scan from john/release 2026-11-16 22:32:16 +00:00
.security.json ci(security): nightly + PR security scan from john/release 2026-11-16 22:32:16 +00:00
boot-smoke.sh feat(upstream): bundle PinchTab OpenAPI 3 spec for per-user browser tools 2026-11-27 14:35:42 +00:00
compose.dev.yaml Release v0.1.0-dev.4: Apple AU pricing and credential forms 2026-11-10 13:01:03 +00:00
compose.yaml feat: per-user OAuth for upstream MCP servers (Coder first) 2026-11-20 13:54:09 +00:00
Dockerfile fix(image): fetch libatomic with apt-get install --download-only 2026-11-28 07:13:11 +00:00
go.mod chore(yawn): pin cdk 0.3.0-dev.54 and format yawn/*.go 2026-11-23 22:36:57 +00:00
go.sum chore(yawn): pin cdk 0.3.0-dev.54 and format yawn/*.go 2026-11-23 22:36:57 +00:00
pipelines.json Own the CT 125 host in a separate, approval-gated release 2026-11-24 10:27:23 +00:00
pyproject.toml remove(pinchtab): drop the PinchTab upstream, spec, docs and tests (v0.2.3) 2026-11-28 16:04:16 +00:00
README.md feat(browse): add owner-gated read-only Chromium attachment 2026-11-28 03:46:58 +00:00
release.json Releases via the shared john/release policy 2026-11-16 21:38:25 +00:00
yawn.json chore(release): bundle the opt-in Browse driver in dev.8 2026-11-28 03:54:02 +00:00

Corn 🌽

Private self-hosted FastMCP personal tools with a server-rendered web console (FastAPI + Jinja + HTMX), Pocket ID sign-in, encrypted per-user credentials, REST and MCP. Each replica runs one process. The managed fleet shares a host-local SQLite database in WAL mode behind a load balancer.

Deployment and updates

Managed corn.yawn.dev: follow the managed runbook. The fleet uses a reviewed version and digest, not :dev.

Standalone: the sample uses the prebuilt Forgejo image code.yawn.dev/john/corn:dev. Update with docker compose -f compose.local.yaml up -d --pull always --no-build --no-deps corn. Images support Linux AMD64 and ARM64 (including Apple Silicon Docker Desktop). No source pull or local build is required. Published SemVer releases advance only the matching allowlisted channel: dev for candidates or latest for stable versions without a prerelease suffix. Full version tags remain available. See deployment for the one-time switch and data-preservation steps.

Console

Open the normal Corn origin. Signed out, / shows the login page; signed in, it opens Connections. Each task has its own bookmarkable URL (/fuel, /transport, /shopping, /calendar, /connections, /notifications, /keys), so the back button, new tabs and refresh behave normally.

Everything is an ordinary HTML form: Enter submits, Tab moves between fields, and the console still works with JavaScript disabled. HTMX (bundled locally, with Leaflet for the map) only swaps result sections in place. Place pickers are a single field: type, use ↑/↓ and Enter. There are no WebSockets, so the reverse proxy needs only plain HTTP to the whole origin.

Every form submission carries a token bound to your session, and cross-origin submissions (including other subdomains of your site) are rejected. Your session is re-checked after every provider call, so a revoked session never receives results. HTML responses are no-store, and a Content-Security-Policy blocks inline and third-party scripts.

  • Connections: existing credentials are shown as configured metadata only. NSW FuelCheck needs API.NSW application key + secret; Proton needs its private read-only HTTPS ICS URL. Secrets clear on save and never prefill from the DB.
  • Fuel: selected fuel type within a strict radius. Place search, explicit coordinates or opt-in browser location; cheapest/nearest sorting, straight-line distance and provider timestamp. Provider fallback stations outside the radius are excluded unless explicitly included.
  • Fuel history: viewing a month automatically downloads NSW's official monthly FuelCheck file once and persists it in SQLite. No manual import is required. The Fuel page defaults to the latest published month; choose another month to browse or backfill it, with whole-month or last 7/14/30-day charts. Each station gets a daily-low sparkline, and an overall chart shows cheapest-by-day and average. GET /api/v1/nsw/fuel/history?month=2026-10 and MCP nsw_fuel_history_month expose the same read-through behaviour with bulk station IDs and pagination. Explicit stored months work offline after restart. Live API credentials are not required for the historical REST/bulk MCP endpoints. Official data starts August 2016; the importer supports modern layouts from January 2017 (older layouts are refused). Catalogue discovery handles titles ending in .xlsx as well as plain month names. Prices are never extrapolated across missing months. The catalogue is checked at most every six hours; an explicit import/refresh remains available for corrections. Charts are server-rendered SVG: no extra JavaScript.
  • Transport: Departures, Plan a journey, Live map and Disruptions. Readable scheduled/estimated Sydney times, route/viewport filtering, vehicle markers, freshness/speed/occupancy when supplied. Automatic bounded GTFS route/trip/stop metadata cache supplies line names and destinations; readable per-line counts, 15-second realtime cache and hidden old positions. No GPS-invented ETAs/fares.
  • Shopping: Apple AU live search and fresh visible-page availability, with generic retailer adapter boundaries. Bounded concurrency, reusable connections, pagination, name/price sorting, new/refurbished categories, per-product or batch availability refresh. Exact colour/capacity SKUs, matching in-stock stores and separately labelled alternatives. Model → size/configuration → colour grouping, model/size/variant refresh and explicit stock states. Invalid postcodes surface once beside the input. Price checks never stand in for stock checks. Successful checks with no positive exact-SKU pickup result default to Out of stock — check vendor. Request failures remain errors. Store pickup is checked for iPhone and iPad only; Mac, Watch, AirPods and other models keep prices and show Check pickup on Apple with a direct link (Apple serves their pickup data only to its own site).
  • Calendar: manual read-only lookups. Transport map auto-refresh is opt-in and active only while its view is open; no shopping watches or background stock jobs.
  • Notifications/API Keys: SMTP configuration presence (not send test), and mint/list/revoke existing Corn API keys.

One TfNSW key

Use TfNSW (Trip Planner + realtime) to save a shared key in nsw/tfnsw. It must have access to both TfNSW products; this is not your FuelCheck key. Only nsw/tfnsw is used. Legacy trip_planner / public_transport fallback and promotion logic have been removed. Old encrypted entries remain inert until you explicitly delete them; removing the shared key does not restore legacy selection. No credentials are rewritten at startup; no schema/envelope/identity changes.

Optional approximate location

Shopping suggests an editable postcode or suburb automatically when the page opens (switchable off), using ipapi.co from your browser (provider sees your public IP). PO Box postcodes that Apple rejects are replaced with the city name, and manual edits always win over a delayed lookup result. Fuel/map retain explicit location buttons. No lookup before Shopping is opened, no GPS, no server-IP lookup or persistent IP/location store. Minimal browser-page cache lasts one hour; VPN/mobile IPs may be wrong.

Transport uses debounced place suggestions (choosing a stop loads departures; choosing a destination with an origin set plans the journey), 15-minute per-user/key/query read-through cache, explicit selection and coordinate routing for address/POI results. A shared mode filter spans transport tabs; departure and disruption results group by mode, mixed-mode journeys retain all their legs. Live map controls precede tables; raw route/service/trip/vehicle keys are visible. Calendar uses a day-grouped agenda with expandable event details. Shopping defaults to All conditions. Exact pickup eligibility is sufficient for In stock; no quantity is required. Same-batch exact-SKU evidence is reused. A successful pickup check with no available exact-SKU result defaults to Out of stock — check vendor. Empty store lists, omitted parts and recommendation-only responses follow the same rule. Unattempted checks and request failures are not stock conclusions.

Open WebUI: MCP or OpenAPI

Both interfaces remain supported. In Admin → Settings → Integrations → External Tool Servers, choose one (labels vary by Open WebUI version):

Connection URL / settings
MCP (Streamable HTTP) https://<corn-host>/mcp
OpenAPI Base URL https://<corn-host>, specification path /api/openapi.json

/api/openapi.yaml remains supported; JSON and YAML are generated from the same reviewed contract. Use Bearer authentication with a Corn API key minted in the console, not the Open WebUI session token. No MCPO bridge is required for native MCP. Click Verify/refresh the tool server after updating Corn; cached schemas may retain old tool lists. Prefer one connection type per model to avoid duplicate tools.

Personal/direct OpenAPI connections run in your browser and require Corn's CORN_ALLOWED_ORIGINS to include the Open WebUI origin, for example "https://ai.yawn.dev" in managed private configuration or your standalone Compose environment. This enables preflights and REST/schema response headers, not cross-origin console-cookie access. Empty/unset disables REST CORS. Multiple origins are comma-separated; do not enter the Corn API URL, paths or wildcards. See the existing Compose update steps. Global Admin tool connections run server-side and do not need browser CORS.

All 24 documented REST operations have explicit, unique operation IDs. The served spec expands parameter references for Open WebUI's parser. API-key lifecycle and browser session routes are intentionally excluded from tool discovery. Connection write/delete operations can alter credentials: disable these for normal assistant use unless explicitly needed. A shared Bearer key executes as its owner, so limit access or use separate per-user connections. Configure a longer tool timeout for first-time monthly fuel-history imports.

FastAPI generates OpenAPI 3.1 from the typed registry in src/corn/contracts.py. JSON and YAML serialize the same contract; there is no hand-maintained schema. CI validates operation IDs, route coverage, private-route exclusions and argument compatibility. See the runtime architecture.

Runner pooling and safe acceptance

PR/main ci.yml and release validation use ${{ vars.CI_GENERAL_RUNNER || 'ubuntu-latest' }} with the official multiarch code.yawn.dev/john/runner-images:ubuntu-24.04 job container. An unset/empty variable keeps routing on the legacy runner. Only after both runners have the ci-linux label and are ready, explicitly set the Actions variable CI_GENERAL_RUNNER=ci-linux to enable available-capacity pooling (not strict round robin). Clear the variable to roll routing back.

The image build/publish job in publish.yml is pinned to ubuntu-latest on chaos, where the job container supports rootless Buildah. It does not need a Docker socket. Keep zuko on zuko-arm64 and the shared pool.

For non-publishing acceptance, manually dispatch Corn CI (ci.yml) against an explicit reviewed branch/ref, with runner=zuko-arm64 to prove native ARM64 execution. The manual-only selector defaults to ci-linux; ubuntu-latest is also available. PR/main routing still uses the existing general variable and fallback. For example, from this repository:

gt workflow run ci.yml --ref REVIEWED_BRANCH -f runner=zuko-arm64

CI runs the identical Python dependency installation, pytest, Chromium browser smoke tests and wheel build used by release validation, in the same Ubuntu 24.04 image with a 60-minute job bound. Workflow-contract tests prevent command drift. The test job does not publish images or advance channels. The separate managed intake job runs only after tests pass on a push to main with CORN_CD_ENABLED=true; PRs and manual runner checks cannot submit it. Generated workflows come from the Go app in yawn/. Inspect the run's runner identity, architecture and result as evidence.

Pipeline declarations

Edit yawn/ci.go, yawn/publish.go, or yawn/cd.go, then from the repo root run go run ./yawn (Go 1.27.4). Commit the outputs: .forgejo/workflows/*.yml, yawn.json (compatibility task index for yawn run), and deploy/managed/release.json (the data-only CD declaration). go run ./yawn -check checks all projections without writing. Do not hand-edit the projections.

The managed Compose payload remains here. The release platform reads the committed declaration at the admitted revision, then reconciles the existing Corn graph using only registered workers. It owns the target, plan and approval; it does not run this Go app on its privileged executor. A pipeline- only change can exercise admission and the no-change plan without creating a release tag, publishing an image, or restarting Corn. Do not dispatch Corn Publish just to test runner acceptance.

Release pipeline

Releases use the shared policy in john/release. release.json lists the only version locations: pyproject.toml, src/corn/__init__.py and the notes file deploy/releases/<version>.md.

To release, open a PR that bumps the version (release.py next dev, then release.py bump X.Y.Z-dev.N from john/release) and adds its notes file. PR CI checks the files agree, the version is newer than every tag and notes exist. Merging the reviewed PR is the approval. release.yml (Corn Release) then tags that exact merge commit, records the Forgejo release and starts Corn Publish (publish.yml) at the tag. Version, commit and prerelease flag come from the tag. To retry, run Corn Publish at that same release tag. A merge that doesn't change the version creates no new tag or image, but its green main CI can still submit the separate managed deployment intake when enabled.

Corn Publish holds one workflow-level corn-image-channels concurrency lock (no cancellation) over both jobs and channel writes, including retries:

  1. validate uses the shared pool/Ubuntu 24.04 image. It checks source versions, prerelease/channel rules and existing tag/release identity via the unchanged guarded scripts/release.py validate path (after the shared release guard confirms a release tag on main whose files match), then runs regression/browser tests and builds a wheel. It exports the exact checked-out SHA, normalized image tag, version and channel only after preflight succeeds. The release token is scoped to that preflight step (it performs API reads); no registry credentials or Docker operations run here.
  2. release requires successful validation and stays pinned to ubuntu-latest. It checks out needs.validate.outputs.sha, never the moving target branch, checks HEAD equality and repeats release guards before registry access (also on publish-job retries). The shared rootless Buildah action builds and smoke-tests AMD64/ARM64 images. Retries reuse a matching immutable image. The job verifies its digest and platform configs, confirms the Forgejo release, then advances the matching channel without downgrading it. Failures stop downstream writes.

Release validation uses the FORGE_RELEASE_TOKEN secret as CORN_RELEASE_TOKEN for tag checks; it is not a secret-free acceptance mode. Failed validation reports failure separately; publish reports its final outcome. Tag publication and deployment are separate: green main CI can submit the exact revision to xyOps. Submission is not deployment; the managed flow plans first and an operator must Resume to apply a change. See the managed runbook.

Data safety and deployment

Keep the same CORN_SECRET_KEY, database URL, volume/bind mount and Compose project. The console reuses corn_web_session; it does not introduce a second identity or credential store. Every request checks the persisted session. Namespaced writes are atomic and preserve unrelated credentials. Never use down -v for an update.

See deployment, architecture, and the code review. Browse is an optional, read-only pilot for attaching to an owner-approved private Chromium browser. Release notes are archived under deploy/releases/.

One runtime tool contract

src/corn/contracts.py defines typed operation inputs, paths, operation IDs and explicit MCP compatibility mappings. FastAPI generates OpenAPI 3.1 at runtime; JSON and YAML endpoints serialize the same cached document. No hand-maintained OpenAPI YAML is shipped. Overlapping MCP tools use generated Pydantic input schemas and call those same typed REST adapters in-process, with each caller's current Bearer token (never a shared service key). Existing response handlers are reused.

Changing a shared parameter's type/default/constraints updates both discovery interfaces and REST validation. Aliases only describe intentional differences: calendar tz/timezone_name, history CSV/list IDs, split fuel searches, shopping vendor default, and transit-live subset. Health/whoami and composite history/import remain MCP-only. Credential management remains REST-only. Response payloads remain owned by existing services; this release does not add exhaustive typed outputs.

Tests use synthetic credentials/temp databases; uploaded or deployed secrets are not copied into fixtures, source or logs.