Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/jevfish-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: JevFish web build is committed

on:
pull_request:
paths: ["jevfish/web/**"]
push:
branches: [main]
paths: ["jevfish/web/**"]

jobs:
dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
working-directory: jevfish/web
- run: npm run build
working-directory: jevfish/web
- name: web/dist matches the source
run: |
git status --porcelain jevfish/web/dist
test -z "$(git status --porcelain jevfish/web/dist)"
30 changes: 30 additions & 0 deletions JevFish.app/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>JevFish</string>
<key>CFBundleExecutable</key>
<string>JevFish</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundleIdentifier</key>
<string>com.markiewee.jevfish</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>JevFish</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.2.0</string>
<key>CFBundleVersion</key>
<string>0.2.0</string>
<key>LSMinimumSystemVersion</key>
<string>12.0</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
33 changes: 33 additions & 0 deletions JevFish.app/Contents/MacOS/JevFish
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Finder runs this when JevFish.app is opened. The work happens in jevfish/launcher/launch.sh.
here="$(cd "$(dirname "$0")" && pwd)"
root="$(cd "$here/../../.." && pwd)"
state="$HOME/Library/Application Support/JevFish"
has_launcher() { [ -f "$1/jevfish/launcher/launch.sh" ]; }

# Moved out of its folder: use the folder from the last good start.
if ! has_launcher "$root" && [ -f "$state/repo-path" ]; then
root="$(head -n 1 "$state/repo-path")"
fi
# A downloaded copy can run from a temporary path (App Translocation). Ask Spotlight.
if ! has_launcher "$root"; then
while IFS= read -r marker; do
candidate="$(cd "$(dirname "$marker")/../.." 2>/dev/null && pwd)"
if has_launcher "$candidate"; then
root="$candidate"
break
fi
done < <(mdfind -name jevfish-folder-marker 2>/dev/null)
fi
if ! has_launcher "$root"; then
osascript -e 'display alert "JevFish cannot find its files" message "Keep JevFish.app inside the JevFish folder you downloaded and open it from there." as critical' >/dev/null 2>&1
exit 1
fi

# macOS does not let an app read files in Desktop, Documents or Downloads, and gives no way
# to ask (that needs a paid Apple developer account). Terminal has the permissions the user
# granted it, so hand the same script to Terminal when the folder is out of reach.
if head -c 1 "$root/jevfish/launcher/launch.sh" >/dev/null 2>&1; then
exec /bin/bash "$root/jevfish/launcher/launch.sh" "$root"
fi
exec "${JEVFISH_OPEN_CMD:-open}" -a Terminal "$root/jevfish/launcher/launch.sh"
Binary file added JevFish.app/Contents/Resources/AppIcon.icns
Binary file not shown.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
> **This fork adds JevFish.** [`jevfish/`](jevfish/) is our own rebuild of MiroFish's five-stage pipeline. TypeSafe's Jev decides every simulated person's turn; an LLM only writes the text. The graph is local, so no Zep account is needed, and the prediction is calibrated. See [jevfish/README.md](jevfish/README.md). The original MiroFish code below is kept unchanged as reference.
>
> **To run it on a Mac, double-click `JevFish.app` in this folder.** The first start installs everything it needs and opens JevFish in your browser; the app then asks for your Jev and language-model keys on screen. No terminal, no Homebrew, no Node. If macOS blocks the app because you downloaded the ZIP, open System Settings, Privacy & Security, and click Open Anyway. Keep the folder in your home folder rather than Desktop, Documents or Downloads, or JevFish starts in a Terminal window instead. Full instructions: [jevfish/README.md](jevfish/README.md).

<div align="center">

Expand Down
2 changes: 1 addition & 1 deletion jevfish/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ data/
__pycache__/
*.pyc
web/node_modules/
web/dist/
!web/dist/
.cache/
log/
26 changes: 23 additions & 3 deletions jevfish/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,38 @@ Each simulated turn is a single Jev request containing seven typed questions:

## Run it

Double-click **JevFish.app** in this folder. Nothing else is needed: no terminal, no Homebrew, no Node.

- The first start installs uv and the Python packages (about 1 GB) with no admin password, then opens JevFish in your browser. It took 30 seconds on a fast connection and can take a few minutes on a slow one.
- Later starts take a few seconds, and reuse a JevFish that is already running.
- It uses the first free port from 5055 to 5064. Logs are in `~/Library/Logs/JevFish/`.
- If something goes wrong, a dialog says what, with a button that opens the log.

