Skip to content

feat: change default port from 6969 to 3207 with fallback chain#273

Merged
BYK merged 1 commit into
mainfrom
feat/change-default-port-3207
May 12, 2026
Merged

feat: change default port from 6969 to 3207 with fallback chain#273
BYK merged 1 commit into
mainfrom
feat/change-default-port-3207

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 12, 2026

Summary

  • Replace the hardcoded default port 6969 with a fallback chain: 3207 (primary) -> 5673 (fallback) -> random OS-assigned port
  • Add port file discovery (~/.local/share/lore/gateway.port) so plugins find the gateway even on a random fallback port
  • Refactor both OpenCode and Pi plugins to use the gateway's startGateway() instead of duplicating startup logic

Port Mnemonics

  • 3207: flip upside-down (calculator-word style) -> 7=L, 0=O, 2=R, 3=E -> LORE
  • 5673: T9 phone keypad -> 5=L, 6=O, 7=R, 3=E -> LORE

Details

Gateway core

  • config.ts: Added DEFAULT_PORTS = [3207, 5673], DEFAULT_PORT, and portExplicit flag to GatewayConfig
  • portfile.ts (new): writePortFile(), readPortFile(), removePortFile() for plugin discovery
  • server.ts: Fixed port 0 + multi-host binding — pins resolved port after first Bun.serve() so all hosts share the same actual port
  • start.ts: Rewrote startGateway() with fallback loop. Explicit --port / LORE_LISTEN_PORT skips the chain.
  • index.ts: Exported startGateway, probeGateway, readPortFile, DEFAULT_PORTS, DEFAULT_PORT

Plugins

  • OpenCode + Pi: Replaced hardcoded http://127.0.0.1:6969 with resolveGatewayUrl() (probes port file + known defaults). Refactored startInProcess() to delegate to startGateway(), eliminating duplicated EADDRINUSE handling.

Docs

  • Updated all 11 references to 6969 across help text, CLI comments, README, and landing page

Verification

  • bun run typecheck — all 4 packages pass
  • bun test — 1,304 tests pass, 0 fail (core: 772, gateway: 523, opencode: 9)
  • bun run build — all packages build successfully
  • Zero remaining references to 6969 in source/docs

@BYK BYK force-pushed the feat/change-default-port-3207 branch from 2c70887 to d53156e Compare May 12, 2026 22:15
Replace the hardcoded default port 6969 with a fallback chain:
3207 (primary, upside-down calculator = LORE) -> 5673 (T9 phone
keypad = LORE) -> OS-assigned random port. The fallback only
activates when the port is taken by a non-lore process; explicit
--port / LORE_LISTEN_PORT skips the chain entirely.

Key changes:
- Add DEFAULT_PORTS/DEFAULT_PORT constants and portExplicit flag
  to GatewayConfig
- Add port file (~/.local/share/lore/gateway.port) so plugins can
  discover the gateway even on a random fallback port
- Fix port 0 + multi-host binding (pin resolved port after first
  Bun.serve so all hosts share the same actual port)
- Rewrite startGateway() with the fallback loop + port file mgmt
- Export startGateway/probeGateway/readPortFile from gateway package
- Refactor both OpenCode and Pi plugins to use resolveGatewayUrl()
  (probes port file + known defaults) and delegate to startGateway()
  instead of duplicating startup/EADDRINUSE logic
- Update all docs, help text, and comments from 6969 to 3207
@BYK BYK force-pushed the feat/change-default-port-3207 branch from d53156e to 65eb16f Compare May 12, 2026 22:24
@BYK BYK merged commit 2629a38 into main May 12, 2026
7 checks passed
@BYK BYK deleted the feat/change-default-port-3207 branch May 12, 2026 22:27
This was referenced May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant