Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f276a8d
feat: add APN relay MVP and experimental push bridge
R44VC0RP Mar 28, 2026
cf79208
mobile-voice commit
R44VC0RP Mar 28, 2026
d065d5a
Add Porter workflow files for APN relay project (#19547)
porter-deployment-app[bot] Mar 28, 2026
56e0e5c
Update packages json for the porter stuff
R44VC0RP Mar 28, 2026
0051b60
feat: improve mobile model download UX and relay defaults
R44VC0RP Mar 28, 2026
f080147
update for app and bun
R44VC0RP Mar 28, 2026
bd6e81f
update for env checks
R44VC0RP Mar 28, 2026
b737e87
update env again
R44VC0RP Mar 28, 2026
f1e88d3
update for the db.ts
R44VC0RP Mar 28, 2026
3a5be7a
update index.ts
R44VC0RP Mar 28, 2026
62fae6d
fix: auto-recover APNs env mismatch in relay
R44VC0RP Mar 28, 2026
0a9fcab
chore: update dependencies and enhance mobile-voice functionality
R44VC0RP Mar 28, 2026
52d1ee7
feat: use new mobile app icon and QR-only server add flow
R44VC0RP Mar 28, 2026
a45c3a0
feat: harden mobile server flow and enrich push alerts
R44VC0RP Mar 28, 2026
bd2e34f
update
R44VC0RP Mar 28, 2026
2abf110
update for whisper
R44VC0RP Mar 29, 2026
ddd30ef
update
R44VC0RP Mar 29, 2026
eadb0e2
update to the apn and server management
R44VC0RP Mar 29, 2026
9a8b2ae
update apn server
R44VC0RP Mar 29, 2026
d3ec6f7
feat: route push notifications by server and session
R44VC0RP Mar 29, 2026
cb535ee
feat: support advertised QR hosts for mobile pairing
R44VC0RP Mar 29, 2026
2f44d19
feat: support deep-link QR pairing in mobile
R44VC0RP Mar 29, 2026
ab7b1d7
Update settings
R44VC0RP Mar 30, 2026
8ee4ada
update for onboarding
R44VC0RP Mar 30, 2026
ec27518
update mobile voice quality guardrails
R44VC0RP Mar 30, 2026
785635c
refactor mobile onboarding config
R44VC0RP Mar 30, 2026
f8f9865
refactor mobile session payload parsing
R44VC0RP Mar 30, 2026
df3276f
refactor mobile web color hydration
R44VC0RP Mar 30, 2026
49b40e3
refactor mobile fire-and-forget calls
R44VC0RP Mar 30, 2026
922633e
refactor mobile derived ui state
R44VC0RP Mar 30, 2026
abf79ae
refactor mobile screen orchestration
R44VC0RP Mar 30, 2026
bcf7817
update mobile dictation controls
R44VC0RP Mar 30, 2026
aacf1d2
update app hanlding
R44VC0RP Mar 30, 2026
15fae6c
update mobile pairing flow and audio session handling
R44VC0RP Mar 30, 2026
6494f48
update
R44VC0RP Mar 30, 2026
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
27 changes: 27 additions & 0 deletions .github/workflows/porter-app-5534-apn-relay.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"on":
push:
branches:
- opencode-remote-voice
name: Deploy to apn-relay
jobs:
porter-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set Github tag
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Setup porter
uses: porter-dev/setup-porter@v0.1.0
- name: Deploy stack
timeout-minutes: 30
run: porter apply
env:
PORTER_APP_NAME: apn-relay
PORTER_CLUSTER: "5534"
PORTER_DEPLOYMENT_TARGET_ID: d60e67f5-b0a6-4275-8ed6-3cebaf092147
PORTER_HOST: https://dashboard.porter.run
PORTER_PROJECT: "18525"
PORTER_TAG: ${{ steps.vars.outputs.sha_short }}
PORTER_TOKEN: ${{ secrets.PORTER_APP_18525_975734319 }}
222 changes: 128 additions & 94 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,128 +1,162 @@
- To regenerate the JavaScript SDK, run `./packages/sdk/js/script/build.ts`.
- ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE.
- The default branch in this repo is `dev`.
- Local `main` ref may not exist; use `dev` or `origin/dev` for diffs.
- Prefer automation: execute requested actions without confirmation unless blocked by missing info or safety/irreversibility.
# OpenCode Monorepo Agent Guide

## Style Guide
This file is for coding agents working in `/Users/ryanvogel/dev/opencode`.

### General Principles
## Scope And Precedence

- Keep things in one function unless composable or reusable
- Avoid `try`/`catch` where possible
- Avoid using the `any` type
- Prefer single word variable names where possible
- Use Bun APIs when possible, like `Bun.file()`
- Rely on type inference when possible; avoid explicit type annotations or interfaces unless necessary for exports or clarity
- Prefer functional array methods (flatMap, filter, map) over for loops; use type guards on filter to maintain type inference downstream
- Start with this file for repo-wide defaults.
- Then check package-local `AGENTS.md` files for stricter rules.
- Existing local guides include `packages/opencode/AGENTS.md` and `packages/app/AGENTS.md`.
- Package-specific guides override this file when they conflict.

### Naming
## Repo Facts

- Package manager: `bun` (`bun@1.3.11`).
- Monorepo tool: `turbo`.
- Default branch: `dev`.
- Root test script intentionally fails; do not run tests from root.

## Cursor / Copilot Rules

- No `.cursor/rules/` directory found.
- No `.cursorrules` file found.
- No `.github/copilot-instructions.md` file found.
- If these files are added later, treat them as mandatory project policy.

## High-Value Commands

Run commands from the correct package directory unless noted.

### Root

- Install deps: `bun install`
- Run all typechecks via turbo: `bun run typecheck`
- OpenCode dev CLI entry: `bun run dev`
- OpenCode serve (common): `bun run dev serve --hostname 0.0.0.0 --port 4096`

### `packages/opencode`

Prefer single word names for variables and functions. Only use multiple words if necessary.
- Dev CLI: `bun run dev`
- Typecheck: `bun run typecheck`
- Tests (all): `bun test --timeout 30000`
- Tests (single file): `bun test test/path/to/file.test.ts --timeout 30000`
- Tests (single test name): `bun test test/path/to/file.test.ts -t "name fragment" --timeout 30000`
- Build: `bun run build`
- Drizzle helper: `bun run db`

### Naming Enforcement (Read This)
### `packages/app`

THIS RULE IS MANDATORY FOR AGENT WRITTEN CODE.
- Dev server: `bun dev`
- Build: `bun run build`
- Typecheck: `bun run typecheck`
- Unit tests (all): `bun run test:unit`
- Unit tests (single file): `bun test --preload ./happydom.ts ./src/path/to/file.test.ts`
- Unit tests (single test name): `bun test --preload ./happydom.ts ./src/path/to/file.test.ts -t "name fragment"`
- E2E tests: `bun run test:e2e`

- Use single word names by default for new locals, params, and helper functions.
- Multi-word names are allowed only when a single word would be unclear or ambiguous.
- Do not introduce new camelCase compounds when a short single-word alternative is clear.
- Before finishing edits, review touched lines and shorten newly introduced identifiers where possible.
- Good short names to prefer: `pid`, `cfg`, `err`, `opts`, `dir`, `root`, `child`, `state`, `timeout`.
- Examples to avoid unless truly required: `inputPID`, `existingClient`, `connectTimeout`, `workerPath`.
### `packages/mobile-voice`

```ts
// Good
const foo = 1
function journal(dir: string) {}
- Start Expo: `bun run start`
- Start Expo dev client: `bunx expo start --dev-client --clear --host lan`
- iOS native run: `bun run ios`
- Android native run: `bun run android`
- Lint: `bun run lint`
- Expo doctor: `bunx expo-doctor`
- Dependency compatibility check: `bunx expo install --check`

// Bad
const fooBar = 1
function prepareJournal(dir: string) {}
```
### `packages/apn-relay`

Reduce total variable count by inlining when a value is only used once.
- Start relay: `bun run dev`
- Typecheck: `bun run typecheck`
- DB connectivity check: `bun run db:check`

```ts
// Good
const journal = await Bun.file(path.join(dir, "journal.json")).json()
## Build / Lint / Test Expectations

// Bad
const journalPath = path.join(dir, "journal.json")
const journal = await Bun.file(journalPath).json()
```
- Always run the narrowest checks that prove your change.
- For backend changes: run package typecheck + relevant tests.
- For mobile changes: run `expo lint` and at least one `expo` compile-style command if possible.
- Never claim tests passed unless you ran them in this workspace.

### Destructuring
## Single-Test Guidance

Avoid unnecessary destructuring. Use dot notation to preserve context.
- Prefer running one file first, then broaden scope.
- For Bun tests, pass the file path directly.
- For name filtering, use `-t "..."`.
- Keep original timeouts when scripts define them.

```ts
// Good
obj.a
obj.b
## Code Style Guidelines

// Bad
const { a, b } = obj
```
These conventions are already used heavily in this repo and should be preserved.

### Variables
### Formatting

Prefer `const` over `let`. Use ternaries or early returns instead of reassignment.
- Use Prettier defaults configured in root: `semi: false`, `printWidth: 120`.
- Keep imports grouped and stable; avoid noisy reorder-only edits.
- Avoid unrelated formatting churn in touched files.

```ts
// Good
const foo = condition ? 1 : 2
### Imports

// Bad
let foo
if (condition) foo = 1
else foo = 2
```
- Prefer explicit imports over dynamic imports unless runtime gating is required.
- Prefer existing alias patterns (for example `@/...`) where already configured.
- Do not introduce new dependency layers when a local util already exists.

### Types

- Avoid `any`.
- Prefer inference for local variables.
- Add explicit annotations for exported APIs and complex boundaries.
- Prefer `zod` schemas for request/response validation and parsing.

### Naming

- Follow existing repo preference for short, clear names.
- Use single-word names when readable; use multi-word only for clarity.
- Keep naming consistent with nearby code.

### Control Flow

Avoid `else` statements. Prefer early returns.
- Prefer early returns over nested `else` blocks.
- Keep functions focused; split only when it improves reuse or readability.

### Error Handling

- Fail with actionable messages.
- Avoid swallowing errors silently.
- Log enough context to debug production issues (IDs, env, status), but never secrets.
- In UI code, degrade gracefully for missing capabilities.

### Data / DB

- For Drizzle schema, use snake_case fields and columns.
- Keep migration and schema changes minimal and explicit.
- Follow package-specific DB guidance in `packages/opencode/AGENTS.md`.

```ts
// Good
function foo() {
if (condition) return 1
return 2
}
### Testing Philosophy

// Bad
function foo() {
if (condition) return 1
else return 2
}
```
- Prefer testing real behavior over mocks.
- Add regression tests for bug fixes where practical.
- Keep fixtures small and focused.

### Schema Definitions (Drizzle)
## Agent Workflow Tips

Use snake_case for field names so column names don't need to be redefined as strings.
- Read existing code paths before introducing new abstractions.
- Match local patterns first; do not impose a new style per file.
- If a package has its own `AGENTS.md`, review it before editing.
- For OpenCode Effect services, follow `packages/opencode/AGENTS.md` strictly.

```ts
// Good
const table = sqliteTable("session", {
id: text().primaryKey(),
project_id: text().notNull(),
created_at: integer().notNull(),
})
## Known Operational Notes

// Bad
const table = sqliteTable("session", {
id: text("id").primaryKey(),
projectID: text("project_id").notNull(),
createdAt: integer("created_at").notNull(),
})
```
- `packages/app/AGENTS.md` says: never restart app/server processes during that package's debugging workflow.
- `packages/app/AGENTS.md` also documents local backend+web split for UI work.
- `packages/opencode/AGENTS.md` contains mandatory Effect and database conventions.

## Testing
## Regeneration / Special Scripts

- Avoid mocks as much as possible
- Test actual implementation, do not duplicate logic into tests
- Tests cannot run from repo root (guard: `do-not-run-tests-from-root`); run from package dirs like `packages/opencode`.
- Regenerate JS SDK with: `./packages/sdk/js/script/build.ts`

## Type Checking
## Quick Checklist Before Finishing

- Always run `bun typecheck` from package directories (e.g., `packages/opencode`), never `tsc` directly.
- Ran relevant package checks.
- Updated docs/config when behavior changed.
- Avoided committing unrelated files.
- Kept edits minimal and aligned with local conventions.
Loading
Loading