**Where you keep the folder matters.** macOS does not let an app read files in Desktop, Documents or Downloads, and an app can only ask for that with a paid Apple developer account. Keep the JevFish folder in your home folder, in Applications, or on another disk, and the app starts silently. From Desktop, Documents or Downloads it still works: the app hands the same start-up to Terminal, which uses the permissions you have already given it, and a Terminal window shows the progress.

Then the app asks for two keys on its Setup screen:
- **Jev** from [console.typesafe.ai](https://console.typesafe.ai). A typical run costs about US$0.04.
- **A language model**: a free [Gemini key](https://aistudio.google.com/apikey), or any OpenAI-compatible service (address, model, key).

"Save and check" stores them in `jevfish/.env` (readable only by you) and checks both with calls that cost nothing. There is also a **test mode** that runs every screen on deterministic fakes, so you can look around without keys. Every number it shows is made up.

**If macOS blocks the app**, it came from a downloaded ZIP, which macOS quarantines. Open System Settings, Privacy & Security, scroll to the JevFish message and click Open Anyway. A `git clone` has no such block.

### From the terminal

```sh
cd jevfish
uv sync
cd web && npm install && npm run build && cd ..
cd web && npm install && npm run build && cd .. # only if you change the web app; the built one is committed

export TYPESAFE_API_KEY=... # console.typesafe.ai
export TYPESAFE_API_KEY=... # or set the keys in the app
export GEMINI_API_KEY=... # or LLM_API_KEY + LLM_BASE_URL + LLM_MODEL for any OpenAI-compatible model
uv run jevfish serve # http://127.0.0.1:5055
```

- **Whole pipeline from the terminal:** `uv run jevfish demo` runs it on `examples/lazybee-cleaning.md`. That file uses example figures, not real Lazybee data.
- **No keys:** `JEVFISH_FAKE_JUDGE=1 JEVFISH_FAKE_LLM=1 uv run jevfish serve` runs everything on deterministic fakes, useful for trying the UI.
- **No keys:** `JEVFISH_FAKE_JUDGE=1 JEVFISH_FAKE_LLM=1 uv run jevfish serve` runs everything on deterministic fakes, the same as test mode.
- The API answers only requests addressed to this computer, and refuses changing requests sent from another website. `serve --host 0.0.0.0` turns that off and warns, which also exposes the key screen to your network.

Settings:
- `JEVFISH_DATA_DIR` sets where data is stored (default `jevfish/data`).
Expand Down
10 changes: 9 additions & 1 deletion jevfish/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ type Task = { id: string; kind: "graph"|"prepare"|"run"|"report"; project_id: st
```

## Meta
- `GET /api/health` returns `{ok, judge: "jev"|"fake"|"missing TYPESAFE_API_KEY", jev_model, llm: "<model>"|"fake"|"missing LLM_API_KEY", llm_fallbacks: string[], llm_base_url, data_dir}`.
- `GET /api/health` returns `{ok, app: "jevfish", setup_needed, judge: "jev"|"fake"|"missing TYPESAFE_API_KEY", jev_model, llm: "<model>"|"fake"|"missing LLM_API_KEY", llm_fallbacks: string[], llm_base_url, data_dir}`.
- **Local only:** every `/api/` request must be addressed to `127.0.0.1`, `localhost` or `::1`, and requests that change something must not come from another site's `Origin`. Anything else gets 403. `jevfish serve --host` beyond loopback turns the guard off and says so.
- `GET /api/tasks/<tid>` returns a Task. `POST /api/tasks/<tid>/cancel` cancels it and returns the Task.

## Setup
- `GET /api/settings` returns `{env_file, test_mode, setup_needed, typesafe_key, llm_provider: "gemini"|"openai", gemini_key, llm_key, llm_base_url, llm_model, active_tasks}`. Saved keys come back as the last four characters (`""` when the key is too short to hint at, `null` when none is saved). Full keys are never sent to the browser.
- `PUT /api/settings` saves keys and returns the same shape. Fields: `typesafe_key`, `llm_provider`, `llm_key`, `llm_base_url`, `llm_model`, `test_mode`. A blank key keeps the saved one. Writes `jevfish/.env` (mode 600) and applies at once, with no restart. Jobs already running keep the keys they started with.
- `POST /api/settings/check` checks the keys in the body, falling back to the saved ones, and returns `{jev: {ok, message}, llm: {ok, message}}`. Both checks are free: listing models for Jev and Gemini, a one-token request for other providers.
- `GET /api/example` returns `{name, requirement, seed_text}` for the example project.
- `POST /api/shutdown` stops the server, right after answering `{ok: true}`.

## Projects
```ts
type Project = { id: string; name: string; requirement: string; created_at: string; updated_at: string;
Expand Down
Loading
Loading