Compare commits
40
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5b2ce1518 | ||
|
|
a4d6d64c6e | ||
|
|
72e563e5f2 | ||
|
|
393c52c214 | ||
|
|
9e4e221970 | ||
|
|
e8b0126371 | ||
|
|
90d9a2ad1f | ||
|
|
065ef922bd | ||
|
|
7d11533490 | ||
|
|
1031a226f8 | ||
|
|
ddd98876b5 | ||
|
|
dfd41da2fd | ||
|
|
b37279ca21 | ||
|
|
13eeb07f5f | ||
|
|
1e9bac7f6e | ||
|
|
1c290767f2 | ||
|
|
9becb3f40a | ||
|
|
2c351726ae | ||
|
|
9e891d2e97 | ||
|
|
b8d07eb852 | ||
|
|
223c3dc800 | ||
|
|
afb6e89bfd | ||
|
|
9309edf4f4 | ||
|
|
d28ced8fd7 | ||
|
|
076608021c | ||
|
|
fb4f9aa58e | ||
|
|
de21f4dcd7 | ||
|
|
442bc9540e | ||
|
|
f7570712a7 | ||
|
|
2847655a1a | ||
|
|
268016d872 | ||
|
|
ac3f22c274 | ||
|
|
b36888e9cc | ||
|
|
9bb9023009 | ||
|
|
f70cb5de45 | ||
|
|
3d3586800e | ||
|
|
767de271e9 | ||
|
|
9d2c2cae37 | ||
|
|
dcccca3f7b | ||
|
|
4ed89e4ba7 |
No files matched your search
+125
-3
@@ -5,17 +5,139 @@ T3 Code runs as a **Node.js WebSocket server** that wraps `codex app-server` (JS
|
||||
```
|
||||
┌─────────────────────────────────┐
|
||||
│ Browser (React + Vite) │
|
||||
│ Connected via WebSocket │
|
||||
│ wsTransport (state machine) │
|
||||
│ Typed push decode at boundary │
|
||||
└──────────┬──────────────────────┘
|
||||
│ ws://localhost:3773
|
||||
┌──────────▼──────────────────────┐
|
||||
│ apps/server (Node.js) │
|
||||
│ WebSocket + HTTP static server │
|
||||
│ ProviderManager │
|
||||
│ CodexAppServerManager │
|
||||
│ ServerPushBus (ordered pushes) │
|
||||
│ ServerReadiness (startup gate) │
|
||||
│ OrchestrationEngine │
|
||||
│ ProviderService │
|
||||
│ CheckpointReactor │
|
||||
│ RuntimeReceiptBus │
|
||||
└──────────┬──────────────────────┘
|
||||
│ JSON-RPC over stdio
|
||||
┌──────────▼──────────────────────┐
|
||||
│ codex app-server │
|
||||
└─────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Components
|
||||
|
||||
- **Browser app**: The React app renders session state, owns the client-side WebSocket transport, and treats typed push events as the boundary between server runtime details and UI state.
|
||||
|
||||
- **Server**: `apps/server` is the main coordinator. It serves the web app, accepts WebSocket requests, waits for startup readiness before welcoming clients, and sends all outbound pushes through a single ordered push path.
|
||||
|
||||
- **Provider runtime**: `codex app-server` does the actual provider/session work. The server talks to it over JSON-RPC on stdio and translates those runtime events into the app's orchestration model.
|
||||
|
||||
- **Background workers**: Long-running async flows such as runtime ingestion, command reaction, and checkpoint processing run as queue-backed workers. This keeps work ordered, reduces timing races, and gives tests a deterministic way to wait for the system to go idle.
|
||||
|
||||
- **Runtime signals**: The server emits lightweight typed receipts when important async milestones finish, such as checkpoint capture, diff finalization, or a turn becoming fully quiescent. Tests and orchestration code wait on these signals instead of polling internal state.
|
||||
|
||||
## Event Lifecycle
|
||||
|
||||
### Startup and client connect
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Browser
|
||||
participant Transport as WsTransport
|
||||
participant Server as wsServer
|
||||
participant Layers as serverLayers
|
||||
participant Ready as ServerReadiness
|
||||
participant Push as ServerPushBus
|
||||
|
||||
Browser->>Transport: Load app and open WebSocket
|
||||
Transport->>Server: Connect
|
||||
Server->>Layers: Start runtime services
|
||||
Server->>Ready: Wait for startup barriers
|
||||
Ready-->>Server: Ready
|
||||
Server->>Push: Publish server.welcome
|
||||
Push-->>Transport: Ordered welcome push
|
||||
Transport-->>Browser: Hydrate initial state
|
||||
```
|
||||
|
||||
1. The browser boots [`WsTransport`][1] and registers typed listeners in [`wsNativeApi`][2].
|
||||
2. The server accepts the connection in [`wsServer`][3] and brings up the runtime graph defined in [`serverLayers`][7].
|
||||
3. [`ServerReadiness`][4] waits until the key startup barriers are complete.
|
||||
4. Once the server is ready, [`wsServer`][3] sends `server.welcome` from the contracts in [`ws.ts`][6] through [`ServerPushBus`][5].
|
||||
5. The browser receives that ordered push through [`WsTransport`][1], and [`wsNativeApi`][2] uses it to seed local client state.
|
||||
|
||||
### User turn flow
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Browser
|
||||
participant Transport as WsTransport
|
||||
participant Server as wsServer
|
||||
participant Provider as ProviderService
|
||||
participant Codex as codex app-server
|
||||
participant Ingest as ProviderRuntimeIngestion
|
||||
participant Engine as OrchestrationEngine
|
||||
participant Push as ServerPushBus
|
||||
|
||||
Browser->>Transport: Send user action
|
||||
Transport->>Server: Typed WebSocket request
|
||||
Server->>Provider: Route request
|
||||
Provider->>Codex: JSON-RPC over stdio
|
||||
Codex-->>Ingest: Provider runtime events
|
||||
Ingest->>Engine: Normalize into orchestration events
|
||||
Engine-->>Server: Domain events
|
||||
Server->>Push: Publish orchestration.domainEvent
|
||||
Push-->>Browser: Typed push
|
||||
```
|
||||
|
||||
1. A user action in the browser becomes a typed request through [`WsTransport`][1] and the browser API layer in [`nativeApi`][12].
|
||||
2. [`wsServer`][3] decodes that request using the shared WebSocket contracts in [`ws.ts`][6] and routes it to the right service.
|
||||
3. [`ProviderService`][8] starts or resumes a session and talks to `codex app-server` over JSON-RPC on stdio.
|
||||
4. Provider-native events are pulled back into the server by [`ProviderRuntimeIngestion`][9], which converts them into orchestration events.
|
||||
5. [`OrchestrationEngine`][10] persists those events, updates the read model, and exposes them as domain events.
|
||||
6. [`wsServer`][3] pushes those updates to the browser through [`ServerPushBus`][5] on channels defined in [`orchestration.ts`][11].
|
||||
|
||||
### Async completion flow
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Server as wsServer
|
||||
participant Worker as Queue-backed workers
|
||||
participant Cmd as ProviderCommandReactor
|
||||
participant Checkpoint as CheckpointReactor
|
||||
participant Receipt as RuntimeReceiptBus
|
||||
participant Push as ServerPushBus
|
||||
participant Browser
|
||||
|
||||
Server->>Worker: Enqueue follow-up work
|
||||
Worker->>Cmd: Process provider commands
|
||||
Worker->>Checkpoint: Process checkpoint tasks
|
||||
Checkpoint->>Receipt: Publish completion receipt
|
||||
Cmd-->>Server: Produce orchestration changes
|
||||
Checkpoint-->>Server: Produce orchestration changes
|
||||
Server->>Push: Publish resulting state updates
|
||||
Push-->>Browser: User-visible push
|
||||
```
|
||||
|
||||
1. Some work continues after the initial request returns, especially in [`ProviderRuntimeIngestion`][9], [`ProviderCommandReactor`][13], and [`CheckpointReactor`][14].
|
||||
2. These flows run as queue-backed workers using [`DrainableWorker`][16], which helps keep side effects ordered and test synchronization deterministic.
|
||||
3. When a milestone completes, the server emits a typed receipt on [`RuntimeReceiptBus`][15], such as checkpoint completion or turn quiescence.
|
||||
4. Tests and orchestration code wait on those receipts instead of polling git state, projections, or timers.
|
||||
5. Any user-visible state changes produced by that async work still go back through [`wsServer`][3] and [`ServerPushBus`][5].
|
||||
|
||||
[1]: ../apps/web/src/wsTransport.ts
|
||||
[2]: ../apps/web/src/wsNativeApi.ts
|
||||
[3]: ../apps/server/src/wsServer.ts
|
||||
[4]: ../apps/server/src/wsServer/readiness.ts
|
||||
[5]: ../apps/server/src/wsServer/pushBus.ts
|
||||
[6]: ../packages/contracts/src/ws.ts
|
||||
[7]: ../apps/server/src/serverLayers.ts
|
||||
[8]: ../apps/server/src/provider/Layers/ProviderService.ts
|
||||
[9]: ../apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
|
||||
[10]: ../apps/server/src/orchestration/Layers/OrchestrationEngine.ts
|
||||
[11]: ../packages/contracts/src/orchestration.ts
|
||||
[12]: ../apps/web/src/nativeApi.ts
|
||||
[13]: ../apps/server/src/orchestration/Layers/ProviderCommandReactor.ts
|
||||
[14]: ../apps/server/src/orchestration/Layers/CheckpointReactor.ts
|
||||
[15]: ../apps/server/src/orchestration/Layers/RuntimeReceiptBus.ts
|
||||
[16]: ../packages/shared/src/DrainableWorker.ts
|
||||
@@ -3,7 +3,9 @@
|
||||
The web app communicates with the server via WebSocket using a simple JSON-RPC-style protocol:
|
||||
|
||||
- **Request/Response**: `{ id, method, params }` → `{ id, result }` or `{ id, error }`
|
||||
- **Push events**: `{ type: "push", channel, data }` for orchestration read-model updates
|
||||
- **Push events**: typed envelopes with `channel`, `sequence` (monotonic per connection), and channel-specific `data`
|
||||
|
||||
Push channels: `server.welcome`, `server.configUpdated`, `terminal.event`, `orchestration.domainEvent`. Payloads are schema-validated at the transport boundary (`wsTransport.ts`). Decode failures produce structured `WsDecodeDiagnostic` with `code`, `reason`, and path info.
|
||||
|
||||
Methods mirror the `NativeApi` interface defined in `@t3tools/contracts`:
|
||||
|
||||
@@ -12,3 +14,17 @@ Methods mirror the `NativeApi` interface defined in `@t3tools/contracts`:
|
||||
- `shell.openInEditor`, `server.getConfig`
|
||||
|
||||
Codex is the only implemented provider. `claudeCode` is reserved in contracts/UI.
|
||||
|
||||
## Client transport
|
||||
|
||||
`wsTransport.ts` manages connection state: `connecting` → `open` → `reconnecting` → `closed` → `disposed`. Outbound requests are queued while disconnected and flushed on reconnect. Inbound pushes are decoded and validated at the boundary, then cached per channel. Subscribers can opt into `replayLatest` to receive the last push on subscribe.
|
||||
|
||||
## Server-side orchestration layers
|
||||
|
||||
Provider runtime events flow through queue-based workers:
|
||||
|
||||
1. **ProviderRuntimeIngestion** — consumes provider runtime streams, emits orchestration commands
|
||||
2. **ProviderCommandReactor** — reacts to orchestration intent events, dispatches provider calls
|
||||
3. **CheckpointReactor** — captures git checkpoints on turn start/complete, publishes runtime receipts
|
||||
|
||||
All three use `DrainableWorker` internally and expose `drain()` for deterministic test synchronization.
|
||||
@@ -3,4 +3,5 @@
|
||||
- `/apps/server`: Node.js WebSocket server. Wraps Codex app-server, serves the built web app, and opens the browser on start.
|
||||
- `/apps/web`: React + Vite UI. Session control, conversation, and provider event rendering. Connects to the server via WebSocket.
|
||||
- `/apps/desktop`: Electron shell. Spawns a desktop-scoped `t3` backend process and loads the shared web app.
|
||||
- `/packages/contracts`: Shared Zod schemas and TypeScript contracts for provider events, WebSocket protocol, and model/session types.
|
||||
- `/packages/contracts`: Shared effect/Schema schemas and TypeScript contracts for provider events, WebSocket protocol, and model/session types.
|
||||
- `/packages/shared`: Shared runtime utilities consumed by both server and web. Uses explicit subpath exports (e.g. `@t3tools/shared/git`, `@t3tools/shared/DrainableWorker`) — no barrel index.
|
||||
@@ -26,3 +26,4 @@ github:PatrickBauer
|
||||
github:realAhmedRoach
|
||||
github:shiroyasha9
|
||||
github:Yash-Singh1
|
||||
github:eggfriedrice24
|
||||
@@ -8,7 +8,7 @@ on:
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
name: Lint, Typecheck, Test, Browser Test, Build
|
||||
name: Format, Lint, Typecheck, Test, Browser Test, Build
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -45,6 +45,9 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Format
|
||||
run: bun run fmt:check
|
||||
|
||||
- name: Lint
|
||||
run: bun run lint
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[tools]
|
||||
node = "24.13.1"
|
||||
bun = "1.3.9"
|
||||
+3
-2
@@ -7,7 +7,8 @@
|
||||
"node_modules",
|
||||
"bun.lock",
|
||||
"*.tsbuildinfo",
|
||||
"**/routeTree.gen.ts"
|
||||
"**/routeTree.gen.ts",
|
||||
"apps/web/public/mockServiceWorker.js"
|
||||
],
|
||||
"experimentalSortPackageJson": {}
|
||||
"sortPackageJson": {}
|
||||
}
|
||||
@@ -1,20 +1,24 @@
|
||||
# Plan: Centralize Model Normalization in Contracts
|
||||
|
||||
## Summary
|
||||
|
||||
Move model alias/default normalization into `packages/contracts` so desktop and renderer use one shared source of truth.
|
||||
|
||||
## Motivation
|
||||
|
||||
- Removes duplicated logic between:
|
||||
- `apps/desktop/src/codexAppServerManager.ts`
|
||||
- `apps/renderer/src/model-logic.ts`
|
||||
- Prevents behavior drift when model aliases/defaults are updated.
|
||||
|
||||
## Scope
|
||||
|
||||
- Add shared model utilities to contracts.
|
||||
- Update desktop and renderer to consume shared utilities.
|
||||
- Keep renderer-specific display options in renderer.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
1. Add `packages/contracts/src/model.ts` with:
|
||||
- Canonical model list
|
||||
- Alias map
|
||||
@@ -29,14 +33,17 @@ Move model alias/default normalization into `packages/contracts` so desktop and
|
||||
- Keep renderer tests focused on renderer-only behavior.
|
||||
|
||||
## Risks
|
||||
|
||||
- Desktop/renderer may currently rely on slightly different fallback behavior.
|
||||
- Import graph must avoid bundling issues for Electron main/preload.
|
||||
|
||||
## Validation
|
||||
|
||||
- `bun run test`
|
||||
- `bun run typecheck`
|
||||
- Manual check that model selection and session start still send expected model slug.
|
||||
|
||||
## Done Criteria
|
||||
|
||||
- No duplicated alias/default map in desktop and renderer.
|
||||
- Shared model utilities are contract-tested.
|
||||
@@ -1,17 +1,21 @@
|
||||
# Plan: Strengthen Typed IPC Boundaries in Main Process
|
||||
|
||||
## Summary
|
||||
|
||||
Replace loose payload casting in IPC handlers with strict schema parsing and typed helper wrappers.
|
||||
|
||||
## Motivation
|
||||
|
||||
- `apps/desktop/src/main.ts` currently uses casts like `payload as Parameters<...>`.
|
||||
- Casts can hide contract breakages until runtime.
|
||||
|
||||
## Scope
|
||||
|
||||
- Desktop main process IPC registration.
|
||||
- Optional shared helper for handler registration.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
1. Add IPC helper utility (e.g. `apps/desktop/src/ipcHelpers.ts`) to:
|
||||
- Parse payload(s) with Zod schemas
|
||||
- Standardize typed handler signatures
|
||||
@@ -24,14 +28,17 @@ Replace loose payload casting in IPC handlers with strict schema parsing and typ
|
||||
4. Add tests for handler parsing failure paths (invalid payloads).
|
||||
|
||||
## Risks
|
||||
|
||||
- Refactor can subtly change IPC error shape/messages.
|
||||
- Helper abstraction should stay simple and not obscure control flow.
|
||||
|
||||
## Validation
|
||||
|
||||
- `bun run test`
|
||||
- `bun run typecheck`
|
||||
- Manual invalid payload check from renderer/devtools to confirm fast failure.
|
||||
|
||||
## Done Criteria
|
||||
|
||||
- No provider handler uses `payload as Parameters<...>`.
|
||||
- All IPC entrypoints parse unknown payloads at boundary.
|
||||
@@ -1,9 +1,11 @@
|
||||
# Plan: Decompose CodexAppServerManager
|
||||
|
||||
## Summary
|
||||
|
||||
Split `CodexAppServerManager` into smaller modules with clear responsibilities.
|
||||
|
||||
## Motivation
|
||||
|
||||
- `apps/desktop/src/codexAppServerManager.ts` is large and mixes:
|
||||
- Process lifecycle
|
||||
- JSON-RPC parsing/routing
|
||||
@@ -12,10 +14,12 @@ Split `CodexAppServerManager` into smaller modules with clear responsibilities.
|
||||
- This increases regression risk and slows changes.
|
||||
|
||||
## Scope
|
||||
|
||||
- Desktop provider internals only.
|
||||
- Keep external behavior/API stable.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
1. Extract modules:
|
||||
- `codex/processLifecycle.ts`
|
||||
- `codex/jsonrpcRouter.ts`
|
||||
@@ -29,13 +33,16 @@ Split `CodexAppServerManager` into smaller modules with clear responsibilities.
|
||||
- Session state transitions
|
||||
|
||||
## Risks
|
||||
|
||||
- Reordering event handling can change behavior.
|
||||
- Must preserve pending request timeout/cancellation semantics.
|
||||
|
||||
## Validation
|
||||
|
||||
- Existing tests pass.
|
||||
- Add module-level tests for parsing and transition logic.
|
||||
|
||||
## Done Criteria
|
||||
|
||||
- Main manager file materially smaller and orchestration-focused.
|
||||
- Core protocol/state logic covered by focused tests.
|
||||
@@ -1,9 +1,11 @@
|
||||
# Plan: Split ChatView into Smaller UI/Logic Units
|
||||
|
||||
## Summary
|
||||
|
||||
Refactor `ChatView.tsx` into composable pieces with isolated responsibilities.
|
||||
|
||||
## Motivation
|
||||
|
||||
- `apps/renderer/src/components/ChatView.tsx` is large and handles:
|
||||
- Session orchestration
|
||||
- Send/interrupt actions
|
||||
@@ -13,10 +15,12 @@ Refactor `ChatView.tsx` into composable pieces with isolated responsibilities.
|
||||
- Hard to test and maintain as one component.
|
||||
|
||||
## Scope
|
||||
|
||||
- Renderer component boundaries and hooks.
|
||||
- Keep visual behavior unchanged.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
1. Create hook: `apps/renderer/src/hooks/useChatSession.ts`
|
||||
- `ensureSession`
|
||||
- `sendTurn`
|
||||
@@ -29,12 +33,15 @@ Refactor `ChatView.tsx` into composable pieces with isolated responsibilities.
|
||||
4. Add focused tests for hook behavior (error handling, session reuse).
|
||||
|
||||
## Risks
|
||||
|
||||
- Refactor can break subtle UI interactions (auto-scroll, menu close, keyboard send).
|
||||
|
||||
## Validation
|
||||
|
||||
- `bun run test`
|
||||
- Manual smoke: send, stream, interrupt, model switch.
|
||||
|
||||
## Done Criteria
|
||||
|
||||
- `ChatView.tsx` significantly reduced and easier to scan.
|
||||
- Session logic isolated from rendering.
|
||||
@@ -1,17 +1,21 @@
|
||||
# Plan: Move Renderer Persisted-State Validation to Zod
|
||||
|
||||
## Summary
|
||||
|
||||
Use explicit Zod schemas for localStorage state parsing and migration.
|
||||
|
||||
## Motivation
|
||||
|
||||
- `apps/renderer/src/store.ts` has large manual sanitize functions.
|
||||
- Manual type guards are verbose and easier to get wrong during schema evolution.
|
||||
|
||||
## Scope
|
||||
|
||||
- Renderer state hydration/persistence path.
|
||||
- No backend/protocol changes.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
1. Add schema module: `apps/renderer/src/persistenceSchema.ts`
|
||||
- Persisted payload versions (`v1`, `v2`)
|
||||
- Thread/message/project schemas
|
||||
@@ -23,12 +27,15 @@ Use explicit Zod schemas for localStorage state parsing and migration.
|
||||
- Unknown thread/project references filtered
|
||||
|
||||
## Risks
|
||||
|
||||
- Overly strict schemas could drop valid historical data unexpectedly.
|
||||
|
||||
## Validation
|
||||
|
||||
- Unit tests for migration/hydration.
|
||||
- Manual reload test with existing localStorage data.
|
||||
|
||||
## Done Criteria
|
||||
|
||||
- Store hydration logic is schema-driven.
|
||||
- Migration behavior is tested and documented.
|
||||
@@ -1,17 +1,21 @@
|
||||
# Plan: Add Provider Log Stream Lifecycle Management
|
||||
|
||||
## Summary
|
||||
|
||||
Ensure `ProviderManager` logging stream is initialized, rotated/structured, and closed safely.
|
||||
|
||||
## Motivation
|
||||
|
||||
- `apps/desktop/src/providerManager.ts` opens a write stream in constructor.
|
||||
- Stream lifecycle is not explicit on shutdown.
|
||||
|
||||
## Scope
|
||||
|
||||
- Desktop provider logging behavior.
|
||||
- App shutdown integration.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
1. Add explicit `dispose()` on `ProviderManager`:
|
||||
- Remove event listeners
|
||||
- End/close log stream
|
||||
@@ -20,12 +24,15 @@ Ensure `ProviderManager` logging stream is initialized, rotated/structured, and
|
||||
4. Optional: per-session log files under `.logs/providers/`.
|
||||
|
||||
## Risks
|
||||
|
||||
- Improper close sequencing may lose final log lines.
|
||||
|
||||
## Validation
|
||||
|
||||
- Manual run/quit cycle to ensure no open handle warnings.
|
||||
- Confirm logs flush on quit and file descriptors are not leaked.
|
||||
|
||||
## Done Criteria
|
||||
|
||||
- ProviderManager owns complete log stream lifecycle.
|
||||
- Shutdown path explicitly disposes provider resources.
|
||||
@@ -1,17 +1,21 @@
|
||||
# Plan: Add CI Workflow for Core Quality Gates
|
||||
|
||||
## Summary
|
||||
|
||||
Add GitHub Actions workflow to run lint/typecheck/test (and optionally smoke-test) on pushes and PRs.
|
||||
|
||||
## Motivation
|
||||
|
||||
- Repository currently has no CI workflow files.
|
||||
- Quality checks are only local/manual.
|
||||
|
||||
## Scope
|
||||
|
||||
- `.github/workflows/ci.yml`
|
||||
- Bun + Turbo setup in CI.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
1. Add `ci.yml` with jobs:
|
||||
- Setup Bun and Node environment
|
||||
- Install deps
|
||||
@@ -22,13 +26,16 @@ Add GitHub Actions workflow to run lint/typecheck/test (and optionally smoke-tes
|
||||
3. Configure caching for Bun/Turbo as appropriate.
|
||||
|
||||
## Risks
|
||||
|
||||
- Smoke test may be flaky in headless CI environments.
|
||||
- CI runtime can grow if caching is misconfigured.
|
||||
|
||||
## Validation
|
||||
|
||||
- Verify workflow runs on a branch PR.
|
||||
- Ensure failures surface clearly by job name.
|
||||
|
||||
## Done Criteria
|
||||
|
||||
- CI blocks regressions in lint/typecheck/test.
|
||||
- Workflow docs added to README.
|
||||
@@ -1,17 +1,21 @@
|
||||
# Plan: Add Pre-Commit Formatting/Lint Hooks
|
||||
|
||||
## Summary
|
||||
|
||||
Introduce pre-commit automation so formatting and basic lint checks happen before commits.
|
||||
|
||||
## Motivation
|
||||
|
||||
- Current lint failures include formatting-only issues.
|
||||
- Shift-left feedback reduces noisy CI failures and cleanup churn.
|
||||
|
||||
## Scope
|
||||
|
||||
- Root tooling config and package scripts.
|
||||
- No runtime code changes.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
1. Add hook tooling (e.g. Husky + lint-staged or Lefthook).
|
||||
2. Configure staged-file tasks:
|
||||
- `biome format --write`
|
||||
@@ -20,13 +24,16 @@ Introduce pre-commit automation so formatting and basic lint checks happen befor
|
||||
4. Keep checks fast to avoid developer friction.
|
||||
|
||||
## Risks
|
||||
|
||||
- Slow hooks can frustrate contributors and be bypassed.
|
||||
- Need to ensure compatibility with Bun workspace setup.
|
||||
|
||||
## Validation
|
||||
|
||||
- Create sample staged changes and verify hook behavior.
|
||||
- Confirm formatting fixes are applied automatically.
|
||||
|
||||
## Done Criteria
|
||||
|
||||
- Pre-commit hook installed and documented.
|
||||
- Formatting-only lint failures drop significantly.
|
||||
@@ -1,17 +1,21 @@
|
||||
# Plan: Expand Event/State Transition Test Coverage
|
||||
|
||||
## Summary
|
||||
|
||||
Add focused tests for renderer event handling and session evolution logic.
|
||||
|
||||
## Motivation
|
||||
|
||||
- Core behavior is event-driven and stateful.
|
||||
- Existing renderer tests cover only a subset of timeline/model behavior.
|
||||
|
||||
## Scope
|
||||
|
||||
- `apps/renderer/src/session-logic.test.ts`
|
||||
- Optional reducer tests for `apps/renderer/src/store.ts`.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
1. Add tests for `evolveSession`:
|
||||
- `thread/started`
|
||||
- `turn/started`
|
||||
@@ -24,12 +28,15 @@ Add focused tests for renderer event handling and session evolution logic.
|
||||
3. Add reducer integration tests for `APPLY_EVENT`.
|
||||
|
||||
## Risks
|
||||
|
||||
- Tests may be brittle if event payload fixtures are too coupled to implementation details.
|
||||
|
||||
## Validation
|
||||
|
||||
- `bun run test`
|
||||
- Ensure new tests remain deterministic and fast.
|
||||
|
||||
## Done Criteria
|
||||
|
||||
- High-risk event transitions are covered by unit tests.
|
||||
- Regressions in stream assembly/session status are caught quickly.
|
||||
@@ -1,17 +1,21 @@
|
||||
# Plan: Unify Process and PTY Session Abstractions in ProcessManager
|
||||
|
||||
## Summary
|
||||
|
||||
Refactor `ProcessManager` to use a single runtime-session interface for child-process and PTY modes.
|
||||
|
||||
## Motivation
|
||||
|
||||
- `apps/desktop/src/processManager.ts` maintains parallel maps and branch-heavy logic.
|
||||
- New execution backends/providers will multiply complexity.
|
||||
|
||||
## Scope
|
||||
|
||||
- Desktop process execution internals.
|
||||
- Preserve public `ProcessManager` API.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
1. Introduce internal interface (e.g. `RuntimeSession`):
|
||||
- `write(data)`
|
||||
- `kill()`
|
||||
@@ -24,12 +28,15 @@ Refactor `ProcessManager` to use a single runtime-session interface for child-pr
|
||||
5. Add tests for both implementations.
|
||||
|
||||
## Risks
|
||||
|
||||
- PTY behavior differs by platform; abstraction must not hide required differences.
|
||||
|
||||
## Validation
|
||||
|
||||
- Existing `processManager.test.ts` passes.
|
||||
- Add PTY-path tests where feasible.
|
||||
|
||||
## Done Criteria
|
||||
|
||||
- Manager no longer branches per backend in `write/kill/killAll`.
|
||||
- Session backends are independently testable.
|
||||
+1
-3
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
PR 1: Service contracts + error taxonomy
|
||||
Add ProviderService, CodexService, CheckpointStore as Context.Tag service defs.
|
||||
Add typed Schema.TaggedError hierarchies for all 3 services (cause: Schema.optional(Schema.Defect) on each).
|
||||
@@ -39,4 +37,4 @@ Remove throw-based flow entirely from provider path.
|
||||
PR 10: Cleanup + deprecation removal
|
||||
Remove legacy class implementations/adapters once parity is proven.
|
||||
Finalize layer composition and startup graph docs.
|
||||
Add architecture notes for service boundaries and error model.
|
||||
Add architecture notes for service boundaries and error model.
|
||||
@@ -1,12 +1,14 @@
|
||||
# Effect Migration Plan (From Current State)
|
||||
|
||||
Current status summary:
|
||||
|
||||
- Service contracts, typed errors, and most checkpoint/persistence services exist.
|
||||
- `ProviderServiceLive` is already native orchestration (not a thin adapter).
|
||||
- Production server path still uses legacy `ProviderManager`/`FilesystemCheckpointStore`.
|
||||
- Checkpoint flow now avoids snapshot re-sync and is write-time driven.
|
||||
|
||||
## PR 1: Wire Provider/Checkpoint Effect Stack Into `wsServer`
|
||||
|
||||
- Build one runtime layer graph for provider + checkpoint + persistence + orchestration.
|
||||
- Resolve `ProviderService` from runtime in `wsServer`.
|
||||
- Replace `ProviderManager` method calls in WS handlers with `ProviderService` calls.
|
||||
@@ -14,12 +16,14 @@ Current status summary:
|
||||
- Keep WS method/push payloads identical.
|
||||
|
||||
## PR 2: Runtime Composition + Startup Ownership
|
||||
|
||||
- Create/centralize `AppLive` composition for server startup.
|
||||
- Ensure outer runtime provides Node/platform services once.
|
||||
- Ensure migrations run at startup via scoped/layer startup path.
|
||||
- Remove ad-hoc service initialization in request-time paths.
|
||||
|
||||
## PR 3: Session Lifecycle Hygiene + Checkpoint Invariants
|
||||
|
||||
- Add explicit checkpoint session cleanup on `stopSession` / `stopAll`.
|
||||
- Remove per-session lock/cwd map leaks.
|
||||
- Keep strict invariant model:
|
||||
@@ -29,12 +33,14 @@ Current status summary:
|
||||
- Add tests for lifecycle cleanup and invariant-failure surfaces.
|
||||
|
||||
## PR 4: Provider Event Stream Hardening (Without Extra Service Fragmentation)
|
||||
|
||||
- Keep `ProviderService` as the public event surface.
|
||||
- Internally move callback fanout to Effect concurrency primitives (`Queue`/`PubSub`) for ordering/backpressure control.
|
||||
- Keep API as `subscribeToEvents` unless we explicitly choose stream API later.
|
||||
- Add tests for ordering and subscriber isolation under load.
|
||||
|
||||
## PR 5: Codex Runtime Split (Scoped Effect Core)
|
||||
|
||||
- Extract `CodexAppServerManager` responsibilities into Effect-native layers:
|
||||
- scoped process lifecycle
|
||||
- RPC request/response + pending map via `Deferred`
|
||||
@@ -43,16 +49,19 @@ Current status summary:
|
||||
- Preserve protocol behavior and timeout semantics.
|
||||
|
||||
## PR 6: Codex Protocol Decode Hardening
|
||||
|
||||
- Replace ad-hoc unknown parsing with runtime schema decode.
|
||||
- Map decode failures to typed tagged errors with `cause` retained.
|
||||
- Add regression tests for malformed/partial protocol frames.
|
||||
|
||||
## PR 7: Remove Legacy Provider Stack
|
||||
|
||||
- Remove `ProviderManager` + legacy checkpoint integration from runtime path.
|
||||
- Remove `FilesystemCheckpointStore` from active server flow (keep only if explicitly needed for compatibility tooling).
|
||||
- Update tests to assert only Effect service path is used.
|
||||
|
||||
## PR 8: Final Cleanup + Docs
|
||||
|
||||
- Update architecture docs with final layer graph and service boundaries.
|
||||
- Document error model and recovery semantics.
|
||||
- Trim dead compatibility code and stale plan references.
|
||||
@@ -1,6 +1,7 @@
|
||||
# ProviderService Integration Test Plan
|
||||
|
||||
Goal:
|
||||
|
||||
- Validate end-to-end `ProviderService` behavior with real layers:
|
||||
- `ProviderServiceLive`
|
||||
- `CheckpointServiceLive`
|
||||
@@ -13,6 +14,7 @@ Goal:
|
||||
## Test Harness
|
||||
|
||||
Build a deterministic `TestProviderAdapterLive` in `apps/server/src/provider/Layers/TestProviderAdapter.integration.ts`:
|
||||
|
||||
- Service contract: `ProviderAdapterShape<ProviderAdapterError>`.
|
||||
- Internal state:
|
||||
- session registry (session + cwd + threadId)
|
||||
@@ -29,13 +31,15 @@ Build a deterministic `TestProviderAdapterLive` in `apps/server/src/provider/Lay
|
||||
- `readThread`, `rollbackThread`, `stopSession`, `stopAll`.
|
||||
|
||||
Use real git-backed temporary workspaces in integration tests:
|
||||
|
||||
- initialize repo with baseline commit
|
||||
- run provider turn in workspace
|
||||
- assert checkpoint diffs against real git refs
|
||||
|
||||
## Core Integration Specs
|
||||
|
||||
1) `startSession` initializes checkpoint root exactly once
|
||||
1. `startSession` initializes checkpoint root exactly once
|
||||
|
||||
- Arrange:
|
||||
- start provider session in git repo.
|
||||
- Assert:
|
||||
@@ -43,7 +47,8 @@ Use real git-backed temporary workspaces in integration tests:
|
||||
- checkpoint ref exists in git.
|
||||
- second `startSession` for new session creates a new independent root.
|
||||
|
||||
2) Turn without filesystem change
|
||||
2. Turn without filesystem change
|
||||
|
||||
- Arrange:
|
||||
- emit normal turn events, no file mutation.
|
||||
- Assert:
|
||||
@@ -54,7 +59,8 @@ Use real git-backed temporary workspaces in integration tests:
|
||||
- `listCheckpoints` returns root + turn 1.
|
||||
- `getCheckpointDiff(0 -> 1)` returns empty/no-op diff.
|
||||
|
||||
3) Turn with filesystem change
|
||||
3. Turn with filesystem change
|
||||
|
||||
- Arrange:
|
||||
- mutate `README.md` during turn.
|
||||
- Assert:
|
||||
@@ -62,7 +68,8 @@ Use real git-backed temporary workspaces in integration tests:
|
||||
- `getCheckpointDiff(0 -> 1)` contains file path and hunk.
|
||||
- persisted checkpoint metadata includes non-empty `checkpointRef`.
|
||||
|
||||
4) Multi-turn sequencing and checkpoint monotonicity
|
||||
4. Multi-turn sequencing and checkpoint monotonicity
|
||||
|
||||
- Arrange:
|
||||
- turn 1: no file change
|
||||
- turn 2: file change
|
||||
@@ -72,7 +79,8 @@ Use real git-backed temporary workspaces in integration tests:
|
||||
- latest checkpoint is marked current.
|
||||
- diffs for adjacent turns map to expected filesystem deltas.
|
||||
|
||||
5) Revert to checkpoint
|
||||
5. Revert to checkpoint
|
||||
|
||||
- Arrange:
|
||||
- execute 3 turns with at least one file-changing turn.
|
||||
- call `revertToCheckpoint(turnCount=1)`.
|
||||
@@ -82,7 +90,8 @@ Use real git-backed temporary workspaces in integration tests:
|
||||
- DB rows for turns >1 are removed.
|
||||
- later refs are deleted from git.
|
||||
|
||||
6) Capture failure surface
|
||||
6. Capture failure surface
|
||||
|
||||
- Arrange:
|
||||
- adapter emits `turn/completed`, but file mutation leaves invalid repo state or store capture fails.
|
||||
- Assert:
|
||||
@@ -92,6 +101,7 @@ Use real git-backed temporary workspaces in integration tests:
|
||||
## WebSocket Coverage (Thin Integration)
|
||||
|
||||
Add one ws server integration spec:
|
||||
|
||||
- Subscribe to `providers.event`.
|
||||
- Run a deterministic provider turn through ws methods.
|
||||
- Assert push stream includes:
|
||||
@@ -101,10 +111,13 @@ Add one ws server integration spec:
|
||||
## Proposed PR Split
|
||||
|
||||
PR A:
|
||||
|
||||
- Test adapter harness + shared integration fixtures (repo setup, runtime/layer setup).
|
||||
|
||||
PR B:
|
||||
|
||||
- Core ProviderService integration specs (cases 1-4).
|
||||
|
||||
PR C:
|
||||
|
||||
- Revert + failure-path specs (cases 5-6) + ws thin integration spec.
|
||||
@@ -1,6 +1,7 @@
|
||||
# Server-Authoritative Event-Sourcing Cleanup Plan
|
||||
|
||||
Goal:
|
||||
|
||||
- Move to a cleaner service architecture with:
|
||||
- durable, server-authoritative event sourcing
|
||||
- strict command routing/validation
|
||||
@@ -85,6 +86,7 @@ CheckpointCatalog ------> SQLite
|
||||
## Commit Series
|
||||
|
||||
### Commit 1: Split public vs system orchestration command contracts
|
||||
|
||||
- Create separate schemas/types:
|
||||
- `ClientOrchestrationCommandSchema`
|
||||
- `SystemOrchestrationCommandSchema`
|
||||
@@ -100,6 +102,7 @@ CheckpointCatalog ------> SQLite
|
||||
- preserve internal dispatch functionality for system commands
|
||||
|
||||
### Commit 2: Introduce `OrchestrationCommandRouter` + handler boundary
|
||||
|
||||
- Add dedicated router service to validate, authorize, and route commands.
|
||||
- Move command-to-event mapping out of `orchestration/Layer.ts` into handlers.
|
||||
- Add aggregate-level invariant checks before append (thread exists, project exists, etc.).
|
||||
@@ -113,6 +116,7 @@ CheckpointCatalog ------> SQLite
|
||||
- handler happy-path tests per command type
|
||||
|
||||
### Commit 3: Harden event store for idempotency + optimistic append metadata
|
||||
|
||||
- Add DB-level idempotency guard for `command_id` (`UNIQUE` where non-null).
|
||||
- Extend append API to support idempotent replays and deterministic return of prior event on duplicate `commandId`.
|
||||
- Add optional aggregate version metadata for future optimistic concurrency.
|
||||
@@ -125,6 +129,7 @@ CheckpointCatalog ------> SQLite
|
||||
- concurrent append behavior stays ordered and deterministic
|
||||
|
||||
### Commit 4: Extract provider-runtime -> orchestration bridge from `wsServer`
|
||||
|
||||
- Create `ProviderRuntimeIngestionService` that:
|
||||
- subscribes to `ProviderService.streamEvents`
|
||||
- translates runtime events into orchestration commands
|
||||
@@ -139,6 +144,7 @@ CheckpointCatalog ------> SQLite
|
||||
- ws integration confirms same external push behavior
|
||||
|
||||
### Commit 5: Make session directory durable (`ProviderSessionRegistry`)
|
||||
|
||||
- Replace in-memory-only `ProviderSessionDirectoryLive` with persistence-backed registry.
|
||||
- Keep in-memory cache optional, but source of truth must be persistent.
|
||||
- Add startup reconciliation to prune dead sessions / keep known thread mapping.
|
||||
@@ -152,6 +158,7 @@ CheckpointCatalog ------> SQLite
|
||||
- stale session cleanup semantics
|
||||
|
||||
### Commit 6: Re-key checkpoint metadata from session to thread identity
|
||||
|
||||
- Change checkpoint catalog primary identity from `provider_session_id` to durable `thread_id`.
|
||||
- Keep `session_id` as nullable metadata only.
|
||||
- Update checkpoint flows (`initialize`, `capture`, `list`, `diff`, `revert`) to use thread identity.
|
||||
@@ -165,6 +172,7 @@ CheckpointCatalog ------> SQLite
|
||||
- revert/diff still work after session churn
|
||||
|
||||
### Commit 7: Add durable projection persistence for orchestration read models
|
||||
|
||||
- Introduce projection tables/snapshots persisted in DB to avoid full replay dependency.
|
||||
- Keep event stream as source of truth; projection rebuild stays deterministic.
|
||||
- `getSnapshot` reads from projection store (memory cache optional).
|
||||
@@ -177,6 +185,7 @@ CheckpointCatalog ------> SQLite
|
||||
- projection rebuild from events yields same result as previous reducer semantics
|
||||
|
||||
### Commit 8: Narrow `ProviderService` responsibilities
|
||||
|
||||
- Keep `ProviderService` focused on provider RPC/session lifecycle + unified runtime stream.
|
||||
- Move checkpoint-capture side effects out of provider event worker into dedicated ingestion/checkpoint pipeline service.
|
||||
- Preserve adapter pluggability and provider-neutral contracts.
|
||||
@@ -188,6 +197,7 @@ CheckpointCatalog ------> SQLite
|
||||
- checkpoint capture still triggered by turn completion through new coordinator
|
||||
|
||||
### Commit 9: Look over schemas (contracts and events)
|
||||
|
||||
- Scan for unused schemas.
|
||||
- Use effect/Schema everywhere
|
||||
- Analyze which we need
|
||||
@@ -196,6 +206,7 @@ CheckpointCatalog ------> SQLite
|
||||
- Persistence entities
|
||||
|
||||
### Commit 10: Remove dead legacy path and finalize docs
|
||||
|
||||
- Remove unused legacy manager/store path from active architecture:
|
||||
- `providerManager.ts`
|
||||
- `filesystemCheckpointStore.ts` (if no longer needed by tests/tools)
|
||||
@@ -210,6 +221,7 @@ CheckpointCatalog ------> SQLite
|
||||
- no regressions in WS protocol behavior
|
||||
|
||||
## Risk Controls
|
||||
|
||||
- Keep WS method names and payload contracts stable throughout.
|
||||
- Gate each commit with targeted integration tests before moving forward.
|
||||
- Avoid broad event-type churn in one step; migrate schemas incrementally with clear compatibility windows.
|
||||
@@ -1,10 +1,11 @@
|
||||
Rewrite `createServer` and `index.ts` to be Effect native.
|
||||
|
||||
Maybe use `effect/unstable/Socket` for the web socket server
|
||||
|
||||
- https://github.com/Effect-TS/effect-smol/blob/main/packages/effect/src/unstable/socket/SocketServer.ts
|
||||
- https://github.com/Effect-TS/effect-smol/blob/main/packages/platform-node/test/NodeSocket.test.ts
|
||||
|
||||
- Migrate remaining runtime code to Effect
|
||||
- `gitManager` -> `src/git`
|
||||
- `terminalManager` -> `src/terminal` (Manager + PTY)
|
||||
- ...
|
||||
- ...
|
||||
@@ -24,21 +24,25 @@
|
||||
- Mark invalid/false-positive items with explicit rationale.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Every open thread is mapped to one canonical fix item or marked invalid.
|
||||
|
||||
## Phase 1: Runtime Survival and Critical Event Wiring
|
||||
|
||||
Related bug groups solved together:
|
||||
|
||||
- Worker loop/fiber fatal error handling in orchestration reactors.
|
||||
- WebSocket message error boundaries and unhandled rejection guards.
|
||||
- Close invalid `providers.event` review findings as documented architecture mismatch (no code change expected).
|
||||
|
||||
Primary files:
|
||||
|
||||
- `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts`
|
||||
- `apps/server/src/orchestration/Layers/CheckpointReactor.ts`
|
||||
- `apps/server/src/wsServer.ts`
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- A single event-processing failure cannot permanently stop ingestion/reactor loops.
|
||||
- WS message handling cannot produce unhandled promise rejections.
|
||||
- Invalid provider-event-channel review findings are closed with architecture rationale.
|
||||
@@ -46,17 +50,20 @@ Exit criteria:
|
||||
## Phase 2: State Consistency and Ordering
|
||||
|
||||
Related bug groups solved together:
|
||||
|
||||
- Fire-and-forget revert completion causing consistency windows.
|
||||
- Non-atomic append/projection paths and retry behavior.
|
||||
- Race-sensitive thread/event association issues.
|
||||
|
||||
Primary files:
|
||||
|
||||
- `apps/server/src/orchestration/Layers/CheckpointReactor.ts`
|
||||
- `apps/server/src/orchestration/Layers/OrchestrationEngine.ts`
|
||||
- `apps/server/src/orchestration/Layers/ProjectionPipeline.ts`
|
||||
- `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts`
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Revert flow is deterministically reflected in read model updates.
|
||||
- Append/project failure mode is explicit and safe under retry.
|
||||
- No cross-thread misassociation under concurrent runtime events.
|
||||
@@ -64,12 +71,14 @@ Exit criteria:
|
||||
## Phase 3: Checkpointing Correctness Bundle
|
||||
|
||||
Related bug groups solved together:
|
||||
|
||||
- Checkpoint input normalization consistency.
|
||||
- Snapshot/projector coverage mismatches.
|
||||
- Checkpoint ref/workspace CWD utility duplication.
|
||||
- Checkpoint diff/error handling behavior gaps.
|
||||
|
||||
Primary files:
|
||||
|
||||
- `apps/server/src/checkpointing/Layers/CheckpointStore.ts`
|
||||
- `apps/server/src/checkpointing/Layers/CheckpointDiffQuery.ts`
|
||||
- `apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts`
|
||||
@@ -77,6 +86,7 @@ Primary files:
|
||||
- `apps/server/src/wsServer.ts`
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Checkpoint capture/restore/revert paths use one normalization policy.
|
||||
- Required projectors are actually represented in snapshot reads.
|
||||
- Shared checkpoint/ref/CWD helpers are centralized.
|
||||
@@ -84,27 +94,32 @@ Exit criteria:
|
||||
## Phase 4: Memory and Lifecycle Hygiene
|
||||
|
||||
Related bug groups solved together:
|
||||
|
||||
- Unbounded in-memory dedup sets/maps.
|
||||
- Missing cleanup/lifecycle protections in long-lived effects/resources.
|
||||
|
||||
Primary files:
|
||||
|
||||
- `apps/server/src/orchestration/Layers/ProviderCommandReactor.ts`
|
||||
- `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts`
|
||||
- `apps/server/src/config.ts`
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Long-running server memory does not grow unbounded from dedup bookkeeping.
|
||||
- Resource cleanup paths are registered for interruption/shutdown.
|
||||
|
||||
## Phase 5: Transport, Parsing, and Platform Edge Cases
|
||||
|
||||
Related bug groups solved together:
|
||||
|
||||
- UTF-8 chunk boundary decode correctness.
|
||||
- Markdown/file-link parsing edge cases.
|
||||
- Shell/OS-specific PATH parsing behavior.
|
||||
- Git rename parsing and small keybinding edge cases.
|
||||
|
||||
Primary files:
|
||||
|
||||
- `apps/server/src/wsServer.ts`
|
||||
- `apps/server/src/git/Layers/CodexTextGeneration.ts`
|
||||
- `apps/web/src/markdown-links.ts`
|
||||
@@ -113,23 +128,27 @@ Primary files:
|
||||
- `apps/server/src/keybindings.ts`
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Edge-case parsers are robust across valid but non-trivial inputs.
|
||||
- Platform-dependent command behavior has safe fallbacks.
|
||||
|
||||
## Phase 6: Build and Maintainability Cleanup
|
||||
|
||||
Related bug groups solved together:
|
||||
|
||||
- Build script/runtime assumption cleanup.
|
||||
- Redundant error-union declarations and utility/type duplication.
|
||||
- Non-functional cleanup comments/docs markers.
|
||||
|
||||
Primary files:
|
||||
|
||||
- `apps/server/package.json`
|
||||
- `apps/server/src/checkpointing/Errors.ts`
|
||||
- Shared utility locations introduced during earlier phases
|
||||
- `AGENTS.md` (if cleanup is still pending)
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Build path is explicit and environment-safe.
|
||||
- Redundant types/utilities are removed in favor of single sources of truth.
|
||||
|
||||
@@ -140,6 +159,7 @@ Exit criteria:
|
||||
- Resolve threads with fix references per canonical checklist item.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Lint passes.
|
||||
- Backend tests pass.
|
||||
- All actionable review threads are resolved or explicitly justified.
|
||||
@@ -5,6 +5,7 @@ _Last updated: 2026-02-26_
|
||||
This is the working checklist for remediation execution.
|
||||
|
||||
Status values:
|
||||
|
||||
- `TODO`: Not started
|
||||
- `IN_PROGRESS`: Currently being worked
|
||||
- `BLOCKED`: Waiting on decision/dependency
|
||||
@@ -150,7 +151,7 @@ Counts: active `51` (`valid=33`, `partially-valid=18`), closed-invalid `6`
|
||||
- Area: `WebSocket robustness`
|
||||
- File: `apps/web/src/wsTransport.ts:59`
|
||||
- Threads: PRRT_kwDORLtfbc5whtrN
|
||||
- Audit note: Transport _tag override risk exists but current callsites are constrained.
|
||||
- Audit note: Transport \_tag override risk exists but current callsites are constrained.
|
||||
|
||||
### Phase 2
|
||||
|
||||
@@ -181,7 +182,7 @@ Counts: active `51` (`valid=33`, `partially-valid=18`), closed-invalid `6`
|
||||
- Threads: PRRT_kwDORLtfbc5whxJO
|
||||
- Audit note: Message fallback retention issue is real, but prior FK-violation claim is overstated.
|
||||
|
||||
- [x] `C016` The in-memory `pendingTurnStartByThreadId` map isn't restored during bootstrap. If the service restarts after processing `thread.turn-start-requested` but before `thread.session-set`, the `userMessageId` and `startedAt` will be lost since bootstrap resumes *after* the committed sequence. Consider persisting this pending state or processing these two events atomically. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
|
||||
- [x] `C016` The in-memory `pendingTurnStartByThreadId` map isn't restored during bootstrap. If the service restarts after processing `thread.turn-start-requested` but before `thread.session-set`, the `userMessageId` and `startedAt` will be lost since bootstrap resumes _after_ the committed sequence. Consider persisting this pending state or processing these two events atomically. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
|
||||
- Status: `DONE`
|
||||
- Verdict: `valid`
|
||||
- Severity: `Medium`
|
||||
@@ -198,7 +199,7 @@ Counts: active `51` (`valid=33`, `partially-valid=18`), closed-invalid `6`
|
||||
- Severity: `Medium`
|
||||
- Area: `Checkpointing correctness`
|
||||
- File: `apps/server/src/checkpointing/Layers/CheckpointStore.ts:94`
|
||||
- Threads: PRRT_kwDORLtfbc5widJw, PRRT_kwDORLtfbc5wnWv_, PRRT_kwDORLtfbc5w0_g7, PRRT_kwDORLtfbc5w1C36 (+3 duplicate thread(s))
|
||||
- Threads: PRRT*kwDORLtfbc5widJw, PRRT_kwDORLtfbc5wnWv*, PRRT_kwDORLtfbc5w0_g7, PRRT_kwDORLtfbc5w1C36 (+3 duplicate thread(s))
|
||||
- Audit note: Edge schema strategy is in place across contracts/consumers (trim/normalize via schemas and decode at boundaries); CheckpointStore remains an internal repository boundary.
|
||||
|
||||
- [x] `C017` `REQUIRED_SNAPSHOT_PROJECTORS` includes `pending-approvals` and `thread-turns`, but `getSnapshot` doesn't query their data. If these projectors lag behind, the returned `snapshotSequence` will be lower than what the included data actually reflects, causing clients to replay already-applied events. Consider filtering `REQUIRED_SNAPSHOT_PROJECTORS` to only include projectors whose data is actually fetched in the snapshot. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
|
||||
@@ -250,7 +251,7 @@ Counts: active `51` (`valid=33`, `partially-valid=18`), closed-invalid `6`
|
||||
|
||||
### Phase 5
|
||||
|
||||
- [ ] `C009` Git's braced rename syntax (e.g., `src/{old => new}/file.ts`) isn't handled correctly. The current slice after ` => ` produces invalid paths like `new}/file.ts`. Consider expanding the braces to construct the full destination path. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
|
||||
- [ ] `C009` Git's braced rename syntax (e.g., `src/{old => new}/file.ts`) isn't handled correctly. The current slice after `=>` produces invalid paths like `new}/file.ts`. Consider expanding the braces to construct the full destination path. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
|
||||
- Status: `TODO`
|
||||
- Verdict: `valid`
|
||||
- Severity: `Medium`
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
# Plan: Provider-Neutral Runtime Determinism and Flake Elimination
|
||||
|
||||
## Summary
|
||||
Replace timing-sensitive websocket and orchestration behavior with explicit typed runtime boundaries, ordered push delivery, and server-owned completion receipts. The cutover is broad and single-shot: no compatibility shim, no mixed old/new transport. The design must reduce flakes without baking Codex-specific lifecycle semantics into generic runtime code.
|
||||
|
||||
## Implementation Status
|
||||
|
||||
All 7 sections are implemented. CI passes (format, lint, typecheck, test, browser test, build). One deferred item remains: the shared `WsTestClient` helper from section 7 — tests use direct transport subscription and receipt-based waits instead.
|
||||
|
||||
### New files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `packages/shared/src/DrainableWorker.ts` | Queue-based Effect worker with deterministic `drain` signal |
|
||||
| `packages/shared/src/schemaJson.ts` | Two-phase JSON→Schema decode helpers (`decodeJsonResult`, `formatSchemaError`) |
|
||||
| `apps/server/src/wsServer/pushBus.ts` | `ServerPushBus` — ordered typed push pipeline with auto-incrementing sequence |
|
||||
| `apps/server/src/wsServer/readiness.ts` | `ServerReadiness` — Deferred-based barriers for startup sequencing |
|
||||
| `apps/server/src/orchestration/Services/RuntimeReceiptBus.ts` | Receipt schema union: checkpoint captured, diff finalized, turn quiesced |
|
||||
| `apps/server/src/orchestration/Layers/RuntimeReceiptBus.ts` | PubSub-backed receipt bus implementation |
|
||||
| `apps/server/src/watchFileWithStatPolling.ts` | Stat-polling file watcher for containers where `fs.watch` is unreliable |
|
||||
| `apps/server/vitest.config.ts` | Server-specific test config (timeout bumps) |
|
||||
| `apps/server/src/wsServer/pushBus.test.ts` | Push bus serialization and welcome-gating tests |
|
||||
| `packages/shared/src/DrainableWorker.test.ts` | Drainable worker enqueue/drain lifecycle tests |
|
||||
|
||||
### Key modifications
|
||||
|
||||
| File | Change |
|
||||
|------|--------|
|
||||
| `packages/contracts/src/ws.ts` | Channel-indexed `WsPushPayloadByChannel` map, `WsPush` union schema, `WsPushSequence` |
|
||||
| `apps/server/src/wsServer.ts` | Integrated `ServerPushBus` and `ServerReadiness`; welcome gated on readiness |
|
||||
| `apps/server/src/keybindings.ts` | Explicit runtime with `start`/`ready`/`snapshot`; dual `fs.watch` + stat-polling watcher |
|
||||
| `apps/web/src/wsTransport.ts` | Connection state machine (`connecting`→`open`→`reconnecting`→`closed`→`disposed`); two-phase decode at boundary; cached latest push by channel |
|
||||
| `apps/web/src/wsNativeApi.ts` | Removed decode logic; delegates to pre-validated transport messages |
|
||||
| `apps/server/src/orchestration/Layers/CheckpointReactor.ts` | Uses `DrainableWorker`; publishes completion receipts |
|
||||
| `apps/server/src/orchestration/Layers/ProviderCommandReactor.ts` | Uses `DrainableWorker` for command processing |
|
||||
| `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts` | Uses `DrainableWorker` for event ingestion |
|
||||
| `apps/server/integration/OrchestrationEngineHarness.integration.ts` | Receipt-based waits replace polling loops |
|
||||
|
||||
## Key Changes
|
||||
### 1. Strengthen the generic boundaries, not the Codex boundary — DONE
|
||||
- `ProviderRuntimeEvent` remains the canonical provider event contract; `ProviderService` remains the only cross-provider facade.
|
||||
- Raw Codex payloads and event ordering stay isolated in `CodexAdapter.ts` and `codexAppServerManager.ts`.
|
||||
- `ProviderKind` was not expanded. The runtime stays provider-neutral by contract.
|
||||
|
||||
### 2. Replace loose websocket envelopes with channel-indexed typed pushes — DONE
|
||||
- `packages/contracts/src/ws.ts` now derives push messages from a `WsPushPayloadByChannel` channel-to-schema map. `WsPush` is a union schema replacing `channel: string` + `data: unknown`.
|
||||
- Every server push carries `sequence: number`, auto-incremented in `ServerPushBus`.
|
||||
- `packages/shared/src/schemaJson.ts` provides structured decode diagnostics via `formatSchemaError`.
|
||||
- `packages/contracts/src/ws.test.ts` covers typed push envelope validation and channel/payload mismatch rejection.
|
||||
|
||||
### 3. Introduce explicit server readiness and a single push pipeline — DONE
|
||||
- `apps/server/src/wsServer/pushBus.ts`: `ServerPushBus` with `publishAll` (broadcast) and `publishClient` (targeted) methods, backed by one ordered path. All pushes flow through it.
|
||||
- `apps/server/src/wsServer/readiness.ts`: `ServerReadiness` with Deferred-based barriers for HTTP listening, push bus, keybindings, terminal subscriptions, and orchestration subscriptions.
|
||||
- `server.welcome` is emitted only after connection-scoped and server-scoped readiness is complete.
|
||||
- `wsServer.ts` no longer publishes directly from ad hoc background streams.
|
||||
|
||||
### 4. Turn background watchers into explicit runtimes — DONE
|
||||
- `apps/server/src/keybindings.ts` refactored as explicit `KeybindingsShape` service with `start`, `ready`, `snapshot` semantics.
|
||||
- Initial config load, cache warmup, and dual watcher attachment (`fs.watch` + `watchFileWithStatPolling`) complete before `ready` resolves.
|
||||
- `watchFileWithStatPolling.ts` is the thin adapter for environments where `fs.watch` is unreliable.
|
||||
|
||||
### 5. Replace polling-based orchestration waiting with receipts — DONE
|
||||
- `RuntimeReceiptBus` service defines three receipt types: `CheckpointBaselineCapturedReceipt`, `CheckpointDiffFinalizedReceipt` (with `status: "ready"|"missing"|"error"`), and `TurnProcessingQuiescedReceipt`.
|
||||
- `CheckpointReactor`, `ProviderCommandReactor`, and `ProviderRuntimeIngestion` use `DrainableWorker` and publish receipts on completion.
|
||||
- Integration harness and checkpoint tests await receipts instead of polling snapshots and git refs.
|
||||
|
||||
### 6. Centralize client transport state and decoding — DONE
|
||||
- `apps/web/src/wsTransport.ts` implements an explicit connection state machine: `connecting`, `open`, `reconnecting`, `closed`, `disposed`.
|
||||
- Two-phase decode (JSON parse → Schema validate) happens at the transport boundary. `wsNativeApi.ts` receives pre-validated messages.
|
||||
- Cached latest welcome/config modeled as explicit `latestPushByChannel` state.
|
||||
|
||||
### 7. Replace ad hoc test helpers with semantic test clients — MOSTLY DONE
|
||||
- `DrainableWorker` replaces timing-sensitive `Effect.sleep` with deterministic `drain()` across reactor tests.
|
||||
- Orchestration harness waits on receipts/barriers instead of `waitForThread`, `waitForGitRef`, and retry loops.
|
||||
- Behavioral assertions moved to deterministic unit-style harnesses; narrow integration tests kept for real filesystem/socket behavior.
|
||||
- **Deferred:** Shared `WsTestClient` helper (connect, awaitSemanticWelcome, awaitTypedPush, trackSequence, matchRpcResponseById). Tests use direct transport subscription instead.
|
||||
|
||||
## Provider-Coupling Guardrails
|
||||
- No generic runtime API may depend on Codex-native event names, thread IDs, or request payload shapes.
|
||||
- No readiness barrier may be defined as "Codex has emitted X." Readiness is owned by the server runtime, not by provider event order.
|
||||
- No websocket channel payload may contain raw provider-native payloads unless the channel is explicitly debug/internal.
|
||||
- Any provider-specific divergence must be exposed through provider capabilities from `ProviderService.getCapabilities()`, not `if provider === "codex"` branches in shared runtime code.
|
||||
- Generic tests must use canonical `ProviderRuntimeEvent` fixtures. Codex-specific ordering and translation tests stay in adapter/app-server suites only.
|
||||
- Keep UI/provider-specific knobs such as Codex-only options scoped to provider UX code. Do not pull them into generic transport or orchestration state.
|
||||
|
||||
## Test Plan
|
||||
- Contracts:
|
||||
- schema tests for typed push envelopes and structured decode diagnostics
|
||||
- ordering tests for `sequence`
|
||||
- Server:
|
||||
- readiness tests proving `server.welcome` cannot precede runtime readiness
|
||||
- push bus tests proving terminal/config/orchestration pushes are serialized and typed
|
||||
- keybindings runtime tests with fake watch source plus one real watcher integration test
|
||||
- Orchestration:
|
||||
- receipt tests proving checkpoint refs and projections are complete before completion signals resolve
|
||||
- replacement of polling-based checkpoint/integration waits with receipt-based waits
|
||||
- Web:
|
||||
- transport tests for invalid JSON, invalid envelope, invalid payload, reconnect queue flushing, cached semantic state
|
||||
- Validation gate:
|
||||
- `bun run lint`
|
||||
- `bun run typecheck`
|
||||
- `mise exec -- bun run test`
|
||||
- repeated full-suite run after cutover to confirm flake removal
|
||||
|
||||
## Assumptions and Defaults
|
||||
- This remains a single-provider product during the cutover, but the runtime contracts must stay provider-neutral.
|
||||
- No backward-compatibility layer is required for old websocket push envelopes.
|
||||
- The goal is deterministic runtime behavior first; reducing retries and sleeps in tests is a consequence, not the primary mechanism.
|
||||
- If a completion signal cannot be expressed provider-neutrally, it does not belong in the shared runtime layer and must stay adapter-local.
|
||||
@@ -3,13 +3,16 @@
|
||||
Goal: Align the orchestration model to `SPEC.md` 1:1 and remove legacy persistence/application cruft.
|
||||
|
||||
Execution mode for this plan:
|
||||
|
||||
- Hard cutover only. Existing DB and migration history are disposable.
|
||||
- Intermediate steps are allowed to break runtime, tests, typecheck, and lint.
|
||||
- We optimize for small, reviewable work units, not continuous app operability.
|
||||
- Only the final gate requires everything to run cleanly.
|
||||
|
||||
## 1. Freeze SPEC contract as source of truth
|
||||
|
||||
Work units:
|
||||
|
||||
- Create `.plans/spec-contract-matrix.md` with one row per requirement in `SPEC.md` sections `7.1`-`7.4`.
|
||||
- Add exact SQL-level requirements per row: table, column, type, nullability, PK/unique, index, and invariants.
|
||||
- Add app-level requirements per row: writer path, reader path, and owning module.
|
||||
@@ -17,17 +20,22 @@ Work units:
|
||||
- Identify any ambiguous spec lines and record a concrete interpretation in the matrix.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- Complete matrix file with no unclassified rows.
|
||||
- Single source checklist used by all later steps.
|
||||
|
||||
Breakage allowed:
|
||||
|
||||
- No code changes required yet.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Every requirement in `7.1`-`7.4` has exactly one matrix row.
|
||||
|
||||
## 2. Hard cutover migrations (replace current migration set)
|
||||
|
||||
Work units:
|
||||
|
||||
- Delete the current legacy migration files and rewrite migration loader ordering.
|
||||
- Create `001_orchestration_events.ts` with full envelope columns and required event indexes.
|
||||
- Create `002_orchestration_command_receipts.ts` with PK + lookup indexes.
|
||||
@@ -47,17 +55,22 @@ Work units:
|
||||
- Ensure old tables (`projects`, `provider_checkpoints`, `provider_sessions`) are not recreated.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- New 5-file migration chain.
|
||||
- Updated migration loader references only new migrations.
|
||||
|
||||
Breakage allowed:
|
||||
|
||||
- Repositories/services can be temporarily broken due to removed old tables.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Fresh DB initializes with only canonical tables plus migration bookkeeping.
|
||||
|
||||
## 3. Align persistence row/request schemas to DB 1:1
|
||||
|
||||
Work units:
|
||||
|
||||
- Define row schemas for each canonical table (contracts or persistence layer module).
|
||||
- Define request schemas for every insert/update/query operation touching canonical tables.
|
||||
- Remove or deprecate row/request schemas tied to deleted legacy tables.
|
||||
@@ -65,17 +78,22 @@ Work units:
|
||||
- Ensure SQL aliases map 1:1 to schema field names (no implicit shape transforms).
|
||||
|
||||
Deliverables:
|
||||
|
||||
- Canonical row/request schemas committed.
|
||||
- Zero references to legacy row schemas in active code paths.
|
||||
|
||||
Breakage allowed:
|
||||
|
||||
- Runtime can still fail while query layers are being rewired.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Every canonical table used in code has a typed row schema and typed request schema.
|
||||
|
||||
## 4. Rewrite event store for full persisted envelope
|
||||
|
||||
Work units:
|
||||
|
||||
- Refactor append path to write full envelope fields:
|
||||
- `event_id`, `aggregate_kind`, `stream_id`, `stream_version`, `event_type`, `occurred_at`, `command_id`, `causation_event_id`, `correlation_id`, `actor_kind`, `payload_json`, `metadata_json`
|
||||
- Implement stream version assignment/checking per aggregate stream.
|
||||
@@ -84,16 +102,21 @@ Work units:
|
||||
- Add explicit SQL ordering guarantees for replay (`ORDER BY sequence ASC`).
|
||||
|
||||
Deliverables:
|
||||
|
||||
- Event store append/replay fully aligned with canonical envelope.
|
||||
|
||||
Breakage allowed:
|
||||
|
||||
- Command dispatch flow can be partially broken until receipts/projectors are updated.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Event store no longer depends on legacy event table shape.
|
||||
|
||||
## 5. Add command receipt idempotency
|
||||
|
||||
Work units:
|
||||
|
||||
- Introduce persistence access layer for `orchestration_command_receipts`.
|
||||
- In command dispatch flow, check existing receipt by `commandId` before append.
|
||||
- On first execution, persist accepted receipt with `resultSequence`.
|
||||
@@ -102,16 +125,21 @@ Work units:
|
||||
- Ensure receipt write and event append ordering is deterministic.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- Dispatch path with idempotency behavior wired through receipts.
|
||||
|
||||
Breakage allowed:
|
||||
|
||||
- Snapshot/read model may still be inconsistent until projectors are fully wired.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Duplicate command IDs no longer create duplicate events.
|
||||
|
||||
## 6. Build DB-backed projection pipeline
|
||||
|
||||
Work units:
|
||||
|
||||
- Create projector runner that consumes events and applies table-specific projections.
|
||||
- Implement projector handlers for each projection table.
|
||||
- For each handler, update target row(s) and `projection_state.last_applied_sequence` in the same transaction.
|
||||
@@ -120,16 +148,21 @@ Work units:
|
||||
- Add safe resume logic from projector `last_applied_sequence`.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- Persistent projector pipeline writing all `projection_*` tables.
|
||||
|
||||
Breakage allowed:
|
||||
|
||||
- Web/API layer may still read old in-memory model until step 7.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Events drive projection rows in DB; projection state advances transactionally.
|
||||
|
||||
## 7. Move RPC reads to projections and diff blobs
|
||||
|
||||
Work units:
|
||||
|
||||
- Implement snapshot query service reading only projection tables.
|
||||
- Build thread hydration from projection rows: messages, activities, checkpoints, session.
|
||||
- Compute `snapshotSequence` as the minimum required projector sequence from `projection_state`.
|
||||
@@ -138,16 +171,21 @@ Work units:
|
||||
- Validate replay handoff contract: snapshot sequence -> replay from `fromSequenceExclusive`.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- `orchestration.getSnapshot` and `orchestration.getTurnDiff` served from DB projections/blob store.
|
||||
|
||||
Breakage allowed:
|
||||
|
||||
- Provider runtime persistence may still be partially legacy until step 8.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- No orchestration read RPC depends on legacy tables or in-memory-only state.
|
||||
|
||||
## 8. Migrate provider runtime persistence to canonical table
|
||||
|
||||
Work units:
|
||||
|
||||
- Create repository/service for `provider_session_runtime`.
|
||||
- Update adapter/session manager to persist runtime/resume cursor in new table.
|
||||
- Ensure domain-visible session state still flows through orchestration events to `projection_thread_sessions`.
|
||||
@@ -155,16 +193,21 @@ Work units:
|
||||
- Verify restart/resume path reads runtime state from canonical table only.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- Provider runtime state entirely backed by `provider_session_runtime`.
|
||||
|
||||
Breakage allowed:
|
||||
|
||||
- Some legacy interfaces may still exist but should be disconnected.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- Runtime restore no longer reads/writes legacy provider session persistence.
|
||||
|
||||
## 9. Remove old cruft aggressively
|
||||
|
||||
Work units:
|
||||
|
||||
- Delete legacy repositories/services that map to removed tables.
|
||||
- Remove dead migration imports and obsolete persistence service interfaces.
|
||||
- Remove compatibility code paths that translate legacy row shapes.
|
||||
@@ -172,16 +215,21 @@ Work units:
|
||||
- Update internal docs/comments to reference canonical projection/event model only.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- Legacy persistence and translation layers removed from active codebase.
|
||||
|
||||
Breakage allowed:
|
||||
|
||||
- Temporary compile failures acceptable while deletion/refactor is in progress.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- No production code path references deleted legacy tables/services.
|
||||
|
||||
## 10. Final verification gate (first point where green is required)
|
||||
|
||||
Work units:
|
||||
|
||||
- Add migration tests that assert canonical tables, columns, constraints, and indexes.
|
||||
- Add event store tests for envelope persistence, metadata, actor kind, and replay.
|
||||
- Add receipt idempotency tests for accept/reject/duplicate paths.
|
||||
@@ -192,10 +240,13 @@ Work units:
|
||||
- Run project lint/typecheck/tests and fix failures.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- Green checks with canonical schema + persistence model in place.
|
||||
|
||||
Breakage allowed:
|
||||
|
||||
- None at end of step.
|
||||
|
||||
Exit criteria:
|
||||
|
||||
- SPEC `7.1`-`7.4` requirements satisfied and validated by tests.
|
||||
@@ -1,6 +1,7 @@
|
||||
# SPEC Contract Matrix (Sections 7.1-7.4)
|
||||
|
||||
Status legend:
|
||||
|
||||
- `required`: requirement acknowledged, no current implementation claim yet.
|
||||
- `implemented`: requirement currently satisfied in code + schema.
|
||||
- `to-replace`: partial/misaligned implementation exists and must be replaced.
|
||||
@@ -9,6 +10,7 @@ Status legend:
|
||||
## 7.1 Write-Side Persisted Tables
|
||||
|
||||
### W1
|
||||
|
||||
- Spec ref: `7.1.1 orchestration_events`
|
||||
- Requirement: append-only event store with canonical envelope columns.
|
||||
- SQL contract:
|
||||
@@ -32,6 +34,7 @@ Status legend:
|
||||
- Notes: current migration/table lacks `stream_id`, `stream_version`, `causation_event_id`, `correlation_id`, `actor_kind`, `metadata_json`.
|
||||
|
||||
### W2
|
||||
|
||||
- Spec ref: `7.1.2 orchestration_command_receipts`
|
||||
- Requirement: command idempotency + ack replay receipts table.
|
||||
- SQL contract:
|
||||
@@ -49,6 +52,7 @@ Status legend:
|
||||
- Notes: missing table and missing idempotency flow.
|
||||
|
||||
### W3
|
||||
|
||||
- Spec ref: `7.1.3 checkpoint_diff_blobs`
|
||||
- Requirement: store large plaintext diffs separate from checkpoint summaries.
|
||||
- SQL contract:
|
||||
@@ -65,6 +69,7 @@ Status legend:
|
||||
- Notes: no canonical diff blob table yet.
|
||||
|
||||
### W4
|
||||
|
||||
- Spec ref: `7.1.4 provider_session_runtime`
|
||||
- Requirement: server-internal provider runtime/resume state.
|
||||
- SQL contract:
|
||||
@@ -86,6 +91,7 @@ Status legend:
|
||||
## 7.2 Canonical Persisted Event Schema
|
||||
|
||||
### E1
|
||||
|
||||
- Spec ref: `7.2 OrchestrationPersistedEventSchema`
|
||||
- Requirement: full typed persisted event envelope in shared contracts.
|
||||
- SQL contract: envelope fields in W1 must map 1:1 to contracts schema.
|
||||
@@ -96,6 +102,7 @@ Status legend:
|
||||
- Notes: contract schema exists; DB + store mapping still incomplete.
|
||||
|
||||
### E2
|
||||
|
||||
- Spec ref: `7.2 Rules/payload discriminated by eventType`
|
||||
- Requirement: `payload` validation keyed by `eventType`.
|
||||
- SQL contract: `event_type` drives payload decode schema; invalid combinations rejected.
|
||||
@@ -106,6 +113,7 @@ Status legend:
|
||||
- Notes: decode is present but DB does not persist full envelope columns.
|
||||
|
||||
### E3
|
||||
|
||||
- Spec ref: `7.2 Rules/provider ids scope`
|
||||
- Requirement: provider ids live in metadata/provider payload, not as thread identity replacement.
|
||||
- SQL contract: provider fields persisted inside `metadata_json`; `stream_id` remains project/thread id.
|
||||
@@ -116,6 +124,7 @@ Status legend:
|
||||
- Notes: metadata plumbing is incomplete in persistence path.
|
||||
|
||||
### E4
|
||||
|
||||
- Spec ref: `7.2 Rules/streamVersion concurrency guard`
|
||||
- Requirement: stream version monotonic per aggregate stream; enforced on write.
|
||||
- SQL contract: `stream_version INTEGER NOT NULL` + uniqueness/invariant enforcement per stream.
|
||||
@@ -128,6 +137,7 @@ Status legend:
|
||||
## 7.3 Required Projected Tables (Read Models)
|
||||
|
||||
### P1
|
||||
|
||||
- Spec ref: `7.3.1 projection_projects`
|
||||
- Requirement: persisted project projection table.
|
||||
- SQL contract:
|
||||
@@ -145,6 +155,7 @@ Status legend:
|
||||
- Notes: legacy `projects` table is separate concept and should be removed from orchestration model.
|
||||
|
||||
### P2
|
||||
|
||||
- Spec ref: `7.3.2 projection_threads`
|
||||
- Requirement: persisted thread projection table.
|
||||
- SQL contract:
|
||||
@@ -165,6 +176,7 @@ Status legend:
|
||||
- Notes: missing table and projector writes.
|
||||
|
||||
### P3
|
||||
|
||||
- Spec ref: `7.3.3 projection_thread_messages`
|
||||
- Requirement: persisted thread message projection table.
|
||||
- SQL contract:
|
||||
@@ -183,6 +195,7 @@ Status legend:
|
||||
- Notes: missing table and message projection writes.
|
||||
|
||||
### P4
|
||||
|
||||
- Spec ref: `7.3.4 projection_thread_activities`
|
||||
- Requirement: persisted thread activity projection table.
|
||||
- SQL contract:
|
||||
@@ -201,6 +214,7 @@ Status legend:
|
||||
- Notes: no canonical activity projection persistence.
|
||||
|
||||
### P5
|
||||
|
||||
- Spec ref: `7.3.5 projection_thread_sessions`
|
||||
- Requirement: persisted thread session projection table.
|
||||
- SQL contract:
|
||||
@@ -219,6 +233,7 @@ Status legend:
|
||||
- Notes: current provider session table is not this domain projection.
|
||||
|
||||
### P6
|
||||
|
||||
- Spec ref: `7.3.6 projection_thread_turns`
|
||||
- Requirement: persisted thread turn projection table.
|
||||
- SQL contract:
|
||||
@@ -237,6 +252,7 @@ Status legend:
|
||||
- Notes: missing table and projection logic.
|
||||
|
||||
### P7
|
||||
|
||||
- Spec ref: `7.3.7 projection_checkpoints`
|
||||
- Requirement: persisted checkpoint summary projection table.
|
||||
- SQL contract:
|
||||
@@ -256,6 +272,7 @@ Status legend:
|
||||
- Notes: current table semantics do not match canonical checkpoint projection schema.
|
||||
|
||||
### P8
|
||||
|
||||
- Spec ref: `7.3.8 projection_pending_approvals`
|
||||
- Requirement: persisted pending-approval projection table.
|
||||
- SQL contract:
|
||||
@@ -273,6 +290,7 @@ Status legend:
|
||||
- Notes: missing table and projection logic.
|
||||
|
||||
### P9
|
||||
|
||||
- Spec ref: `7.3.9 projection_state`
|
||||
- Requirement: projector progress tracking table.
|
||||
- SQL contract:
|
||||
@@ -286,6 +304,7 @@ Status legend:
|
||||
- Notes: missing table and projector bookkeeping.
|
||||
|
||||
### P10
|
||||
|
||||
- Spec ref: `7.3 Projection consistency rules`
|
||||
- Requirement: projector row updates and `projection_state` update must be atomic per event.
|
||||
- SQL contract: per-projector transaction boundary covering both projection write and state update.
|
||||
@@ -296,6 +315,7 @@ Status legend:
|
||||
- Notes: requires transactional projection executor.
|
||||
|
||||
### P11
|
||||
|
||||
- Spec ref: `7.3 Optional debug field`
|
||||
- Requirement: `lastEventSequence` on projection rows is optional and not required for correctness.
|
||||
- SQL contract: optional; not required in baseline schema.
|
||||
@@ -308,6 +328,7 @@ Status legend:
|
||||
## 7.4 Snapshot and RPC Requirements
|
||||
|
||||
### R1
|
||||
|
||||
- Spec ref: `7.4.1`
|
||||
- Requirement: `orchestration.getSnapshot` fully served from projection tables and returns `snapshotSequence`.
|
||||
- SQL contract: snapshot query joins/reads only `projection_*` + `projection_state`.
|
||||
@@ -318,6 +339,7 @@ Status legend:
|
||||
- Notes: current in-memory read model path must be removed for SPEC compliance.
|
||||
|
||||
### R2
|
||||
|
||||
- Spec ref: `7.4.2`
|
||||
- Requirement: snapshot `projects[]` source is `projection_projects`.
|
||||
- SQL contract: `projects` collection assembled from `projection_projects` rows.
|
||||
@@ -328,6 +350,7 @@ Status legend:
|
||||
- Notes: no DB project projection reader exists yet.
|
||||
|
||||
### R3
|
||||
|
||||
- Spec ref: `7.4.3`
|
||||
- Requirement: thread snapshot `checkpoints[]` source is `projection_checkpoints` with required fields.
|
||||
- SQL contract: fields `turnId`, `completedAt`, `status`, `files[]`, `checkpointRef`, optional `assistantMessageId`, `checkpointTurnCount`.
|
||||
@@ -338,6 +361,7 @@ Status legend:
|
||||
- Notes: canonical projection table and reader not implemented.
|
||||
|
||||
### R4
|
||||
|
||||
- Spec ref: `7.4.4`
|
||||
- Requirement: no `listCheckpoints` orchestration RPC; list in snapshot + full diff via `getTurnDiff` from diff blobs.
|
||||
- SQL contract: `getTurnDiff` reads `checkpoint_diff_blobs` only.
|
||||
@@ -348,6 +372,7 @@ Status legend:
|
||||
- Notes: current checkpoint repository is not canonical source.
|
||||
|
||||
### R5
|
||||
|
||||
- Spec ref: `7.4.5`
|
||||
- Requirement: client acts on `ThreadId`; server resolves provider session via `projection_thread_sessions`.
|
||||
- SQL contract: session lookup by `thread_id` from projection table.
|
||||
@@ -358,6 +383,7 @@ Status legend:
|
||||
- Notes: remove provider-session-as-routing-key behavior.
|
||||
|
||||
### R6
|
||||
|
||||
- Spec ref: `7.4.6`
|
||||
- Requirement: `snapshotSequence` derived from `projection_state` minimum over dependent projectors.
|
||||
- SQL contract: `MIN(last_applied_sequence)` across required projector keys.
|
||||
@@ -368,6 +394,7 @@ Status legend:
|
||||
- Notes: must move from in-memory sequence to DB projection-state semantics.
|
||||
|
||||
### R7
|
||||
|
||||
- Spec ref: `7.4.7`
|
||||
- Requirement: snapshot/replay handoff has no gap (`getSnapshot` -> subscribe from snapshot sequence).
|
||||
- SQL contract: read consistency strategy guaranteeing no missing events between snapshot visibility and replay start.
|
||||
@@ -380,22 +407,27 @@ Status legend:
|
||||
## Ambiguous/Interpretation Decisions (tracked upfront)
|
||||
|
||||
### A1
|
||||
|
||||
- Topic: `orchestration_events.stream_id` vs event runtime `aggregateId` naming.
|
||||
- Decision: persist canonical DB column name `stream_id`; map to runtime `aggregateId` where needed in decider/projector code.
|
||||
|
||||
### A2
|
||||
|
||||
- Topic: JSON column typing in SQLite for `payload`, `metadata`, projection payload/files, runtime cursor/payload.
|
||||
- Decision: store as `TEXT` JSON with strict encode/decode schemas at boundaries.
|
||||
|
||||
### A3
|
||||
|
||||
- Topic: `snapshotSequence` dependency set for min-sequence computation.
|
||||
- Decision: include all projectors used to construct snapshot payload (`projects`, `threads`, `messages`, `activities`, `sessions`, `turns`, `checkpoints`, `pending_approvals`).
|
||||
|
||||
### A4
|
||||
|
||||
- Topic: no-gap handoff mechanism in `7.4.7`.
|
||||
- Decision: implement explicit sequence fence semantics at snapshot time; replay starts from fence `fromSequenceExclusive`.
|
||||
|
||||
## Checklist Completeness Statement
|
||||
|
||||
- Coverage scope: `SPEC.md` sections `7.1`, `7.2`, `7.3`, `7.4`.
|
||||
- Requirement rows present: `W1-W4`, `E1-E4`, `P1-P11`, `R1-R7`.
|
||||
- Unclassified rows: `0`.
|
||||
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
dist
|
||||
.DS_Store
|
||||
@@ -0,0 +1,92 @@
|
||||
# effect-http-ws-cli (PoC)
|
||||
|
||||
Minimal PoC using Effect v4 beta with a single unified program:
|
||||
|
||||
- `effect/unstable/cli` as the app entrypoint
|
||||
- `effect/unstable/http` (`HttpServer`, `HttpRouter`, `HttpServerRequest`, `HttpServerResponse`) for server/runtime logic
|
||||
- `@effect/platform-node` to host the server on Node.js
|
||||
- HTTP + WebSocket message routing based on `effect/Schema` validation
|
||||
- static asset serving from local filesystem (`public/` by default)
|
||||
|
||||
The repo now uses a Bun workspace:
|
||||
|
||||
- `server/` contains the Effect HTTP + WebSocket backend
|
||||
- `web/` remains the Vite + React frontend package
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
bun install
|
||||
bun run web:build
|
||||
bun run start -- --port 8787 --host 127.0.0.1 --assets public --db todo.sqlite
|
||||
```
|
||||
|
||||
Then open `http://127.0.0.1:8787`.
|
||||
|
||||
## Frontend
|
||||
|
||||
React + Vite client lives in `web/` and is built into `public/` so it is served by the static router.
|
||||
|
||||
```bash
|
||||
bun run web:build
|
||||
```
|
||||
|
||||
For local development without building the frontend:
|
||||
|
||||
```bash
|
||||
bun run dev
|
||||
```
|
||||
|
||||
That starts the backend, starts Vite on `http://127.0.0.1:5173`, and redirects frontend page requests there. In dev, Vite proxies `/api/*`, `/ws`, and `/health` back to the backend server.
|
||||
|
||||
If you want to run the processes separately, start `bun run web:dev` and launch the backend with `FRONTEND_DEV_ORIGIN=http://127.0.0.1:5173`.
|
||||
|
||||
The UI now demonstrates a typed realtime todo workflow:
|
||||
|
||||
- load todo snapshot on page load (`listTodos`)
|
||||
- subscribe to todo updates (`subscribeTodos`)
|
||||
- mutate todos via RPC (`renameTodo`, `completeTodo`, `archiveTodo`)
|
||||
|
||||
### Config Sources
|
||||
|
||||
Config is resolved from both CLI flags and `effect/Config`:
|
||||
|
||||
- CLI flags: `--host`, `--port`, `--assets`, `--db`, `--request-logging`, `--frontend-dev-origin`
|
||||
- Env via `effect/Config`: `HOST`, `PORT`, `ASSETS_DIR`, `DB_FILENAME`, `REQUEST_LOGGING`, `FRONTEND_DEV_ORIGIN`
|
||||
|
||||
Precedence:
|
||||
|
||||
1. CLI flags
|
||||
2. `effect/Config` (environment)
|
||||
3. hard defaults (`127.0.0.1`, `8787`, `public`, `todo.sqlite`)
|
||||
|
||||
### SQL Persistence
|
||||
|
||||
- Uses `effect/unstable/sql` + `SqlSchema` for typed SQL request/result decoding.
|
||||
- Uses `@effect/sql-sqlite-node` as the Node runtime SQL client.
|
||||
- Database schema is managed by `effect/unstable/sql/Migrator` via `server/src/migrations.ts` with statically imported migration files.
|
||||
|
||||
## API
|
||||
|
||||
- `GET /health`
|
||||
- `POST /api/dispatch`
|
||||
- `GET /ws` (WebSocket RPC)
|
||||
- `GET *` (static files)
|
||||
|
||||
### Message schema
|
||||
|
||||
Incoming messages are validated with `Schema`:
|
||||
|
||||
- `{ "kind": "echo", "text": string }`
|
||||
- `{ "kind": "sum", "left": number, "right": number }`
|
||||
- `{ "kind": "time" }`
|
||||
|
||||
Both HTTP and WebSocket dispatch use the same schema-driven router.
|
||||
|
||||
## Verify
|
||||
|
||||
```bash
|
||||
bun run test
|
||||
bun run test:web
|
||||
bun run lint
|
||||
```
|
||||
@@ -0,0 +1,638 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"configVersion": 0,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "effect-http-ws-cli",
|
||||
},
|
||||
"server": {
|
||||
"name": "@effect-http-ws-cli/server",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/sql-sqlite-node": "catalog:",
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "^24.10.0",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
"web": {
|
||||
"name": "@effect-http-ws-cli/web",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@effect-http-ws-cli/server": "workspace:*",
|
||||
"@effect/atom-react": "catalog:",
|
||||
"@tanstack/react-router": "^1.166.2",
|
||||
"effect": "catalog:",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tanstack/router-plugin": "^1.166.2",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.1",
|
||||
"@vitest/browser-playwright": "^4.0.18",
|
||||
"playwright": "^1.58.2",
|
||||
"typescript": "catalog:",
|
||||
"vite": "^7.2.0",
|
||||
"vitest": "catalog:",
|
||||
"vitest-browser-react": "^2.0.5",
|
||||
},
|
||||
},
|
||||
},
|
||||
"catalog": {
|
||||
"@effect/atom-react": "4.0.0-beta.27",
|
||||
"@effect/platform-node": "4.0.0-beta.27",
|
||||
"@effect/sql-sqlite-node": "4.0.0-beta.27",
|
||||
"@effect/vitest": "4.0.0-beta.27",
|
||||
"effect": "4.0.0-beta.27",
|
||||
"typescript": "6.0.0-beta",
|
||||
"vitest": "^4.0.18",
|
||||
},
|
||||
"packages": {
|
||||
"@babel/code-frame": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="],
|
||||
|
||||
"@babel/compat-data": ["@babel/[email protected]", "", {}, "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg=="],
|
||||
|
||||
"@babel/core": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-module-transforms": "^7.28.6", "@babel/helpers": "^7.28.6", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/traverse": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA=="],
|
||||
|
||||
"@babel/generator": ["@babel/[email protected]", "", { "dependencies": { "@babel/parser": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw=="],
|
||||
|
||||
"@babel/helper-compilation-targets": ["@babel/[email protected]", "", { "dependencies": { "@babel/compat-data": "^7.28.6", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA=="],
|
||||
|
||||
"@babel/helper-globals": ["@babel/[email protected]", "", {}, "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw=="],
|
||||
|
||||
"@babel/helper-module-imports": ["@babel/[email protected]", "", { "dependencies": { "@babel/traverse": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw=="],
|
||||
|
||||
"@babel/helper-module-transforms": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-module-imports": "^7.28.6", "@babel/helper-validator-identifier": "^7.28.5", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA=="],
|
||||
|
||||
"@babel/helper-plugin-utils": ["@babel/[email protected]", "", {}, "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug=="],
|
||||
|
||||
"@babel/helper-string-parser": ["@babel/[email protected]", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="],
|
||||
|
||||
"@babel/helper-validator-identifier": ["@babel/[email protected]", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="],
|
||||
|
||||
"@babel/helper-validator-option": ["@babel/[email protected]", "", {}, "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg=="],
|
||||
|
||||
"@babel/helpers": ["@babel/[email protected]", "", { "dependencies": { "@babel/template": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw=="],
|
||||
|
||||
"@babel/parser": ["@babel/[email protected]", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="],
|
||||
|
||||
"@babel/plugin-syntax-jsx": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w=="],
|
||||
|
||||
"@babel/plugin-syntax-typescript": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A=="],
|
||||
|
||||
"@babel/plugin-transform-react-jsx-self": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw=="],
|
||||
|
||||
"@babel/plugin-transform-react-jsx-source": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw=="],
|
||||
|
||||
"@babel/template": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.28.6", "@babel/parser": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ=="],
|
||||
|
||||
"@babel/traverse": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/types": "^7.29.0", "debug": "^4.3.1" } }, "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA=="],
|
||||
|
||||
"@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="],
|
||||
|
||||
"@effect-http-ws-cli/server": ["@effect-http-ws-cli/server@workspace:server"],
|
||||
|
||||
"@effect-http-ws-cli/web": ["@effect-http-ws-cli/web@workspace:web"],
|
||||
|
||||
"@effect/atom-react": ["@effect/[email protected]", "", { "peerDependencies": { "effect": "^4.0.0-beta.27", "react": "^19.2.4", "scheduler": "*" } }, "sha512-miq9lG74I9ypFdDTUIYWQR2OomxDweYM4Fv/h/Md0eXVrk+c/KAkgK0YT5pn3x5plZUHSuSuBEC36185/zpFPA=="],
|
||||
|
||||
"@effect/platform-node": ["@effect/[email protected]", "", { "dependencies": { "@effect/platform-node-shared": "^4.0.0-beta.27", "mime": "^4.1.0", "undici": "^7.20.0" }, "peerDependencies": { "effect": "^4.0.0-beta.27", "ioredis": "^5.7.0" } }, "sha512-UPZMtFVnDIM5nb6A2pEPo229VnfgMdvl/9sGiQaYRB9qEVHerk0elxcoWOb2szoivBYePYFOsPKIWpR6jCldtQ=="],
|
||||
|
||||
"@effect/platform-node-shared": ["@effect/[email protected]", "", { "dependencies": { "@types/ws": "^8.18.1", "ws": "^8.19.0" }, "peerDependencies": { "effect": "^4.0.0-beta.27" } }, "sha512-prRa5MIWGAvq2g6FgVP5RFfPwI+DvcXCaEZetvPMK70wdkTR1+jKQqJ9QDKWNIP+2d4llE/cF21SvcpBJWq0gw=="],
|
||||
|
||||
"@effect/sql-sqlite-node": ["@effect/[email protected]", "", { "dependencies": { "better-sqlite3": "^12.6.2" }, "peerDependencies": { "effect": "^4.0.0-beta.27" } }, "sha512-GhTe2gIob7wuQ7OYHM+FtjPhYhf0oFtImPWwaXdQ14kxCSQVFuHY+ll45p2bxTAInnrnDip+Q+UC6xpNnvI3Cw=="],
|
||||
|
||||
"@effect/vitest": ["@effect/[email protected]", "", { "peerDependencies": { "effect": "^4.0.0-beta.27", "vitest": "^3.0.0 || ^4.0.0" } }, "sha512-l9LIQK2yqOF3h47CmlT2VfYWtfHLd+ZuMzma+w0OjxmPsR6bzYMA33ft4gljJ/lEQnXvGHxiTpnZySALCfv+pA=="],
|
||||
|
||||
"@esbuild/aix-ppc64": ["@esbuild/[email protected]", "", { "os": "aix", "cpu": "ppc64" }, "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg=="],
|
||||
|
||||
"@esbuild/android-arm": ["@esbuild/[email protected]", "", { "os": "android", "cpu": "arm" }, "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA=="],
|
||||
|
||||
"@esbuild/android-arm64": ["@esbuild/[email protected]", "", { "os": "android", "cpu": "arm64" }, "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg=="],
|
||||
|
||||
"@esbuild/android-x64": ["@esbuild/[email protected]", "", { "os": "android", "cpu": "x64" }, "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ=="],
|
||||
|
||||
"@esbuild/darwin-arm64": ["@esbuild/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg=="],
|
||||
|
||||
"@esbuild/darwin-x64": ["@esbuild/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg=="],
|
||||
|
||||
"@esbuild/freebsd-arm64": ["@esbuild/[email protected]", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w=="],
|
||||
|
||||
"@esbuild/freebsd-x64": ["@esbuild/[email protected]", "", { "os": "freebsd", "cpu": "x64" }, "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA=="],
|
||||
|
||||
"@esbuild/linux-arm": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw=="],
|
||||
|
||||
"@esbuild/linux-arm64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg=="],
|
||||
|
||||
"@esbuild/linux-ia32": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "ia32" }, "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg=="],
|
||||
|
||||
"@esbuild/linux-loong64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA=="],
|
||||
|
||||
"@esbuild/linux-mips64el": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw=="],
|
||||
|
||||
"@esbuild/linux-ppc64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA=="],
|
||||
|
||||
"@esbuild/linux-riscv64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ=="],
|
||||
|
||||
"@esbuild/linux-s390x": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "s390x" }, "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw=="],
|
||||
|
||||
"@esbuild/linux-x64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA=="],
|
||||
|
||||
"@esbuild/netbsd-arm64": ["@esbuild/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA=="],
|
||||
|
||||
"@esbuild/netbsd-x64": ["@esbuild/[email protected]", "", { "os": "none", "cpu": "x64" }, "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA=="],
|
||||
|
||||
"@esbuild/openbsd-arm64": ["@esbuild/[email protected]", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw=="],
|
||||
|
||||
"@esbuild/openbsd-x64": ["@esbuild/[email protected]", "", { "os": "openbsd", "cpu": "x64" }, "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ=="],
|
||||
|
||||
"@esbuild/openharmony-arm64": ["@esbuild/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g=="],
|
||||
|
||||
"@esbuild/sunos-x64": ["@esbuild/[email protected]", "", { "os": "sunos", "cpu": "x64" }, "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA=="],
|
||||
|
||||
"@esbuild/win32-arm64": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA=="],
|
||||
|
||||
"@esbuild/win32-ia32": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q=="],
|
||||
|
||||
"@esbuild/win32-x64": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA=="],
|
||||
|
||||
"@ioredis/commands": ["@ioredis/[email protected]", "", {}, "sha512-JH8ZL/ywcJyR9MmJ5BNqZllXNZQqQbnVZOqpPQqE1vHiFgAw4NHbvE0FOduNU8IX9babitBT46571OnPTT0Zcw=="],
|
||||
|
||||
"@jridgewell/gen-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],
|
||||
|
||||
"@jridgewell/remapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="],
|
||||
|
||||
"@jridgewell/resolve-uri": ["@jridgewell/[email protected]", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
|
||||
|
||||
"@jridgewell/sourcemap-codec": ["@jridgewell/[email protected]", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="],
|
||||
|
||||
"@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-darwin-arm64": ["@msgpackr-extract/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-darwin-x64": ["@msgpackr-extract/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-linux-arm": ["@msgpackr-extract/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-linux-arm64": ["@msgpackr-extract/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-linux-x64": ["@msgpackr-extract/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-win32-x64": ["@msgpackr-extract/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ=="],
|
||||
|
||||
"@polka/url": ["@polka/[email protected]", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="],
|
||||
|
||||
"@rolldown/pluginutils": ["@rolldown/[email protected]", "", {}, "sha512-eybk3TjzzzV97Dlj5c+XrBFW57eTNhzod66y9HrBlzJ6NsCrWCp/2kaPS3K9wJmurBC0Tdw4yPjXKZqlznim3Q=="],
|
||||
|
||||
"@rollup/rollup-android-arm-eabi": ["@rollup/[email protected]", "", { "os": "android", "cpu": "arm" }, "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg=="],
|
||||
|
||||
"@rollup/rollup-android-arm64": ["@rollup/[email protected]", "", { "os": "android", "cpu": "arm64" }, "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q=="],
|
||||
|
||||
"@rollup/rollup-darwin-arm64": ["@rollup/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg=="],
|
||||
|
||||
"@rollup/rollup-darwin-x64": ["@rollup/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w=="],
|
||||
|
||||
"@rollup/rollup-freebsd-arm64": ["@rollup/[email protected]", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA=="],
|
||||
|
||||
"@rollup/rollup-freebsd-x64": ["@rollup/[email protected]", "", { "os": "freebsd", "cpu": "x64" }, "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg=="],
|
||||
|
||||
"@rollup/rollup-linux-arm-gnueabihf": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw=="],
|
||||
|
||||
"@rollup/rollup-linux-arm-musleabihf": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA=="],
|
||||
|
||||
"@rollup/rollup-linux-arm64-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA=="],
|
||||
|
||||
"@rollup/rollup-linux-arm64-musl": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA=="],
|
||||
|
||||
"@rollup/rollup-linux-loong64-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg=="],
|
||||
|
||||
"@rollup/rollup-linux-loong64-musl": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q=="],
|
||||
|
||||
"@rollup/rollup-linux-ppc64-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA=="],
|
||||
|
||||
"@rollup/rollup-linux-ppc64-musl": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA=="],
|
||||
|
||||
"@rollup/rollup-linux-riscv64-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg=="],
|
||||
|
||||
"@rollup/rollup-linux-riscv64-musl": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg=="],
|
||||
|
||||
"@rollup/rollup-linux-s390x-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "s390x" }, "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w=="],
|
||||
|
||||
"@rollup/rollup-linux-x64-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg=="],
|
||||
|
||||
"@rollup/rollup-linux-x64-musl": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg=="],
|
||||
|
||||
"@rollup/rollup-openbsd-x64": ["@rollup/[email protected]", "", { "os": "openbsd", "cpu": "x64" }, "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ=="],
|
||||
|
||||
"@rollup/rollup-openharmony-arm64": ["@rollup/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA=="],
|
||||
|
||||
"@rollup/rollup-win32-arm64-msvc": ["@rollup/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A=="],
|
||||
|
||||
"@rollup/rollup-win32-ia32-msvc": ["@rollup/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA=="],
|
||||
|
||||
"@rollup/rollup-win32-x64-gnu": ["@rollup/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA=="],
|
||||
|
||||
"@rollup/rollup-win32-x64-msvc": ["@rollup/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA=="],
|
||||
|
||||
"@standard-schema/spec": ["@standard-schema/[email protected]", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
|
||||
|
||||
"@tanstack/history": ["@tanstack/[email protected]", "", {}, "sha512-Kp/WSt411ZWYvgXy6uiv5RmhHrz9cAml05AQPrtdAp7eUqvIDbMGPnML25OKbzR3RJ1q4wgENxDTvlGPa9+Mww=="],
|
||||
|
||||
"@tanstack/react-router": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/history": "1.161.4", "@tanstack/react-store": "^0.9.1", "@tanstack/router-core": "1.166.2", "isbot": "^5.1.22", "tiny-invariant": "^1.3.3", "tiny-warning": "^1.0.3" }, "peerDependencies": { "react": ">=18.0.0 || >=19.0.0", "react-dom": ">=18.0.0 || >=19.0.0" } }, "sha512-pKhUtrvVLlhjWhsHkJSuIzh1J4LcP+8ErbIqRLORX9Js8dUFMKoT0+8oFpi+P8QRpuhm/7rzjYiWfcyTsqQZtA=="],
|
||||
|
||||
"@tanstack/react-store": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/store": "0.9.1", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-YzJLnRvy5lIEFTLWBAZmcOjK3+2AepnBv/sr6NZmiqJvq7zTQggyK99Gw8fqYdMdHPQWXjz0epFKJXC+9V2xDA=="],
|
||||
|
||||
"@tanstack/router-core": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/history": "1.161.4", "@tanstack/store": "^0.9.1", "cookie-es": "^2.0.0", "seroval": "^1.4.2", "seroval-plugins": "^1.4.2", "tiny-invariant": "^1.3.3", "tiny-warning": "^1.0.3" } }, "sha512-zn3NhENOAX9ToQiX077UV2OH3aJKOvV2ZMNZZxZ3gDG3i3WqL8NfWfEgetEAfMN37/Mnt90PpotYgf7IyuoKqQ=="],
|
||||
|
||||
"@tanstack/router-generator": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/router-core": "1.166.2", "@tanstack/router-utils": "1.161.4", "@tanstack/virtual-file-routes": "1.161.4", "prettier": "^3.5.0", "recast": "^0.23.11", "source-map": "^0.7.4", "tsx": "^4.19.2", "zod": "^3.24.2" } }, "sha512-wbvdyP1PKKQKk4aVlGeK9S5uDy8zodTr3tEZ2gRKNavJLusXbEWqtoo42JxHFFNB6dtguehFMt8PyZPAtkgWwQ=="],
|
||||
|
||||
"@tanstack/router-plugin": ["@tanstack/[email protected]", "", { "dependencies": { "@babel/core": "^7.28.5", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.5", "@babel/types": "^7.28.5", "@tanstack/router-core": "1.166.2", "@tanstack/router-generator": "1.166.2", "@tanstack/router-utils": "1.161.4", "@tanstack/virtual-file-routes": "1.161.4", "chokidar": "^3.6.0", "unplugin": "^2.1.2", "zod": "^3.24.2" }, "peerDependencies": { "@rsbuild/core": ">=1.0.2", "@tanstack/react-router": "^1.166.2", "vite": ">=5.0.0 || >=6.0.0 || >=7.0.0", "vite-plugin-solid": "^2.11.10", "webpack": ">=5.92.0" }, "optionalPeers": ["@rsbuild/core", "@tanstack/react-router", "vite", "vite-plugin-solid", "webpack"] }, "sha512-TnyV/7//Vp5fR49mmNbOWHGz9IJTm1lqVxzPdtpzg7D5PjkW2HFmLFLtWwpJgz2R7AJJWR4Ge5kIPmC+fVZ6eQ=="],
|
||||
|
||||
"@tanstack/router-utils": ["@tanstack/[email protected]", "", { "dependencies": { "@babel/core": "^7.28.5", "@babel/generator": "^7.28.5", "@babel/parser": "^7.28.5", "@babel/types": "^7.28.5", "ansis": "^4.1.0", "babel-dead-code-elimination": "^1.0.12", "diff": "^8.0.2", "pathe": "^2.0.3", "tinyglobby": "^0.2.15" } }, "sha512-r8TpjyIZoqrXXaf2DDyjd44gjGBoyE+/oEaaH68yLI9ySPO1gUWmQENZ1MZnmBnpUGN24NOZxdjDLc8npK0SAw=="],
|
||||
|
||||
"@tanstack/store": ["@tanstack/[email protected]", "", {}, "sha512-+qcNkOy0N1qSGsP7omVCW0SDrXtaDcycPqBDE726yryiA5eTDFpjBReaYjghVJwNf1pcPMyzIwTGlYjCSQR0Fg=="],
|
||||
|
||||
"@tanstack/virtual-file-routes": ["@tanstack/[email protected]", "", {}, "sha512-42WoRePf8v690qG8yGRe/YOh+oHni9vUaUUfoqlS91U2scd3a5rkLtVsc6b7z60w3RogH0I00vdrC5AaeiZ18w=="],
|
||||
|
||||
"@types/babel__core": ["@types/[email protected]", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="],
|
||||
|
||||
"@types/babel__generator": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.0.0" } }, "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg=="],
|
||||
|
||||
"@types/babel__template": ["@types/[email protected]", "", { "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" } }, "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A=="],
|
||||
|
||||
"@types/babel__traverse": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.28.2" } }, "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q=="],
|
||||
|
||||
"@types/chai": ["@types/[email protected]", "", { "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA=="],
|
||||
|
||||
"@types/deep-eql": ["@types/[email protected]", "", {}, "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw=="],
|
||||
|
||||
"@types/estree": ["@types/[email protected]", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
|
||||
|
||||
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-fPxQqz4VTgPI/IQ+lj9r0h+fDR66bzoeMGHp8ASee+32OSGIkeASsoZuJixsQoVef1QJbeubcPBxKk22QVoWdw=="],
|
||||
|
||||
"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w=="],
|
||||
|
||||
"@types/react-dom": ["@types/[email protected]", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="],
|
||||
|
||||
"@types/ws": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],
|
||||
|
||||
"@vitejs/plugin-react": ["@vitejs/[email protected]", "", { "dependencies": { "@babel/core": "^7.29.0", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-rc.3", "@types/babel__core": "^7.20.5", "react-refresh": "^0.18.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-VIcFLdRi/VYRU8OL/puL7QXMYafHmqOnwTZY50U1JPlCNj30PxCMx65c494b1K9be9hX83KVt0+gTEwTWLqToA=="],
|
||||
|
||||
"@vitest/browser": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/mocker": "4.0.18", "@vitest/utils": "4.0.18", "magic-string": "^0.30.21", "pixelmatch": "7.1.0", "pngjs": "^7.0.0", "sirv": "^3.0.2", "tinyrainbow": "^3.0.3", "ws": "^8.18.3" }, "peerDependencies": { "vitest": "4.0.18" } }, "sha512-gVQqh7paBz3gC+ZdcCmNSWJMk70IUjDeVqi+5m5vYpEHsIwRgw3Y545jljtajhkekIpIp5Gg8oK7bctgY0E2Ng=="],
|
||||
|
||||
"@vitest/browser-playwright": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/browser": "4.0.18", "@vitest/mocker": "4.0.18", "tinyrainbow": "^3.0.3" }, "peerDependencies": { "playwright": "*", "vitest": "4.0.18" } }, "sha512-gfajTHVCiwpxRj1qh0Sh/5bbGLG4F/ZH/V9xvFVoFddpITfMta9YGow0W6ZpTTORv2vdJuz9TnrNSmjKvpOf4g=="],
|
||||
|
||||
"@vitest/expect": ["@vitest/[email protected]", "", { "dependencies": { "@standard-schema/spec": "^1.0.0", "@types/chai": "^5.2.2", "@vitest/spy": "4.0.18", "@vitest/utils": "4.0.18", "chai": "^6.2.1", "tinyrainbow": "^3.0.3" } }, "sha512-8sCWUyckXXYvx4opfzVY03EOiYVxyNrHS5QxX3DAIi5dpJAAkyJezHCP77VMX4HKA2LDT/Jpfo8i2r5BE3GnQQ=="],
|
||||
|
||||
"@vitest/mocker": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/spy": "4.0.18", "estree-walker": "^3.0.3", "magic-string": "^0.30.21" }, "peerDependencies": { "msw": "^2.4.9", "vite": "^6.0.0 || ^7.0.0-0" }, "optionalPeers": ["msw"] }, "sha512-HhVd0MDnzzsgevnOWCBj5Otnzobjy5wLBe4EdeeFGv8luMsGcYqDuFRMcttKWZA5vVO8RFjexVovXvAM4JoJDQ=="],
|
||||
|
||||
"@vitest/pretty-format": ["@vitest/[email protected]", "", { "dependencies": { "tinyrainbow": "^3.0.3" } }, "sha512-P24GK3GulZWC5tz87ux0m8OADrQIUVDPIjjj65vBXYG17ZeU3qD7r+MNZ1RNv4l8CGU2vtTRqixrOi9fYk/yKw=="],
|
||||
|
||||
"@vitest/runner": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/utils": "4.0.18", "pathe": "^2.0.3" } }, "sha512-rpk9y12PGa22Jg6g5M3UVVnTS7+zycIGk9ZNGN+m6tZHKQb7jrP7/77WfZy13Y/EUDd52NDsLRQhYKtv7XfPQw=="],
|
||||
|
||||
"@vitest/snapshot": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/pretty-format": "4.0.18", "magic-string": "^0.30.21", "pathe": "^2.0.3" } }, "sha512-PCiV0rcl7jKQjbgYqjtakly6T1uwv/5BQ9SwBLekVg/EaYeQFPiXcgrC2Y7vDMA8dM1SUEAEV82kgSQIlXNMvA=="],
|
||||
|
||||
"@vitest/spy": ["@vitest/[email protected]", "", {}, "sha512-cbQt3PTSD7P2OARdVW3qWER5EGq7PHlvE+QfzSC0lbwO+xnt7+XH06ZzFjFRgzUX//JmpxrCu92VdwvEPlWSNw=="],
|
||||
|
||||
"@vitest/utils": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/pretty-format": "4.0.18", "tinyrainbow": "^3.0.3" } }, "sha512-msMRKLMVLWygpK3u2Hybgi4MNjcYJvwTb0Ru09+fOyCXIgT5raYP041DRRdiJiI3k/2U6SEbAETB3YtBrUkCFA=="],
|
||||
|
||||
"acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw=="],
|
||||
|
||||
"ansis": ["[email protected]", "", {}, "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig=="],
|
||||
|
||||
"anymatch": ["[email protected]", "", { "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" } }, "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw=="],
|
||||
|
||||
"assertion-error": ["[email protected]", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="],
|
||||
|
||||
"ast-types": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.1" } }, "sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg=="],
|
||||
|
||||
"babel-dead-code-elimination": ["[email protected]", "", { "dependencies": { "@babel/core": "^7.23.7", "@babel/parser": "^7.23.6", "@babel/traverse": "^7.23.7", "@babel/types": "^7.23.6" } }, "sha512-GERT7L2TiYcYDtYk1IpD+ASAYXjKbLTDPhBtYj7X1NuRMDTMtAx9kyBenub1Ev41lo91OHCKdmP+egTDmfQ7Ig=="],
|
||||
|
||||
"base64-js": ["[email protected]", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="],
|
||||
|
||||
"baseline-browser-mapping": ["[email protected]", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA=="],
|
||||
|
||||
"better-sqlite3": ["[email protected]", "", { "dependencies": { "bindings": "^1.5.0", "prebuild-install": "^7.1.1" } }, "sha512-8VYKM3MjCa9WcaSAI3hzwhmyHVlH8tiGFwf0RlTsZPWJ1I5MkzjiudCo4KC4DxOaL/53A5B1sI/IbldNFDbsKA=="],
|
||||
|
||||
"binary-extensions": ["[email protected]", "", {}, "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw=="],
|
||||
|
||||
"bindings": ["[email protected]", "", { "dependencies": { "file-uri-to-path": "1.0.0" } }, "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ=="],
|
||||
|
||||
"bl": ["[email protected]", "", { "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="],
|
||||
|
||||
"braces": ["[email protected]", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="],
|
||||
|
||||
"browserslist": ["[email protected]", "", { "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", "electron-to-chromium": "^1.5.263", "node-releases": "^2.0.27", "update-browserslist-db": "^1.2.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA=="],
|
||||
|
||||
"buffer": ["[email protected]", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],
|
||||
|
||||
"caniuse-lite": ["[email protected]", "", {}, "sha512-sg01JDPzZ9jGshqKSckOQthXnYwOEP50jeVFhaSFbZcOy05TiuuaffDOfcwtCisJ9kNQuLBFibYywv2Bgm9osw=="],
|
||||
|
||||
"chai": ["[email protected]", "", {}, "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg=="],
|
||||
|
||||
"chokidar": ["[email protected]", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="],
|
||||
|
||||
"chownr": ["[email protected]", "", {}, "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="],
|
||||
|
||||
"cluster-key-slot": ["[email protected]", "", {}, "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA=="],
|
||||
|
||||
"convert-source-map": ["[email protected]", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="],
|
||||
|
||||
"cookie-es": ["[email protected]", "", {}, "sha512-RAj4E421UYRgqokKUmotqAwuplYw15qtdXfY+hGzgCJ/MBjCVZcSoHK/kH9kocfjRjcDME7IiDWR/1WX1TM2Pg=="],
|
||||
|
||||
"csstype": ["[email protected]", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="],
|
||||
|
||||
"debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
|
||||
|
||||
"decompress-response": ["[email protected]", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="],
|
||||
|
||||
"deep-extend": ["[email protected]", "", {}, "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="],
|
||||
|
||||
"denque": ["[email protected]", "", {}, "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw=="],
|
||||
|
||||
"detect-libc": ["[email protected]", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
|
||||
|
||||
"diff": ["[email protected]", "", {}, "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ=="],
|
||||
|
||||
"effect": ["[email protected]", "", { "dependencies": { "@standard-schema/spec": "^1.1.0", "fast-check": "^4.5.3", "find-my-way-ts": "^0.1.6", "ini": "^6.0.0", "kubernetes-types": "^1.30.0", "msgpackr": "^1.11.8", "multipasta": "^0.2.7", "toml": "^3.0.0", "uuid": "^13.0.0", "yaml": "^2.8.2" } }, "sha512-bNQEF3vaVGF8jAJ+HW1A4DaxVNmujgEu89sO+VNW1AvUYtPGMtKPTBU15K9inu1rG+hkxNFFRlVvLAJsdaE2mg=="],
|
||||
|
||||
"electron-to-chromium": ["[email protected]", "", {}, "sha512-5z3uFKBWjiNR44nFcYdkcXjKMbg5KXNdciu7mhTPo9tB7NbqSNP2sSnGR+fqknZSCwKkBN+oxiiajWs4dT6ORg=="],
|
||||
|
||||
"end-of-stream": ["[email protected]", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="],
|
||||
|
||||
"es-module-lexer": ["[email protected]", "", {}, "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA=="],
|
||||
|
||||
"esbuild": ["[email protected]", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.3", "@esbuild/android-arm": "0.27.3", "@esbuild/android-arm64": "0.27.3", "@esbuild/android-x64": "0.27.3", "@esbuild/darwin-arm64": "0.27.3", "@esbuild/darwin-x64": "0.27.3", "@esbuild/freebsd-arm64": "0.27.3", "@esbuild/freebsd-x64": "0.27.3", "@esbuild/linux-arm": "0.27.3", "@esbuild/linux-arm64": "0.27.3", "@esbuild/linux-ia32": "0.27.3", "@esbuild/linux-loong64": "0.27.3", "@esbuild/linux-mips64el": "0.27.3", "@esbuild/linux-ppc64": "0.27.3", "@esbuild/linux-riscv64": "0.27.3", "@esbuild/linux-s390x": "0.27.3", "@esbuild/linux-x64": "0.27.3", "@esbuild/netbsd-arm64": "0.27.3", "@esbuild/netbsd-x64": "0.27.3", "@esbuild/openbsd-arm64": "0.27.3", "@esbuild/openbsd-x64": "0.27.3", "@esbuild/openharmony-arm64": "0.27.3", "@esbuild/sunos-x64": "0.27.3", "@esbuild/win32-arm64": "0.27.3", "@esbuild/win32-ia32": "0.27.3", "@esbuild/win32-x64": "0.27.3" }, "bin": "bin/esbuild" }, "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg=="],
|
||||
|
||||
"escalade": ["[email protected]", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
|
||||
|
||||
"esprima": ["[email protected]", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="],
|
||||
|
||||
"estree-walker": ["[email protected]", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="],
|
||||
|
||||
"expand-template": ["[email protected]", "", {}, "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg=="],
|
||||
|
||||
"expect-type": ["[email protected]", "", {}, "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA=="],
|
||||
|
||||
"fast-check": ["[email protected]", "", { "dependencies": { "pure-rand": "^7.0.0" } }, "sha512-IE9csY7lnhxBnA8g/WI5eg/hygA6MGWJMSNfFRrBlXUciADEhS1EDB0SIsMSvzubzIlOBbVITSsypCsW717poA=="],
|
||||
|
||||
"fdir": ["[email protected]", "", { "peerDependencies": { "picomatch": "^3 || ^4" } }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
|
||||
|
||||
"file-uri-to-path": ["[email protected]", "", {}, "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="],
|
||||
|
||||
"fill-range": ["[email protected]", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="],
|
||||
|
||||
"find-my-way-ts": ["[email protected]", "", {}, "sha512-a85L9ZoXtNAey3Y6Z+eBWW658kO/MwR7zIafkIUPUMf3isZG0NCs2pjW2wtjxAKuJPxMAsHUIP4ZPGv0o5gyTA=="],
|
||||
|
||||
"fs-constants": ["[email protected]", "", {}, "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="],
|
||||
|
||||
"fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="],
|
||||
|
||||
"gensync": ["[email protected]", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="],
|
||||
|
||||
"get-tsconfig": ["[email protected]", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw=="],
|
||||
|
||||
"github-from-package": ["[email protected]", "", {}, "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="],
|
||||
|
||||
"glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
|
||||
|
||||
"ieee754": ["[email protected]", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
|
||||
|
||||
"inherits": ["[email protected]", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
||||
|
||||
"ini": ["[email protected]", "", {}, "sha512-IBTdIkzZNOpqm7q3dRqJvMaldXjDHWkEDfrwGEQTs5eaQMWV+djAhR+wahyNNMAa+qpbDUhBMVt4ZKNwpPm7xQ=="],
|
||||
|
||||
"ioredis": ["[email protected]", "", { "dependencies": { "@ioredis/commands": "1.5.1", "cluster-key-slot": "^1.1.0", "debug": "^4.3.4", "denque": "^2.1.0", "lodash.defaults": "^4.2.0", "lodash.isarguments": "^3.1.0", "redis-errors": "^1.2.0", "redis-parser": "^3.0.0", "standard-as-callback": "^2.1.0" } }, "sha512-HVBe9OFuqs+Z6n64q09PQvP1/R4Bm+30PAyyD4wIEqssh3v9L21QjCVk4kRLucMBcDokJTcLjsGeVRlq/nH6DA=="],
|
||||
|
||||
"is-binary-path": ["[email protected]", "", { "dependencies": { "binary-extensions": "^2.0.0" } }, "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw=="],
|
||||
|
||||
"is-extglob": ["[email protected]", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="],
|
||||
|
||||
"is-glob": ["[email protected]", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],
|
||||
|
||||
"is-number": ["[email protected]", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="],
|
||||
|
||||
"isbot": ["[email protected]", "", {}, "sha512-waFfC72ZNfwLLuJ2iLaoVaqcNo+CAaLR7xCpAn0Y5WfGzkNHv7ZN39Vbi1y+kb+Zs46XHOX3tZNExroFUPX+Kg=="],
|
||||
|
||||
"js-tokens": ["[email protected]", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="],
|
||||
|
||||
"jsesc": ["[email protected]", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="],
|
||||
|
||||
"json5": ["[email protected]", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],
|
||||
|
||||
"kubernetes-types": ["[email protected]", "", {}, "sha512-Dew1okvhM/SQcIa2rcgujNndZwU8VnSapDgdxlYoB84ZlpAD43U6KLAFqYo17ykSFGHNPrg0qry0bP+GJd9v7Q=="],
|
||||
|
||||
"lodash.defaults": ["[email protected]", "", {}, "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ=="],
|
||||
|
||||
"lodash.isarguments": ["[email protected]", "", {}, "sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg=="],
|
||||
|
||||
"lru-cache": ["[email protected]", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],
|
||||
|
||||
"magic-string": ["[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
|
||||
|
||||
"mime": ["[email protected]", "", { "bin": "bin/cli.js" }, "sha512-X5ju04+cAzsojXKes0B/S4tcYtFAJ6tTMuSPBEn9CPGlrWr8Fiw7qYeLT0XyH80HSoAoqWCaz+MWKh22P7G1cw=="],
|
||||
|
||||
"mimic-response": ["[email protected]", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="],
|
||||
|
||||
"minimist": ["[email protected]", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],
|
||||
|
||||
"mkdirp-classic": ["[email protected]", "", {}, "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="],
|
||||
|
||||
"mrmime": ["[email protected]", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="],
|
||||
|
||||
"ms": ["[email protected]", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
||||
|
||||
"msgpackr": ["[email protected]", "", { "optionalDependencies": { "msgpackr-extract": "^3.0.2" } }, "sha512-bC4UGzHhVvgDNS7kn9tV8fAucIYUBuGojcaLiz7v+P63Lmtm0Xeji8B/8tYKddALXxJLpwIeBmUN3u64C4YkRA=="],
|
||||
|
||||
"msgpackr-extract": ["[email protected]", "", { "dependencies": { "node-gyp-build-optional-packages": "5.2.2" }, "optionalDependencies": { "@msgpackr-extract/msgpackr-extract-darwin-arm64": "3.0.3", "@msgpackr-extract/msgpackr-extract-darwin-x64": "3.0.3", "@msgpackr-extract/msgpackr-extract-linux-arm": "3.0.3", "@msgpackr-extract/msgpackr-extract-linux-arm64": "3.0.3", "@msgpackr-extract/msgpackr-extract-linux-x64": "3.0.3", "@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.3" }, "bin": { "download-msgpackr-prebuilds": "bin/download-prebuilds.js" } }, "sha512-P0efT1C9jIdVRefqjzOQ9Xml57zpOXnIuS+csaB4MdZbTdmGDLo8XhzBG1N7aO11gKDDkJvBLULeFTo46wwreA=="],
|
||||
|
||||
"multipasta": ["[email protected]", "", {}, "sha512-KPA58d68KgGil15oDqXjkUBEBYc00XvbPj5/X+dyzeo/lWm9Nc25pQRlf1D+gv4OpK7NM0J1odrbu9JNNGvynA=="],
|
||||
|
||||
"nanoid": ["[email protected]", "", { "bin": "bin/nanoid.cjs" }, "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w=="],
|
||||
|
||||
"napi-build-utils": ["[email protected]", "", {}, "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA=="],
|
||||
|
||||
"node-abi": ["[email protected]", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-+CGM1L1CgmtheLcBuleyYOn7NWPVu0s0EJH2C4puxgEZb9h8QpR9G2dBfZJOAUhi7VQxuBPMd0hiISWcTyiYyQ=="],
|
||||
|
||||
"node-gyp-build-optional-packages": ["[email protected]", "", { "dependencies": { "detect-libc": "^2.0.1" }, "bin": { "node-gyp-build-optional-packages": "bin.js", "node-gyp-build-optional-packages-optional": "optional.js", "node-gyp-build-optional-packages-test": "build-test.js" } }, "sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw=="],
|
||||
|
||||
"node-releases": ["[email protected]", "", {}, "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA=="],
|
||||
|
||||
"normalize-path": ["[email protected]", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="],
|
||||
|
||||
"obug": ["[email protected]", "", {}, "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ=="],
|
||||
|
||||
"once": ["[email protected]", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
|
||||
|
||||
"pathe": ["[email protected]", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
|
||||
|
||||
"picocolors": ["[email protected]", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
||||
|
||||
"picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
|
||||
|
||||
"pixelmatch": ["[email protected]", "", { "dependencies": { "pngjs": "^7.0.0" }, "bin": { "pixelmatch": "bin/pixelmatch" } }, "sha512-1wrVzJ2STrpmONHKBy228LM1b84msXDUoAzVEl0R8Mz4Ce6EPr+IVtxm8+yvrqLYMHswREkjYFaMxnyGnaY3Ng=="],
|
||||
|
||||
"playwright": ["[email protected]", "", { "dependencies": { "playwright-core": "1.58.2" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-vA30H8Nvkq/cPBnNw4Q8TWz1EJyqgpuinBcHET0YVJVFldr8JDNiU9LaWAE1KqSkRYazuaBhTpB5ZzShOezQ6A=="],
|
||||
|
||||
"playwright-core": ["[email protected]", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-yZkEtftgwS8CsfYo7nm0KE8jsvm6i/PTgVtB8DL726wNf6H2IMsDuxCpJj59KDaxCtSnrWan2AeDqM7JBaultg=="],
|
||||
|
||||
"pngjs": ["[email protected]", "", {}, "sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow=="],
|
||||
|
||||
"postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg=="],
|
||||
|
||||
"prebuild-install": ["[email protected]", "", { "dependencies": { "detect-libc": "^2.0.0", "expand-template": "^2.0.3", "github-from-package": "0.0.0", "minimist": "^1.2.3", "mkdirp-classic": "^0.5.3", "napi-build-utils": "^2.0.0", "node-abi": "^3.3.0", "pump": "^3.0.0", "rc": "^1.2.7", "simple-get": "^4.0.0", "tar-fs": "^2.0.0", "tunnel-agent": "^0.6.0" }, "bin": { "prebuild-install": "bin.js" } }, "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug=="],
|
||||
|
||||
"prettier": ["[email protected]", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg=="],
|
||||
|
||||
"pump": ["[email protected]", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA=="],
|
||||
|
||||
"pure-rand": ["[email protected]", "", {}, "sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ=="],
|
||||
|
||||
"rc": ["[email protected]", "", { "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" }, "bin": { "rc": "./cli.js" } }, "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw=="],
|
||||
|
||||
"react": ["[email protected]", "", {}, "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ=="],
|
||||
|
||||
"react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.4" } }, "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ=="],
|
||||
|
||||
"react-refresh": ["[email protected]", "", {}, "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw=="],
|
||||
|
||||
"readable-stream": ["[email protected]", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
||||
|
||||
"readdirp": ["[email protected]", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="],
|
||||
|
||||
"recast": ["[email protected]", "", { "dependencies": { "ast-types": "^0.16.1", "esprima": "~4.0.0", "source-map": "~0.6.1", "tiny-invariant": "^1.3.3", "tslib": "^2.0.1" } }, "sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA=="],
|
||||
|
||||
"redis-errors": ["[email protected]", "", {}, "sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w=="],
|
||||
|
||||
"redis-parser": ["[email protected]", "", { "dependencies": { "redis-errors": "^1.0.0" } }, "sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A=="],
|
||||
|
||||
"resolve-pkg-maps": ["[email protected]", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="],
|
||||
|
||||
"rollup": ["[email protected]", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.59.0", "@rollup/rollup-android-arm64": "4.59.0", "@rollup/rollup-darwin-arm64": "4.59.0", "@rollup/rollup-darwin-x64": "4.59.0", "@rollup/rollup-freebsd-arm64": "4.59.0", "@rollup/rollup-freebsd-x64": "4.59.0", "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", "@rollup/rollup-linux-arm-musleabihf": "4.59.0", "@rollup/rollup-linux-arm64-gnu": "4.59.0", "@rollup/rollup-linux-arm64-musl": "4.59.0", "@rollup/rollup-linux-loong64-gnu": "4.59.0", "@rollup/rollup-linux-loong64-musl": "4.59.0", "@rollup/rollup-linux-ppc64-gnu": "4.59.0", "@rollup/rollup-linux-ppc64-musl": "4.59.0", "@rollup/rollup-linux-riscv64-gnu": "4.59.0", "@rollup/rollup-linux-riscv64-musl": "4.59.0", "@rollup/rollup-linux-s390x-gnu": "4.59.0", "@rollup/rollup-linux-x64-gnu": "4.59.0", "@rollup/rollup-linux-x64-musl": "4.59.0", "@rollup/rollup-openbsd-x64": "4.59.0", "@rollup/rollup-openharmony-arm64": "4.59.0", "@rollup/rollup-win32-arm64-msvc": "4.59.0", "@rollup/rollup-win32-ia32-msvc": "4.59.0", "@rollup/rollup-win32-x64-gnu": "4.59.0", "@rollup/rollup-win32-x64-msvc": "4.59.0", "fsevents": "~2.3.2" }, "bin": "dist/bin/rollup" }, "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg=="],
|
||||
|
||||
"safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
|
||||
|
||||
"scheduler": ["[email protected]", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="],
|
||||
|
||||
"semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
|
||||
|
||||
"seroval": ["[email protected]", "", {}, "sha512-OE4cvmJ1uSPrKorFIH9/w/Qwuvi/IMcGbv5RKgcJ/zjA/IohDLU6SVaxFN9FwajbP7nsX0dQqMDes1whk3y+yw=="],
|
||||
|
||||
"seroval-plugins": ["[email protected]", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-EAHqADIQondwRZIdeW2I636zgsODzoBDwb3PT/+7TLDWyw1Dy/Xv7iGUIEXXav7usHDE9HVhOU61irI3EnyyHA=="],
|
||||
|
||||
"siginfo": ["[email protected]", "", {}, "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="],
|
||||
|
||||
"simple-concat": ["[email protected]", "", {}, "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="],
|
||||
|
||||
"simple-get": ["[email protected]", "", { "dependencies": { "decompress-response": "^6.0.0", "once": "^1.3.1", "simple-concat": "^1.0.0" } }, "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA=="],
|
||||
|
||||
"sirv": ["[email protected]", "", { "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", "totalist": "^3.0.0" } }, "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g=="],
|
||||
|
||||
"source-map": ["[email protected]", "", {}, "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ=="],
|
||||
|
||||
"source-map-js": ["[email protected]", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
|
||||
|
||||
"stackback": ["[email protected]", "", {}, "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw=="],
|
||||
|
||||
"standard-as-callback": ["[email protected]", "", {}, "sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A=="],
|
||||
|
||||
"std-env": ["[email protected]", "", {}, "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg=="],
|
||||
|
||||
"string_decoder": ["[email protected]", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="],
|
||||
|
||||
"strip-json-comments": ["[email protected]", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="],
|
||||
|
||||
"tar-fs": ["[email protected]", "", { "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", "tar-stream": "^2.1.4" } }, "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ=="],
|
||||
|
||||
"tar-stream": ["[email protected]", "", { "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.1.1" } }, "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ=="],
|
||||
|
||||
"tiny-invariant": ["[email protected]", "", {}, "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg=="],
|
||||
|
||||
"tiny-warning": ["[email protected]", "", {}, "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="],
|
||||
|
||||
"tinybench": ["[email protected]", "", {}, "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg=="],
|
||||
|
||||
"tinyexec": ["[email protected]", "", {}, "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg=="],
|
||||
|
||||
"tinyglobby": ["[email protected]", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="],
|
||||
|
||||
"tinyrainbow": ["[email protected]", "", {}, "sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q=="],
|
||||
|
||||
"to-regex-range": ["[email protected]", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],
|
||||
|
||||
"toml": ["[email protected]", "", {}, "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w=="],
|
||||
|
||||
"totalist": ["[email protected]", "", {}, "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ=="],
|
||||
|
||||
"tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"tsx": ["[email protected]", "", { "dependencies": { "esbuild": "~0.27.0", "get-tsconfig": "^4.7.5" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "bin": "dist/cli.mjs" }, "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw=="],
|
||||
|
||||
"tunnel-agent": ["[email protected]", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w=="],
|
||||
|
||||
"typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CldZdztDpQRLM1HC6WDQjQkQN5Ub5zRau737a1diGh3lPmb9oRsaWHk1y5iqK0o7+1bNJ0oXfEGRkAogFZBL+Q=="],
|
||||
|
||||
"undici": ["[email protected]", "", {}, "sha512-RqslV2Us5BrllB+JeiZnK4peryVTndy9Dnqq62S3yYRRTj0tFQCwEniUy2167skdGOy3vqRzEvl1Dm4sV2ReDg=="],
|
||||
|
||||
"undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
||||
|
||||
"unplugin": ["[email protected]", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "acorn": "^8.15.0", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww=="],
|
||||
|
||||
"update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="],
|
||||
|
||||
"use-sync-external-store": ["[email protected]", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w=="],
|
||||
|
||||
"util-deprecate": ["[email protected]", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
|
||||
|
||||
"uuid": ["[email protected]", "", { "bin": "dist-node/bin/uuid" }, "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w=="],
|
||||
|
||||
"vite": ["[email protected]", "", { "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser"], "bin": "bin/vite.js" }, "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA=="],
|
||||
|
||||
"vitest": ["[email protected]", "", { "dependencies": { "@vitest/expect": "4.0.18", "@vitest/mocker": "4.0.18", "@vitest/pretty-format": "4.0.18", "@vitest/runner": "4.0.18", "@vitest/snapshot": "4.0.18", "@vitest/spy": "4.0.18", "@vitest/utils": "4.0.18", "es-module-lexer": "^1.7.0", "expect-type": "^1.2.2", "magic-string": "^0.30.21", "obug": "^2.1.1", "pathe": "^2.0.3", "picomatch": "^4.0.3", "std-env": "^3.10.0", "tinybench": "^2.9.0", "tinyexec": "^1.0.2", "tinyglobby": "^0.2.15", "tinyrainbow": "^3.0.3", "vite": "^6.0.0 || ^7.0.0", "why-is-node-running": "^2.3.0" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "4.0.18", "@vitest/browser-preview": "4.0.18", "@vitest/browser-webdriverio": "4.0.18", "@vitest/ui": "4.0.18", "happy-dom": "*", "jsdom": "*" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/ui", "happy-dom", "jsdom"], "bin": "vitest.mjs" }, "sha512-hOQuK7h0FGKgBAas7v0mSAsnvrIgAvWmRFjmzpJ7SwFHH3g1k2u37JtYwOwmEKhK6ZO3v9ggDBBm0La1LCK4uQ=="],
|
||||
|
||||
"vitest-browser-react": ["[email protected]", "", { "peerDependencies": { "@types/react": "^18.0.0 || ^19.0.0", "@types/react-dom": "^18.0.0 || ^19.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0", "vitest": "^4.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-YODQX8mHTJCyKNVYTWJrLEYrUtw+QfLl78owgvuE7C5ydgmGBq6v5s4jK2w6wdPhIZsN9PpV1rQbmAevWJjO9g=="],
|
||||
|
||||
"webpack-virtual-modules": ["[email protected]", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="],
|
||||
|
||||
"why-is-node-running": ["[email protected]", "", { "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" }, "bin": "cli.js" }, "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w=="],
|
||||
|
||||
"wrappy": ["[email protected]", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
|
||||
|
||||
"ws": ["[email protected]", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg=="],
|
||||
|
||||
"yallist": ["[email protected]", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="],
|
||||
|
||||
"yaml": ["[email protected]", "", { "bin": "bin.mjs" }, "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A=="],
|
||||
|
||||
"zod": ["[email protected]", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
|
||||
|
||||
"@types/ws/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-akNQMv0wW5uyRpD2v2IEyRSZiR+BeGuoB6L310EgGObO44HSMNT8z1xzio28V8qOrgYaopIDNA18YgdXd+qTiw=="],
|
||||
|
||||
"anymatch/picomatch": ["[email protected]", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
||||
|
||||
"chokidar/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"node-abi/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
||||
|
||||
"rc/ini": ["[email protected]", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="],
|
||||
|
||||
"readdirp/picomatch": ["[email protected]", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
||||
|
||||
"recast/source-map": ["[email protected]", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
|
||||
|
||||
"rollup/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"tsx/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"vite/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"@types/ws/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "effect-http-ws-cli",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"packageManager": "[email protected]",
|
||||
"workspaces": {
|
||||
"packages": ["server", "web"],
|
||||
"catalog": {
|
||||
"@effect/platform-node": "4.0.0-beta.27",
|
||||
"@effect/sql-sqlite-node": "4.0.0-beta.27",
|
||||
"@effect/atom-react": "4.0.0-beta.27",
|
||||
"@effect/vitest": "4.0.0-beta.27",
|
||||
"effect": "4.0.0-beta.27",
|
||||
"typescript": "6.0.0-beta",
|
||||
"vitest": "^4.0.18"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "node scripts/dev.mjs",
|
||||
"start": "node server/src/bin.ts",
|
||||
"web:dev": "bun run --filter @effect-http-ws-cli/web dev",
|
||||
"web:build": "bun run --filter @effect-http-ws-cli/web build",
|
||||
"web:preview": "bun run --filter @effect-http-ws-cli/web preview",
|
||||
"test": "bun run --filter @effect-http-ws-cli/server test",
|
||||
"test:web": "bun run --filter @effect-http-ws-cli/web test",
|
||||
"test:all": "bun run --sequential --workspaces test",
|
||||
"lint": "bun run --sequential --workspaces lint"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
:root{--paper: #f3f0e8;--ink: #13222c;--ink-soft: #345264;--accent: #dc4f18;--accent-soft: #f8bb68;--panel: #fffdf6;--line: #162f3f22;--shadow: 0 16px 40px #0f1e291f}*{box-sizing:border-box}body{margin:0;min-height:100vh;font-family:IBM Plex Sans,Segoe UI,sans-serif;color:var(--ink);background:radial-gradient(circle at 10% 10%,#f7cf9a 0%,transparent 36%),radial-gradient(circle at 92% 88%,#95c7d2 0%,transparent 32%),linear-gradient(165deg,#ece8dc 0%,var(--paper) 48%,#e9dfcf 100%)}.shell{width:min(1100px,100% - 2rem);margin:1.5rem auto;padding:1.5rem;border:1px solid var(--line);border-radius:20px;background:color-mix(in oklab,var(--paper),white 35%);box-shadow:var(--shadow)}.hero{position:relative;overflow:hidden;padding:1.5rem;border-radius:16px;border:1px solid var(--line);background:linear-gradient(140deg,#fff9ed,#f7efe0 65%,#f2e7d4)}.hero:after{content:"";position:absolute;width:220px;height:220px;right:-60px;top:-90px;border-radius:999px;background:linear-gradient(180deg,var(--accent-soft),transparent 70%);pointer-events:none}.eyebrow{margin:0;font-size:.72rem;letter-spacing:.22em;text-transform:uppercase;color:var(--ink-soft)}h1,h2{font-family:Archivo Black,Impact,sans-serif;letter-spacing:.02em;margin:0}h1{margin-top:.35rem;font-size:clamp(1.5rem,4vw,2.35rem)}h2{font-size:1.1rem}.lead{margin:.6rem 0 0;color:var(--ink-soft);max-width:68ch}.panel{border:1px solid var(--line);border-radius:14px;padding:1rem;background:var(--panel);margin-top:1rem}.status-panel{margin-top:0;background:linear-gradient(140deg,#fbf7ee,#f1e8d7)}.status-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem}.status-item{border:1px solid var(--line);border-radius:10px;padding:.55rem .7rem;display:flex;justify-content:space-between;align-items:baseline;gap:.75rem;background:#fff}.status-label{color:var(--ink-soft);font-size:.82rem}.status-subscription-connected{border-color:#24704755;background:#f1fbf5}.status-subscription-connecting{border-color:#8d6a1b55;background:#fff8eb}.status-subscription-idle{border-color:var(--line)}.status-mutation-busy{border-color:#6b3b2e55;background:#fff3ef}.todo-header{display:flex;justify-content:space-between;align-items:baseline;gap:1rem}.meta{display:flex;gap:.75rem;color:var(--ink-soft);font-size:.86rem}.todo-list{margin:.8rem 0 0;padding:0;list-style:none;display:grid;gap:.6rem}.event-list{margin:.8rem 0 0;padding:0;list-style:none;display:grid;gap:.5rem;max-height:260px;overflow:auto}.event-item{border:1px solid var(--line);border-radius:10px;background:#fff;padding:.55rem .65rem}.event-top{display:flex;justify-content:space-between;gap:.6rem;color:var(--ink-soft);font-size:.8rem}.event-body{margin-top:.2rem;display:flex;justify-content:space-between;gap:.75rem;font-size:.9rem}.event-body small{color:var(--ink-soft);white-space:nowrap}.todo-item{display:flex;gap:.8rem;align-items:center;border:1px solid var(--line);border-radius:10px;background:#fff;padding:.65rem}.todo-main{flex:1}.todo-main input{width:100%;margin:0;border:1px solid var(--line);background:#fff;border-radius:8px;padding:.42rem .55rem;color:var(--ink);font:inherit;font-weight:600}.todo-main small{display:block;margin-top:.3rem;color:var(--ink-soft)}.todo-actions{display:flex;gap:.45rem}button{border:1px solid #0f243233;border-radius:8px;background:linear-gradient(160deg,#fff,#f4efe3);color:var(--ink);padding:.4rem .6rem;font:inherit;font-size:.85rem;font-weight:700;cursor:pointer;transition:transform .12s ease,box-shadow .12s ease}button:hover{transform:translateY(-1px);box-shadow:0 8px 18px #0f20321a}.todo-item.is-completed .todo-main input{text-decoration:line-through;color:var(--ink-soft)}.todo-item.is-archived{opacity:.64}.footer{margin-top:1rem;display:flex;gap:1rem;align-items:center;font-size:.88rem;color:var(--ink-soft)}.error{color:var(--accent);font-weight:700}@media(max-width:880px){.shell{width:min(1100px,100% - 1rem);padding:1rem}.todo-item{flex-direction:column;align-items:stretch}.todo-actions{justify-content:flex-end}.status-grid{grid-template-columns:1fr}}
|
||||
@@ -0,0 +1,35 @@
|
||||
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))i(u);new MutationObserver(u=>{for(const o of u)if(o.type==="childList")for(const d of o.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function s(u){const o={};return u.integrity&&(o.integrity=u.integrity),u.referrerPolicy&&(o.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?o.credentials="include":u.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(u){if(u.ep)return;u.ep=!0;const o=s(u);fetch(u.href,o)}})();function KR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zm={exports:{}},au={};var O1;function PR(){if(O1)return au;O1=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(i,u,o){var d=null;if(o!==void 0&&(d=""+o),u.key!==void 0&&(d=""+u.key),"key"in u){o={};for(var h in u)h!=="key"&&(o[h]=u[h])}else o=u;return u=o.ref,{$$typeof:e,type:i,key:d,ref:u!==void 0?u:null,props:o}}return au.Fragment=n,au.jsx=s,au.jsxs=s,au}var R1;function XR(){return R1||(R1=1,Zm.exports=PR()),Zm.exports}var ee=XR(),Wm={exports:{}},ye={};var A1;function QR(){if(A1)return ye;A1=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),v=Symbol.iterator;function _(w){return w===null||typeof w!="object"?null:(w=v&&w[v]||w["@@iterator"],typeof w=="function"?w:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,j={};function B(w,G,re){this.props=w,this.context=G,this.refs=j,this.updater=re||x}B.prototype.isReactComponent={},B.prototype.setState=function(w,G){if(typeof w!="object"&&typeof w!="function"&&w!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,w,G,"setState")},B.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function M(){}M.prototype=B.prototype;function I(w,G,re){this.props=w,this.context=G,this.refs=j,this.updater=re||x}var z=I.prototype=new M;z.constructor=I,T(z,B.prototype),z.isPureReactComponent=!0;var W=Array.isArray;function H(){}var V={H:null,A:null,T:null,S:null},Y=Object.prototype.hasOwnProperty;function te(w,G,re){var ae=re.ref;return{$$typeof:e,type:w,key:G,ref:ae!==void 0?ae:null,props:re}}function fe(w,G){return te(w.type,G,w.props)}function oe(w){return typeof w=="object"&&w!==null&&w.$$typeof===e}function ie(w){var G={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(re){return G[re]})}var A=/\/+/g;function Q(w,G){return typeof w=="object"&&w!==null&&w.key!=null?ie(""+w.key):G.toString(36)}function Z(w){switch(w.status){case"fulfilled":return w.value;case"rejected":throw w.reason;default:switch(typeof w.status=="string"?w.then(H,H):(w.status="pending",w.then(function(G){w.status==="pending"&&(w.status="fulfilled",w.value=G)},function(G){w.status==="pending"&&(w.status="rejected",w.reason=G)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function O(w,G,re,ae,he){var xe=typeof w;(xe==="undefined"||xe==="boolean")&&(w=null);var Ne=!1;if(w===null)Ne=!0;else switch(xe){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(w.$$typeof){case e:case n:Ne=!0;break;case y:return Ne=w._init,O(Ne(w._payload),G,re,ae,he)}}if(Ne)return he=he(w),Ne=ae===""?"."+Q(w,0):ae,W(he)?(re="",Ne!=null&&(re=Ne.replace(A,"$&/")+"/"),O(he,G,re,"",function(Ur){return Ur})):he!=null&&(oe(he)&&(he=fe(he,re+(he.key==null||w&&w.key===he.key?"":(""+he.key).replace(A,"$&/")+"/")+Ne)),G.push(he)),1;Ne=0;var pt=ae===""?".":ae+":";if(W(w))for(var Ze=0;Ze<w.length;Ze++)ae=w[Ze],xe=pt+Q(ae,Ze),Ne+=O(ae,G,re,xe,he);else if(Ze=_(w),typeof Ze=="function")for(w=Ze.call(w),Ze=0;!(ae=w.next()).done;)ae=ae.value,xe=pt+Q(ae,Ze++),Ne+=O(ae,G,re,xe,he);else if(xe==="object"){if(typeof w.then=="function")return O(Z(w),G,re,ae,he);throw G=String(w),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(w).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function N(w,G,re){if(w==null)return w;var ae=[],he=0;return O(w,ae,"","",function(xe){return G.call(re,xe,he++)}),ae}function ne(w){if(w._status===-1){var G=w._result;G=G(),G.then(function(re){(w._status===0||w._status===-1)&&(w._status=1,w._result=re)},function(re){(w._status===0||w._status==Line truncated
|
||||
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||||
`+ps+t+oc}var fc=!1;function Wa(t,r){if(!t||fc)return"";fc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(r){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(F){var q=F}Reflect.construct(t,[],J)}else{try{J.call()}catch(F){q=F}t.call(J.prototype)}}else{try{throw Error()}catch(F){q=F}(J=t())&&typeof J.catch=="function"&&J.catch(function(){})}}catch(F){if(F&&q&&typeof F.stack=="string")return[F.stack,q.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var l=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");l&&l.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=c.DetermineComponentFrameRoot(),g=f[0],b=f[1];if(g&&b){var E=g.split(`
|
||||
`),L=b.split(`
|
||||
`);for(l=c=0;c<E.length&&!E[c].includes("DetermineComponentFrameRoot");)c++;for(;l<L.length&&!L[l].includes("DetermineComponentFrameRoot");)l++;if(c===E.length||l===L.length)for(c=E.length-1,l=L.length-1;1<=c&&0<=l&&E[c]!==L[l];)l--;for(;1<=c&&0<=l;c--,l--)if(E[c]!==L[l]){if(c!==1||l!==1)do if(c--,l--,0>l||E[c]!==L[l]){var K=`
|
||||
`+E[c].replace(" at new "," at ");return t.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",t.displayName)),K}while(1<=c&&0<=l);break}}}finally{fc=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?mr(a):""}function bl(t,r){switch(t.tag){case 26:case 27:case 5:return mr(t.type);case 16:return mr("Lazy");case 13:return t.child!==r&&r!==null?mr("Suspense Fallback"):mr("Suspense");case 19:return mr("SuspenseList");case 0:case 15:return Wa(t.type,!1);case 11:return Wa(t.type.render,!1);case 1:return Wa(t.type,!0);case 31:return mr("Activity");default:return""}}function Nr(t){try{var r="",a=null;do r+=bl(t,a),a=t,t=t.return;while(t);return r}catch(c){return`
|
||||
Error generating stack: `+c.message+`
|
||||
`+c.stack}}var ca=Object.prototype.hasOwnProperty,tr=e.unstable_scheduleCallback,dc=e.unstable_cancelCallback,qd=e.unstable_shouldYield,_l=e.unstable_requestPaint,rn=e.unstable_now,xl=e.unstable_getCurrentPriorityLevel,Fe=e.unstable_ImmediatePriority,_t=e.unstable_UserBlockingPriority,Qt=e.unstable_NormalPriority,El=e.unstable_LowPriority,My=e.unstable_IdlePriority,M2=e.log,C2=e.unstable_setDisableYieldValue,hc=null,bn=null;function gs(t){if(typeof M2=="function"&&C2(t),bn&&typeof bn.setStrictMode=="function")try{bn.setStrictMode(hc,t)}catch{}}var _n=Math.clz32?Math.clz32:z2,k2=Math.log,U2=Math.LN2;function z2(t){return t>>>=0,t===0?32:31-(k2(t)/U2|0)|0}var wl=256,Tl=262144,Ol=4194304;function ua(t){var r=t&42;if(r!==0)return r;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Rl(t,r,a){var c=t.pendingLanes;if(c===0)return 0;var l=0,f=t.suspendedLanes,g=t.pingedLanes;t=t.warmLanes;var b=c&134217727;return b!==0?(c=b&~f,c!==0?l=ua(c):(g&=b,g!==0?l=ua(g):a||(a=b&~t,a!==0&&(l=ua(a))))):(b=c&~f,b!==0?l=ua(b):g!==0?l=ua(g):a||(a=c&~t,a!==0&&(l=ua(a)))),l===0?0:r!==0&&r!==l&&(r&f)===0&&(f=l&-l,a=r&-r,f>=a||f===32&&(a&4194048)!==0)?r:l}function mc(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function N2(t,r){switch(t){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Cy(){var t=Ol;return Ol<<=1,(Ol&62914560)===0&&(Ol=4194304),t}function $d(t){for(var r=[],a=0;31>a;a++)r.push(t);return r}function pc(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function D2(t,r,a,c,l,f){var g=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var b=t.entanglements,E=t.expirationTimes,L=t.hiddenUpdates;for(a=g&~a;0<a;){var K=31-_n(a),J=1<<K;b[K]=0,E[K]=-1;var q=L[K];if(q!==null)for(L[K]=null,K=0;K<q.length;K++){var F=q[K];F!==null&&(F.lane&=-536870913)}a&=~J}c!==0&&ky(t,c,0),f!==0&&l===0&&t.tag!==0&&(t.suspendedLanes|=f&~(g&~r))}function ky(t,r,a){t.pendingLanes|=r,t.suspendedLanes&=~r;var c=31-_n(r);t.entangledLanes|=r,t.entanglements[c]=t.entanglements[c]|1073741824|a&261930}function Uy(t,r){var a=t.entangledLanes|=r;for(t=t.entanglements;a;){var c=31-_n(a),l=1<<c;l&r|t[c]&r&&(t[c]|=r),a&=~l}}function zy(t,r){var a=r&-r;return a=(a&42)!==0?1:Hd(a),(a&(t.suspendedLanes|r))!==0?0:a}function Hd(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Vd(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Ny(){var t=N.p;return t!==0?t:(t=window.event,t===void 0?32:v1(t.type))}function Dy(t,r){var a=N.p;try{return N.p=t,r()}finally{N.p=a}}var ys=Math.random().toString(36).slice(2),It="__reactFiber$"+ys,cn="__reactProps$"+ys,ei="__reactContainer$"+ys,Id="__reactEvents$"+ys,L2="__reactListeners$"+ys,j2="__reactHandles$"+ys,Ly="__reactResources$"+ys,gc="__reactMarker$"+ys;function Yd(t){delete t[It],delete t[cn],delete t[Id],delete t[L2],delete t[j2]}function ti(t){var r=t[It];if(r)return r;for(var a=t.parentNode;a;){if(r=a[ei]||a[It]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(t=r1(t);t!==null;){if(a=t[It])return a;t=r1(t)}return r}t=a,a=t.parentNode}return null}function ni(t){if(t=t[It]||t[ei]){var r=t.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return t}return null}function yc(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t.stateNode;throw Error(i(33))}function ri(t){var r=t[Ly];return r||(r=t[Ly]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function zt(t){t[gc]=!0}var jy=new Set,By={};function la(t,r){si(t,r),si(t+"Capture",r)}function si(t,r){for(By[t]=r,t=0;t<r.length;t++)jy.add(r[t])}var B2=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u21
Line truncated
|
||||
`).replace(pR,"")}function Kb(t,r){return r=Fb(r),Fb(t)===r}function Ye(t,r,a,c,l,f){switch(a){case"children":typeof c=="string"?r==="body"||r==="textarea"&&c===""||ii(t,c):(typeof c=="number"||typeof c=="bigint")&&r!=="body"&&ii(t,""+c);break;case"className":Ml(t,"class",c);break;case"tabIndex":Ml(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Ml(t,a,c);break;case"style":Ky(t,c,f);break;case"data":if(r!=="object"){Ml(t,"data",c);break}case"src":case"href":if(c===""&&(r!=="a"||a!=="href")){t.removeAttribute(a);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(a);break}c=kl(""+c),t.setAttribute(a,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(a==="formAction"?(r!=="input"&&Ye(t,r,"name",l.name,l,null),Ye(t,r,"formEncType",l.formEncType,l,null),Ye(t,r,"formMethod",l.formMethod,l,null),Ye(t,r,"formTarget",l.formTarget,l,null)):(Ye(t,r,"encType",l.encType,l,null),Ye(t,r,"method",l.method,l,null),Ye(t,r,"target",l.target,l,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(a);break}c=kl(""+c),t.setAttribute(a,c);break;case"onClick":c!=null&&(t.onclick=Lr);break;case"onScroll":c!=null&&Re("scroll",t);break;case"onScrollEnd":c!=null&&Re("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(a=c.__html,a!=null){if(l.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}a=kl(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(a,""+c):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":c===!0?t.setAttribute(a,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(a,c):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(a,c):t.removeAttribute(a);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(a):t.setAttribute(a,c);break;case"popover":Re("beforetoggle",t),Re("toggle",t),Al(t,"popover",c);break;case"xlinkActuate":Dr(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Dr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Dr(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Dr(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Dr(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Dr(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Dr(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Dr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Dr(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Al(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=I2.get(a)||a,Al(t,a,c))}}function Nm(t,r,a,c,l,f){switch(a){case"style":Ky(t,c,f);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(a=c.__html,a!=null){if(l.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof c=="string"?ii(t,c):(typeof c=="number"||typeof c=="bigint")&&ii(t,""+c);break;case"onScroll":c!=null&&Re("scroll",t);break;case"onScrollEnd":c!=null&&Re("scrollend",t);break;case"onClick":c!=null&&(t.onclick=Lr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne
Line truncated
|
||||
`+o(y+1));return`[
|
||||
${o(y+1)}${S}
|
||||
${o(y)}]`}if(m instanceof Date)return MA(m);if(!n?.ignoreToString&&Be(m,"toString")&&typeof m.toString=="function"&&m.toString!==Object.prototype.toString&&m.toString!==Array.prototype.toString){const S=CA(m);return m instanceof Error&&m.cause?`${S} (cause: ${p(m.cause,y)})`:S}if(typeof m=="string")return JSON.stringify(m);if(typeof m=="number"||m==null||typeof m=="boolean"||typeof m=="symbol")return String(m);if(typeof m=="bigint")return String(m)+"n";if(typeof m=="object"||typeof m=="function"){if(i.has(m))return j1;if(i.add(m),Zf in m)return Rt(Lx(m));if(Symbol.iterator in m)return`${m.constructor.name}(${p(Array.from(m),y)})`;const S=h(m);if(!u||S.length<=1){const _=`{${S.map(x=>`${ff(x)}:${p(m[x],y)}`).join(",")}}`;return d(m,_)}const v=`{
|
||||
${S.map(_=>`${o(y+1)}${ff(_)}: ${p(m[_],y+1)}`).join(`,
|
||||
`)}
|
||||
${o(y)}}`;return d(m,v)}return String(m)}return p(e,0)}const j1="[Circular]";function ff(e){return typeof e=="string"?JSON.stringify(e):String(e)}function AA(e){return e.map(n=>`[${ff(n)}]`).join("")}function MA(e){try{return e.toISOString()}catch{return"Invalid Date"}}function CA(e){try{const n=e.toString();return typeof n=="string"?n:String(n)}catch{return"[toString threw]"}}function jx(e,n){let s=[];const i=JSON.stringify(e,(u,o)=>typeof o=="object"&&o!==null?s.includes(o)?void 0:s.push(o)&&Wf(o):o,n?.space);return s=void 0,i}const Ws=Symbol.for("nodejs.util.inspect.custom"),Fa=e=>{try{if(Be(e,"toJSON")&&Qf(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(Fa)}catch{return"[toJSON threw]"}return Wf(e)},kA=(e,n=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?UA(e,n):String(e)}catch{return String(e)}},UA=(e,n)=>{let s=[];const i=JSON.stringify(e,(u,o)=>typeof o=="object"&&o!==null?s.includes(o)?void 0:s.push(o)&&Wf(o):o,n);return s=void 0,i},B1={toJSON(){return Fa(this)},[Ws](){return this.toJSON()},toString(){return Rt(this.toJSON())}};class ed{called=!1;self;constructor(n){this.self=n}next(n){return this.called?{value:n,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new ed(this.self)}}const Pi="~effect/Effect/internal",Bx={[Pi]:e=>e()},zA={[Pi]:e=>e()},NA=Bx[Pi](()=>new Error().stack)?.includes(Pi)===!0,Wt=NA?Bx[Pi]:zA[Pi],ls="~effect/Effect",ku="~effect/Exit",DA={_A:_e,_E:_e,_R:_e},qx=`${ls}/identifier`,we=`${ls}/args`,Ht=`${ls}/evaluate`,kn=`${ls}/successCont`,_r=`${ls}/failureCont`,ja=`${ls}/ensureCont`,Aa=Symbol.for("effect/Effect/Yield"),Ar={pipe(){return bt(this,arguments)},toJSON(){return{...this}},toString(){return Rt(this.toJSON(),{ignoreToString:!0,space:2})},[Ws](){return this.toJSON()}},td={[Symbol.iterator](){return new ed(this)}},LA={...td,pipe(){return bt(this,arguments)}},jA={[ls]:DA,...Ar,[Symbol.iterator](){return new ed(this)},asEffect(){return this},toJSON(){return{_id:"Effect",op:this[qx],...we in this?{args:this[we]}:void 0}}},Xt=e=>Be(e,ls),$x=e=>Be(e,ku),Xo="~effect/Cause",Qo="~effect/Cause/Reason",nd=e=>Be(e,Xo),BA=e=>Be(e,Qo);class Ka{[Xo];reasons;constructor(n){this[Xo]=Xo,this.reasons=n}pipe(){return bt(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(n=>n.toJSON())}}toString(){return`Cause(${Rt(this.reasons)})`}[Ws](){return this.toJSON()}[nn](n){return nd(n)&&this.reasons.length===n.reasons.length&&this.reasons.every((s,i)=>$t(s,n.reasons[i]))}[tn](){return Dx(this.reasons)}}const q1=new WeakMap;class Hg{[Qo];annotations;_tag;constructor(n,s,i){if(this[Qo]=Qo,this._tag=n,s!==rd&&typeof i=="object"&&i!==null&&s.size>0){const u=q1.get(i);u&&(s=new Map([...u,...s])),q1.set(i,s)}this.annotations=s}annotate(n,s){if(n.mapUnsafe.size===0)return this;const i=new Map(this.annotations);n.mapUnsafe.forEach((o,d)=>{s?.overwrite!==!0&&i.has(d)||i.set(d,o)});const u=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return u.annotations=i,u}pipe(){return bt(this,arguments)}toString(){return Rt(this)}[Ws](){return this.toString()}}const rd=new Map;class Hx extends Hg{error;constructor(n,s=rd){super("Fail",s,n),this.error=n}toString(){return`Fail(${Rt(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[nn](n){return Yg(n)&&$t(this.error,n.error)&&$t(this.annotations,n.annotations)}[tn](){return Xn(Mt(this._tag))(Xn(Je(this.error))(Je(this.annotations)))}}const sd=e=>new Ka(e),qA=new Ka([]),Vg=e=>new Ka([new Hx(e)]);class Ig extends Hg{defect;constructor(n,s=rd){super("Die",s,n),this.defect=n}toString(){return`Die(${Rt(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[nn](n){return HA(n)&&$t(this.defect,n.defect)&&$t(this.annotations,n.annotations)}[tn](){return Xn(Mt(this._tag))(Xn(Je(this.defect))(Je(this.annotations)))}}const $A=e=>new Ka([new Ig(e)]),Hp=P(e=>nd(e[0]),(e,n,s)=>n.mapUnsafe.size===0?e:new Ka(e.reasons.map(i=>i.annotate(n,s)))),Yg=e=>e._tag==="Fail",HA=e=>e._tag==="Die",Gg=e=>e._tag==="Interrupt";function VA(e){return Xi("Effect.evaluate: Not implemented")}const Zu=e=>({...jA,[qx]:e.op,[Ht]:e[Ht]??VA,[kn]:e[kn],[_r]:e[_r],[ja]:e[ja]}),or=e=>{const n=Zu(e);return function(){const s=Object.create(n);return s[we]=e.single===!1?arguments:arguments[0],s}},Vx=e=>{const n={...Zu(e),[ku]:ku,_tag:e.op,get[e.prop](){return this[we]},toString(){return`${e.op}(${Rt(this[we])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[we]}},[nn](s){return $x(s)&&s._tag===this._tag&&$t(this[we],s[we])},[tn](){return Xn(Mt(e.op),Je(this[we]))}};return function(s){const i=Object.create(n);return i[we]=s,i}},et=Vx({op:"Success",prop:"value",[Ht](e){const n=e.getCont(kn);return n?n[kn](this[we],e,this):e.yieldWith(this)}}),ad={key:"effect/Cause/StackTrace"},IA={key:"effect/Cause/InterruptorStackTrace"},Jn=Vx({op:"Failure",prop:"cause",[Ht](e){let n=this[we],s=!1;e.currentStackFrame&&(n=Hp(n,{mapUnsafe:new Map([[ad.key,e.currentStackFrame]])}),s=!0);let i=e.get
Line truncated
|
||||
`);if(s.length>2){const i=s[2].match(/at (.*)/);i&&(n.message=n.message+` (defined at ${i[1]})`)}}if(n.stack){const s=n.stack.split(`
|
||||
`);s.splice(1,3),n.stack=s.join(`
|
||||
`)}return n},Ba=P(2,(e,n)=>{if(e.mapUnsafe.size===0)return n;if(n.mapUnsafe.size===0)return e;const s=new Map(e.mapUnsafe);return n.mapUnsafe.forEach((i,u)=>s.set(u,i)),ir(s)}),lC=(...e)=>{const n=new Map;for(let s=0;s<e.length;s++)e[s].mapUnsafe.forEach((i,u)=>{n.set(u,i)});return ir(n)},ft=Sn,Ji=ft("effect/Scheduler",{defaultValue:()=>new Nu}),oC="setImmediate"in globalThis?e=>{const n=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(n)}:e=>{const n=setTimeout(e,0);return()=>clearTimeout(n)};class fC{buckets=[];scheduleTask(n,s){const i=this.buckets,u=i.length;let o,d=0;for(;d<u&&!(i[d][0]>s);d++)o=i[d];o&&o[0]===s?o[1].push(n):d===u?i.push([s,[n]]):i.splice(d,0,[s,[n]])}drain(){const n=this.buckets;return this.buckets=[],n}}class Nu{tasks=new fC;running=void 0;executionMode;setImmediate;constructor(n="async",s=oC){this.executionMode=n,this.setImmediate=s}scheduleTask(n,s){this.tasks.scheduleTask(n,s),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){const n=this.tasks.drain();for(let s=0;s<n.length;s++){const i=n[s][1];for(let u=0;u<i.length;u++)i[u]()}}shouldYield(n){return n.currentOpCount>=n.maxOpsBeforeYield}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}}const dC=ft("effect/Scheduler/MaxOpsBeforeYield",{defaultValue:()=>2048}),hE="effect/Tracer/ParentSpan";class hC extends Sn()(hE){}const mC=e=>e,Fp=ft("effect/Tracer/DisablePropagation",{defaultValue:Ux}),pC=ft("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),gC=ft("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),mE="effect/Tracer",yC=ft(mE,{defaultValue:()=>mC({span:e=>new SC(e)})});class SC{_tag="Span";spanId;traceId="native";sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];constructor(n){this.name=n.name,this.parent=n.parent,this.annotations=n.annotations,this.links=n.links,this.startTime=n.startTime,this.kind=n.kind,this.sampled=n.sampled,this.status={_tag:"Started",startTime:n.startTime},this.attributes=new Map,this.traceId=n.parent?.traceId??Y1(32),this.spanId=Y1(16)}end(n,s){this.status={_tag:"Ended",endTime:n,exit:s,startTime:this.status.startTime}}attribute(n,s){this.attributes.set(n,s)}event(n,s,i){this.events.push([n,s,i??{}])}addLinks(n){this.links.push(...n)}}const Y1=(function(){const e="abcdef0123456789",n=e.length;return function(s){let i="";for(let u=0;u<s;u++)i+=e.charAt(Math.floor(Math.random()*n));return i}})(),vC=ft("effect/References/CurrentConcurrency",{defaultValue:()=>"unbounded"}),pE=ft("effect/References/CurrentStackFrame",{defaultValue:jg}),bC=ft("effect/References/TracerEnabled",{defaultValue:Pf}),gE=ft("effect/References/TracerTimingEnabled",{defaultValue:Pf}),_C=ft("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),xC=ft("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Zg=ft("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),EC=ft("effect/References/CurrentLogLevel",{defaultValue:()=>"Info"}),wC=ft("effect/References/MinimumLogLevel",{defaultValue:()=>"Info"}),TC=ft("effect/References/CurrentLogSpans",{defaultValue:()=>[]}),OC="effect/observability/Metric/FiberRuntimeMetricsKey",RC=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;const n=Error.stackTraceLimit;Error.stackTraceLimit=3;const s=new Error;return Error.stackTraceLimit=n,{...e,captureStackTrace:MC(()=>s.stack)}},AC=e=>n=>{let s;return()=>{if(s!==void 0)return s;const i=n();if(!i)return;const u=i.split(`
|
||||
`);if(u[e]!==void 0)return s=u[e].trim(),s}},MC=AC(3),CC="dev";let yE=class extends Hg{fiberId;constructor(n,s=rd){super("Interrupt",s,"Interrupted"),this.fiberId=n}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[nn](n){return Gg(n)&&this.fiberId===n.fiberId&&this.annotations===n.annotations}[tn](){return Xn(Mt(`${this._tag}:${this.fiberId}`))($p(this.annotations))}};const kC=e=>new yE(e),el=e=>new Ka([new yE(e)]),UC=e=>{const n=e.reasons.find(Yg);return n?fs(n):ur(e)},Pa=e=>{for(let n=0;n<e.reasons.length;n++){const s=e.reasons[n];if(s._tag==="Fail")return fs(s.error)}return ur(e)},zC=e=>e.reasons.some(Gg),Wg=e=>{let n;for(let s=0;s<e.reasons.length;s++){const i=e.reasons[s];i._tag==="Interrupt"&&(n??=new Set,i.fiberId!==void 0&&n.add(i.fiberId))}return n?fs(n):ur(e)},NC=e=>{const n=Wg(e);return ct(n)?DC:n.success},DC=new Set,LC=e=>e.reasons.every(Gg),jC=P(2,(e,n)=>{if(e.reasons.length===0)return n;if(n.reasons.length===0)return e;const s=new Ka(CM(e.reasons,n.reasons));return $t(e,s)?e:s}),BC=e=>{const n={Fail:[],Die:[],Interrupt:[]};for(let s=0;s<e.reasons.length;s++)n[e.reasons[s]._tag].push(e.reasons[s]);return n},SE=e=>{const n=BC(e);return n.Fail.length>0?n.Fail[0].error:n.Die.length>0?n.Die[0].defect:n.Interrupt.length>0?new globalThis.Error("All fibers interrupted without error"):new globalThis.Error("Empty cause")},qC=e=>{const n=[],s=[];if(e.reasons.length===0)return n;const i=Error.stackTraceLimit;Error.stackTraceLimit=1;for(const u of e.reasons){if(u._tag==="Interrupt"){s.push(u);continue}n.push(Kp(u._tag==="Die"?u.defect:u.error,u.annotations))}if(n.length===0){const u=new Error("The fiber was interrupted by:");u.name="InterruptCause",u.stack=IC(u,s);const o=new globalThis.Error("All fibers interrupted without error",{cause:u});o.name="InterruptError",o.stack=`${o.name}: ${o.message}`,n.push(Kp(o,s[0].annotations))}return Error.stackTraceLimit=i,n},Kp=(e,n)=>{const s=typeof e;let i;if(e&&s==="object"){if(i=new globalThis.Error($C(e),{cause:e.cause?Kp(e.cause):void 0}),typeof e.name=="string"&&(i.name=e.name),typeof e.stack=="string")i.stack=VC(e.stack,i,n);else{const u=`${i.name}: ${i.message}`;i.stack=n?vE(u,n):u}for(const u of Object.keys(e))u in i||(i[u]=e[u])}else i=new globalThis.Error(e?s==="string"?e:jx(e):`Unknown error: ${e}`);return i},$C=e=>{if(typeof e.message=="string")return e.message;if(typeof e.toString=="function"&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return jx(e)},HC=/\((.*)\)/g,VC=(e,n,s)=>{const i=`${n.name}: ${n.message}`,u=(e.startsWith(i)?e.slice(i.length):e).split(`
|
||||
`),o=[i];for(let d=1;d<u.length&&!/(?:Generator\.next|~effect\/Effect)/.test(u[d]);d++)o.push(u[d]);return s?vE(o.join(`
|
||||
`),s):o.join(`
|
||||
`)},vE=(e,n)=>{const s=n?.get(ad.key);return s&&(e=`${e}
|
||||
${bE(s)}`),e},IC=(e,n)=>{const s=[`${e.name}: ${e.message}`];for(const i of n){const u=i.fiberId!==void 0?`#${i.fiberId}`:"unknown",o=i.annotations.get(IA.key);s.push(` at fiber (${u})`),o&&s.push(bE(o))}return s.join(`
|
||||
`)},bE=e=>{const n=[];let s=e,i=0;for(;s&&i<10;){const u=s.stack();if(u){const o=u.matchAll(HC);let d=!1;for(const[,h]of o)d=!0,n.push(` at ${s.name} (${h})`);d||n.push(` at ${s.name} (${u.replace(/^at /,"")})`)}else n.push(` at ${s.name}`);s=s.parent,i++}return n.join(`
|
||||
`)},e0=e=>qC(e).map(n=>n.cause?`${n.stack} {
|
||||
${_E(n.cause," ")}
|
||||
}`:n.stack).join(`
|
||||
`),_E=(e,n)=>{const s=e.stack.split(`
|
||||
`);let i=`${n}[cause]: ${s[0]}`;for(let u=1,o=s.length;u<o;u++)i+=`
|
||||
${n}${s[u]}`;return e.cause&&(i+=` {
|
||||
${_E(e.cause,`${n} `)}
|
||||
${n}}`),i},Pp=`~effect/Fiber/${CC}`,YC={_A:_e,_E:_e},GC={id:0},xE=()=>globalThis[Su];class EE{constructor(n,s=!0){this[Pp]=YC,this.setServices(n),this.id=++GC.id,this.currentOpCount=0,this.currentLoopCount=0,this.interruptible=s,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0}[Pp];id;interruptible;currentOpCount;currentLoopCount;_stack;_observers;_exit;_currentExit;_children;_interruptedCause;_yielded;services;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;getRef(n){return cC(this.services,n)}addObserver(n){return this._exit?(n(this._exit),cc):(this._observers.push(n),()=>{const s=this._observers.indexOf(n);s>=0&&this._observers.splice(s,1)})}interruptUnsafe(n,s){if(this._exit)return;let i=el(n);this.currentStackFrame&&(i=Hp(i,Qi(ad,this.currentStackFrame))),s&&(i=Hp(i,s)),this._interruptedCause=this._interruptedCause?jC(this._interruptedCause,i):i,this.interruptible&&this.evaluate(en(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(n){if(this.runtimeMetrics?.recordFiberStart(this.services),this._exit)return;if(this._yielded!==void 0){const i=this._yielded;this._yielded=void 0,i()}const s=this.runLoop(n);if(s!==Aa){this._exit=s,this.runtimeMetrics?.recordFiberEnd(this.services,this._exit);for(let i=0;i<this._observers.length;i++)this._observers[i](s);this._observers.length=0}}runLoop(n){const s=globalThis[Su];globalThis[Su]=this;let i=!1,u=n;this.currentOpCount=0;const o=++this.currentLoopCount;try{for(;;){if(this.currentOpCount++,!i&&this.currentScheduler.shouldYield(this)){i=!0;const d=u;u=qe(n0,()=>d)}if(u=this.currentTracerContext?this.currentTracerContext(u,this):u[Ht](this),o!==this.currentLoopCount)return Aa;if(u===Aa){const d=this._yielded;return ku in d?(this._yielded=void 0,d):Aa}}}catch(d){return Be(u,Ht)?this.runLoop(Xi(d)):Xi(`Fiber.runLoop: Not a valid effect: ${String(u)}`)}finally{globalThis[Su]=s}}getCont(n){for(;;){const s=this._stack.pop();if(!s)return;const i=s[ja]&&s[ja](this);if(i)return i[n]=i,i;if(s[n])return s}}yieldWith(n){return this._yielded=n,Aa}children(){return this._children??=new Set}pipe(){return bt(this,arguments)}setServices(n){this.services=n,this.currentScheduler=this.getRef(Ji),this.currentSpan=n.mapUnsafe.get(hE),this.currentLogLevel=this.getRef(EC),this.minimumLogLevel=this.getRef(wC),this.currentStackFrame=n.mapUnsafe.get(pE.key),this.maxOpsBeforeYield=this.getRef(dC),this.runtimeMetrics=n.mapUnsafe.get(OC);const s=n.mapUnsafe.get(mE);this.currentTracerContext=s?s.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}}const cd=e=>{if(!e.currentStackFrame)return;const n=new Map;return n.set(ad.key,e.currentStackFrame),ir(n)},FC=e=>{const n=e;return n._exit?ve(n._exit):an(s=>n._exit?s(ve(n._exit)):lt(e.addObserver(i=>s(ve(i)))))},wE=e=>an(n=>{const s=e[Symbol.iterator](),i=[];let u;function o(){let d=s.next();for(;!d.done;){if(d.value._exit){i.push(d.value._exit),d=s.next();continue}u=d.value.addObserver(h=>{i.push(h),o()});return}n(ve(i))}return o(),lt(()=>u?.())}),KC=e=>{const n=e;return n._exit?n._exit:an(s=>n._exit?s(n._exit):lt(e.addObserver(s)))},PC=e=>an(n=>{const s=Array.from(e);if(s.length===0)return n(ve(Ip()));const i=new Array(s.length),u=Ip();let o=0,d=!1;for(let h=0;h<s.length&&!d;h++)u.push(s[h].addObserver(p=>{if(o++,p._tag==="Failure")return d=!0,u.forEach(m=>m()),n(p);i[h]=p.value,o===s.length&&n(ve(i))}))}),t0=e=>Ve(n=>XC(e,n.id)),XC=P(e=>Be(e[0],Pp),(e,n,s)=>Ve(i=>{let u=cd(i);return u=u&&s?Ba(u,s):u??s,e.interruptUnsafe(n,u),ld(FC(e))})),mf=e=>Ve(n=>{const s=cd(n);for(const i of e)i.interruptUnsafe(n.id,s);return ld(wE(e))}),ve=et,en=Jn,ud=Mr,lt=or({op:"Sync",[Ht](e){const n=this[we](),s=e.getCont(kn);return s?s[kn](n,e):e.yieldWith(et(n))}}),ot=or({op:"Suspend",[Ht](e){return this[we]()}}),QC=or({op:"Yield",[Ht](e){let n=!1;return e.currentScheduler.scheduleTask(()=>{n||e.evaluate(Or)},this[we]??0),e.yieldWith(()=>{n=!0})}}),n0=QC(0),JC=e=>ve(Te(e)),r0=ve(Ct()),s0=e=>Xi(e),TE=e=>ot(()=>ud(Wt(e))),kt=ve(void 0),ZC=e=>OE(function(n,s){Wt(()=>e(s)).then(i=>n(ve(i)),i=>n(s0(i)))},e.length!==0),WC=e=>Ve(n=>e(n.id)),OE=or({op:"Async",single:!1,[Ht](e){const n=Wt(()=>this[we][0].bind(e.currentScheduler));let s=!1,i=!1;const u=this[we][1]?new AbortController:void 0,o=n(d=>{s||(s=!0,i?e.evaluate(d):i=d)},u?.signal);return i!==!1?i:(i=!0,e._yielded=()=>{s=!0},u===void 0&&o===void 0||e._stack.push(e3(()=>(s=!0,u?.abort(),o??Or))),Aa)}}),e3=or({op:"AsyncFinalizer",[ja](e){e.interruptible&&(e.interruptible=!1,e._stack.push(gd))},[_r](e,n){return zC(e)?qe(this[we](),()=>en(e)):en(e)}}),an=e=>OE(e,e.length>=2),t3=an(cc),n3=(...e)=>ot(()=>Du(e.length===1?e[0]():e[1].call(e[0].self))),RE=(e,...n)=>{const s=n.length===0?function(){return ot(()=>Du(e.apply(this,arguments)))}:function(){let i=ot(()=>Du(e.apply(this,arguments)));for(let u=0;u<n
Line truncated
|
||||
`)}const yz=gz();function Sz(e){let n=e.message;if(e.path&&e.path.length>0){const s=AA(e.path);n+=`
|
||||
at ${s}`}return n}function Yu(e){switch(e._tag){case"InvalidType":case"OneOf":case"Composite":case"AnyOf":return uu(e.ast.annotations);case"InvalidValue":case"Forbidden":return uu(e.annotations);case"MissingKey":return uu(e.annotations,"messageMissingKey");case"UnexpectedKey":return uu(e.ast.annotations,"messageUnexpectedKey");case"Filter":return uu(e.filter.annotations);case"Encoding":return Yu(e.issue)}}function uu(e,n="message"){const s=e?.[n];if(typeof s=="string")return s}function h_(e){return os(e)?"no value provided":Rt(e.value)}class ec extends Kf{run;constructor(n){super(),this.run=n}map(n){return new ec((s,i)=>this.run(s,i).pipe(vw(Pg(n))))}compose(n){return m_(this)?n:m_(n)?this:new ec((s,i)=>this.run(s,i).pipe(Ii(u=>n.run(u,i))))}}const Uw=new ec(Ee);function m_(e){return e.run===Uw.run}function tc(){return Uw}function pn(e){return vz(Pg(e))}function vz(e){return new ec(n=>Ee(e(n)))}function bz(){return pn(globalThis.String)}function zw(){return pn(globalThis.Number)}const og="~effect/SchemaTransformation/Transformation";class gn{[og]=og;_tag="Transformation";decode;encode;constructor(n,s){this.decode=n,this.encode=s}flip(){return new gn(this.encode,this.decode)}compose(n){return new gn(this.decode.compose(n.decode),n.encode.compose(this.encode))}}function _z(e){return Be(e,og)}const Nw=e=>_z(e)?e:new gn(e.decode,e.encode);function Ed(e){return new gn(pn(e.decode),pn(e.encode))}const xz=new gn(tc(),tc());function $0(){return xz}const Dw=new gn(zw(),bz()),Lw=e=>Ed({decode:n=>{const s=new Error(n.message);return typeof n.name=="string"&&n.name!=="Error"&&(s.name=n.name),typeof n.stack=="string"&&(s.stack=n.stack),s},encode:n=>{const s={name:n.name,message:n.message};return e?.includeStack&&typeof n.stack=="string"&&(s.stack=n.stack),s}});function Ja(e){return n=>n._tag===e}const jw=Ja("Declaration"),Ez=Ja("Never"),Of=Ja("Literal"),wz=Ja("UniqueSymbol"),Tz=Ja("Arrays"),Oz=Ja("Objects"),Rz=Ja("Union");let Vt=class{to;transformation;constructor(n,s){this.to=n,this.transformation=s}};const Az={};class nc{isOptional;isMutable;defaultValue;annotations;constructor(n,s,i=void 0,u=void 0){this.isOptional=n,this.isMutable=s,this.defaultValue=i,this.annotations=u}}const p_="~effect/Schema";class vn{[p_]=p_;annotations;checks;encoding;context;constructor(n=void 0,s=void 0,i=void 0,u=void 0){this.annotations=n,this.checks=s,this.encoding=i,this.context=u}toString(){return`<${this._tag}>`}}class ol extends vn{_tag="Declaration";typeParameters;run;constructor(n,s,i,u,o,d){super(i,u,o,d),this.typeParameters=n,this.run=s}getParser(){const n=this.run(this.typeParameters);return(s,i)=>os(s)?b0:vw(n(s.value,this,i),Te)}recur(n){const s=rc(this.typeParameters,n);return s===this.typeParameters?this:new ol(s,this.run,this.annotations,this.checks,void 0,this.context)}getExpected(){const n=this.annotations?.expected;return typeof n=="string"?n:"<Declaration>"}}class Mz extends vn{_tag="Null";getParser(){return Od(this,null)}getExpected(){return"null"}}const Bw=new Mz;let Cz=class extends vn{_tag="Undefined";getParser(){return Od(this,void 0)}toCodecJson(){return qt(this,[qw])}getExpected(){return"undefined"}};const qw=new Vt(Bw,new gn(pn(()=>{}),pn(()=>null))),kz=new Cz;let Uz=class extends vn{_tag="Void";getParser(){return Od(this,void 0)}toCodecJson(){return qt(this,[qw])}getExpected(){return"void"}};const zz=new Uz;let Nz=class extends vn{_tag="Never";getParser(){return Za(this,uA)}getExpected(){return"never"}};const Dz=new Nz;let Lz=class extends vn{_tag="Any";getParser(){return Za(this,Nx)}getExpected(){return"any"}};const jz=new Lz;let Bz=class extends vn{_tag="Unknown";getParser(){return Za(this,Nx)}getExpected(){return"unknown"}};const H0=new Bz;let Tu=class extends vn{_tag="Literal";literal;constructor(n,s,i,u,o){if(super(s,i,u,o),typeof n=="number"&&!globalThis.Number.isFinite(n))throw new Error(`A numeric literal must be finite, got ${Rt(n)}`);this.literal=n}getParser(){return Od(this,this.literal)}toCodecJson(){return typeof this.literal=="bigint"?g_(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:g_(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function g_(e){const n=globalThis.String(e.literal);return qt(e,[new Vt(new Tu(n),new gn(pn(()=>e.literal),pn(()=>n)))])}let qz=class extends vn{_tag="String";getParser(){return Za(this,Xf)}getExpected(){return"string"}};const $w=new qz;let $z=class extends vn{_tag="Number";getParser(){return Za(this,of)}toCodecJson(){return this.checks&&(gu(this.checks,"isFinite")||gu(this.checks,"isInt"))?this:qt(this,[Kz])}toCodecStringTree(){return this.checks&&(gu(this.checks,"isFinite")||gu(this.checks,"isInt"))?qt(this,[sN]):qt(this,[aN])}getExpected(){return"number"}};function gu(e,n){return e.some(s=>{switch(s._tag){case"Filter":return s.annotations?.meta?._tag===n;case"FilterGroup":return gu(s.checks,n)}})}const Hw=new $z;let Hz=class extends vn{_tag="Boolean";getParser(){ret
Line truncated
|
||||
`)[5]??""]})),z6=P(2,(e,n)=>x6(e)?gl(s=>n(s,e),function(s,i){s.set(e,i)},e.refresh??function(s){s(e)}):Xs(s=>n(s,e),e.refresh??function(s){s(e)})),N6=y6,j_="~effect-atom/atom/Atom/ServerValue",D6=P(2,(e,n)=>j_ in e?e[j_](s=>n.get(s)):n.get(e));var bp=Cx();function LT(e){const n=bp.unstable_scheduleCallback(bp.unstable_LowPriority,e);return()=>bp.unstable_cancelCallback(n)}const kd=le.createContext(AT({scheduleTask:LT,defaultIdleTTL:400})),L6=e=>{const n=le.useRef(null);return n.current===null&&(n.current={registry:AT({scheduleTask:e.scheduleTask??LT,initialValues:e.initialValues,timeoutResolution:e.timeoutResolution,defaultIdleTTL:e.defaultIdleTTL})}),le.useEffect(()=>(n.current?.timeout!==void 0&&clearTimeout(n.current.timeout),()=>{n.current.timeout=setTimeout(()=>{n.current?.registry.dispose(),n.current=null},500)}),[n]),le.createElement(kd.Provider,{value:n.current.registry},e?.children)},B_=new WeakMap;function j6(e,n){let s=B_.get(e);s===void 0&&(s=new WeakMap,B_.set(e,s));const i=s.get(n);if(i!==void 0)return i;const u={subscribe(o){return e.subscribe(n,o)},snapshot(){return e.get(n)},getServerSnapshot(){return D6(n,e)}};return s.set(n,u),u}function B6(e,n){const s=j6(e,n);return le.useSyncExternalStore(s.subscribe,s.snapshot,s.getServerSnapshot)}const ta=(e,n)=>{const s=le.useContext(kd);return B6(s,e)};function jT(e,n){le.useEffect(()=>e.mount(n),[n,e])}function q6(e,n,s){return s?.mode==="promise"||s?.mode==="promiseExit"?le.useCallback(i=>{e.set(n,i);const u=G4(u6(e,n,{suspendOnWaiting:!0}));return s.mode==="promise"?u.then($6):u},[e,n,s.mode]):le.useCallback(i=>{e.set(n,typeof i=="function"?i(e.get(n)):i)},[e,n])}const $6=e=>{if(ew(e))return e.value;throw JE(e.cause)},Wr=(e,n)=>{const s=le.useContext(kd);return jT(s,e),q6(s,e,n)},H6=e=>{const n=le.useContext(kd);return jT(n,e),le.useCallback(()=>{n.refresh(e)},[n,e])};var it=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(it||{});function BT({update:e,notify:n,unwatched:s}){return{link:i,unlink:u,propagate:o,checkDirty:d,shallowPropagate:h};function i(m,y,S){const v=y.depsTail;if(v!==void 0&&v.dep===m)return;const _=v!==void 0?v.nextDep:y.deps;if(_!==void 0&&_.dep===m){_.version=S,y.depsTail=_;return}const x=m.subsTail;if(x!==void 0&&x.version===S&&x.sub===y)return;const T=y.depsTail=m.subsTail={version:S,dep:m,sub:y,prevDep:v,nextDep:_,prevSub:x,nextSub:void 0};_!==void 0&&(_.prevDep=T),v!==void 0?v.nextDep=T:y.deps=T,x!==void 0?x.nextSub=T:m.subs=T}function u(m,y=m.sub){const S=m.dep,v=m.prevDep,_=m.nextDep,x=m.nextSub,T=m.prevSub;return _!==void 0?_.prevDep=v:y.depsTail=v,v!==void 0?v.nextDep=_:y.deps=_,x!==void 0?x.prevSub=T:S.subsTail=T,T!==void 0?T.nextSub=x:(S.subs=x)===void 0&&s(S),_}function o(m){let y=m.nextSub,S;e:do{const v=m.sub;let _=v.flags;if(_&60?_&12?_&4?!(_&48)&&p(m,v)?(v.flags=_|40,_&=1):_=0:v.flags=_&-9|32:_=0:v.flags=_|32,_&2&&n(v),_&1){const x=v.subs;if(x!==void 0){const T=(m=x).nextSub;T!==void 0&&(S={value:y,prev:S},y=T);continue}}if((m=y)!==void 0){y=m.nextSub;continue}for(;S!==void 0;)if(m=S.value,S=S.prev,m!==void 0){y=m.nextSub;continue e}break}while(!0)}function d(m,y){let S,v=0,_=!1;e:do{const x=m.dep,T=x.flags;if(y.flags&16)_=!0;else if((T&17)===17){if(e(x)){const j=x.subs;j.nextSub!==void 0&&h(j),_=!0}}else if((T&33)===33){(m.nextSub!==void 0||m.prevSub!==void 0)&&(S={value:m,prev:S}),m=x.deps,y=x,++v;continue}if(!_){const j=m.nextDep;if(j!==void 0){m=j;continue}}for(;v--;){const j=y.subs,B=j.nextSub!==void 0;if(B?(m=S.value,S=S.prev):m=j,_){if(e(y)){B&&h(j),y=m.sub;continue}_=!1}else y.flags&=-33;y=m.sub;const M=m.nextDep;if(M!==void 0){m=M;continue e}}return _}while(!0)}function h(m){do{const y=m.sub,S=y.flags;(S&48)===32&&(y.flags=S|16,(S&6)===2&&n(y))}while((m=m.nextSub)!==void 0)}function p(m,y){let S=y.depsTail;for(;S!==void 0;){if(S===m)return!0;S=S.prevDep}return!1}}let cy=0,Oa=0,Au=0;const es=[],{link:rB,unlink:qT,propagate:sB,checkDirty:V6,shallowPropagate:aB}=BT({update(e){return e.depsTail!==void 0?F6(e):K6(e)},notify(e){let n=Au,s=n;do if(es[n++]=e,e.flags&=-3,e=e.subs?.sub,e===void 0||!(e.flags&2))break;while(!0);for(Au=n;s<--n;){const i=es[s];es[s++]=es[n],es[n]=i}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Ud(e)):Q6.call(e)}});function I6(){return cy}function Y6(){++cy}function G6(){--cy||X6()}function F6(e){e.depsTail=void 0,e.flags=5;try{const n=e.value;return n!==(e.value=e.getter(n))}finally{e.flags&=-5,Ud(e)}}function K6(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function P6(e){const n=e.flags;if(n&16||n&32&&V6(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,Ud(e)}}else e.flags=2}function X6(){try{for(;Oa<Au;){const e=es[Oa];es[Oa++]=void 0,P6(e)}}finally{for(;Oa<Au;){const e=es[Oa];es[Oa++]=void 0,e.flags|=10}Oa=0,Au=0}}function Q6(){this.depsTail=void 0,this.flags=0,Ud(
Line truncated
|
||||
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>effect-http-ws-cli rpc console</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Archivo+Black&family=IBM+Plex+Sans:wght@400;500;700&display=swap" rel="stylesheet" />
|
||||
<script type="module" crossorigin src="/assets/index-CuY7i06l.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Bz7MwgeQ.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,94 @@
|
||||
import { spawn } from "node:child_process"
|
||||
|
||||
const frontendDevOrigin = process.env.FRONTEND_DEV_ORIGIN ?? "http://127.0.0.1:5173"
|
||||
const frontendDevUrl = new URL(frontendDevOrigin)
|
||||
|
||||
if (frontendDevUrl.protocol !== "http:" && frontendDevUrl.protocol !== "https:") {
|
||||
throw new Error(`FRONTEND_DEV_ORIGIN must use http or https, received ${frontendDevOrigin}`)
|
||||
}
|
||||
|
||||
const frontendHost = process.env.FRONTEND_DEV_HOST ?? frontendDevUrl.hostname
|
||||
const frontendPort = process.env.FRONTEND_DEV_PORT ?? (frontendDevUrl.port || "5173")
|
||||
const serverArgs = process.argv.slice(2)
|
||||
|
||||
const readFlagValue = (name) => {
|
||||
const index = serverArgs.findIndex((arg) => arg === name)
|
||||
if (index >= 0) {
|
||||
return serverArgs[index + 1]
|
||||
}
|
||||
|
||||
const prefixed = serverArgs.find((arg) => arg.startsWith(`${name}=`))
|
||||
return prefixed ? prefixed.slice(name.length + 1) : undefined
|
||||
}
|
||||
|
||||
const normalizeBackendHost = (host) => {
|
||||
if (!host || host === "0.0.0.0" || host === "::") {
|
||||
return "127.0.0.1"
|
||||
}
|
||||
return host
|
||||
}
|
||||
|
||||
const backendHost = normalizeBackendHost(process.env.HOST ?? readFlagValue("--host"))
|
||||
const backendPort = process.env.PORT ?? readFlagValue("--port") ?? "8787"
|
||||
const backendOrigin = process.env.VITE_BACKEND_ORIGIN ?? `http://${backendHost}:${backendPort}`
|
||||
|
||||
const children = new Set()
|
||||
let shuttingDown = false
|
||||
|
||||
const stopChildren = (signal = "SIGTERM") => {
|
||||
if (shuttingDown) {
|
||||
return
|
||||
}
|
||||
shuttingDown = true
|
||||
for (const child of children) {
|
||||
if (!child.killed) {
|
||||
child.kill(signal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const spawnChild = (command, args, env = {}) => {
|
||||
const child = spawn(command, args, {
|
||||
stdio: "inherit",
|
||||
env: {
|
||||
...process.env,
|
||||
...env
|
||||
}
|
||||
})
|
||||
|
||||
children.add(child)
|
||||
|
||||
child.on("exit", (code, signal) => {
|
||||
stopChildren(signal ?? "SIGTERM")
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal)
|
||||
return
|
||||
}
|
||||
process.exit(code ?? 0)
|
||||
})
|
||||
|
||||
return child
|
||||
}
|
||||
|
||||
spawnChild("bun", [
|
||||
"run",
|
||||
"--filter",
|
||||
"@effect-http-ws-cli/web",
|
||||
"dev",
|
||||
"--",
|
||||
"--host",
|
||||
frontendHost,
|
||||
"--port",
|
||||
frontendPort,
|
||||
"--strictPort"
|
||||
], {
|
||||
VITE_BACKEND_ORIGIN: backendOrigin
|
||||
})
|
||||
|
||||
spawnChild("node", ["server/src/bin.ts", ...serverArgs], {
|
||||
FRONTEND_DEV_ORIGIN: frontendDevOrigin
|
||||
})
|
||||
|
||||
for (const signal of ["SIGINT", "SIGTERM"]) {
|
||||
process.on(signal, () => stopChildren(signal))
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@effect-http-ws-cli/server",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"./client": "./src/client.ts",
|
||||
"./contracts": "./src/contracts.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "node src/bin.ts",
|
||||
"start": "node src/bin.ts",
|
||||
"test": "vitest run",
|
||||
"lint": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/sql-sqlite-node": "catalog:",
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "^24.10.0",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient"
|
||||
|
||||
export default Effect.gen(function*() {
|
||||
const sql = yield* SqlClient.SqlClient
|
||||
|
||||
yield* sql`
|
||||
CREATE TABLE IF NOT EXISTS todos (
|
||||
id TEXT PRIMARY KEY NOT NULL,
|
||||
title TEXT NOT NULL,
|
||||
completed INTEGER NOT NULL,
|
||||
archived INTEGER NOT NULL,
|
||||
revision INTEGER NOT NULL,
|
||||
updated_at TEXT NOT NULL
|
||||
)
|
||||
`
|
||||
|
||||
yield* sql`
|
||||
CREATE TABLE IF NOT EXISTS todo_events (
|
||||
event_offset INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
at TEXT NOT NULL,
|
||||
todo_json TEXT NOT NULL,
|
||||
change_json TEXT NOT NULL,
|
||||
archived INTEGER NOT NULL
|
||||
)
|
||||
`
|
||||
|
||||
yield* sql`
|
||||
CREATE INDEX IF NOT EXISTS idx_todo_events_archived_offset
|
||||
ON todo_events (archived, event_offset)
|
||||
`
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env node
|
||||
import * as NodeRuntime from "@effect/platform-node/NodeRuntime"
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices"
|
||||
import * as Effect from "effect/Effect"
|
||||
import { cli } from "./cli.ts"
|
||||
import { Command } from "effect/unstable/cli"
|
||||
|
||||
Command.run(cli, { version: "0.1.0" }).pipe(
|
||||
Effect.provide(NodeServices.layer),
|
||||
NodeRuntime.runMain
|
||||
)
|
||||
@@ -0,0 +1,125 @@
|
||||
import * as SqliteNode from "@effect/sql-sqlite-node"
|
||||
import { Command, Flag } from "effect/unstable/cli"
|
||||
import * as Config from "effect/Config"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as FileSystem from "effect/FileSystem"
|
||||
import * as Option from "effect/Option"
|
||||
import * as Path from "effect/Path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
import { ServerConfig } from "./config.ts"
|
||||
import { runMigrations } from "./migrations.ts"
|
||||
import { runServer } from "./server.ts"
|
||||
import type { ServerConfigData } from "./config.ts"
|
||||
|
||||
const defaultAssetsDir = fileURLToPath(new URL("../../public", import.meta.url))
|
||||
const defaultDbFilename = fileURLToPath(new URL("../../todo.sqlite", import.meta.url))
|
||||
|
||||
const hostFlag = Flag.string("host").pipe(
|
||||
Flag.withDescription("Host interface to bind"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const portFlag = Flag.integer("port").pipe(
|
||||
Flag.withDescription("Port to listen on"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const assetsFlag = Flag.directory("assets").pipe(
|
||||
Flag.withDescription("Directory of static assets"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const dbFlag = Flag.string("db").pipe(
|
||||
Flag.withDescription("SQLite database filename"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const requestLoggingFlag = Flag.boolean("request-logging").pipe(
|
||||
Flag.withDescription("Enable request logging"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const frontendDevOriginFlag = Flag.string("frontend-dev-origin").pipe(
|
||||
Flag.withDescription("Redirect frontend GET requests to a Vite dev server origin"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const EnvServerConfig = Config.unwrap({
|
||||
host: Config.string("HOST").pipe(Config.withDefault("127.0.0.1")),
|
||||
port: Config.port("PORT").pipe(Config.withDefault(8787)),
|
||||
assetsDir: Config.string("ASSETS_DIR").pipe(Config.withDefault(defaultAssetsDir)),
|
||||
dbFilename: Config.string("DB_FILENAME").pipe(Config.withDefault(defaultDbFilename)),
|
||||
requestLogging: Config.boolean("REQUEST_LOGGING").pipe(Config.withDefault(true)),
|
||||
frontendDevOrigin: Config.string("FRONTEND_DEV_ORIGIN").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined)
|
||||
)
|
||||
})
|
||||
|
||||
export interface CliServerFlags {
|
||||
readonly host: Option.Option<string>
|
||||
readonly port: Option.Option<number>
|
||||
readonly assets: Option.Option<string>
|
||||
readonly db: Option.Option<string>
|
||||
readonly requestLogging: Option.Option<boolean>
|
||||
readonly frontendDevOrigin: Option.Option<string>
|
||||
}
|
||||
|
||||
export const resolveServerConfig = (
|
||||
flags: CliServerFlags
|
||||
): Effect.Effect<ServerConfigData, Config.ConfigError> =>
|
||||
Effect.gen(function*() {
|
||||
const env = yield* EnvServerConfig
|
||||
return {
|
||||
host: Option.getOrElse(flags.host, () => env.host),
|
||||
port: Option.getOrElse(flags.port, () => env.port),
|
||||
assetsDir: Option.getOrElse(flags.assets, () => env.assetsDir),
|
||||
dbFilename: Option.getOrElse(flags.db, () => env.dbFilename),
|
||||
requestLogging: Option.getOrElse(flags.requestLogging, () => env.requestLogging),
|
||||
frontendDevOrigin: Option.getOrElse(flags.frontendDevOrigin, () => env.frontendDevOrigin)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
export const resetDatabase = (dbFilename: string) =>
|
||||
Effect.gen(function*() {
|
||||
const fs = yield* FileSystem.FileSystem
|
||||
const path = yield* Path.Path
|
||||
|
||||
if (dbFilename !== ":memory:") {
|
||||
yield* fs.remove(path.resolve(dbFilename), { force: true })
|
||||
}
|
||||
|
||||
const sqliteLayer = SqliteNode.SqliteClient.layer({
|
||||
filename: dbFilename
|
||||
})
|
||||
|
||||
yield* runMigrations.pipe(Effect.provide(sqliteLayer))
|
||||
})
|
||||
|
||||
const commandFlags = {
|
||||
host: hostFlag,
|
||||
port: portFlag,
|
||||
assets: assetsFlag,
|
||||
db: dbFlag,
|
||||
requestLogging: requestLoggingFlag,
|
||||
frontendDevOrigin: frontendDevOriginFlag
|
||||
} as const
|
||||
|
||||
const rootCommand = Command.make("effect-http-ws-cli", commandFlags).pipe(
|
||||
Command.withDescription("Run a unified Effect HTTP + WebSocket server"),
|
||||
Command.withHandler((flags) =>
|
||||
Effect.flatMap(resolveServerConfig(flags), (config) =>
|
||||
runServer.pipe(Effect.provideService(ServerConfig, config)))),
|
||||
)
|
||||
|
||||
const resetCommand = Command.make("reset", commandFlags).pipe(
|
||||
Command.withDescription("Delete the SQLite database file and rerun migrations"),
|
||||
Command.withHandler((flags) =>
|
||||
Effect.flatMap(resolveServerConfig(flags), (config) => resetDatabase(config.dbFilename))
|
||||
)
|
||||
)
|
||||
|
||||
export const cli = rootCommand.pipe(
|
||||
Command.withSubcommands([resetCommand])
|
||||
)
|
||||
@@ -0,0 +1,58 @@
|
||||
import { NodeSocket } from "@effect/platform-node"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as RpcClient from "effect/unstable/rpc/RpcClient"
|
||||
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization"
|
||||
import * as Stream from "effect/Stream"
|
||||
import { WsRpcGroup } from "./contracts.ts"
|
||||
|
||||
export const wsRpcProtocolLayer = (wsUrl: string) =>
|
||||
RpcClient.layerProtocolSocket().pipe(
|
||||
Layer.provide(NodeSocket.layerWebSocket(wsUrl)),
|
||||
Layer.provide(RpcSerialization.layerJson)
|
||||
)
|
||||
|
||||
export const makeWsRpcClient = RpcClient.make(WsRpcGroup)
|
||||
type WsRpcClient = typeof makeWsRpcClient extends Effect.Effect<infer Client, any, any> ? Client : never
|
||||
|
||||
export const withWsRpcClient = <A, E, R>(
|
||||
wsUrl: string,
|
||||
f: (client: WsRpcClient) => Effect.Effect<A, E, R>
|
||||
) =>
|
||||
makeWsRpcClient.pipe(
|
||||
Effect.flatMap(f),
|
||||
Effect.provide(wsRpcProtocolLayer(wsUrl))
|
||||
)
|
||||
|
||||
export const runClientExample = (wsUrl: string) =>
|
||||
Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.gen(function*() {
|
||||
const echoed = yield* client.echo({ text: "hello from client" })
|
||||
const summed = yield* client.sum({ left: 20, right: 22 })
|
||||
const time = yield* client.time(undefined)
|
||||
return { echoed, summed, time }
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
export const runSubscriptionExample = (wsUrl: string, modelId: string) =>
|
||||
Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.gen(function*() {
|
||||
const snapshot = yield* client.listTodos({ includeArchived: true })
|
||||
const todo = snapshot.todos[0]
|
||||
if (!todo) {
|
||||
return []
|
||||
}
|
||||
|
||||
yield* client.renameTodo({ id: todo.id, title: `${modelId}: first` })
|
||||
yield* client.completeTodo({ id: todo.id, completed: true })
|
||||
|
||||
return yield* client.subscribeTodos({ fromOffset: snapshot.offset, includeArchived: true }).pipe(
|
||||
Stream.take(2),
|
||||
Stream.runCollect
|
||||
)
|
||||
})
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
import * as ServiceMap from "effect/ServiceMap"
|
||||
|
||||
export interface ServerConfigData {
|
||||
readonly host: string
|
||||
readonly port: number
|
||||
readonly assetsDir: string
|
||||
readonly dbFilename: string
|
||||
readonly requestLogging: boolean
|
||||
readonly frontendDevOrigin: string | undefined
|
||||
}
|
||||
|
||||
export class ServerConfig extends ServiceMap.Service<ServerConfig, ServerConfigData>()(
|
||||
"effect-http-ws-cli/ServerConfig"
|
||||
) {}
|
||||
@@ -0,0 +1,132 @@
|
||||
import * as Schema from "effect/Schema"
|
||||
import * as Rpc from "effect/unstable/rpc/Rpc"
|
||||
import * as RpcGroup from "effect/unstable/rpc/RpcGroup"
|
||||
|
||||
export const EchoPayload = Schema.Struct({
|
||||
text: Schema.String
|
||||
})
|
||||
|
||||
export const EchoResult = Schema.Struct({
|
||||
text: Schema.String
|
||||
})
|
||||
|
||||
export const SumPayload = Schema.Struct({
|
||||
left: Schema.Number,
|
||||
right: Schema.Number
|
||||
})
|
||||
|
||||
export const SumResult = Schema.Struct({
|
||||
total: Schema.Number
|
||||
})
|
||||
|
||||
export const TimeResult = Schema.Struct({
|
||||
iso: Schema.String
|
||||
})
|
||||
|
||||
export const Todo = Schema.Struct({
|
||||
id: Schema.String,
|
||||
title: Schema.String,
|
||||
completed: Schema.Boolean,
|
||||
archived: Schema.Boolean,
|
||||
revision: Schema.Number,
|
||||
updatedAt: Schema.String
|
||||
})
|
||||
export type Todo = Schema.Schema.Type<typeof Todo>
|
||||
|
||||
export const TodoChange = Schema.Union([
|
||||
Schema.Struct({
|
||||
_tag: Schema.Literal("TodoCreated")
|
||||
}),
|
||||
Schema.Struct({
|
||||
_tag: Schema.Literal("TodoRenamed"),
|
||||
title: Schema.String
|
||||
}),
|
||||
Schema.Struct({
|
||||
_tag: Schema.Literal("TodoCompleted"),
|
||||
completed: Schema.Boolean
|
||||
}),
|
||||
Schema.Struct({
|
||||
_tag: Schema.Literal("TodoArchived"),
|
||||
archived: Schema.Boolean
|
||||
})
|
||||
])
|
||||
export type TodoChange = Schema.Schema.Type<typeof TodoChange>
|
||||
|
||||
export const TodoEvent = Schema.Struct({
|
||||
offset: Schema.Number,
|
||||
at: Schema.String,
|
||||
todo: Todo,
|
||||
change: TodoChange
|
||||
})
|
||||
export type TodoEvent = Schema.Schema.Type<typeof TodoEvent>
|
||||
|
||||
export const TodoSnapshot = Schema.Struct({
|
||||
offset: Schema.Number,
|
||||
todos: Schema.Array(Todo)
|
||||
})
|
||||
export type TodoSnapshot = Schema.Schema.Type<typeof TodoSnapshot>
|
||||
|
||||
export const EchoRpc = Rpc.make("echo", {
|
||||
payload: EchoPayload,
|
||||
success: EchoResult
|
||||
})
|
||||
|
||||
export const SumRpc = Rpc.make("sum", {
|
||||
payload: SumPayload,
|
||||
success: SumResult
|
||||
})
|
||||
|
||||
export const TimeRpc = Rpc.make("time", {
|
||||
success: TimeResult
|
||||
})
|
||||
|
||||
export const ListTodosRpc = Rpc.make("listTodos", {
|
||||
payload: Schema.Struct({
|
||||
includeArchived: Schema.Boolean
|
||||
}),
|
||||
success: TodoSnapshot
|
||||
})
|
||||
|
||||
export const RenameTodoRpc = Rpc.make("renameTodo", {
|
||||
payload: Schema.Struct({
|
||||
id: Schema.String,
|
||||
title: Schema.String
|
||||
}),
|
||||
success: TodoEvent
|
||||
})
|
||||
|
||||
export const CompleteTodoRpc = Rpc.make("completeTodo", {
|
||||
payload: Schema.Struct({
|
||||
id: Schema.String,
|
||||
completed: Schema.Boolean
|
||||
}),
|
||||
success: TodoEvent
|
||||
})
|
||||
|
||||
export const ArchiveTodoRpc = Rpc.make("archiveTodo", {
|
||||
payload: Schema.Struct({
|
||||
id: Schema.String,
|
||||
archived: Schema.Boolean
|
||||
}),
|
||||
success: TodoEvent
|
||||
})
|
||||
|
||||
export const SubscribeTodosRpc = Rpc.make("subscribeTodos", {
|
||||
payload: Schema.Struct({
|
||||
fromOffset: Schema.Number,
|
||||
includeArchived: Schema.Boolean
|
||||
}),
|
||||
success: TodoEvent,
|
||||
stream: true
|
||||
})
|
||||
|
||||
export const WsRpcGroup = RpcGroup.make(
|
||||
EchoRpc,
|
||||
SumRpc,
|
||||
TimeRpc,
|
||||
ListTodosRpc,
|
||||
RenameTodoRpc,
|
||||
CompleteTodoRpc,
|
||||
ArchiveTodoRpc,
|
||||
SubscribeTodosRpc
|
||||
)
|
||||
@@ -0,0 +1,73 @@
|
||||
import * as Schema from "effect/Schema"
|
||||
import * as SchemaTransformation from "effect/SchemaTransformation"
|
||||
|
||||
export const ClientMessage = Schema.Union([
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("echo"),
|
||||
text: Schema.String
|
||||
}),
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("sum"),
|
||||
left: Schema.Number,
|
||||
right: Schema.Number
|
||||
}),
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("time")
|
||||
})
|
||||
])
|
||||
|
||||
export type ClientMessage = Schema.Schema.Type<typeof ClientMessage>
|
||||
|
||||
export const ServerMessage = Schema.Union([
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("echo"),
|
||||
text: Schema.String
|
||||
}),
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("sumResult"),
|
||||
total: Schema.Number
|
||||
}),
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("time"),
|
||||
iso: Schema.String
|
||||
}),
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("error"),
|
||||
error: Schema.String
|
||||
})
|
||||
])
|
||||
|
||||
|
||||
export type ServerMessage = Schema.Schema.Type<typeof ServerMessage>
|
||||
|
||||
export const decodeClientMessage = Schema.decodeUnknownEffect(ClientMessage)
|
||||
|
||||
const Utf8StringFromUint8Array = Schema.Uint8Array.pipe(
|
||||
Schema.decodeTo(
|
||||
Schema.String,
|
||||
SchemaTransformation.transform({
|
||||
decode: (bytes) => new TextDecoder().decode(bytes),
|
||||
encode: (text) => new TextEncoder().encode(text)
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
const ClientMessageFromWire = Schema.Union([
|
||||
Schema.String,
|
||||
Utf8StringFromUint8Array
|
||||
]).pipe(
|
||||
Schema.decodeTo(Schema.fromJsonString(ClientMessage))
|
||||
)
|
||||
|
||||
export const decodeWireClientMessage = Schema.decodeUnknownEffect(ClientMessageFromWire)
|
||||
|
||||
export const routeClientMessage = (message: ClientMessage): ServerMessage => {
|
||||
switch (message.kind) {
|
||||
case "echo":
|
||||
return { kind: "echo", text: message.text }
|
||||
case "sum":
|
||||
return { kind: "sumResult", total: message.left + message.right }
|
||||
case "time":
|
||||
return { kind: "time", iso: new Date().toISOString() }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* MigrationsLive - Migration runner with inline loader
|
||||
*
|
||||
* Uses Migrator.make with fromRecord to define migrations inline.
|
||||
* All migrations are statically imported - no dynamic file system loading.
|
||||
*
|
||||
* Migrations run automatically when the MigrationsLive layer is provided,
|
||||
* ensuring the database schema is up-to-date before the application starts.
|
||||
*/
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as ServiceMap from "effect/ServiceMap"
|
||||
import * as Migrator from "effect/unstable/sql/Migrator"
|
||||
import Migration0001 from "./Migrations/001_TodoSchema.ts"
|
||||
|
||||
const loader = Migrator.fromRecord({
|
||||
"1_TodoSchema": Migration0001
|
||||
})
|
||||
|
||||
const run = Migrator.make({})
|
||||
|
||||
export const runMigrations = Effect.gen(function*() {
|
||||
yield* Effect.log("Running migrations...")
|
||||
yield* run({ loader })
|
||||
yield* Effect.log("Migrations ran successfully")
|
||||
})
|
||||
|
||||
export interface MigrationsReadyApi {
|
||||
readonly ready: true
|
||||
}
|
||||
|
||||
export class MigrationsReady extends ServiceMap.Service<MigrationsReady, MigrationsReadyApi>()(
|
||||
"effect-http-ws-cli/MigrationsReady"
|
||||
) {}
|
||||
|
||||
export const MigrationsLive = Layer.effect(
|
||||
MigrationsReady,
|
||||
runMigrations.pipe(
|
||||
Effect.as(MigrationsReady.of({ ready: true }))
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,268 @@
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as Option from "effect/Option"
|
||||
import * as PubSub from "effect/PubSub"
|
||||
import * as Schema from "effect/Schema"
|
||||
import * as ServiceMap from "effect/ServiceMap"
|
||||
import * as Stream from "effect/Stream"
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient"
|
||||
import * as SqlSchema from "effect/unstable/sql/SqlSchema"
|
||||
import type { Todo, TodoChange, TodoEvent, TodoSnapshot } from "./contracts.ts"
|
||||
import { Todo as TodoSchema, TodoChange as TodoChangeSchema } from "./contracts.ts"
|
||||
import { MigrationsReady } from "./migrations.ts"
|
||||
|
||||
export interface TodoStoreApi {
|
||||
readonly list: (input: {
|
||||
readonly includeArchived: boolean
|
||||
}) => Effect.Effect<TodoSnapshot, never, SqlClient.SqlClient>
|
||||
readonly rename: (input: {
|
||||
readonly id: string
|
||||
readonly title: string
|
||||
}) => Effect.Effect<TodoEvent, never, SqlClient.SqlClient>
|
||||
readonly complete: (input: {
|
||||
readonly id: string
|
||||
readonly completed: boolean
|
||||
}) => Effect.Effect<TodoEvent, never, SqlClient.SqlClient>
|
||||
readonly archive: (input: {
|
||||
readonly id: string
|
||||
readonly archived: boolean
|
||||
}) => Effect.Effect<TodoEvent, never, SqlClient.SqlClient>
|
||||
readonly subscribe: (input: {
|
||||
readonly fromOffset: number
|
||||
readonly includeArchived: boolean
|
||||
}) => Stream.Stream<TodoEvent, never, SqlClient.SqlClient>
|
||||
}
|
||||
|
||||
export class TodoStore extends ServiceMap.Service<TodoStore, TodoStoreApi>()(
|
||||
"effect-http-ws-cli/TodoStore"
|
||||
) {}
|
||||
|
||||
const TodoRow = Schema.Struct({
|
||||
id: Schema.String,
|
||||
title: Schema.String,
|
||||
completed: Schema.BooleanFromBit,
|
||||
archived: Schema.BooleanFromBit,
|
||||
revision: Schema.Number,
|
||||
updatedAt: Schema.String
|
||||
})
|
||||
|
||||
const TodoEventRow = Schema.Struct({
|
||||
offset: Schema.Number,
|
||||
at: Schema.String,
|
||||
todo: Schema.fromJsonString(TodoSchema),
|
||||
change: Schema.fromJsonString(TodoChangeSchema)
|
||||
})
|
||||
|
||||
const EventInsertRequest = Schema.Struct({
|
||||
at: Schema.String,
|
||||
todo: Schema.fromJsonString(TodoSchema),
|
||||
change: Schema.fromJsonString(TodoChangeSchema),
|
||||
archived: Schema.BooleanFromBit
|
||||
})
|
||||
|
||||
const ListRequest = Schema.Struct({
|
||||
includeArchived: Schema.Boolean
|
||||
})
|
||||
|
||||
const CatchupRequest = Schema.Struct({
|
||||
fromOffset: Schema.Number,
|
||||
includeArchived: Schema.Boolean
|
||||
})
|
||||
|
||||
const OffsetRow = Schema.Struct({
|
||||
offset: Schema.Number
|
||||
})
|
||||
|
||||
const makeQueries = (sql: SqlClient.SqlClient) => {
|
||||
const listTodoRows = SqlSchema.findAll({
|
||||
Request: ListRequest,
|
||||
Result: TodoRow,
|
||||
execute: (request) =>
|
||||
request.includeArchived
|
||||
? sql<Todo>`
|
||||
SELECT id, title, completed, archived, revision, updated_at AS updatedAt
|
||||
FROM todos
|
||||
ORDER BY id
|
||||
`
|
||||
: sql<Todo>`
|
||||
SELECT id, title, completed, archived, revision, updated_at AS updatedAt
|
||||
FROM todos
|
||||
WHERE archived = 0
|
||||
ORDER BY id
|
||||
`
|
||||
})
|
||||
|
||||
const findTodoById = SqlSchema.findOneOption({
|
||||
Request: Schema.String,
|
||||
Result: TodoRow,
|
||||
execute: (id) => sql<Todo>`
|
||||
SELECT id, title, completed, archived, revision, updated_at AS updatedAt
|
||||
FROM todos
|
||||
WHERE id = ${id}
|
||||
`
|
||||
})
|
||||
|
||||
const upsertTodo = SqlSchema.void({
|
||||
Request: TodoRow,
|
||||
execute: (todo) => sql`
|
||||
INSERT INTO todos (id, title, completed, archived, revision, updated_at)
|
||||
VALUES (${todo.id}, ${todo.title}, ${todo.completed}, ${todo.archived}, ${todo.revision}, ${todo.updatedAt})
|
||||
ON CONFLICT(id) DO UPDATE SET
|
||||
title = excluded.title,
|
||||
completed = excluded.completed,
|
||||
archived = excluded.archived,
|
||||
revision = excluded.revision,
|
||||
updated_at = excluded.updated_at
|
||||
`
|
||||
})
|
||||
|
||||
const loadEventsSince = SqlSchema.findAll({
|
||||
Request: CatchupRequest,
|
||||
Result: TodoEventRow,
|
||||
execute: (request) =>
|
||||
request.includeArchived
|
||||
? sql<TodoEvent>`
|
||||
SELECT event_offset AS "offset", at, todo_json AS todo, change_json AS change
|
||||
FROM todo_events
|
||||
WHERE event_offset > ${request.fromOffset}
|
||||
ORDER BY event_offset
|
||||
`
|
||||
: sql<TodoEvent>`
|
||||
SELECT event_offset AS "offset", at, todo_json AS todo, change_json AS change
|
||||
FROM todo_events
|
||||
WHERE event_offset > ${request.fromOffset} AND archived = 0
|
||||
ORDER BY event_offset
|
||||
`
|
||||
})
|
||||
|
||||
const insertTodoEvent = SqlSchema.findOne({
|
||||
Request: EventInsertRequest,
|
||||
Result: TodoEventRow,
|
||||
execute: (request) => sql<TodoEvent>`
|
||||
INSERT INTO todo_events (at, todo_json, change_json, archived)
|
||||
VALUES (${request.at}, ${request.todo}, ${request.change}, ${request.archived})
|
||||
RETURNING event_offset AS "offset", at, todo_json AS todo, change_json AS change
|
||||
`
|
||||
})
|
||||
|
||||
const currentOffset = SqlSchema.findOne({
|
||||
Request: Schema.Undefined,
|
||||
Result: OffsetRow,
|
||||
execute: () => sql<{ readonly offset: number }>`
|
||||
SELECT COALESCE(MAX(event_offset), 0) AS "offset"
|
||||
FROM todo_events
|
||||
`
|
||||
})
|
||||
|
||||
return {
|
||||
listTodoRows,
|
||||
findTodoById,
|
||||
upsertTodo,
|
||||
loadEventsSince,
|
||||
insertTodoEvent,
|
||||
currentOffset
|
||||
} as const
|
||||
}
|
||||
|
||||
export const layerTodoStore = Layer.effect(
|
||||
TodoStore,
|
||||
Effect.gen(function*() {
|
||||
yield* MigrationsReady
|
||||
const eventsPubSub = yield* PubSub.unbounded<TodoEvent>()
|
||||
|
||||
const append = (
|
||||
todoId: string,
|
||||
change: TodoChange,
|
||||
update: (todo: Todo) => Todo
|
||||
): Effect.Effect<TodoEvent, never, SqlClient.SqlClient> =>
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) => {
|
||||
const queries = makeQueries(sql)
|
||||
return sql.withTransaction(
|
||||
queries.findTodoById(todoId).pipe(
|
||||
Effect.flatMap(
|
||||
Option.match({
|
||||
onNone: () => Effect.die(`Todo not found: ${todoId}`),
|
||||
onSome: (todo) => {
|
||||
const updated = update(todo)
|
||||
return queries.upsertTodo(updated).pipe(
|
||||
Effect.flatMap(() =>
|
||||
queries.insertTodoEvent({
|
||||
at: updated.updatedAt,
|
||||
todo: updated,
|
||||
change,
|
||||
archived: updated.archived
|
||||
})
|
||||
)
|
||||
)
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
}).pipe(Effect.tap((event) => PubSub.publish(eventsPubSub, event)), Effect.orDie)
|
||||
|
||||
const visible = (todo: Todo, includeArchived: boolean) => includeArchived || !todo.archived
|
||||
|
||||
const subscribe = (input: {
|
||||
readonly fromOffset: number
|
||||
readonly includeArchived: boolean
|
||||
}): Stream.Stream<TodoEvent, never, SqlClient.SqlClient> => {
|
||||
const catchup = Stream.fromIterableEffect(
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) => makeQueries(sql).loadEventsSince(input))
|
||||
).pipe(Stream.orDie)
|
||||
|
||||
const live = Stream.fromPubSub(eventsPubSub).pipe(
|
||||
Stream.filter((event) => visible(event.todo, input.includeArchived))
|
||||
)
|
||||
|
||||
return Stream.concat(catchup, live)
|
||||
}
|
||||
|
||||
return TodoStore.of({
|
||||
list: ({ includeArchived }) =>
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) => {
|
||||
const queries = makeQueries(sql)
|
||||
return Effect.all({
|
||||
todos: queries.listTodoRows({ includeArchived }),
|
||||
offset: queries.currentOffset(undefined).pipe(Effect.map(({ offset }) => offset))
|
||||
}).pipe(
|
||||
Effect.map(({ offset, todos }) => ({ offset, todos }))
|
||||
)
|
||||
}).pipe(Effect.orDie),
|
||||
rename: ({ id, title }) =>
|
||||
append(
|
||||
id,
|
||||
{ _tag: "TodoRenamed", title },
|
||||
(todo) => ({
|
||||
...todo,
|
||||
title,
|
||||
revision: todo.revision + 1,
|
||||
updatedAt: new Date().toISOString()
|
||||
})
|
||||
),
|
||||
complete: ({ id, completed }) =>
|
||||
append(
|
||||
id,
|
||||
{ _tag: "TodoCompleted", completed },
|
||||
(todo) => ({
|
||||
...todo,
|
||||
completed,
|
||||
revision: todo.revision + 1,
|
||||
updatedAt: new Date().toISOString()
|
||||
})
|
||||
),
|
||||
archive: ({ id, archived }) =>
|
||||
append(
|
||||
id,
|
||||
{ _tag: "TodoArchived", archived },
|
||||
(todo) => ({
|
||||
...todo,
|
||||
archived,
|
||||
revision: todo.revision + 1,
|
||||
updatedAt: new Date().toISOString()
|
||||
})
|
||||
),
|
||||
subscribe
|
||||
})
|
||||
})
|
||||
)
|
||||
@@ -0,0 +1,155 @@
|
||||
import { NodeHttpServer } from "@effect/platform-node"
|
||||
import * as SqliteNode from "@effect/sql-sqlite-node"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as FileSystem from "effect/FileSystem"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as Path from "effect/Path"
|
||||
import * as Http from "node:http"
|
||||
import {
|
||||
HttpRouter,
|
||||
HttpServerRequest,
|
||||
HttpServerResponse
|
||||
} from "effect/unstable/http"
|
||||
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization"
|
||||
import * as RpcServer from "effect/unstable/rpc/RpcServer"
|
||||
import * as Stream from "effect/Stream"
|
||||
import {
|
||||
ClientMessage,
|
||||
routeClientMessage,
|
||||
ServerMessage
|
||||
} from "./messages.ts"
|
||||
import { ServerConfig } from "./config.ts"
|
||||
import { WsRpcGroup } from "./contracts.ts"
|
||||
import { TodoStore, layerTodoStore } from "./model-store.ts"
|
||||
import { MigrationsLive } from "./migrations.ts"
|
||||
|
||||
const respondMessage = HttpServerResponse.schemaJson(ServerMessage)
|
||||
|
||||
const messageDispatchRoute = HttpRouter.add(
|
||||
"POST",
|
||||
"/api/dispatch",
|
||||
HttpServerRequest.schemaBodyJson(ClientMessage).pipe(
|
||||
Effect.flatMap((message) => respondMessage(routeClientMessage(message))),
|
||||
Effect.catchTag(
|
||||
"SchemaError",
|
||||
() => Effect.succeed(HttpServerResponse.jsonUnsafe({ kind: "error", error: "Invalid message schema" }, { status: 400 }))
|
||||
),
|
||||
Effect.catchTag(
|
||||
"HttpServerError",
|
||||
() => Effect.succeed(HttpServerResponse.jsonUnsafe({ kind: "error", error: "Invalid request body" }, { status: 400 }))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
const websocketRpcRoute = RpcServer.layerHttp({
|
||||
group: WsRpcGroup,
|
||||
path: "/ws",
|
||||
protocol: "websocket"
|
||||
}).pipe(
|
||||
Layer.provide(WsRpcGroup.toLayer({
|
||||
echo: ({ text }) => Effect.succeed({ text }),
|
||||
sum: ({ left, right }) => Effect.succeed({ total: left + right }),
|
||||
time: () => Effect.sync(() => ({ iso: new Date().toISOString() })),
|
||||
listTodos: ({ includeArchived }) =>
|
||||
Effect.flatMap(Effect.service(TodoStore), (store) => store.list({ includeArchived })),
|
||||
renameTodo: ({ id, title }) =>
|
||||
Effect.flatMap(Effect.service(TodoStore), (store) => store.rename({ id, title })),
|
||||
completeTodo: ({ id, completed }) =>
|
||||
Effect.flatMap(Effect.service(TodoStore), (store) => store.complete({ id, completed })),
|
||||
archiveTodo: ({ id, archived }) =>
|
||||
Effect.flatMap(Effect.service(TodoStore), (store) => store.archive({ id, archived })),
|
||||
subscribeTodos: ({ fromOffset, includeArchived }) =>
|
||||
Stream.unwrap(
|
||||
Effect.map(
|
||||
Effect.service(TodoStore),
|
||||
(store) => store.subscribe({ fromOffset, includeArchived })
|
||||
)
|
||||
)
|
||||
})),
|
||||
Layer.provide(layerTodoStore),
|
||||
Layer.provide(RpcSerialization.layerJson)
|
||||
)
|
||||
|
||||
const staticRoute = HttpRouter.add(
|
||||
"GET",
|
||||
"*",
|
||||
(request) =>
|
||||
Effect.gen(function*() {
|
||||
const fs = yield* FileSystem.FileSystem
|
||||
const path = yield* Path.Path
|
||||
const config = yield* ServerConfig
|
||||
const url = HttpServerRequest.toURL(request)
|
||||
if (!url) {
|
||||
return HttpServerResponse.text("Bad Request", { status: 400 })
|
||||
}
|
||||
|
||||
if (config.frontendDevOrigin) {
|
||||
return HttpServerResponse.redirect(
|
||||
new URL(`${url.pathname}${url.search}`, config.frontendDevOrigin),
|
||||
{
|
||||
status: 307,
|
||||
headers: { "cache-control": "no-store" }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const root = path.resolve(config.assetsDir)
|
||||
const decodedPath = decodeURIComponent(url.pathname)
|
||||
const target = decodedPath === "/"
|
||||
? "index.html"
|
||||
: decodedPath.endsWith("/")
|
||||
? `${decodedPath.slice(1)}index.html`
|
||||
: decodedPath.slice(1)
|
||||
|
||||
const normalizedTarget = path.normalize(target)
|
||||
const absoluteTarget = path.resolve(root, normalizedTarget)
|
||||
const relativeToRoot = path.relative(root, absoluteTarget)
|
||||
|
||||
if (relativeToRoot.startsWith("..") || path.isAbsolute(relativeToRoot)) {
|
||||
return HttpServerResponse.text("Forbidden", { status: 403 })
|
||||
}
|
||||
|
||||
const exists = yield* fs.exists(absoluteTarget)
|
||||
if (!exists) {
|
||||
return HttpServerResponse.text("Not Found", { status: 404 })
|
||||
}
|
||||
|
||||
return yield* HttpServerResponse.file(absoluteTarget)
|
||||
}).pipe(Effect.catchCause(() => Effect.succeed(HttpServerResponse.text("Bad Request", { status: 400 }))))
|
||||
)
|
||||
|
||||
export const makeRoutesLayer =
|
||||
Layer.mergeAll(
|
||||
HttpRouter.add(
|
||||
"GET",
|
||||
"/health",
|
||||
HttpServerResponse.json({ ok: true })
|
||||
),
|
||||
messageDispatchRoute,
|
||||
websocketRpcRoute,
|
||||
staticRoute
|
||||
)
|
||||
|
||||
export const makeServerLayer = Layer.unwrap(
|
||||
Effect.gen(function*() {
|
||||
const config = yield* ServerConfig
|
||||
const sqliteLayer = SqliteNode.SqliteClient.layer({
|
||||
filename: config.dbFilename
|
||||
})
|
||||
const persistenceLayer = MigrationsLive.pipe(
|
||||
Layer.provideMerge(sqliteLayer)
|
||||
)
|
||||
|
||||
return HttpRouter.serve(makeRoutesLayer, {
|
||||
disableLogger: !config.requestLogging
|
||||
}).pipe(
|
||||
Layer.provideMerge(persistenceLayer),
|
||||
Layer.provide(NodeHttpServer.layer(Http.createServer, {
|
||||
host: config.host,
|
||||
port: config.port
|
||||
}))
|
||||
)
|
||||
})
|
||||
)
|
||||
|
||||
export const runServer = Layer.launch(makeServerLayer)
|
||||
@@ -0,0 +1,79 @@
|
||||
import { describe, expect, it } from "@effect/vitest"
|
||||
import * as ConfigProvider from "effect/ConfigProvider"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Option from "effect/Option"
|
||||
import { resolveServerConfig } from "../src/cli.ts"
|
||||
|
||||
describe("cli config resolution", () => {
|
||||
it.effect("falls back to effect/config values when flags are omitted", () =>
|
||||
Effect.gen(function*() {
|
||||
const resolved = yield* resolveServerConfig({
|
||||
host: Option.none(),
|
||||
port: Option.none(),
|
||||
assets: Option.none(),
|
||||
db: Option.none(),
|
||||
requestLogging: Option.none(),
|
||||
frontendDevOrigin: Option.none()
|
||||
}).pipe(
|
||||
Effect.provideService(
|
||||
ConfigProvider.ConfigProvider,
|
||||
ConfigProvider.fromEnv({
|
||||
env: {
|
||||
HOST: "0.0.0.0",
|
||||
PORT: "4001",
|
||||
ASSETS_DIR: "public",
|
||||
DB_FILENAME: "dev.sqlite",
|
||||
REQUEST_LOGGING: "false",
|
||||
FRONTEND_DEV_ORIGIN: "http://127.0.0.1:5173"
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
expect(resolved).toEqual({
|
||||
host: "0.0.0.0",
|
||||
port: 4001,
|
||||
assetsDir: "public",
|
||||
dbFilename: "dev.sqlite",
|
||||
requestLogging: false,
|
||||
frontendDevOrigin: "http://127.0.0.1:5173"
|
||||
})
|
||||
})
|
||||
)
|
||||
|
||||
it.effect("uses CLI flags when provided", () =>
|
||||
Effect.gen(function*() {
|
||||
const resolved = yield* resolveServerConfig({
|
||||
host: Option.some("127.0.0.1"),
|
||||
port: Option.some(8788),
|
||||
assets: Option.some("public"),
|
||||
db: Option.some("override.sqlite"),
|
||||
requestLogging: Option.some(true),
|
||||
frontendDevOrigin: Option.some("http://127.0.0.1:4173")
|
||||
}).pipe(
|
||||
Effect.provideService(
|
||||
ConfigProvider.ConfigProvider,
|
||||
ConfigProvider.fromEnv({
|
||||
env: {
|
||||
HOST: "0.0.0.0",
|
||||
PORT: "4001",
|
||||
ASSETS_DIR: "other",
|
||||
DB_FILENAME: "ignored.sqlite",
|
||||
REQUEST_LOGGING: "false",
|
||||
FRONTEND_DEV_ORIGIN: "http://127.0.0.1:5173"
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
expect(resolved).toEqual({
|
||||
host: "127.0.0.1",
|
||||
port: 8788,
|
||||
assetsDir: "public",
|
||||
dbFilename: "override.sqlite",
|
||||
requestLogging: true,
|
||||
frontendDevOrigin: "http://127.0.0.1:4173"
|
||||
})
|
||||
})
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,90 @@
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices"
|
||||
import * as SqliteNode from "@effect/sql-sqlite-node"
|
||||
import { describe, expect, it } from "@effect/vitest"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient"
|
||||
import * as FileSystem from "node:fs"
|
||||
import * as OS from "node:os"
|
||||
import * as NodePath from "node:path"
|
||||
import { resetDatabase } from "../src/cli.ts"
|
||||
import { MigrationsLive } from "../src/migrations.ts"
|
||||
|
||||
const countRows = (dbFilename: string, tableName: string) =>
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) =>
|
||||
sql<{ readonly count: number }>`SELECT COUNT(*) AS count FROM ${sql(tableName)}`.pipe(
|
||||
Effect.map((rows) => rows[0]?.count ?? 0)
|
||||
)
|
||||
).pipe(
|
||||
Effect.provide(SqliteNode.SqliteClient.layer({ filename: dbFilename }))
|
||||
)
|
||||
|
||||
const insertTodo = (dbFilename: string) =>
|
||||
Effect.scoped(
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) => {
|
||||
const now = new Date().toISOString()
|
||||
const id = "todo-reset-test"
|
||||
const title = "before-reset"
|
||||
return sql.withTransaction(
|
||||
sql`
|
||||
INSERT INTO todos (id, title, completed, archived, revision, updated_at)
|
||||
VALUES (${id}, ${title}, 0, 0, 1, ${now})
|
||||
`.pipe(
|
||||
Effect.flatMap(() =>
|
||||
sql`
|
||||
INSERT INTO todo_events (at, todo_json, change_json, archived)
|
||||
VALUES (
|
||||
${now},
|
||||
${JSON.stringify({
|
||||
id,
|
||||
title,
|
||||
completed: false,
|
||||
archived: false,
|
||||
revision: 1,
|
||||
updatedAt: now
|
||||
})},
|
||||
${JSON.stringify({ _tag: "TodoCreated" })},
|
||||
0
|
||||
)
|
||||
`
|
||||
)
|
||||
)
|
||||
)
|
||||
}).pipe(
|
||||
Effect.provide(MigrationsLive.pipe(Layer.provideMerge(SqliteNode.SqliteClient.layer({ filename: dbFilename }))))
|
||||
)
|
||||
)
|
||||
|
||||
describe("reset command", () => {
|
||||
it.effect("deletes the database and reruns migrations without reseeding todos", () =>
|
||||
Effect.gen(function*() {
|
||||
const dbFilename = NodePath.join(
|
||||
OS.tmpdir(),
|
||||
`effect-http-ws-cli-reset-${Date.now()}-${Math.random().toString(16).slice(2)}.sqlite`
|
||||
)
|
||||
|
||||
yield* insertTodo(dbFilename)
|
||||
|
||||
const beforeCount = yield* countRows(dbFilename, "todos")
|
||||
expect(beforeCount).toBe(1)
|
||||
|
||||
yield* resetDatabase(dbFilename).pipe(
|
||||
Effect.provide(NodeServices.layer)
|
||||
)
|
||||
|
||||
const todoCount = yield* countRows(dbFilename, "todos")
|
||||
const migrationCount = yield* countRows(dbFilename, "effect_sql_migrations")
|
||||
|
||||
expect(todoCount).toBe(0)
|
||||
expect(migrationCount).toBe(1)
|
||||
|
||||
yield* Effect.sync(() => {
|
||||
try {
|
||||
FileSystem.rmSync(dbFilename, { force: true })
|
||||
} catch {
|
||||
// ignore cleanup failures in tests
|
||||
}
|
||||
})
|
||||
})
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,310 @@
|
||||
import { NodeHttpServer } from "@effect/platform-node"
|
||||
import * as SqliteNode from "@effect/sql-sqlite-node"
|
||||
import { describe, expect, it } from "@effect/vitest"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as Stream from "effect/Stream"
|
||||
import * as FileSystem from "node:fs"
|
||||
import * as OS from "node:os"
|
||||
import * as NodePath from "node:path"
|
||||
import {
|
||||
HttpBody,
|
||||
HttpClient,
|
||||
HttpClientResponse,
|
||||
HttpServer,
|
||||
HttpRouter
|
||||
} from "effect/unstable/http"
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient"
|
||||
import { ServerConfig } from "../src/config.ts"
|
||||
import { MigrationsLive } from "../src/migrations.ts"
|
||||
import { ServerMessage } from "../src/messages.ts"
|
||||
import { withWsRpcClient } from "../src/client.ts"
|
||||
import { makeRoutesLayer } from "../src/server.ts"
|
||||
|
||||
const testServerConfig = {
|
||||
host: "127.0.0.1",
|
||||
port: 0,
|
||||
assetsDir: new URL("../../public", import.meta.url).pathname,
|
||||
dbFilename: ":memory:",
|
||||
requestLogging: false,
|
||||
frontendDevOrigin: undefined
|
||||
}
|
||||
|
||||
const AppUnderTest = HttpRouter.serve(
|
||||
makeRoutesLayer,
|
||||
{
|
||||
disableListenLog: true,
|
||||
disableLogger: true
|
||||
}
|
||||
)
|
||||
|
||||
const persistenceLayer = (dbFilename: string) => {
|
||||
const sqliteLayer = SqliteNode.SqliteClient.layer({ filename: dbFilename })
|
||||
return MigrationsLive.pipe(Layer.provideMerge(sqliteLayer))
|
||||
}
|
||||
|
||||
const appLayer = (dbFilename: string) =>
|
||||
AppUnderTest.pipe(Layer.provideMerge(persistenceLayer(dbFilename)))
|
||||
|
||||
const insertTodo = (dbFilename: string, id: string, title: string) =>
|
||||
Effect.scoped(
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) => {
|
||||
const now = new Date().toISOString()
|
||||
return sql.withTransaction(
|
||||
sql`
|
||||
INSERT INTO todos (id, title, completed, archived, revision, updated_at)
|
||||
VALUES (${id}, ${title}, 0, 0, 1, ${now})
|
||||
`.pipe(
|
||||
Effect.flatMap(() =>
|
||||
sql`
|
||||
INSERT INTO todo_events (at, todo_json, change_json, archived)
|
||||
VALUES (
|
||||
${now},
|
||||
${JSON.stringify({
|
||||
id,
|
||||
title,
|
||||
completed: false,
|
||||
archived: false,
|
||||
revision: 1,
|
||||
updatedAt: now
|
||||
})},
|
||||
${JSON.stringify({ _tag: "TodoCreated" })},
|
||||
0
|
||||
)
|
||||
`
|
||||
)
|
||||
)
|
||||
)
|
||||
}).pipe(
|
||||
Effect.provide(persistenceLayer(dbFilename))
|
||||
)
|
||||
)
|
||||
|
||||
describe("server", () => {
|
||||
it.effect("routes HTTP messages validated by Schema", () =>
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(testServerConfig.dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, testServerConfig)
|
||||
)
|
||||
const client = yield* HttpClient.HttpClient
|
||||
const response = yield* client.post("/api/dispatch", {
|
||||
body: HttpBody.jsonUnsafe({ kind: "sum", left: 20, right: 22 })
|
||||
})
|
||||
|
||||
const parsed = yield* HttpClientResponse.schemaBodyJson(ServerMessage)(response)
|
||||
expect(parsed).toEqual({ kind: "sumResult", total: 42 })
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("serves static files from local filesystem", () =>
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(testServerConfig.dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, testServerConfig)
|
||||
)
|
||||
const text = yield* HttpClient.get("/").pipe(
|
||||
Effect.flatMap((response) => response.text)
|
||||
)
|
||||
|
||||
expect(text).toContain("effect-http-ws-cli")
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("redirects frontend requests to the Vite dev server when enabled", () =>
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(testServerConfig.dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, {
|
||||
...testServerConfig,
|
||||
frontendDevOrigin: "http://127.0.0.1:5173"
|
||||
})
|
||||
)
|
||||
|
||||
const server = yield* HttpServer.HttpServer
|
||||
const address = server.address as HttpServer.TcpAddress
|
||||
const response = yield* Effect.promise(() =>
|
||||
fetch(`http://127.0.0.1:${address.port}/todos?filter=active`, {
|
||||
redirect: "manual"
|
||||
})
|
||||
)
|
||||
|
||||
expect(response.status).toBe(307)
|
||||
expect(response.headers.get("location")).toBe("http://127.0.0.1:5173/todos?filter=active")
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("routes WebSocket RPC messages with shared contracts", () =>
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(testServerConfig.dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, testServerConfig)
|
||||
)
|
||||
const server = yield* HttpServer.HttpServer
|
||||
const address = server.address as HttpServer.TcpAddress
|
||||
const wsUrl = `ws://127.0.0.1:${address.port}/ws`
|
||||
|
||||
const response = yield* Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) => client.echo({ text: "hello from ws" }))
|
||||
)
|
||||
|
||||
expect(response).toEqual({ text: "hello from ws" })
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("routes WebSocket RPC calls for multiple procedures", () =>
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(testServerConfig.dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, testServerConfig)
|
||||
)
|
||||
const server = yield* HttpServer.HttpServer
|
||||
const address = server.address as HttpServer.TcpAddress
|
||||
const wsUrl = `ws://127.0.0.1:${address.port}/ws`
|
||||
|
||||
const result = yield* Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.all({
|
||||
sum: client.sum({ left: 1, right: 2 }),
|
||||
time: client.time(undefined)
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
expect(result.sum).toEqual({ total: 3 })
|
||||
expect(typeof result.time.iso).toBe("string")
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("lists todos and streams todo updates from offset", () =>
|
||||
Effect.gen(function*() {
|
||||
const dbFilename = NodePath.join(
|
||||
OS.tmpdir(),
|
||||
`effect-http-ws-cli-stream-${Date.now()}-${Math.random().toString(16).slice(2)}.sqlite`
|
||||
)
|
||||
|
||||
yield* insertTodo(dbFilename, "todo-stream-test", "stream-seed")
|
||||
|
||||
const events = yield* Effect.scoped(
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, {
|
||||
...testServerConfig,
|
||||
dbFilename
|
||||
})
|
||||
)
|
||||
const server = yield* HttpServer.HttpServer
|
||||
const address = server.address as HttpServer.TcpAddress
|
||||
const wsUrl = `ws://127.0.0.1:${address.port}/ws`
|
||||
|
||||
return yield* withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.gen(function*() {
|
||||
const snapshot = yield* client.listTodos({ includeArchived: true })
|
||||
const firstTodo = snapshot.todos[0]
|
||||
if (!firstTodo) {
|
||||
return yield* Effect.die("Expected a todo fixture")
|
||||
}
|
||||
|
||||
yield* client.renameTodo({ id: firstTodo.id, title: "alpha" })
|
||||
yield* client.completeTodo({ id: firstTodo.id, completed: true })
|
||||
yield* client.archiveTodo({ id: firstTodo.id, archived: true })
|
||||
|
||||
return yield* client.subscribeTodos({
|
||||
fromOffset: snapshot.offset,
|
||||
includeArchived: true
|
||||
}).pipe(
|
||||
Stream.take(3),
|
||||
Stream.runCollect
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
).pipe(
|
||||
Effect.ensuring(
|
||||
Effect.sync(() => {
|
||||
try {
|
||||
FileSystem.rmSync(dbFilename, { force: true })
|
||||
} catch {
|
||||
// ignore cleanup failures in tests
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
expect(events).toHaveLength(3)
|
||||
expect(events[0]?.change).toEqual({ _tag: "TodoRenamed", title: "alpha" })
|
||||
expect(events[1]?.change).toEqual({ _tag: "TodoCompleted", completed: true })
|
||||
expect(events[2]?.change).toEqual({ _tag: "TodoArchived", archived: true })
|
||||
expect(events[0]?.todo.title).toBe("alpha")
|
||||
expect(events[1]?.todo.completed).toBe(true)
|
||||
expect(events[2]?.todo.archived).toBe(true)
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("persists todos across server restarts when using a file database", () =>
|
||||
Effect.gen(function*() {
|
||||
const dbFilename = NodePath.join(
|
||||
OS.tmpdir(),
|
||||
`effect-http-ws-cli-${Date.now()}-${Math.random().toString(16).slice(2)}.sqlite`
|
||||
)
|
||||
|
||||
yield* insertTodo(dbFilename, "todo-persist-test", "persist-seed")
|
||||
|
||||
const withServer = <A, E, R>(f: (wsUrl: string) => Effect.Effect<A, E, R>) =>
|
||||
Effect.scoped(
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, {
|
||||
...testServerConfig,
|
||||
dbFilename
|
||||
})
|
||||
)
|
||||
|
||||
const server = yield* HttpServer.HttpServer
|
||||
const address = server.address as HttpServer.TcpAddress
|
||||
const wsUrl = `ws://127.0.0.1:${address.port}/ws`
|
||||
return yield* f(wsUrl)
|
||||
})
|
||||
)
|
||||
|
||||
const renamedTodoId = yield* withServer((wsUrl) =>
|
||||
Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.gen(function*() {
|
||||
const snapshot = yield* client.listTodos({ includeArchived: true })
|
||||
const firstTodo = snapshot.todos[0]
|
||||
if (!firstTodo) {
|
||||
return yield* Effect.die("Expected a todo fixture")
|
||||
}
|
||||
|
||||
yield* client.renameTodo({ id: firstTodo.id, title: "persisted-title" })
|
||||
return firstTodo.id
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
const persistedTitle = yield* withServer((wsUrl) =>
|
||||
Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.gen(function*() {
|
||||
const snapshot = yield* client.listTodos({ includeArchived: true })
|
||||
const persisted = snapshot.todos.find((todo) => todo.id === renamedTodoId)
|
||||
if (!persisted) {
|
||||
return yield* Effect.die("Expected persisted todo")
|
||||
}
|
||||
return persisted.title
|
||||
})
|
||||
)
|
||||
)
|
||||
).pipe(
|
||||
Effect.ensuring(
|
||||
Effect.sync(() => {
|
||||
try {
|
||||
FileSystem.rmSync(dbFilename, { force: true })
|
||||
} catch {
|
||||
// ignore cleanup failures in tests
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
expect(persistedTitle).toBe("persisted-title")
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["src", "test", "vitest.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { defineConfig } from "vitest/config"
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
include: ["test/**/*.test.ts"],
|
||||
environment: "node"
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"allowImportingTsExtensions": true,
|
||||
"rewriteRelativeImportExtensions": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true,
|
||||
"resolveJsonModule": true,
|
||||
"types": ["node", "vitest/globals"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>effect-http-ws-cli rpc console</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Archivo+Black&family=IBM+Plex+Sans:wght@400;500;700&display=swap" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@effect-http-ws-cli/web",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"test": "vitest run",
|
||||
"lint": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@effect-http-ws-cli/server": "workspace:*",
|
||||
"@effect/atom-react": "catalog:",
|
||||
"@tanstack/react-router": "^1.166.2",
|
||||
"effect": "catalog:",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tanstack/router-plugin": "^1.166.2",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.1",
|
||||
"@vitest/browser-playwright": "^4.0.18",
|
||||
"playwright": "^1.58.2",
|
||||
"typescript": "catalog:",
|
||||
"vite": "^7.2.0",
|
||||
"vitest": "catalog:",
|
||||
"vitest-browser-react": "^2.0.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { StrictMode } from "react"
|
||||
import { createRoot } from "react-dom/client"
|
||||
import { RegistryProvider } from "@effect/atom-react"
|
||||
import { createBrowserHistory, RouterProvider } from "@tanstack/react-router"
|
||||
import { getRouter } from "./router"
|
||||
import "./styles.css"
|
||||
|
||||
const history = createBrowserHistory()
|
||||
const router = getRouter(history)
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<RegistryProvider>
|
||||
<RouterProvider router={router} />
|
||||
</RegistryProvider>
|
||||
</StrictMode>
|
||||
)
|
||||
@@ -0,0 +1,59 @@
|
||||
/* eslint-disable */
|
||||
|
||||
// @ts-nocheck
|
||||
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
|
||||
// This file was automatically generated by TanStack Router.
|
||||
// You should NOT make any changes in this file as it will be overwritten.
|
||||
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
||||
|
||||
import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
|
||||
const IndexRoute = IndexRouteImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
'/': typeof IndexRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths: '/'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to: '/'
|
||||
id: '__root__' | '/'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
}
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
interface FileRoutesByPath {
|
||||
'/': {
|
||||
id: '/'
|
||||
path: '/'
|
||||
fullPath: '/'
|
||||
preLoaderRoute: typeof IndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
}
|
||||
export const routeTree = rootRouteImport
|
||||
._addFileChildren(rootRouteChildren)
|
||||
._addFileTypes<FileRouteTypes>()
|
||||
@@ -0,0 +1,15 @@
|
||||
import { createRouter, type RouterHistory } from "@tanstack/react-router"
|
||||
import { routeTree } from "./routeTree.gen"
|
||||
|
||||
export const getRouter = (history: RouterHistory) =>
|
||||
createRouter({
|
||||
routeTree,
|
||||
history
|
||||
})
|
||||
|
||||
|
||||
declare module "@tanstack/react-router" {
|
||||
interface Register {
|
||||
router: ReturnType<typeof getRouter>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Outlet, createRootRoute } from "@tanstack/react-router"
|
||||
|
||||
export const Route = createRootRoute({
|
||||
component: Outlet
|
||||
})
|
||||
@@ -0,0 +1,460 @@
|
||||
import { createFileRoute } from "@tanstack/react-router"
|
||||
|
||||
|
||||
|
||||
import { useEffect, useRef } from "react"
|
||||
import * as Cause from "effect/Cause"
|
||||
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"
|
||||
import { useAtomRefresh, useAtomSet, useAtomValue } from "@effect/atom-react"
|
||||
import type { Todo, TodoEvent, TodoChange } from "@effect-http-ws-cli/server/contracts"
|
||||
import {
|
||||
archiveTodoMutationAtom,
|
||||
completeTodoMutationAtom,
|
||||
renameTodoMutationAtom,
|
||||
subscribeTodosPullAtom,
|
||||
todosSnapshotAtom
|
||||
} from "../rpc"
|
||||
import {
|
||||
connectionAtom,
|
||||
eventsAtom,
|
||||
mutationBusyAtom,
|
||||
todoProjectionAtom
|
||||
} from "../state"
|
||||
|
||||
const reconnectBaseMs = 1_250
|
||||
const reconnectMaxMs = 20_000
|
||||
const maxReconnectAttempts = 8
|
||||
|
||||
|
||||
|
||||
export const Route = createFileRoute("/")({
|
||||
component: IndexRoute
|
||||
})
|
||||
|
||||
function IndexRoute() {
|
||||
const setProjection = useAtomSet(todoProjectionAtom)
|
||||
const setEvents = useAtomSet(eventsAtom)
|
||||
const setConnection = useAtomSet(connectionAtom)
|
||||
const setBusy = useAtomSet(mutationBusyAtom)
|
||||
|
||||
const snapshotResult = useAtomValue(todosSnapshotAtom)
|
||||
const subscriptionPullResult = useAtomValue(subscribeTodosPullAtom)
|
||||
const pullSubscription = useAtomSet(subscribeTodosPullAtom)
|
||||
const refreshSubscription = useAtomRefresh(subscribeTodosPullAtom)
|
||||
|
||||
const seenOffsetsRef = useRef<Set<number>>(new Set())
|
||||
const baselineOffsetRef = useRef(0)
|
||||
const hasInitializedRef = useRef(false)
|
||||
const hasStartedSubscriptionRef = useRef(false)
|
||||
const brokenSubscriptionRef = useRef(false)
|
||||
|
||||
const reconnectAttemptsRef = useRef(0)
|
||||
const reconnectTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
|
||||
const clearReconnectTimer = () => {
|
||||
if (reconnectTimerRef.current !== null) {
|
||||
clearTimeout(reconnectTimerRef.current)
|
||||
reconnectTimerRef.current = null
|
||||
}
|
||||
}
|
||||
|
||||
const startSubscriptionPull = () => {
|
||||
clearReconnectTimer()
|
||||
if (!hasStartedSubscriptionRef.current) {
|
||||
hasStartedSubscriptionRef.current = true
|
||||
}
|
||||
setConnection((current) => ({ ...current, subscriptionState: "connecting" }))
|
||||
refreshSubscription()
|
||||
pullSubscription(undefined)
|
||||
}
|
||||
|
||||
const scheduleReconnect = (lastError: string) => {
|
||||
brokenSubscriptionRef.current = true
|
||||
reconnectAttemptsRef.current += 1
|
||||
|
||||
if (reconnectAttemptsRef.current > maxReconnectAttempts) {
|
||||
setConnection((current) => ({
|
||||
...current,
|
||||
lastError,
|
||||
subscriptionState: "idle"
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
||||
const delayMs = Math.min(
|
||||
reconnectBaseMs * 2 ** Math.max(0, reconnectAttemptsRef.current - 1),
|
||||
reconnectMaxMs
|
||||
)
|
||||
|
||||
setConnection((current) => ({
|
||||
...current,
|
||||
lastError,
|
||||
subscriptionState: "connecting"
|
||||
}))
|
||||
|
||||
clearReconnectTimer()
|
||||
reconnectTimerRef.current = setTimeout(() => {
|
||||
reconnectTimerRef.current = null
|
||||
startSubscriptionPull()
|
||||
}, delayMs)
|
||||
}
|
||||
|
||||
const addEvent = (event: TodoEvent): boolean => {
|
||||
if (event.offset <= baselineOffsetRef.current) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (seenOffsetsRef.current.has(event.offset)) {
|
||||
return false
|
||||
}
|
||||
|
||||
seenOffsetsRef.current.add(event.offset)
|
||||
setEvents((events) => [...events, event])
|
||||
return true
|
||||
}
|
||||
|
||||
const applyEvent = (event: TodoEvent) => {
|
||||
setProjection((current) => ({
|
||||
...current,
|
||||
lastOffset: Math.max(current.lastOffset, event.offset),
|
||||
todos: sortTodos(
|
||||
current.todos.some((todo) => todo.id === event.todo.id)
|
||||
? current.todos.map((todo) => (todo.id === event.todo.id ? event.todo : todo))
|
||||
: [...current.todos, event.todo]
|
||||
),
|
||||
titleDrafts: {
|
||||
...current.titleDrafts,
|
||||
[event.todo.id]: event.todo.title
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
const applyTodoEvent = (event: TodoEvent) => {
|
||||
const isNew = addEvent(event)
|
||||
if (isNew) {
|
||||
applyEvent(event)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (AsyncResult.isInitial(snapshotResult)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (AsyncResult.isFailure(snapshotResult)) {
|
||||
scheduleReconnect(Cause.pretty(snapshotResult.cause))
|
||||
return
|
||||
}
|
||||
|
||||
const snapshot = snapshotResult.value
|
||||
|
||||
setProjection({
|
||||
todos: sortTodos(snapshot.todos),
|
||||
lastOffset: snapshot.offset,
|
||||
titleDrafts: Object.fromEntries(snapshot.todos.map((todo) => [todo.id, todo.title]))
|
||||
})
|
||||
|
||||
if (!hasInitializedRef.current) {
|
||||
hasInitializedRef.current = true
|
||||
baselineOffsetRef.current = snapshot.offset
|
||||
seenOffsetsRef.current = new Set()
|
||||
setEvents([])
|
||||
startSubscriptionPull()
|
||||
}
|
||||
}, [snapshotResult, setEvents, setProjection])
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasStartedSubscriptionRef.current) {
|
||||
return
|
||||
}
|
||||
|
||||
if (AsyncResult.isInitial(subscriptionPullResult)) {
|
||||
setConnection((current) => ({
|
||||
...current,
|
||||
subscriptionState: subscriptionPullResult.waiting ? "connected" : "connecting"
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
||||
if (AsyncResult.isFailure(subscriptionPullResult)) {
|
||||
scheduleReconnect(Cause.pretty(subscriptionPullResult.cause))
|
||||
return
|
||||
}
|
||||
|
||||
reconnectAttemptsRef.current = 0
|
||||
brokenSubscriptionRef.current = false
|
||||
|
||||
setConnection((current) => ({
|
||||
...current,
|
||||
lastError: null,
|
||||
subscriptionState: "connected"
|
||||
}))
|
||||
|
||||
for (const event of subscriptionPullResult.value.items) {
|
||||
applyTodoEvent(event)
|
||||
}
|
||||
|
||||
if (!subscriptionPullResult.value.done && !subscriptionPullResult.waiting) {
|
||||
pullSubscription(undefined)
|
||||
}
|
||||
}, [pullSubscription, setConnection, subscriptionPullResult])
|
||||
|
||||
useEffect(() => {
|
||||
const reconnectOnFocus = () => {
|
||||
if (document.visibilityState !== "visible") {
|
||||
return
|
||||
}
|
||||
|
||||
if (!brokenSubscriptionRef.current) {
|
||||
return
|
||||
}
|
||||
|
||||
reconnectAttemptsRef.current = 0
|
||||
startSubscriptionPull()
|
||||
}
|
||||
|
||||
window.addEventListener("focus", reconnectOnFocus)
|
||||
document.addEventListener("visibilitychange", reconnectOnFocus)
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("focus", reconnectOnFocus)
|
||||
document.removeEventListener("visibilitychange", reconnectOnFocus)
|
||||
}
|
||||
}, [setConnection])
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
clearReconnectTimer()
|
||||
}
|
||||
}, [])
|
||||
|
||||
const runMutation: MutationRunner = (label, run, onSuccess) => {
|
||||
setBusy(label)
|
||||
setConnection((current) => ({ ...current, lastError: null }))
|
||||
|
||||
void run().then(
|
||||
(value) => {
|
||||
onSuccess(value)
|
||||
},
|
||||
(error) => {
|
||||
setConnection((current) => ({ ...current, lastError: Cause.pretty(error) }))
|
||||
}
|
||||
).finally(() => {
|
||||
setBusy(null)
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="shell">
|
||||
<Status />
|
||||
|
||||
<section className="hero">
|
||||
<p className="eyebrow">effect-http-ws-cli</p>
|
||||
<h1>Realtime Todo Stream</h1>
|
||||
<p className="lead">
|
||||
Snapshot on load, then live updates over typed WebSocket RPC subscriptions.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<TodoPanel runMutation={runMutation} applyTodoEvent={applyTodoEvent} />
|
||||
<EventList />
|
||||
<Footer />
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
type MutationRunner = <A>(
|
||||
label: string,
|
||||
run: () => Promise<A>,
|
||||
onSuccess: (value: A) => void
|
||||
) => void
|
||||
|
||||
const sortTodos = (todos: ReadonlyArray<Todo>): ReadonlyArray<Todo> =>
|
||||
[...todos].sort((a, b) => {
|
||||
if (a.archived !== b.archived) return a.archived ? 1 : -1
|
||||
if (a.completed !== b.completed) return a.completed ? 1 : -1
|
||||
return a.id.localeCompare(b.id)
|
||||
})
|
||||
|
||||
const describeChange = (change: TodoChange): string => {
|
||||
switch (change._tag) {
|
||||
case "TodoCreated":
|
||||
return "created"
|
||||
case "TodoRenamed":
|
||||
return `renamed to "${change.title}"`
|
||||
case "TodoCompleted":
|
||||
return change.completed ? "completed" : "marked incomplete"
|
||||
case "TodoArchived":
|
||||
return change.archived ? "archived" : "unarchived"
|
||||
}
|
||||
}
|
||||
|
||||
const Status = () => {
|
||||
const connection = useAtomValue(connectionAtom)
|
||||
const busy = useAtomValue(mutationBusyAtom)
|
||||
|
||||
return (
|
||||
<section className="panel status-panel">
|
||||
<div className="status-grid">
|
||||
<div className={`status-item status-subscription-${connection.subscriptionState}`}>
|
||||
<span className="status-label">Subscription</span>
|
||||
<strong>{connection.subscriptionState}</strong>
|
||||
</div>
|
||||
<div className={`status-item ${busy ? "status-mutation-busy" : "status-mutation-idle"}`}>
|
||||
<span className="status-label">Mutation</span>
|
||||
<strong>{busy ? busy : "idle"}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const TodoPanel = (props: {
|
||||
readonly runMutation: MutationRunner
|
||||
readonly applyTodoEvent: (event: TodoEvent) => void
|
||||
}) => {
|
||||
const projection = useAtomValue(todoProjectionAtom)
|
||||
const connection = useAtomValue(connectionAtom)
|
||||
const setProjection = useAtomSet(todoProjectionAtom)
|
||||
const renameTodo = useAtomSet(renameTodoMutationAtom, { mode: "promise" })
|
||||
const completeTodo = useAtomSet(completeTodoMutationAtom, { mode: "promise" })
|
||||
const archiveTodo = useAtomSet(archiveTodoMutationAtom, { mode: "promise" })
|
||||
|
||||
return (
|
||||
<section className="panel todo-panel">
|
||||
<header className="todo-header">
|
||||
<h2>Todos</h2>
|
||||
<div className="meta">
|
||||
<span>offset #{projection.lastOffset}</span>
|
||||
<span>subscription: {connection.subscriptionState}</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<ul className="todo-list">
|
||||
{projection.todos.map((todo) => (
|
||||
<li
|
||||
key={todo.id}
|
||||
className={`todo-item${todo.completed ? " is-completed" : ""}${todo.archived ? " is-archived" : ""}`}
|
||||
>
|
||||
<div className="todo-main">
|
||||
<input
|
||||
value={projection.titleDrafts[todo.id] ?? todo.title}
|
||||
onChange={(event) => {
|
||||
setProjection((current) => ({
|
||||
...current,
|
||||
titleDrafts: {
|
||||
...current.titleDrafts,
|
||||
[todo.id]: event.target.value
|
||||
}
|
||||
}))
|
||||
}}
|
||||
/>
|
||||
<small>
|
||||
rev {todo.revision} · {new Date(todo.updatedAt).toLocaleTimeString()}
|
||||
</small>
|
||||
</div>
|
||||
<div className="todo-actions">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
props.runMutation(
|
||||
`rename:${todo.id}`,
|
||||
() =>
|
||||
renameTodo({
|
||||
payload: {
|
||||
id: todo.id,
|
||||
title: projection.titleDrafts[todo.id] ?? todo.title
|
||||
}
|
||||
}),
|
||||
props.applyTodoEvent
|
||||
)
|
||||
}
|
||||
>
|
||||
Rename
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
props.runMutation(
|
||||
`complete:${todo.id}`,
|
||||
() =>
|
||||
completeTodo({
|
||||
payload: {
|
||||
id: todo.id,
|
||||
completed: !todo.completed
|
||||
}
|
||||
}),
|
||||
props.applyTodoEvent
|
||||
)
|
||||
}
|
||||
>
|
||||
{todo.completed ? "Undo" : "Complete"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
props.runMutation(
|
||||
`archive:${todo.id}`,
|
||||
() =>
|
||||
archiveTodo({
|
||||
payload: {
|
||||
id: todo.id,
|
||||
archived: !todo.archived
|
||||
}
|
||||
}),
|
||||
props.applyTodoEvent
|
||||
)
|
||||
}
|
||||
>
|
||||
{todo.archived ? "Unarchive" : "Archive"}
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const EventList = () => {
|
||||
const events = useAtomValue(eventsAtom)
|
||||
|
||||
return (
|
||||
<section className="panel event-panel">
|
||||
<header className="todo-header">
|
||||
<h2>Events</h2>
|
||||
<div className="meta">
|
||||
<span>{events.length} total</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<ul className="event-list">
|
||||
{[...events].reverse().map((event) => (
|
||||
<li key={event.offset} className="event-item">
|
||||
<div className="event-top">
|
||||
<strong>#{event.offset}</strong>
|
||||
<span>{new Date(event.at).toLocaleTimeString()}</span>
|
||||
</div>
|
||||
<div className="event-body">
|
||||
<span>{event.todo.title}</span>
|
||||
<small>{describeChange(event.change)}</small>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const Footer = () => {
|
||||
const connection = useAtomValue(connectionAtom)
|
||||
|
||||
return (
|
||||
<footer className="footer">
|
||||
{connection.lastError ? <span className="error">{connection.lastError}</span> : <span>no errors</span>}
|
||||
</footer>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as RpcClient from "effect/unstable/rpc/RpcClient"
|
||||
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization"
|
||||
import * as AtomRpc from "effect/unstable/reactivity/AtomRpc"
|
||||
import * as Socket from "effect/unstable/socket/Socket"
|
||||
import { WsRpcGroup } from "@effect-http-ws-cli/server/contracts"
|
||||
|
||||
const wsUrl = () => {
|
||||
const protocol = window.location.protocol === "https:" ? "wss" : "ws"
|
||||
return `${protocol}://${window.location.host}/ws`
|
||||
}
|
||||
|
||||
const protocolLayer = RpcClient.layerProtocolSocket({
|
||||
retryTransientErrors: true
|
||||
}).pipe(
|
||||
Layer.provide(Socket.layerWebSocket(wsUrl())),
|
||||
Layer.provide(Socket.layerWebSocketConstructorGlobal),
|
||||
Layer.provide(RpcSerialization.layerJson)
|
||||
)
|
||||
|
||||
export class TodoRpcClient extends AtomRpc.Service<TodoRpcClient>()("TodoRpcClient", {
|
||||
group: WsRpcGroup,
|
||||
protocol: protocolLayer
|
||||
}) {}
|
||||
|
||||
export const todosSnapshotAtom = TodoRpcClient.query(
|
||||
"listTodos",
|
||||
{ includeArchived: true }
|
||||
)
|
||||
|
||||
export const subscribeTodosPullAtom = TodoRpcClient.query(
|
||||
"subscribeTodos",
|
||||
{
|
||||
fromOffset: 0,
|
||||
includeArchived: true
|
||||
}
|
||||
)
|
||||
|
||||
export const renameTodoMutationAtom = TodoRpcClient.mutation("renameTodo")
|
||||
export const completeTodoMutationAtom = TodoRpcClient.mutation("completeTodo")
|
||||
export const archiveTodoMutationAtom = TodoRpcClient.mutation("archiveTodo")
|
||||
@@ -0,0 +1,34 @@
|
||||
import * as Atom from "effect/unstable/reactivity/Atom"
|
||||
import type { Todo, TodoEvent } from "@effect-http-ws-cli/server/contracts"
|
||||
|
||||
export type SubscriptionState = "connecting" | "connected" | "idle"
|
||||
|
||||
export interface TodoProjectionState {
|
||||
readonly todos: ReadonlyArray<Todo>
|
||||
readonly titleDrafts: Readonly<Record<string, string>>
|
||||
readonly lastOffset: number
|
||||
}
|
||||
|
||||
export interface ConnectionState {
|
||||
readonly subscriptionState: SubscriptionState
|
||||
readonly lastError: string | null
|
||||
}
|
||||
|
||||
export const todoProjectionAtom = Atom.make<TodoProjectionState>({
|
||||
todos: [],
|
||||
titleDrafts: {},
|
||||
lastOffset: 0
|
||||
}).pipe(Atom.withLabel("todo-projection"))
|
||||
|
||||
export const eventsAtom = Atom.make<ReadonlyArray<TodoEvent>>([]).pipe(
|
||||
Atom.withLabel("events")
|
||||
)
|
||||
|
||||
export const connectionAtom = Atom.make<ConnectionState>({
|
||||
subscriptionState: "idle",
|
||||
lastError: null
|
||||
}).pipe(Atom.withLabel("connection"))
|
||||
|
||||
export const mutationBusyAtom = Atom.make<string | null>(null).pipe(
|
||||
Atom.withLabel("mutation-busy")
|
||||
)
|
||||
@@ -0,0 +1,298 @@
|
||||
:root {
|
||||
--paper: #f3f0e8;
|
||||
--ink: #13222c;
|
||||
--ink-soft: #345264;
|
||||
--accent: #dc4f18;
|
||||
--accent-soft: #f8bb68;
|
||||
--panel: #fffdf6;
|
||||
--line: #162f3f22;
|
||||
--shadow: 0 16px 40px #0f1e291f;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
|
||||
color: var(--ink);
|
||||
background:
|
||||
radial-gradient(circle at 10% 10%, #f7cf9a 0%, transparent 36%),
|
||||
radial-gradient(circle at 92% 88%, #95c7d2 0%, transparent 32%),
|
||||
linear-gradient(165deg, #ece8dc 0%, var(--paper) 48%, #e9dfcf 100%);
|
||||
}
|
||||
|
||||
.shell {
|
||||
width: min(1100px, 100% - 2rem);
|
||||
margin: 1.5rem auto;
|
||||
padding: 1.5rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 20px;
|
||||
background: color-mix(in oklab, var(--paper), white 35%);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.hero {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
padding: 1.5rem;
|
||||
border-radius: 16px;
|
||||
border: 1px solid var(--line);
|
||||
background: linear-gradient(140deg, #fff9ed 0%, #f7efe0 65%, #f2e7d4 100%);
|
||||
}
|
||||
|
||||
.hero::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 220px;
|
||||
height: 220px;
|
||||
right: -60px;
|
||||
top: -90px;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(180deg, var(--accent-soft), transparent 70%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0;
|
||||
font-size: 0.72rem;
|
||||
letter-spacing: 0.22em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
font-family: "Archivo Black", Impact, sans-serif;
|
||||
letter-spacing: 0.02em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 0.35rem;
|
||||
font-size: clamp(1.5rem, 4vw, 2.35rem);
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.lead {
|
||||
margin: 0.6rem 0 0;
|
||||
color: var(--ink-soft);
|
||||
max-width: 68ch;
|
||||
}
|
||||
|
||||
.panel {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 14px;
|
||||
padding: 1rem;
|
||||
background: var(--panel);
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.status-panel {
|
||||
margin-top: 0;
|
||||
background: linear-gradient(140deg, #fbf7ee, #f1e8d7);
|
||||
}
|
||||
|
||||
.status-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0.7rem;
|
||||
}
|
||||
|
||||
.status-item {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
padding: 0.55rem 0.7rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
gap: 0.75rem;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.status-label {
|
||||
color: var(--ink-soft);
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.status-subscription-connected {
|
||||
border-color: #24704755;
|
||||
background: #f1fbf5;
|
||||
}
|
||||
|
||||
.status-subscription-connecting {
|
||||
border-color: #8d6a1b55;
|
||||
background: #fff8eb;
|
||||
}
|
||||
|
||||
.status-subscription-idle {
|
||||
border-color: var(--line);
|
||||
}
|
||||
|
||||
.status-mutation-busy {
|
||||
border-color: #6b3b2e55;
|
||||
background: #fff3ef;
|
||||
}
|
||||
|
||||
.todo-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.meta {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
color: var(--ink-soft);
|
||||
font-size: 0.86rem;
|
||||
}
|
||||
|
||||
.todo-list {
|
||||
margin: 0.8rem 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: grid;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
|
||||
.event-list {
|
||||
margin: 0.8rem 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
max-height: 260px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.event-item {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
padding: 0.55rem 0.65rem;
|
||||
}
|
||||
|
||||
.event-top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 0.6rem;
|
||||
color: var(--ink-soft);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.event-body {
|
||||
margin-top: 0.2rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.event-body small {
|
||||
color: var(--ink-soft);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.todo-item {
|
||||
display: flex;
|
||||
gap: 0.8rem;
|
||||
align-items: center;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
padding: 0.65rem;
|
||||
}
|
||||
|
||||
.todo-main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.todo-main input {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
border: 1px solid var(--line);
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 0.42rem 0.55rem;
|
||||
color: var(--ink);
|
||||
font: inherit;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.todo-main small {
|
||||
display: block;
|
||||
margin-top: 0.3rem;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
|
||||
.todo-actions {
|
||||
display: flex;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
|
||||
button {
|
||||
border: 1px solid #0f243233;
|
||||
border-radius: 8px;
|
||||
background: linear-gradient(160deg, #fff, #f4efe3);
|
||||
color: var(--ink);
|
||||
padding: 0.4rem 0.6rem;
|
||||
font: inherit;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: transform 120ms ease, box-shadow 120ms ease;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 8px 18px #0f20321a;
|
||||
}
|
||||
|
||||
.todo-item.is-completed .todo-main input {
|
||||
text-decoration: line-through;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
|
||||
.todo-item.is-archived {
|
||||
opacity: 0.64;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 1rem;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
align-items: center;
|
||||
font-size: 0.88rem;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--accent);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@media (max-width: 880px) {
|
||||
.shell {
|
||||
width: min(1100px, 100% - 1rem);
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.todo-item {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.todo-actions {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.status-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import * as React from "react"
|
||||
import { RegistryProvider } from "@effect/atom-react"
|
||||
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"
|
||||
import * as Atom from "effect/unstable/reactivity/Atom"
|
||||
import { describe, expect, it, vi } from "vitest"
|
||||
import { render } from "vitest-browser-react"
|
||||
import { createMemoryHistory, RouterProvider } from "@tanstack/react-router"
|
||||
import { getRouter } from "../src/router"
|
||||
|
||||
vi.mock("../src/rpc.ts", () => {
|
||||
const initialSnapshot = AsyncResult.success({
|
||||
offset: 42,
|
||||
todos: [
|
||||
{
|
||||
id: "todo-1",
|
||||
title: "Harness Todo",
|
||||
completed: false,
|
||||
archived: false,
|
||||
revision: 1,
|
||||
updatedAt: "2026-03-05T00:00:00.000Z"
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const noopSubscription = AsyncResult.initial<{
|
||||
readonly done: boolean
|
||||
readonly items: ReadonlyArray<unknown>
|
||||
}>(true)
|
||||
|
||||
const mutationResult = AsyncResult.success({
|
||||
offset: 43,
|
||||
at: "2026-03-05T00:00:01.000Z",
|
||||
todo: {
|
||||
id: "todo-1",
|
||||
title: "Harness Todo",
|
||||
completed: false,
|
||||
archived: false,
|
||||
revision: 1,
|
||||
updatedAt: "2026-03-05T00:00:01.000Z"
|
||||
},
|
||||
change: { _tag: "TodoRenamed", title: "Harness Todo" as const }
|
||||
})
|
||||
|
||||
return {
|
||||
todosSnapshotAtom: Atom.make(initialSnapshot),
|
||||
subscribeTodosPullAtom: Atom.writable(
|
||||
() => noopSubscription,
|
||||
() => {
|
||||
// no-op: smoke test doesn't exercise stream pulling
|
||||
}
|
||||
),
|
||||
renameTodoMutationAtom: Atom.make(mutationResult),
|
||||
completeTodoMutationAtom: Atom.make(mutationResult),
|
||||
archiveTodoMutationAtom: Atom.make(mutationResult)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
describe("web app harness", () => {
|
||||
it("renders App in browser mode", async () => {
|
||||
const history = createMemoryHistory()
|
||||
const router = getRouter(history)
|
||||
const screen = await render(
|
||||
<RegistryProvider>
|
||||
<RouterProvider router={router} />
|
||||
</RegistryProvider>
|
||||
)
|
||||
|
||||
await expect.element(screen.getByRole("heading", { name: "Realtime Todo Stream" })).toBeVisible()
|
||||
await expect.element(screen.getByRole("heading", { name: "Todos" })).toBeVisible()
|
||||
await expect.element(screen.getByRole("textbox")).toHaveValue("Harness Todo")
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"jsx": "react-jsx",
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"types": ["vite/client"]
|
||||
},
|
||||
"include": ["src", "vite.config.ts", "vitest.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { defineConfig } from "vite"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import { TanStackRouterVite } from "@tanstack/router-plugin/vite"
|
||||
|
||||
const backendOrigin = process.env.VITE_BACKEND_ORIGIN ?? "http://127.0.0.1:8787"
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [TanStackRouterVite(), react()],
|
||||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: backendOrigin,
|
||||
changeOrigin: true
|
||||
},
|
||||
"/health": {
|
||||
target: backendOrigin,
|
||||
changeOrigin: true
|
||||
},
|
||||
"/ws": {
|
||||
target: backendOrigin,
|
||||
changeOrigin: true,
|
||||
ws: true
|
||||
}
|
||||
}
|
||||
},
|
||||
build: {
|
||||
outDir: "../public",
|
||||
emptyOutDir: true
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,31 @@
|
||||
import { playwright } from "@vitest/browser-playwright"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import { defineConfig } from "vitest/config"
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
"react",
|
||||
"react-dom",
|
||||
"react/jsx-dev-runtime",
|
||||
"@tanstack/react-router",
|
||||
"@effect/atom-react",
|
||||
"vitest-browser-react",
|
||||
"effect/unstable/reactivity/Atom",
|
||||
"effect/unstable/reactivity/AsyncResult"
|
||||
]
|
||||
},
|
||||
test: {
|
||||
include: ["test/**/*.browser.test.tsx"],
|
||||
browser: {
|
||||
enabled: true,
|
||||
provider: playwright(),
|
||||
instances: [
|
||||
{
|
||||
browser: "chromium"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Task Completion Requirements
|
||||
|
||||
- Both `bun lint` and `bun typecheck` must pass before considering tasks completed.
|
||||
- All of `bun fmt`, `bun lint`, and `bun typecheck` must pass before considering tasks completed.
|
||||
- NEVER run `bun test`. Always use `bun run test` (runs Vitest).
|
||||
|
||||
## Project Snapshot
|
||||
|
||||
@@ -7,7 +7,11 @@ import { desktopDir, resolveElectronPath } from "./electron-launcher.mjs";
|
||||
|
||||
const port = Number(process.env.ELECTRON_RENDERER_PORT ?? 5733);
|
||||
const devServerUrl = `http://localhost:${port}`;
|
||||
const requiredFiles = ["dist-electron/main.js", "dist-electron/preload.js", "../server/dist/index.mjs"];
|
||||
const requiredFiles = [
|
||||
"dist-electron/main.js",
|
||||
"dist-electron/preload.js",
|
||||
"../server/dist/index.mjs",
|
||||
];
|
||||
const watchedDirectories = [
|
||||
{ directory: "dist-electron", files: new Set(["main.js", "preload.js"]) },
|
||||
{ directory: "../server/dist", files: new Set(["index.mjs"]) },
|
||||
@@ -148,13 +152,17 @@ function scheduleRestart() {
|
||||
|
||||
function startWatchers() {
|
||||
for (const { directory, files } of watchedDirectories) {
|
||||
const watcher = watch(join(desktopDir, directory), { persistent: true }, (_eventType, filename) => {
|
||||
if (typeof filename !== "string" || !files.has(filename)) {
|
||||
return;
|
||||
}
|
||||
const watcher = watch(
|
||||
join(desktopDir, directory),
|
||||
{ persistent: true },
|
||||
(_eventType, filename) => {
|
||||
if (typeof filename !== "string" || !files.has(filename)) {
|
||||
return;
|
||||
}
|
||||
|
||||
scheduleRestart();
|
||||
});
|
||||
scheduleRestart();
|
||||
},
|
||||
);
|
||||
|
||||
watchers.push(watcher);
|
||||
}
|
||||
|
||||
+62
-12
@@ -4,10 +4,24 @@ import * as FS from "node:fs";
|
||||
import * as OS from "node:os";
|
||||
import * as Path from "node:path";
|
||||
|
||||
import { app, BrowserWindow, dialog, ipcMain, Menu, nativeImage, protocol, shell } from "electron";
|
||||
import {
|
||||
app,
|
||||
BrowserWindow,
|
||||
dialog,
|
||||
ipcMain,
|
||||
Menu,
|
||||
nativeImage,
|
||||
nativeTheme,
|
||||
protocol,
|
||||
shell,
|
||||
} from "electron";
|
||||
import type { MenuItemConstructorOptions } from "electron";
|
||||
import * as Effect from "effect/Effect";
|
||||
import type { DesktopUpdateActionResult, DesktopUpdateState } from "@t3tools/contracts";
|
||||
import type {
|
||||
DesktopTheme,
|
||||
DesktopUpdateActionResult,
|
||||
DesktopUpdateState,
|
||||
} from "@t3tools/contracts";
|
||||
import { autoUpdater } from "electron-updater";
|
||||
|
||||
import type { ContextMenuItem } from "@t3tools/contracts";
|
||||
@@ -15,10 +29,7 @@ import { NetService } from "@t3tools/shared/Net";
|
||||
import { RotatingFileSink } from "@t3tools/shared/logging";
|
||||
import { showDesktopConfirmDialog } from "./confirmDialog";
|
||||
import { fixPath } from "./fixPath";
|
||||
import {
|
||||
getAutoUpdateDisabledReason,
|
||||
shouldBroadcastDownloadProgress,
|
||||
} from "./updateState";
|
||||
import { getAutoUpdateDisabledReason, shouldBroadcastDownloadProgress } from "./updateState";
|
||||
import {
|
||||
createInitialDesktopUpdateState,
|
||||
reduceDesktopUpdateStateOnCheckFailure,
|
||||
@@ -37,6 +48,7 @@ fixPath();
|
||||
|
||||
const PICK_FOLDER_CHANNEL = "desktop:pick-folder";
|
||||
const CONFIRM_CHANNEL = "desktop:confirm";
|
||||
const SET_THEME_CHANNEL = "desktop:set-theme";
|
||||
const CONTEXT_MENU_CHANNEL = "desktop:context-menu";
|
||||
const OPEN_EXTERNAL_CHANNEL = "desktop:open-external";
|
||||
const MENU_ACTION_CHANNEL = "desktop:menu-action";
|
||||
@@ -140,6 +152,14 @@ function getSafeExternalUrl(rawUrl: unknown): string | null {
|
||||
return parsedUrl.toString();
|
||||
}
|
||||
|
||||
function getSafeTheme(rawTheme: unknown): DesktopTheme | null {
|
||||
if (rawTheme === "light" || rawTheme === "dark" || rawTheme === "system") {
|
||||
return rawTheme;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function writeDesktopStreamChunk(
|
||||
streamName: "stdout" | "stderr",
|
||||
chunk: unknown,
|
||||
@@ -566,7 +586,21 @@ function configureApplicationMenu(): void {
|
||||
],
|
||||
},
|
||||
{ role: "editMenu" },
|
||||
{ role: "viewMenu" },
|
||||
{
|
||||
label: "View",
|
||||
submenu: [
|
||||
{ role: "reload" },
|
||||
{ role: "forceReload" },
|
||||
{ role: "toggleDevTools" },
|
||||
{ type: "separator" },
|
||||
{ role: "resetZoom" },
|
||||
{ role: "zoomIn", accelerator: "CmdOrCtrl+=" },
|
||||
{ role: "zoomIn", accelerator: "CmdOrCtrl+Plus", visible: false },
|
||||
{ role: "zoomOut" },
|
||||
{ type: "separator" },
|
||||
{ role: "togglefullscreen" },
|
||||
],
|
||||
},
|
||||
{ role: "windowMenu" },
|
||||
{
|
||||
role: "help",
|
||||
@@ -702,7 +736,9 @@ async function checkForUpdates(reason: string): Promise<void> {
|
||||
await autoUpdater.checkForUpdates();
|
||||
} catch (error: unknown) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
setUpdateState(reduceDesktopUpdateStateOnCheckFailure(updateState, message, new Date().toISOString()));
|
||||
setUpdateState(
|
||||
reduceDesktopUpdateStateOnCheckFailure(updateState, message, new Date().toISOString()),
|
||||
);
|
||||
console.error(`[desktop-updater] Failed to check for updates: ${message}`);
|
||||
} finally {
|
||||
updateCheckInFlight = false;
|
||||
@@ -764,9 +800,7 @@ function configureAutoUpdater(): void {
|
||||
updaterConfigured = true;
|
||||
|
||||
const githubToken =
|
||||
process.env.T3CODE_DESKTOP_UPDATE_GITHUB_TOKEN?.trim() ||
|
||||
process.env.GH_TOKEN?.trim() ||
|
||||
"";
|
||||
process.env.T3CODE_DESKTOP_UPDATE_GITHUB_TOKEN?.trim() || process.env.GH_TOKEN?.trim() || "";
|
||||
if (githubToken) {
|
||||
// When a token is provided, re-configure the feed with `private: true` so
|
||||
// electron-updater uses the GitHub API (api.github.com) instead of the
|
||||
@@ -801,7 +835,13 @@ function configureAutoUpdater(): void {
|
||||
console.info("[desktop-updater] Looking for updates...");
|
||||
});
|
||||
autoUpdater.on("update-available", (info) => {
|
||||
setUpdateState(reduceDesktopUpdateStateOnUpdateAvailable(updateState, info.version, new Date().toISOString()));
|
||||
setUpdateState(
|
||||
reduceDesktopUpdateStateOnUpdateAvailable(
|
||||
updateState,
|
||||
info.version,
|
||||
new Date().toISOString(),
|
||||
),
|
||||
);
|
||||
lastLoggedDownloadMilestone = -1;
|
||||
console.info(`[desktop-updater] Update available: ${info.version}`);
|
||||
});
|
||||
@@ -1034,6 +1074,16 @@ function registerIpcHandlers(): void {
|
||||
return showDesktopConfirmDialog(message, owner);
|
||||
});
|
||||
|
||||
ipcMain.removeHandler(SET_THEME_CHANNEL);
|
||||
ipcMain.handle(SET_THEME_CHANNEL, async (_event, rawTheme: unknown) => {
|
||||
const theme = getSafeTheme(rawTheme);
|
||||
if (!theme) {
|
||||
return;
|
||||
}
|
||||
|
||||
nativeTheme.themeSource = theme;
|
||||
});
|
||||
|
||||
ipcMain.removeHandler(CONTEXT_MENU_CHANNEL);
|
||||
ipcMain.handle(
|
||||
CONTEXT_MENU_CHANNEL,
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { DesktopBridge } from "@t3tools/contracts";
|
||||
|
||||
const PICK_FOLDER_CHANNEL = "desktop:pick-folder";
|
||||
const CONFIRM_CHANNEL = "desktop:confirm";
|
||||
const SET_THEME_CHANNEL = "desktop:set-theme";
|
||||
const CONTEXT_MENU_CHANNEL = "desktop:context-menu";
|
||||
const OPEN_EXTERNAL_CHANNEL = "desktop:open-external";
|
||||
const MENU_ACTION_CHANNEL = "desktop:menu-action";
|
||||
@@ -16,6 +17,7 @@ contextBridge.exposeInMainWorld("desktopBridge", {
|
||||
getWsUrl: () => wsUrl,
|
||||
pickFolder: () => ipcRenderer.invoke(PICK_FOLDER_CHANNEL),
|
||||
confirm: (message) => ipcRenderer.invoke(CONFIRM_CHANNEL, message),
|
||||
setTheme: (theme) => ipcRenderer.invoke(SET_THEME_CHANNEL, theme),
|
||||
showContextMenu: (items, position) => ipcRenderer.invoke(CONTEXT_MENU_CHANNEL, items, position),
|
||||
openExternal: (url: string) => ipcRenderer.invoke(OPEN_EXTERNAL_CHANNEL, url),
|
||||
onMenuAction: (listener) => {
|
||||
|
||||
@@ -25,8 +25,7 @@ export function resolveDesktopRuntimeInfo(
|
||||
};
|
||||
}
|
||||
|
||||
const hostArch =
|
||||
appArch === "arm64" || input.runningUnderArm64Translation ? "arm64" : appArch;
|
||||
const hostArch = appArch === "arm64" || input.runningUnderArm64Translation ? "arm64" : appArch;
|
||||
|
||||
return {
|
||||
hostArch,
|
||||
|
||||
@@ -83,7 +83,10 @@ describe("updateMachine", () => {
|
||||
},
|
||||
"1.1.0",
|
||||
);
|
||||
const failedInstall = reduceDesktopUpdateStateOnInstallFailure(downloaded, "backend shutdown timed out");
|
||||
const failedInstall = reduceDesktopUpdateStateOnInstallFailure(
|
||||
downloaded,
|
||||
"backend shutdown timed out",
|
||||
);
|
||||
|
||||
expect(downloaded.status).toBe("downloaded");
|
||||
expect(downloaded.downloadedVersion).toBe("1.1.0");
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
---
|
||||
interface Props {
|
||||
title?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
const {
|
||||
title = "T3 Code",
|
||||
description = "T3 Code — The best way to code with AI.",
|
||||
} = Astro.props;
|
||||
---
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content={description} />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=DM+Sans:opsz,[email protected],400;9..40,500;9..40,600&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link rel="icon" href="/favicon.ico" sizes="48x48" />
|
||||
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<title>{title}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page">
|
||||
<nav class="nav">
|
||||
<a href="/" class="nav-brand">
|
||||
<img src="/icon.png" alt="T3" class="nav-icon" />
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/pingdotgg/t3code"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="nav-github"
|
||||
>
|
||||
GitHub
|
||||
<span class="nav-github-arrow" aria-hidden="true">↗</span>
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<main class="main">
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<span class="footer-copy">© {new Date().getFullYear()} T3 Tools Inc</span>
|
||||
<div class="footer-links">
|
||||
<a href="https://github.com/pingdotgg/t3code" target="_blank" rel="noopener noreferrer">GitHub</a>
|
||||
<a href="https://discord.gg/jn4EGJjrvv" target="_blank" rel="noopener noreferrer">Discord</a>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<style is:global>
|
||||
:root {
|
||||
--bg: #09090b;
|
||||
--fg: #fafafa;
|
||||
--fg-muted: #a1a1aa;
|
||||
--fg-dim: #71717a;
|
||||
--border: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
font-family: "DM Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
min-height: 100vh;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
body::after {
|
||||
content: "";
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
opacity: 0.035;
|
||||
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
|
||||
background-repeat: repeat;
|
||||
background-size: 256px 256px;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
@keyframes fade-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/* ── Page ── */
|
||||
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* ── Navbar ── */
|
||||
|
||||
.nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 1.5rem 2.5rem;
|
||||
opacity: 0.5;
|
||||
transition: opacity 0.4s ease;
|
||||
}
|
||||
|
||||
.nav:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.nav-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.nav-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.nav-github {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
color: var(--fg-muted);
|
||||
font-size: 0.875rem;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.nav-github:hover {
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
.nav-github-arrow {
|
||||
display: inline-block;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.nav-github:hover .nav-github-arrow {
|
||||
transform: translateX(2px) translateY(-1px);
|
||||
}
|
||||
|
||||
/* ── Main content ── */
|
||||
|
||||
.main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* ── Footer ── */
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 1.5rem 2.5rem;
|
||||
font-size: 0.8rem;
|
||||
color: var(--fg-dim);
|
||||
}
|
||||
|
||||
.footer-links {
|
||||
display: flex;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
.footer-links a {
|
||||
color: var(--fg-dim);
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.footer-links a:hover {
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
/* ── Mobile ── */
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.nav {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,30 @@
|
||||
const REPO = "pingdotgg/t3code";
|
||||
|
||||
export const RELEASES_URL = `https://github.com/${REPO}/releases`;
|
||||
|
||||
const API_URL = `https://api.github.com/repos/${REPO}/releases/latest`;
|
||||
const CACHE_KEY = "t3code-latest-release";
|
||||
|
||||
export interface ReleaseAsset {
|
||||
name: string;
|
||||
browser_download_url: string;
|
||||
}
|
||||
|
||||
export interface Release {
|
||||
tag_name: string;
|
||||
html_url: string;
|
||||
assets: ReleaseAsset[];
|
||||
}
|
||||
|
||||
export async function fetchLatestRelease(): Promise<Release> {
|
||||
const cached = sessionStorage.getItem(CACHE_KEY);
|
||||
if (cached) return JSON.parse(cached);
|
||||
|
||||
const data = await fetch(API_URL).then((r) => r.json());
|
||||
|
||||
if (data?.assets) {
|
||||
sessionStorage.setItem(CACHE_KEY, JSON.stringify(data));
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
---
|
||||
import Layout from "../layouts/Layout.astro";
|
||||
---
|
||||
|
||||
<Layout title="Download — T3 Code" description="Download T3 Code for macOS, Windows, or Linux.">
|
||||
<h1 class="heading">Download T3 Code</h1>
|
||||
<p class="subheading">
|
||||
<span id="version-label">Loading latest release…</span>
|
||||
<a id="changelog-link" class="changelog-link" href="#" target="_blank" rel="noopener noreferrer" style="display:none">View changelog<span aria-hidden="true"> ↗</span></a>
|
||||
</p>
|
||||
|
||||
<div class="platforms" id="platforms">
|
||||
<!-- macOS -->
|
||||
<section class="platform-section">
|
||||
<div class="platform-header">
|
||||
<svg class="platform-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 814 1000" aria-hidden="true"><path fill="currentColor" d="M788.1 340.9c-5.8 4.5-108.2 62.2-108.2 190.5 0 148.4 130.3 200.9 134.2 202.2-.6 3.2-20.7 71.9-68.7 141.9-42.8 61.6-87.5 123.1-155.5 123.1s-85.5-39.5-164-39.5c-76.5 0-103.7 40.8-165.9 40.8s-105.6-57-155.5-127C46.7 790.7 0 663 0 541.8c0-194.4 126.4-297.5 250.8-297.5 66.1 0 121.2 43.4 162.7 43.4 39.5 0 101.1-46 176.3-46 28.5 0 130.9 2.6 198.3 99.2zm-234-181.5c31.1-36.9 53.1-88.1 53.1-139.3 0-7.1-.6-14.3-1.9-20.1-50.6 1.9-110.8 33.7-147.1 75.8-28.5 32.4-55.1 83.6-55.1 135.5 0 7.8 1.3 15.6 1.9 18.1 3.2.6 8.4 1.3 13.6 1.3 45.4 0 102.5-30.4 135.5-71.3z"/></svg>
|
||||
<h2 class="platform-name">macOS</h2>
|
||||
</div>
|
||||
<div class="download-cards">
|
||||
<a class="download-card" data-asset="arm64.dmg" href="#">
|
||||
<span class="card-arch">Apple Silicon (arm64)</span>
|
||||
<span class="card-format">.dmg</span>
|
||||
</a>
|
||||
<a class="download-card" data-asset="x64.dmg" href="#">
|
||||
<span class="card-arch">Intel (x64)</span>
|
||||
<span class="card-format">.dmg</span>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Windows -->
|
||||
<section class="platform-section">
|
||||
<div class="platform-header">
|
||||
<svg class="platform-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 88 88" aria-hidden="true"><path fill="currentColor" d="m0 12.402 35.687-4.86.016 34.423-35.67.203zm35.67 33.529.028 34.453L.028 75.48.026 45.7zm4.326-39.025L87.314 0v41.527l-47.318.376zm47.329 39.349-.011 41.34-47.318-6.678-.066-34.739z"/></svg>
|
||||
<h2 class="platform-name">Windows</h2>
|
||||
</div>
|
||||
<div class="download-cards">
|
||||
<a class="download-card" data-asset="x64.exe" href="#">
|
||||
<span class="card-arch">Windows 10, 11</span>
|
||||
<span class="card-format">.exe</span>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Linux -->
|
||||
<section class="platform-section">
|
||||
<div class="platform-header">
|
||||
<svg class="platform-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 295" aria-hidden="true"><defs><linearGradient id="lt0" x1="48.548%" x2="51.047%" y1="115.276%" y2="41.364%"><stop offset="0%" stop-color="#FFEED7"/><stop offset="100%" stop-color="#BDBFC2"/></linearGradient><linearGradient id="lt6" x1="49.984%" x2="49.984%" y1="89.845%" y2="40.632%"><stop offset="0%" stop-color="#FFEED7"/><stop offset="100%" stop-color="#BDBFC2"/></linearGradient><linearGradient id="lt8" x1="49.841%" x2="50.241%" y1="13.229%" y2="94.673%"><stop offset="0%" stop-color="#FFF" stop-opacity=".8"/><stop offset="100%" stop-color="#FFF" stop-opacity="0"/></linearGradient><linearGradient id="ltc" x1="53.467%" x2="38.949%" y1="48.921%" y2="98.1%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient><linearGradient id="lte" x1="30.581%" x2="65.887%" y1="34.024%" y2="89.175%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient><linearGradient id="lti" x1="49.733%" x2="50.558%" y1="17.609%" y2="99.385%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient></defs><g fill="none"><path fill="#000" d="M63.213 215.474c-11.387-16.346-13.591-69.606 12.947-102.39C89.292 97.383 92.69 86.455 93.7 71.67c.734-16.805-11.846-66.851 35.537-70.616 48.027-3.857 45.364 43.526 45.088 68.596-.183 21.12 15.52 33.15 26.355 49.68 19.927 30.303 18.274 82.461-3.765 110.745-27.916 35.354-51.791 20.018-67.678 21.304-29.752 1.745-30.762 17.54-66.024-35.905"/><path fill="url(#lt6)" d="M81.027 145.684c6.52-14.785 20.386-40.772 20.662-60.883 0-15.978 47.843-19.835 51.7-3.856 3.856 15.978 13.59 39.853 19.834 51.424 6.245 11.478 24.335 48.118 5.051 80.074-17.356 28.284-69.973 50.69-98.073-3.856-9.55-18.917-7.806-42.333.826-62.903"/><path fill="url(#lt8)" d="M166.428 151.285c0 16.162-15.519 37.1-42.15 36.916-27.456.183-39.118-20.754-39.118-36.916 0-16.161 18.182-29.293 40.588-29.293 22.498.092 40.68 13.132 40.68 29.293"/><path fill="#000" stroke="#000" stroke-width=".977" d="M176.805 117.86c13.59 11.02 38.292 49.587 2.204 74.748-11.846 7.806 10.468 32.508 23.049 19.927 43.618-43.894-1.102-94.308-16.53-111.664-13.774-15.151-25.987 3.49-8.723 16.989z"/><path fill="#000" stroke="#000" stroke-width="1.25" d="M79.925 122.727c-8.907 14.509-30.211 48.669-1.652 66.484 38.384 23.6 27.548 47.108-7.53 25.895-49.404-29.568-5.97-89.257 13.774-112.03 22.59-25.529 4.316 4.683-4.592 19.65z"/><path fill="url(#ltc)" stroke="#E68C3F" stroke-width="6.25" d="M51.835 258.542c-20.57-10.928-50.414 2.112-39.578-27.457 2.204-6.704-3.214-16.805.275-23.325 4.133-7.989 13.04-6.244 18.366-11.57 5.234-5.51 8.54-15.06 18.366-13.59 9.734 1.468 16.254 13.406 23.049 28.099 5.05 10.468 22.865 25.253 21.672 37.007-1.47 17.998-21.948 21.396-42.15 10.836z" transform="translate(10)"/><path fill="url(#lte)" stroke="#E68C3F" stroke-width="6.251" d="M194.445 253.49c15.06-18.273 48.578-14.508 25.988-39.577-4.775-5.418-3.306-16.989-9.183-21.947-6.887-6.061-14.509-1.102-21.488-4.224-6.979-3.398-14.325-9.918-22.865-5.327-8.54 4.684-9.459 16.805-10.285 32.783-.735 11.479-11.203 30.671-5.602 41.231 8.081 16.346 29.11 14.142 43.435-2.938z" transform="translate(10)"/><path fill="url(#lti)" stroke="#E68C3F" stroke-width="3.75" d="M97.107 66.344c3.673-3.398 12.58-13.774 29.477-2.939 3.122 2.02 5.693 2.204 11.662 4.775 12.03 4.96 6.336 16.897-6.52 20.937-5.51 1.745-10.468 8.449-20.386 7.806-8.54-.46-10.744-6.06-15.978-9.091-9.275-5.234-10.652-12.305-5.602-16.07 5.051-3.765 6.98-5.143 7.347-5.418z" transform="translate(10)"/><path fill="#000" d="M133.186 57.712c-.092 5.234 2.48 9.458 5.877 9.458 3.306 0 6.153-4.224 6.245-9.366.091-5.234-2.48-9.459-5.878-9.459-3.397 0-6.152 4.225-6.244 9.367m-21.212.092c.459 4.316-1.194 7.989-3.582 8.356-2.387.276-4.683-2.938-5.142-7.254-.46-4.316 1.194-7.99 3.581-8.357 2.388-.275 4.684 2.939 5.143 7.255"/></g></svg>
|
||||
<h2 class="platform-name">Linux</h2>
|
||||
</div>
|
||||
<div class="download-cards">
|
||||
<a class="download-card" data-asset="x86_64.AppImage" href="#">
|
||||
<span class="card-arch">x86_64</span>
|
||||
<span class="card-format">AppImage</span>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<p class="releases-link">
|
||||
Looking for older versions? Check the
|
||||
<a href="https://github.com/pingdotgg/t3code/releases" target="_blank" rel="noopener noreferrer">
|
||||
GitHub releases page<span aria-hidden="true"> ↗</span>
|
||||
</a>
|
||||
</p>
|
||||
</Layout>
|
||||
|
||||
<script>
|
||||
import { fetchLatestRelease, RELEASES_URL } from "../lib/releases";
|
||||
|
||||
async function init() {
|
||||
const versionLabel = document.getElementById("version-label");
|
||||
const cards = document.querySelectorAll<HTMLAnchorElement>(".download-card");
|
||||
|
||||
try {
|
||||
const release = await fetchLatestRelease();
|
||||
|
||||
if (versionLabel && release.tag_name) {
|
||||
versionLabel.textContent = `Latest (${release.tag_name})`;
|
||||
}
|
||||
|
||||
const changelogLink = document.getElementById("changelog-link") as HTMLAnchorElement | null;
|
||||
if (changelogLink && release.html_url) {
|
||||
changelogLink.href = release.html_url;
|
||||
changelogLink.style.display = "";
|
||||
}
|
||||
|
||||
cards.forEach((card) => {
|
||||
const suffix = card.dataset.asset;
|
||||
if (!suffix) return;
|
||||
|
||||
const match = (release.assets ?? []).find((a) => a.name.endsWith(`-${suffix}`));
|
||||
if (match) {
|
||||
card.href = match.browser_download_url;
|
||||
} else {
|
||||
card.href = RELEASES_URL;
|
||||
}
|
||||
});
|
||||
} catch {
|
||||
if (versionLabel) {
|
||||
versionLabel.textContent = "Could not load release info.";
|
||||
}
|
||||
cards.forEach((card) => {
|
||||
card.href = RELEASES_URL;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.main {
|
||||
padding: 8vh 1.5rem 4rem;
|
||||
}
|
||||
|
||||
/* ── Heading ── */
|
||||
|
||||
.heading {
|
||||
font-weight: 500;
|
||||
font-size: clamp(1.75rem, 4vw, 2.75rem);
|
||||
letter-spacing: -0.035em;
|
||||
line-height: 1.15;
|
||||
text-align: center;
|
||||
margin-bottom: 0.5rem;
|
||||
opacity: 0;
|
||||
animation: fade-in 1s ease-out forwards;
|
||||
}
|
||||
|
||||
.subheading {
|
||||
font-size: 0.9rem;
|
||||
color: var(--fg-dim);
|
||||
margin-bottom: 3.5rem;
|
||||
opacity: 0;
|
||||
animation: fade-in 1s ease-out 0.1s forwards;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.changelog-link {
|
||||
color: var(--fg-muted);
|
||||
font-size: 0.8rem;
|
||||
text-decoration: underline;
|
||||
text-decoration-color: rgba(161, 161, 170, 0.4);
|
||||
text-underline-offset: 3px;
|
||||
transition: color 0.3s ease, text-decoration-color 0.3s ease;
|
||||
}
|
||||
|
||||
.changelog-link:hover {
|
||||
color: var(--fg);
|
||||
text-decoration-color: var(--fg);
|
||||
}
|
||||
|
||||
/* ── Platforms ── */
|
||||
|
||||
.platforms {
|
||||
width: 100%;
|
||||
max-width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2.5rem;
|
||||
opacity: 0;
|
||||
animation: fade-in 1s ease-out 0.2s forwards;
|
||||
}
|
||||
|
||||
.platform-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.platform-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
padding-bottom: 0.5rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.platform-icon {
|
||||
width: 1.15em;
|
||||
height: 1.15em;
|
||||
color: var(--fg-muted);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.platform-name {
|
||||
font-weight: 500;
|
||||
font-size: 1.1rem;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
/* ── Download cards ── */
|
||||
|
||||
.download-cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.download-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
padding: 0.85rem 1rem;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--border);
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
|
||||
}
|
||||
|
||||
.download-card:hover {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border-color: rgba(255, 255, 255, 0.15);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.download-card:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.card-arch {
|
||||
font-weight: 600;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.card-format {
|
||||
font-size: 0.8rem;
|
||||
color: var(--fg-dim);
|
||||
}
|
||||
|
||||
/* ── Releases link ── */
|
||||
|
||||
.releases-link {
|
||||
margin-top: 3rem;
|
||||
font-size: 0.825rem;
|
||||
color: var(--fg-dim);
|
||||
opacity: 0;
|
||||
animation: fade-in 1s ease-out 0.35s forwards;
|
||||
}
|
||||
|
||||
.releases-link a {
|
||||
color: var(--fg-muted);
|
||||
text-decoration: underline;
|
||||
text-decoration-color: rgba(161, 161, 170, 0.4);
|
||||
text-underline-offset: 3px;
|
||||
transition: color 0.3s ease, text-decoration-color 0.3s ease;
|
||||
}
|
||||
|
||||
.releases-link a:hover {
|
||||
color: var(--fg);
|
||||
text-decoration-color: var(--fg);
|
||||
}
|
||||
|
||||
/* ── Mobile ── */
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.main {
|
||||
padding: 5vh 1.25rem 4rem;
|
||||
}
|
||||
|
||||
.platforms {
|
||||
padding: 0 0.25rem;
|
||||
}
|
||||
|
||||
.download-cards {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,75 +1,30 @@
|
||||
---
|
||||
import Layout from "../layouts/Layout.astro";
|
||||
---
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="T3 Code — The best way to code with AI." />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=DM+Sans:opsz,[email protected],400;9..40,500;9..40,600&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link rel="icon" href="/favicon.ico" sizes="48x48" />
|
||||
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<title>T3 Code</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page">
|
||||
<nav class="nav">
|
||||
<a href="/" class="nav-brand">
|
||||
<img src="/icon.png" alt="T3" class="nav-icon" />
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/pingdotgg/t3code"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="nav-github"
|
||||
>
|
||||
GitHub
|
||||
<span class="nav-github-arrow" aria-hidden="true">↗</span>
|
||||
</a>
|
||||
</nav>
|
||||
<Layout>
|
||||
<h1 class="tagline">T3 Code is the best way to code with AI.</h1>
|
||||
|
||||
<main class="main">
|
||||
<h1 class="tagline">T3 Code is the best way to code with AI.</h1>
|
||||
<a
|
||||
id="download-btn"
|
||||
href="https://github.com/pingdotgg/t3code/releases"
|
||||
class="hero-button"
|
||||
>
|
||||
<svg class="hero-button-icon hero-button-icon--apple" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 814 1000" aria-hidden="true"><path fill="currentColor" d="M788.1 340.9c-5.8 4.5-108.2 62.2-108.2 190.5 0 148.4 130.3 200.9 134.2 202.2-.6 3.2-20.7 71.9-68.7 141.9-42.8 61.6-87.5 123.1-155.5 123.1s-85.5-39.5-164-39.5c-76.5 0-103.7 40.8-165.9 40.8s-105.6-57-155.5-127C46.7 790.7 0 663 0 541.8c0-194.4 126.4-297.5 250.8-297.5 66.1 0 121.2 43.4 162.7 43.4 39.5 0 101.1-46 176.3-46 28.5 0 130.9 2.6 198.3 99.2zm-234-181.5c31.1-36.9 53.1-88.1 53.1-139.3 0-7.1-.6-14.3-1.9-20.1-50.6 1.9-110.8 33.7-147.1 75.8-28.5 32.4-55.1 83.6-55.1 135.5 0 7.8 1.3 15.6 1.9 18.1 3.2.6 8.4 1.3 13.6 1.3 45.4 0 102.5-30.4 135.5-71.3z"/></svg>
|
||||
<svg class="hero-button-icon hero-button-icon--windows" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 88 88" aria-hidden="true"><path fill="currentColor" d="m0 12.402 35.687-4.86.016 34.423-35.67.203zm35.67 33.529.028 34.453L.028 75.48.026 45.7zm4.326-39.025L87.314 0v41.527l-47.318.376zm47.329 39.349-.011 41.34-47.318-6.678-.066-34.739z"/></svg>
|
||||
<svg class="hero-button-icon hero-button-icon--linux" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 295" aria-hidden="true"><defs><linearGradient id="lt0" x1="48.548%" x2="51.047%" y1="115.276%" y2="41.364%"><stop offset="0%" stop-color="#FFEED7"/><stop offset="100%" stop-color="#BDBFC2"/></linearGradient><linearGradient id="lt6" x1="49.984%" x2="49.984%" y1="89.845%" y2="40.632%"><stop offset="0%" stop-color="#FFEED7"/><stop offset="100%" stop-color="#BDBFC2"/></linearGradient><linearGradient id="lt8" x1="49.841%" x2="50.241%" y1="13.229%" y2="94.673%"><stop offset="0%" stop-color="#FFF" stop-opacity=".8"/><stop offset="100%" stop-color="#FFF" stop-opacity="0"/></linearGradient><linearGradient id="ltc" x1="53.467%" x2="38.949%" y1="48.921%" y2="98.1%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient><linearGradient id="lte" x1="30.581%" x2="65.887%" y1="34.024%" y2="89.175%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient><linearGradient id="lti" x1="49.733%" x2="50.558%" y1="17.609%" y2="99.385%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient></defs><g fill="none"><path fill="#000" d="M63.213 215.474c-11.387-16.346-13.591-69.606 12.947-102.39C89.292 97.383 92.69 86.455 93.7 71.67c.734-16.805-11.846-66.851 35.537-70.616 48.027-3.857 45.364 43.526 45.088 68.596-.183 21.12 15.52 33.15 26.355 49.68 19.927 30.303 18.274 82.461-3.765 110.745-27.916 35.354-51.791 20.018-67.678 21.304-29.752 1.745-30.762 17.54-66.024-35.905"/><path fill="url(#lt6)" d="M81.027 145.684c6.52-14.785 20.386-40.772 20.662-60.883 0-15.978 47.843-19.835 51.7-3.856 3.856 15.978 13.59 39.853 19.834 51.424 6.245 11.478 24.335 48.118 5.051 80.074-17.356 28.284-69.973 50.69-98.073-3.856-9.55-18.917-7.806-42.333.826-62.903"/><path fill="url(#lt8)" d="M166.428 151.285c0 16.162-15.519 37.1-42.15 36.916-27.456.183-39.118-20.754-39.118-36.916 0-16.161 18.182-29.293 40.588-29.293 22.498.092 40.68 13.132 40.68 29.293"/><path fill="#000" stroke="#000" stroke-width=".977" d="M176.805 117.86c13.59 11.02 38.292 49.587 2.204 74.748-11.846 7.806 10.468 32.508 23.049 19.927 43.618-43.894-1.102-94.308-16.53-111.664-13.774-15.151-25.987 3.49-8.723 16.989z"/><path fill="#000" stroke="#000" stroke-width="1.25" d="M79.925 122.727c-8.907 14.509-30.211 48.669-1.652 66.484 38.384 23.6 27.548 47.108-7.53 25.895-49.404-29.568-5.97-89.257 13.774-112.03 22.59-25.529 4.316 4.683-4.592 19.65z"/><path fill="url(#ltc)" stroke="#E68C3F" stroke-width="6.25" d="M51.835 258.542c-20.57-10.928-50.414 2.112-39.578-27.457 2.204-6.704-3.214-16.805.275-23.325 4.133-7.989 13.04-6.244 18.366-11.57 5.234-5.51 8.54-15.06 18.366-13.59 9.734 1.468 16.254 13.406 23.049 28.099 5.05 10.468 22.865 25.253 21.672 37.007-1.47 17.998-21.948 21.396-42.15 10.836z" transform="translate(10)"/><path fill="url(#lte)" stroke="#E68C3F" stroke-width="6.251" d="M194.445 253.49c15.06-18.273 48.578-14.508 25.988-39.577-4.775-5.418-3.306-16.989-9.183-21.947-6.887-6.061-14.509-1.102-21.488-4.224-6.979-3.398-14.325-9.918-22.865-5.327-8.54 4.684-9.459 16.805-10.285 32.783-.735 11.479-11.203 30.671-5.602 41.231 8.081 16.346 29.11 14.142 43.435-2.938z" transform="translate(10)"/><path fill="url(#lti)" stroke="#E68C3F" stroke-width="3.75" d="M97.107 66.344c3.673-3.398 12.58-13.774 29.477-2.939 3.122 2.02 5.693 2.204 11.662 4.775 12.03 4.96 6.336 16.897-6.52 20.937-5.51 1.745-10.468 8.449-20.386 7.806-8.54-.46-10.744-6.06-15.978-9.091-9.275-5.234-10.652-12.305-5.602-16.07 5.051-3.765 6.98-5.143 7.347-5.418z" transform="translate(10)"/><path fill="#000" d="M133.186 57.712c-.092 5.234 2.48 9.458 5.877 9.458 3.306 0 6.153-4.224 6.245-9.366.091-5.234-2.48-9.459-5.878-9.459-3.397 0-6.152 4.225-6.244 9.367m-21.212.092c.459 4.316-1.194 7.989-3.582 8.356-2.387.276-4.683-2.938-5.142-7.254-.46-4.316 1.194-7.99 3.581-8.357 2.388-.275 4.684 2.939 5.143 7.255"/></g></svg>
|
||||
<span id="download-label">Download now</span>
|
||||
</a>
|
||||
|
||||
<a
|
||||
id="download-btn"
|
||||
href="https://github.com/pingdotgg/t3code/releases"
|
||||
class="hero-button"
|
||||
>
|
||||
<svg class="hero-button-icon hero-button-icon--apple" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 814 1000" aria-hidden="true"><path fill="currentColor" d="M788.1 340.9c-5.8 4.5-108.2 62.2-108.2 190.5 0 148.4 130.3 200.9 134.2 202.2-.6 3.2-20.7 71.9-68.7 141.9-42.8 61.6-87.5 123.1-155.5 123.1s-85.5-39.5-164-39.5c-76.5 0-103.7 40.8-165.9 40.8s-105.6-57-155.5-127C46.7 790.7 0 663 0 541.8c0-194.4 126.4-297.5 250.8-297.5 66.1 0 121.2 43.4 162.7 43.4 39.5 0 101.1-46 176.3-46 28.5 0 130.9 2.6 198.3 99.2zm-234-181.5c31.1-36.9 53.1-88.1 53.1-139.3 0-7.1-.6-14.3-1.9-20.1-50.6 1.9-110.8 33.7-147.1 75.8-28.5 32.4-55.1 83.6-55.1 135.5 0 7.8 1.3 15.6 1.9 18.1 3.2.6 8.4 1.3 13.6 1.3 45.4 0 102.5-30.4 135.5-71.3z"/></svg>
|
||||
<svg class="hero-button-icon hero-button-icon--windows" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 88 88" aria-hidden="true"><path fill="currentColor" d="m0 12.402 35.687-4.86.016 34.423-35.67.203zm35.67 33.529.028 34.453L.028 75.48.026 45.7zm4.326-39.025L87.314 0v41.527l-47.318.376zm47.329 39.349-.011 41.34-47.318-6.678-.066-34.739z"/></svg>
|
||||
<svg class="hero-button-icon hero-button-icon--linux" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 295" aria-hidden="true"><defs><linearGradient id="lt0" x1="48.548%" x2="51.047%" y1="115.276%" y2="41.364%"><stop offset="0%" stop-color="#FFEED7"/><stop offset="100%" stop-color="#BDBFC2"/></linearGradient><linearGradient id="lt6" x1="49.984%" x2="49.984%" y1="89.845%" y2="40.632%"><stop offset="0%" stop-color="#FFEED7"/><stop offset="100%" stop-color="#BDBFC2"/></linearGradient><linearGradient id="lt8" x1="49.841%" x2="50.241%" y1="13.229%" y2="94.673%"><stop offset="0%" stop-color="#FFF" stop-opacity=".8"/><stop offset="100%" stop-color="#FFF" stop-opacity="0"/></linearGradient><linearGradient id="ltc" x1="53.467%" x2="38.949%" y1="48.921%" y2="98.1%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient><linearGradient id="lte" x1="30.581%" x2="65.887%" y1="34.024%" y2="89.175%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient><linearGradient id="lti" x1="49.733%" x2="50.558%" y1="17.609%" y2="99.385%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient></defs><g fill="none"><path fill="#000" d="M63.213 215.474c-11.387-16.346-13.591-69.606 12.947-102.39C89.292 97.383 92.69 86.455 93.7 71.67c.734-16.805-11.846-66.851 35.537-70.616 48.027-3.857 45.364 43.526 45.088 68.596-.183 21.12 15.52 33.15 26.355 49.68 19.927 30.303 18.274 82.461-3.765 110.745-27.916 35.354-51.791 20.018-67.678 21.304-29.752 1.745-30.762 17.54-66.024-35.905"/><path fill="url(#lt6)" d="M81.027 145.684c6.52-14.785 20.386-40.772 20.662-60.883 0-15.978 47.843-19.835 51.7-3.856 3.856 15.978 13.59 39.853 19.834 51.424 6.245 11.478 24.335 48.118 5.051 80.074-17.356 28.284-69.973 50.69-98.073-3.856-9.55-18.917-7.806-42.333.826-62.903"/><path fill="url(#lt8)" d="M166.428 151.285c0 16.162-15.519 37.1-42.15 36.916-27.456.183-39.118-20.754-39.118-36.916 0-16.161 18.182-29.293 40.588-29.293 22.498.092 40.68 13.132 40.68 29.293"/><path fill="#000" stroke="#000" stroke-width=".977" d="M176.805 117.86c13.59 11.02 38.292 49.587 2.204 74.748-11.846 7.806 10.468 32.508 23.049 19.927 43.618-43.894-1.102-94.308-16.53-111.664-13.774-15.151-25.987 3.49-8.723 16.989z"/><path fill="#000" stroke="#000" stroke-width="1.25" d="M79.925 122.727c-8.907 14.509-30.211 48.669-1.652 66.484 38.384 23.6 27.548 47.108-7.53 25.895-49.404-29.568-5.97-89.257 13.774-112.03 22.59-25.529 4.316 4.683-4.592 19.65z"/><path fill="url(#ltc)" stroke="#E68C3F" stroke-width="6.25" d="M51.835 258.542c-20.57-10.928-50.414 2.112-39.578-27.457 2.204-6.704-3.214-16.805.275-23.325 4.133-7.989 13.04-6.244 18.366-11.57 5.234-5.51 8.54-15.06 18.366-13.59 9.734 1.468 16.254 13.406 23.049 28.099 5.05 10.468 22.865 25.253 21.672 37.007-1.47 17.998-21.948 21.396-42.15 10.836z" transform="translate(10)"/><path fill="url(#lte)" stroke="#E68C3F" stroke-width="6.251" d="M194.445 253.49c15.06-18.273 48.578-14.508 25.988-39.577-4.775-5.418-3.306-16.989-9.183-21.947-6.887-6.061-14.509-1.102-21.488-4.224-6.979-3.398-14.325-9.918-22.865-5.327-8.54 4.684-9.459 16.805-10.285 32.783-.735 11.479-11.203 30.671-5.602 41.231 8.081 16.346 29.11 14.142 43.435-2.938z" transform="translate(10)"/><path fill="url(#lti)" stroke="#E68C3F" stroke-width="3.75" d="M97.107 66.344c3.673-3.398 12.58-13.774 29.477-2.939 3.122 2.02 5.693 2.204 11.662 4.775 12.03 4.96 6.336 16.897-6.52 20.937-5.51 1.745-10.468 8.449-20.386 7.806-8.54-.46-10.744-6.06-15.978-9.091-9.275-5.234-10.652-12.305-5.602-16.07 5.051-3.765 6.98-5.143 7.347-5.418z" transform="translate(10)"/><path fill="#000" d="M133.186 57.712c-.092 5.234 2.48 9.458 5.877 9.458 3.306 0 6.153-4.224 6.245-9.366.091-5.234-2.48-9.459-5.878-9.459-3.397 0-6.152 4.225-6.244 9.367m-21.212.092c.459 4.316-1.194 7.989-3.582 8.356-2.387.276-4.683-2.938-5.142-7.254-.46-4.316 1.194-7.99 3.581-8.357 2.388-.275 4.684 2.939 5.143 7.255"/></g></svg>
|
||||
<span id="download-label">Download now</span>
|
||||
</a>
|
||||
<a href="/download" class="other-platforms">Other platforms</a>
|
||||
|
||||
<div class="screenshot-wrap">
|
||||
<img src="/screenshot.jpeg" alt="T3 Code" class="screenshot" />
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<span class="footer-copy">© {new Date().getFullYear()} T3 Tools Inc</span>
|
||||
<div class="footer-links">
|
||||
<a href="https://github.com/pingdotgg/t3code" target="_blank" rel="noopener noreferrer">GitHub</a>
|
||||
<a href="https://discord.gg/jn4EGJjrvv" target="_blank" rel="noopener noreferrer">Discord</a>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<div class="screenshot-wrap">
|
||||
<img src="/screenshot.jpeg" alt="T3 Code" class="screenshot" />
|
||||
</div>
|
||||
</Layout>
|
||||
|
||||
<script>
|
||||
const REPO = "pingdotgg/t3code";
|
||||
const RELEASES_URL = `https://github.com/${REPO}/releases`;
|
||||
const API_URL = `https://api.github.com/repos/${REPO}/releases/latest`;
|
||||
import { fetchLatestRelease, RELEASES_URL, type ReleaseAsset } from "../lib/releases";
|
||||
|
||||
type Platform = { os: "mac" | "win" | "linux"; label: string; arch?: string };
|
||||
|
||||
@@ -87,10 +42,7 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
function pickAsset(
|
||||
assets: Array<{ name: string; browser_download_url: string }>,
|
||||
platform: Platform,
|
||||
): string | null {
|
||||
function pickAsset(assets: ReleaseAsset[], platform: Platform): string | null {
|
||||
if (platform.os === "win") {
|
||||
return (
|
||||
assets.find((a) => a.name.endsWith("-x64.exe"))
|
||||
@@ -125,16 +77,8 @@
|
||||
label.textContent = platform.label;
|
||||
|
||||
try {
|
||||
const cached = sessionStorage.getItem("t3code-latest-release");
|
||||
const data = cached
|
||||
? JSON.parse(cached)
|
||||
: await fetch(API_URL).then((r) => r.json());
|
||||
|
||||
if (!cached && data?.assets) {
|
||||
sessionStorage.setItem("t3code-latest-release", JSON.stringify(data));
|
||||
}
|
||||
|
||||
const url = pickAsset(data.assets ?? [], platform);
|
||||
const release = await fetchLatestRelease();
|
||||
const url = pickAsset(release.assets ?? [], platform);
|
||||
if (url) {
|
||||
btn.href = url;
|
||||
btn.removeAttribute("target");
|
||||
@@ -149,120 +93,7 @@
|
||||
</script>
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--bg: #09090b;
|
||||
--fg: #fafafa;
|
||||
--fg-muted: #a1a1aa;
|
||||
--fg-dim: #71717a;
|
||||
--border: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
font-family: "DM Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
min-height: 100vh;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
body::after {
|
||||
content: "";
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
opacity: 0.035;
|
||||
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
|
||||
background-repeat: repeat;
|
||||
background-size: 256px 256px;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* ── Page ── */
|
||||
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* ── Navbar ── */
|
||||
|
||||
.nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 1.5rem 2.5rem;
|
||||
opacity: 0.5;
|
||||
transition: opacity 0.4s ease;
|
||||
}
|
||||
|
||||
.nav:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.nav-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.nav-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.nav-github {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
color: var(--fg-muted);
|
||||
font-size: 0.875rem;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.nav-github:hover {
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
.nav-github-arrow {
|
||||
display: inline-block;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.nav-github:hover .nav-github-arrow {
|
||||
transform: translateX(2px) translateY(-1px);
|
||||
}
|
||||
|
||||
/* ── Main content ── */
|
||||
|
||||
.main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-top: 10vh;
|
||||
}
|
||||
|
||||
@@ -291,7 +122,7 @@
|
||||
border-radius: 999px;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 5vh;
|
||||
margin-bottom: 1.25rem;
|
||||
opacity: 0;
|
||||
animation: fade-in 1s ease-out 0.15s forwards;
|
||||
transition: transform 0.25s ease, box-shadow 0.25s ease;
|
||||
@@ -325,6 +156,25 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* ── Other platforms link ── */
|
||||
|
||||
.other-platforms {
|
||||
font-size: 0.825rem;
|
||||
color: var(--fg-dim);
|
||||
margin-bottom: 5vh;
|
||||
opacity: 0;
|
||||
animation: fade-in 1s ease-out 0.3s forwards;
|
||||
transition: color 0.3s ease;
|
||||
text-decoration: underline;
|
||||
text-decoration-color: rgba(113, 113, 122, 0.4);
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
|
||||
.other-platforms:hover {
|
||||
color: var(--fg-muted);
|
||||
text-decoration-color: var(--fg-muted);
|
||||
}
|
||||
|
||||
/* ── Screenshot ── */
|
||||
|
||||
.screenshot-wrap {
|
||||
@@ -358,44 +208,6 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* ── Footer ── */
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 1.5rem 2.5rem;
|
||||
font-size: 0.8rem;
|
||||
color: var(--fg-dim);
|
||||
}
|
||||
|
||||
.footer-links {
|
||||
display: flex;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
.footer-links a {
|
||||
color: var(--fg-dim);
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.footer-links a:hover {
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
/* ── Animations ── */
|
||||
|
||||
@keyframes fade-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes screenshot-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
@@ -410,10 +222,6 @@
|
||||
/* ── Mobile ── */
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.nav {
|
||||
padding: 1.25rem 1.25rem;
|
||||
}
|
||||
|
||||
.main {
|
||||
padding-top: 7vh;
|
||||
}
|
||||
@@ -425,9 +233,5 @@
|
||||
.screenshot-wrap {
|
||||
width: 95vw;
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
Layer,
|
||||
ManagedRuntime,
|
||||
Option,
|
||||
Ref,
|
||||
Schedule,
|
||||
Schema,
|
||||
Scope,
|
||||
@@ -45,6 +46,7 @@ import { CheckpointReactorLive } from "../src/orchestration/Layers/CheckpointRea
|
||||
import { OrchestrationEngineLive } from "../src/orchestration/Layers/OrchestrationEngine.ts";
|
||||
import { OrchestrationProjectionPipelineLive } from "../src/orchestration/Layers/ProjectionPipeline.ts";
|
||||
import { OrchestrationProjectionSnapshotQueryLive } from "../src/orchestration/Layers/ProjectionSnapshotQuery.ts";
|
||||
import { RuntimeReceiptBusLive } from "../src/orchestration/Layers/RuntimeReceiptBus.ts";
|
||||
import { OrchestrationReactorLive } from "../src/orchestration/Layers/OrchestrationReactor.ts";
|
||||
import { ProviderCommandReactorLive } from "../src/orchestration/Layers/ProviderCommandReactor.ts";
|
||||
import { ProviderRuntimeIngestionLive } from "../src/orchestration/Layers/ProviderRuntimeIngestion.ts";
|
||||
@@ -54,6 +56,10 @@ import {
|
||||
} from "../src/orchestration/Services/OrchestrationEngine.ts";
|
||||
import { OrchestrationReactor } from "../src/orchestration/Services/OrchestrationReactor.ts";
|
||||
import { ProjectionSnapshotQuery } from "../src/orchestration/Services/ProjectionSnapshotQuery.ts";
|
||||
import {
|
||||
RuntimeReceiptBus,
|
||||
type OrchestrationRuntimeReceipt,
|
||||
} from "../src/orchestration/Services/RuntimeReceiptBus.ts";
|
||||
|
||||
import {
|
||||
makeTestProviderAdapterHarness,
|
||||
@@ -114,7 +120,7 @@ function waitFor<A, E>(
|
||||
read: Effect.Effect<A, E>,
|
||||
predicate: (value: A) => boolean,
|
||||
description: string,
|
||||
timeoutMs = 3000,
|
||||
timeoutMs = 10_000,
|
||||
): Effect.Effect<A, never> {
|
||||
const RETRY_SIGNAL = "wait_for_retry";
|
||||
const retryIntervalMs = 10;
|
||||
@@ -185,6 +191,16 @@ export interface OrchestrationIntegrationHarness {
|
||||
},
|
||||
never
|
||||
>;
|
||||
readonly waitForReceipt: {
|
||||
(
|
||||
predicate: (receipt: OrchestrationRuntimeReceipt) => boolean,
|
||||
timeoutMs?: number,
|
||||
): Effect.Effect<OrchestrationRuntimeReceipt, never>;
|
||||
<Receipt extends OrchestrationRuntimeReceipt>(
|
||||
predicate: (receipt: OrchestrationRuntimeReceipt) => receipt is Receipt,
|
||||
timeoutMs?: number,
|
||||
): Effect.Effect<Receipt, never>;
|
||||
};
|
||||
readonly dispose: Effect.Effect<void, never>;
|
||||
}
|
||||
|
||||
@@ -268,6 +284,7 @@ export const makeOrchestrationIntegrationHarness = (
|
||||
ProjectionPendingApprovalRepositoryLive,
|
||||
CheckpointStoreLive,
|
||||
providerLayer,
|
||||
RuntimeReceiptBusLive,
|
||||
);
|
||||
const runtimeIngestionLayer = ProviderRuntimeIngestionLive.pipe(
|
||||
Layer.provideMerge(runtimeServicesLayer),
|
||||
@@ -322,11 +339,18 @@ export const makeOrchestrationIntegrationHarness = (
|
||||
"load ProjectionPendingApprovalRepository service",
|
||||
() => runtime.runPromise(Effect.service(ProjectionPendingApprovalRepository)),
|
||||
).pipe(Effect.orDie);
|
||||
const runtimeReceiptBus = yield* tryRuntimePromise("load RuntimeReceiptBus service", () =>
|
||||
runtime.runPromise(Effect.service(RuntimeReceiptBus)),
|
||||
).pipe(Effect.orDie);
|
||||
|
||||
const scope = yield* Scope.make("sequential");
|
||||
yield* tryRuntimePromise("start OrchestrationReactor", () =>
|
||||
runtime.runPromise(reactor.start.pipe(Scope.provide(scope))),
|
||||
).pipe(Effect.orDie);
|
||||
const receiptHistory = yield* Ref.make<ReadonlyArray<OrchestrationRuntimeReceipt>>([]);
|
||||
yield* Stream.runForEach(runtimeReceiptBus.stream, (receipt) =>
|
||||
Ref.update(receiptHistory, (history) => [...history, receipt]).pipe(Effect.asVoid),
|
||||
).pipe(Effect.forkIn(scope));
|
||||
yield* sleep(10);
|
||||
|
||||
const waitForThread: OrchestrationIntegrationHarness["waitForThread"] = (
|
||||
@@ -398,6 +422,30 @@ export const makeOrchestrationIntegrationHarness = (
|
||||
never
|
||||
>;
|
||||
|
||||
function waitForReceipt(
|
||||
predicate: (receipt: OrchestrationRuntimeReceipt) => boolean,
|
||||
timeoutMs?: number,
|
||||
): Effect.Effect<OrchestrationRuntimeReceipt, never>;
|
||||
function waitForReceipt<Receipt extends OrchestrationRuntimeReceipt>(
|
||||
predicate: (receipt: OrchestrationRuntimeReceipt) => receipt is Receipt,
|
||||
timeoutMs?: number,
|
||||
): Effect.Effect<Receipt, never>;
|
||||
function waitForReceipt(
|
||||
predicate: (receipt: OrchestrationRuntimeReceipt) => boolean,
|
||||
timeoutMs?: number,
|
||||
) {
|
||||
const readMatchingReceipt = Ref.get(receiptHistory).pipe(
|
||||
Effect.map((history) => history.find(predicate)),
|
||||
);
|
||||
|
||||
return waitFor(
|
||||
readMatchingReceipt,
|
||||
(receipt): receipt is OrchestrationRuntimeReceipt => receipt !== undefined,
|
||||
"runtime receipt",
|
||||
timeoutMs,
|
||||
);
|
||||
}
|
||||
|
||||
let disposed = false;
|
||||
const dispose = Effect.gen(function* () {
|
||||
if (disposed) {
|
||||
@@ -443,6 +491,7 @@ export const makeOrchestrationIntegrationHarness = (
|
||||
waitForThread,
|
||||
waitForDomainEvent,
|
||||
waitForPendingApproval,
|
||||
waitForReceipt,
|
||||
dispose,
|
||||
} satisfies OrchestrationIntegrationHarness;
|
||||
});
|
||||
@@ -72,10 +72,9 @@ function normalizeTurnState(value: unknown): "completed" | "failed" | "interrupt
|
||||
return "completed";
|
||||
}
|
||||
|
||||
function mapRequestType(requestKind: unknown):
|
||||
| "command_execution_approval"
|
||||
| "file_change_approval"
|
||||
| "unknown" {
|
||||
function mapRequestType(
|
||||
requestKind: unknown,
|
||||
): "command_execution_approval" | "file_change_approval" | "unknown" {
|
||||
if (requestKind === "command") {
|
||||
return "command_execution_approval";
|
||||
}
|
||||
@@ -239,323 +238,323 @@ export const makeTestProviderAdapterHarness = (options?: MakeTestProviderAdapter
|
||||
}>
|
||||
>();
|
||||
|
||||
const emit = (event: ProviderRuntimeEvent) => Queue.offer(runtimeEvents, event);
|
||||
const emit = (event: ProviderRuntimeEvent) => Queue.offer(runtimeEvents, event);
|
||||
|
||||
const startSession: ProviderAdapterShape<ProviderAdapterError>["startSession"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
if (input.provider !== undefined && input.provider !== provider) {
|
||||
return yield* new ProviderAdapterValidationError({
|
||||
const startSession: ProviderAdapterShape<ProviderAdapterError>["startSession"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
if (input.provider !== undefined && input.provider !== provider) {
|
||||
return yield* new ProviderAdapterValidationError({
|
||||
provider,
|
||||
operation: "startSession",
|
||||
issue: `Expected provider '${provider}' but received '${input.provider}'.`,
|
||||
});
|
||||
}
|
||||
|
||||
sessionCount += 1;
|
||||
const threadId = input.threadId;
|
||||
const createdAt = nowIso();
|
||||
|
||||
const session: ProviderSession = {
|
||||
provider,
|
||||
operation: "startSession",
|
||||
issue: `Expected provider '${provider}' but received '${input.provider}'.`,
|
||||
});
|
||||
}
|
||||
|
||||
sessionCount += 1;
|
||||
const threadId = input.threadId;
|
||||
const createdAt = nowIso();
|
||||
|
||||
const session: ProviderSession = {
|
||||
provider,
|
||||
status: "ready",
|
||||
runtimeMode: input.runtimeMode,
|
||||
threadId,
|
||||
cwd: input.cwd,
|
||||
resumeCursor: input.resumeCursor ?? { threadId: String(threadId), seed: sessionCount },
|
||||
createdAt,
|
||||
updatedAt: createdAt,
|
||||
};
|
||||
|
||||
sessions.set(threadId, {
|
||||
session,
|
||||
snapshot: {
|
||||
status: "ready",
|
||||
runtimeMode: input.runtimeMode,
|
||||
threadId,
|
||||
turns: [],
|
||||
},
|
||||
turnCount: 0,
|
||||
queuedResponses: queuedResponsesForNextSession.splice(0),
|
||||
rollbackCalls: [],
|
||||
cwd: input.cwd,
|
||||
resumeCursor: input.resumeCursor ?? { threadId: String(threadId), seed: sessionCount },
|
||||
createdAt,
|
||||
updatedAt: createdAt,
|
||||
};
|
||||
|
||||
sessions.set(threadId, {
|
||||
session,
|
||||
snapshot: {
|
||||
threadId,
|
||||
turns: [],
|
||||
},
|
||||
turnCount: 0,
|
||||
queuedResponses: queuedResponsesForNextSession.splice(0),
|
||||
rollbackCalls: [],
|
||||
});
|
||||
|
||||
return session;
|
||||
});
|
||||
|
||||
return session;
|
||||
});
|
||||
const sendTurn: ProviderAdapterShape<ProviderAdapterError>["sendTurn"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
const state = sessions.get(input.threadId);
|
||||
if (!state) {
|
||||
return yield* missingSessionEffect(provider, input.threadId);
|
||||
}
|
||||
|
||||
const sendTurn: ProviderAdapterShape<ProviderAdapterError>["sendTurn"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
const state = sessions.get(input.threadId);
|
||||
if (!state) {
|
||||
return yield* missingSessionEffect(provider, input.threadId);
|
||||
}
|
||||
state.turnCount += 1;
|
||||
const turnCount = state.turnCount;
|
||||
const turnId = TurnId.makeUnsafe(`turn-${turnCount}`);
|
||||
|
||||
state.turnCount += 1;
|
||||
const turnCount = state.turnCount;
|
||||
const turnId = TurnId.makeUnsafe(`turn-${turnCount}`);
|
||||
const response = state.queuedResponses.shift();
|
||||
if (!response) {
|
||||
return yield* new ProviderAdapterValidationError({
|
||||
provider,
|
||||
operation: "sendTurn",
|
||||
issue: `No queued turn response for thread ${input.threadId}.`,
|
||||
});
|
||||
}
|
||||
|
||||
const response = state.queuedResponses.shift();
|
||||
if (!response) {
|
||||
return yield* new ProviderAdapterValidationError({
|
||||
provider,
|
||||
operation: "sendTurn",
|
||||
issue: `No queued turn response for thread ${input.threadId}.`,
|
||||
});
|
||||
}
|
||||
const assistantDeltas: string[] = [];
|
||||
const deferredTurnCompletedEvents: ProviderRuntimeEvent[] = [];
|
||||
for (const fixtureEvent of response.events) {
|
||||
const rawEvent: Record<string, unknown> = {
|
||||
...(fixtureEvent as Record<string, unknown>),
|
||||
eventId: randomUUID(),
|
||||
provider,
|
||||
sessionId: RuntimeSessionId.makeUnsafe(String(input.threadId)),
|
||||
createdAt: nowIso(),
|
||||
};
|
||||
rawEvent.threadId = state.snapshot.threadId;
|
||||
if (Object.hasOwn(rawEvent, "turnId")) {
|
||||
rawEvent.turnId = turnId;
|
||||
}
|
||||
|
||||
const assistantDeltas: string[] = [];
|
||||
const deferredTurnCompletedEvents: ProviderRuntimeEvent[] = [];
|
||||
for (const fixtureEvent of response.events) {
|
||||
const rawEvent: Record<string, unknown> = {
|
||||
...(fixtureEvent as Record<string, unknown>),
|
||||
eventId: randomUUID(),
|
||||
provider,
|
||||
sessionId: RuntimeSessionId.makeUnsafe(String(input.threadId)),
|
||||
createdAt: nowIso(),
|
||||
const runtimeEvent = normalizeFixtureEvent(rawEvent);
|
||||
const runtimeType = (runtimeEvent as { type: string }).type;
|
||||
if (runtimeType === "content.delta") {
|
||||
const payload = runtimeEvent.payload as { delta?: unknown } | undefined;
|
||||
if (typeof payload?.delta === "string") {
|
||||
assistantDeltas.push(payload.delta);
|
||||
}
|
||||
} else if (runtimeType === "message.delta") {
|
||||
const legacyDelta = (runtimeEvent as { delta?: unknown }).delta;
|
||||
if (typeof legacyDelta === "string") {
|
||||
assistantDeltas.push(legacyDelta);
|
||||
}
|
||||
}
|
||||
if (runtimeEvent.type === "turn.completed") {
|
||||
deferredTurnCompletedEvents.push(runtimeEvent);
|
||||
continue;
|
||||
}
|
||||
|
||||
yield* emit(runtimeEvent);
|
||||
}
|
||||
|
||||
if (response.mutateWorkspace && state.session.cwd) {
|
||||
yield* response.mutateWorkspace({ cwd: state.session.cwd!, turnCount });
|
||||
}
|
||||
|
||||
const userItem = {
|
||||
type: "userMessage",
|
||||
content: [{ type: "text", text: input.input }],
|
||||
} as const;
|
||||
const assistantText = assistantDeltas.join("");
|
||||
const nextItems: Array<unknown> =
|
||||
assistantText.length > 0
|
||||
? [userItem, { type: "agentMessage", text: assistantText }]
|
||||
: [userItem];
|
||||
|
||||
const nextTurn: ProviderThreadTurnSnapshot = {
|
||||
id: turnId,
|
||||
items: nextItems,
|
||||
};
|
||||
rawEvent.threadId = state.snapshot.threadId;
|
||||
if (Object.hasOwn(rawEvent, "turnId")) {
|
||||
rawEvent.turnId = turnId;
|
||||
}
|
||||
|
||||
const runtimeEvent = normalizeFixtureEvent(rawEvent);
|
||||
const runtimeType = (runtimeEvent as { type: string }).type;
|
||||
if (runtimeType === "content.delta") {
|
||||
const payload = runtimeEvent.payload as { delta?: unknown } | undefined;
|
||||
if (typeof payload?.delta === "string") {
|
||||
assistantDeltas.push(payload.delta);
|
||||
}
|
||||
} else if (runtimeType === "message.delta") {
|
||||
const legacyDelta = (runtimeEvent as { delta?: unknown }).delta;
|
||||
if (typeof legacyDelta === "string") {
|
||||
assistantDeltas.push(legacyDelta);
|
||||
state.snapshot = {
|
||||
threadId: state.snapshot.threadId,
|
||||
turns: [...state.snapshot.turns, nextTurn],
|
||||
};
|
||||
|
||||
if (deferredTurnCompletedEvents.length === 0) {
|
||||
yield* emit({
|
||||
type: "turn.completed",
|
||||
eventId: EventId.makeUnsafe(randomUUID()),
|
||||
provider,
|
||||
createdAt: nowIso(),
|
||||
threadId: state.snapshot.threadId,
|
||||
turnId,
|
||||
payload: {
|
||||
state: "completed",
|
||||
},
|
||||
});
|
||||
} else {
|
||||
for (const completedEvent of deferredTurnCompletedEvents) {
|
||||
yield* emit(completedEvent);
|
||||
}
|
||||
}
|
||||
if (runtimeEvent.type === "turn.completed") {
|
||||
deferredTurnCompletedEvents.push(runtimeEvent);
|
||||
continue;
|
||||
}
|
||||
|
||||
yield* emit(runtimeEvent);
|
||||
}
|
||||
|
||||
if (response.mutateWorkspace && state.session.cwd) {
|
||||
yield* response.mutateWorkspace({ cwd: state.session.cwd!, turnCount });
|
||||
}
|
||||
|
||||
const userItem = {
|
||||
type: "userMessage",
|
||||
content: [{ type: "text", text: input.input }],
|
||||
} as const;
|
||||
const assistantText = assistantDeltas.join("");
|
||||
const nextItems: Array<unknown> =
|
||||
assistantText.length > 0
|
||||
? [userItem, { type: "agentMessage", text: assistantText }]
|
||||
: [userItem];
|
||||
|
||||
const nextTurn: ProviderThreadTurnSnapshot = {
|
||||
id: turnId,
|
||||
items: nextItems,
|
||||
};
|
||||
|
||||
state.snapshot = {
|
||||
threadId: state.snapshot.threadId,
|
||||
turns: [...state.snapshot.turns, nextTurn],
|
||||
};
|
||||
|
||||
if (deferredTurnCompletedEvents.length === 0) {
|
||||
yield* emit({
|
||||
type: "turn.completed",
|
||||
eventId: EventId.makeUnsafe(randomUUID()),
|
||||
provider,
|
||||
createdAt: nowIso(),
|
||||
return {
|
||||
threadId: state.snapshot.threadId,
|
||||
turnId,
|
||||
payload: {
|
||||
state: "completed",
|
||||
},
|
||||
});
|
||||
} else {
|
||||
for (const completedEvent of deferredTurnCompletedEvents) {
|
||||
yield* emit(completedEvent);
|
||||
}
|
||||
} satisfies ProviderTurnStartResult;
|
||||
});
|
||||
|
||||
const interruptTurn: ProviderAdapterShape<ProviderAdapterError>["interruptTurn"] = (
|
||||
threadId,
|
||||
turnId,
|
||||
) =>
|
||||
sessions.has(threadId)
|
||||
? Effect.sync(() => {
|
||||
const existing = interruptCallsBySession.get(threadId) ?? [];
|
||||
existing.push(turnId);
|
||||
interruptCallsBySession.set(threadId, existing);
|
||||
})
|
||||
: missingSessionEffect(provider, threadId);
|
||||
|
||||
const respondToRequest: ProviderAdapterShape<ProviderAdapterError>["respondToRequest"] = (
|
||||
threadId,
|
||||
requestId,
|
||||
decision,
|
||||
) =>
|
||||
sessions.has(threadId)
|
||||
? Effect.sync(() => {
|
||||
const existing = approvalResponsesBySession.get(threadId) ?? [];
|
||||
existing.push({
|
||||
threadId,
|
||||
requestId,
|
||||
decision,
|
||||
});
|
||||
approvalResponsesBySession.set(threadId, existing);
|
||||
})
|
||||
: missingSessionEffect(provider, threadId);
|
||||
|
||||
const respondToUserInput: ProviderAdapterShape<ProviderAdapterError>["respondToUserInput"] = (
|
||||
threadId,
|
||||
_requestId,
|
||||
_answers,
|
||||
) => (sessions.has(threadId) ? Effect.void : missingSessionEffect(provider, threadId));
|
||||
|
||||
const stopSession: ProviderAdapterShape<ProviderAdapterError>["stopSession"] = (threadId) =>
|
||||
Effect.sync(() => {
|
||||
sessions.delete(threadId);
|
||||
});
|
||||
|
||||
const listSessions: ProviderAdapterShape<ProviderAdapterError>["listSessions"] = () =>
|
||||
Effect.sync(() => Array.from(sessions.values(), (state) => state.session));
|
||||
|
||||
const hasSession: ProviderAdapterShape<ProviderAdapterError>["hasSession"] = (threadId) =>
|
||||
Effect.succeed(sessions.has(threadId));
|
||||
|
||||
const readThread: ProviderAdapterShape<ProviderAdapterError>["readThread"] = (threadId) => {
|
||||
const state = sessions.get(threadId);
|
||||
if (!state) {
|
||||
return missingSessionEffect(provider, threadId);
|
||||
}
|
||||
return Effect.succeed(state.snapshot);
|
||||
};
|
||||
|
||||
const rollbackThread: ProviderAdapterShape<ProviderAdapterError>["rollbackThread"] = (
|
||||
threadId,
|
||||
numTurns,
|
||||
) => {
|
||||
const state = sessions.get(threadId);
|
||||
if (!state) {
|
||||
return missingSessionEffect(provider, threadId);
|
||||
}
|
||||
if (!Number.isInteger(numTurns) || numTurns < 0 || numTurns > state.snapshot.turns.length) {
|
||||
return Effect.fail(
|
||||
new ProviderAdapterValidationError({
|
||||
provider,
|
||||
operation: "rollbackThread",
|
||||
issue: "numTurns must be an integer between 0 and current turn count.",
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
threadId: state.snapshot.threadId,
|
||||
turnId,
|
||||
} satisfies ProviderTurnStartResult;
|
||||
});
|
||||
return Effect.sync(() => {
|
||||
state.rollbackCalls.push(numTurns);
|
||||
state.snapshot = {
|
||||
threadId: state.snapshot.threadId,
|
||||
turns: state.snapshot.turns.slice(0, state.snapshot.turns.length - numTurns),
|
||||
};
|
||||
state.turnCount = state.snapshot.turns.length;
|
||||
return state.snapshot;
|
||||
});
|
||||
};
|
||||
|
||||
const interruptTurn: ProviderAdapterShape<ProviderAdapterError>["interruptTurn"] = (
|
||||
threadId,
|
||||
turnId,
|
||||
) =>
|
||||
sessions.has(threadId)
|
||||
? Effect.sync(() => {
|
||||
const existing = interruptCallsBySession.get(threadId) ?? [];
|
||||
existing.push(turnId);
|
||||
interruptCallsBySession.set(threadId, existing);
|
||||
})
|
||||
: missingSessionEffect(provider, threadId);
|
||||
const stopAll: ProviderAdapterShape<ProviderAdapterError>["stopAll"] = () =>
|
||||
Effect.sync(() => {
|
||||
sessions.clear();
|
||||
});
|
||||
|
||||
const respondToRequest: ProviderAdapterShape<ProviderAdapterError>["respondToRequest"] = (
|
||||
threadId,
|
||||
requestId,
|
||||
decision,
|
||||
) =>
|
||||
sessions.has(threadId)
|
||||
? Effect.sync(() => {
|
||||
const existing = approvalResponsesBySession.get(threadId) ?? [];
|
||||
existing.push({
|
||||
threadId,
|
||||
requestId,
|
||||
decision,
|
||||
});
|
||||
approvalResponsesBySession.set(threadId, existing);
|
||||
})
|
||||
: missingSessionEffect(provider, threadId);
|
||||
const adapter: ProviderAdapterShape<ProviderAdapterError> = {
|
||||
provider,
|
||||
capabilities: {
|
||||
sessionModelSwitch: "in-session",
|
||||
},
|
||||
startSession,
|
||||
sendTurn,
|
||||
interruptTurn,
|
||||
respondToRequest,
|
||||
respondToUserInput,
|
||||
stopSession,
|
||||
listSessions,
|
||||
hasSession,
|
||||
readThread,
|
||||
rollbackThread,
|
||||
stopAll,
|
||||
streamEvents: Stream.fromQueue(runtimeEvents),
|
||||
};
|
||||
|
||||
const respondToUserInput: ProviderAdapterShape<ProviderAdapterError>["respondToUserInput"] = (
|
||||
threadId,
|
||||
_requestId,
|
||||
_answers,
|
||||
) => (sessions.has(threadId) ? Effect.void : missingSessionEffect(provider, threadId));
|
||||
|
||||
const stopSession: ProviderAdapterShape<ProviderAdapterError>["stopSession"] = (threadId) =>
|
||||
Effect.sync(() => {
|
||||
sessions.delete(threadId);
|
||||
});
|
||||
|
||||
const listSessions: ProviderAdapterShape<ProviderAdapterError>["listSessions"] = () =>
|
||||
Effect.sync(() => Array.from(sessions.values(), (state) => state.session));
|
||||
|
||||
const hasSession: ProviderAdapterShape<ProviderAdapterError>["hasSession"] = (threadId) =>
|
||||
Effect.succeed(sessions.has(threadId));
|
||||
|
||||
const readThread: ProviderAdapterShape<ProviderAdapterError>["readThread"] = (threadId) => {
|
||||
const state = sessions.get(threadId);
|
||||
if (!state) {
|
||||
return missingSessionEffect(provider, threadId);
|
||||
}
|
||||
return Effect.succeed(state.snapshot);
|
||||
};
|
||||
|
||||
const rollbackThread: ProviderAdapterShape<ProviderAdapterError>["rollbackThread"] = (
|
||||
threadId,
|
||||
numTurns,
|
||||
) => {
|
||||
const state = sessions.get(threadId);
|
||||
if (!state) {
|
||||
return missingSessionEffect(provider, threadId);
|
||||
}
|
||||
if (!Number.isInteger(numTurns) || numTurns < 0 || numTurns > state.snapshot.turns.length) {
|
||||
return Effect.fail(
|
||||
new ProviderAdapterValidationError({
|
||||
provider,
|
||||
operation: "rollbackThread",
|
||||
issue: "numTurns must be an integer between 0 and current turn count.",
|
||||
}),
|
||||
const queueTurnResponse = (
|
||||
threadId: ThreadId,
|
||||
response: TestTurnResponse,
|
||||
): Effect.Effect<void, ProviderAdapterSessionNotFoundError> =>
|
||||
Effect.sync(() => sessions.get(threadId)).pipe(
|
||||
Effect.flatMap((state) =>
|
||||
state
|
||||
? Effect.sync(() => {
|
||||
state.queuedResponses.push(response);
|
||||
})
|
||||
: Effect.fail(sessionNotFound(provider, threadId)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Effect.sync(() => {
|
||||
state.rollbackCalls.push(numTurns);
|
||||
state.snapshot = {
|
||||
threadId: state.snapshot.threadId,
|
||||
turns: state.snapshot.turns.slice(0, state.snapshot.turns.length - numTurns),
|
||||
};
|
||||
state.turnCount = state.snapshot.turns.length;
|
||||
return state.snapshot;
|
||||
});
|
||||
};
|
||||
const queueTurnResponseForNextSession = (
|
||||
response: TestTurnResponse,
|
||||
): Effect.Effect<void, never> =>
|
||||
Effect.sync(() => {
|
||||
queuedResponsesForNextSession.push(response);
|
||||
});
|
||||
|
||||
const stopAll: ProviderAdapterShape<ProviderAdapterError>["stopAll"] = () =>
|
||||
Effect.sync(() => {
|
||||
sessions.clear();
|
||||
});
|
||||
const getRollbackCalls = (threadId: ThreadId): ReadonlyArray<number> => {
|
||||
const state = sessions.get(threadId);
|
||||
if (!state) {
|
||||
return [];
|
||||
}
|
||||
return [...state.rollbackCalls];
|
||||
};
|
||||
|
||||
const adapter: ProviderAdapterShape<ProviderAdapterError> = {
|
||||
provider,
|
||||
capabilities: {
|
||||
sessionModelSwitch: "in-session",
|
||||
},
|
||||
startSession,
|
||||
sendTurn,
|
||||
interruptTurn,
|
||||
respondToRequest,
|
||||
respondToUserInput,
|
||||
stopSession,
|
||||
listSessions,
|
||||
hasSession,
|
||||
readThread,
|
||||
rollbackThread,
|
||||
stopAll,
|
||||
streamEvents: Stream.fromQueue(runtimeEvents),
|
||||
};
|
||||
const getStartCount = (): number => sessionCount;
|
||||
|
||||
const queueTurnResponse = (
|
||||
threadId: ThreadId,
|
||||
response: TestTurnResponse,
|
||||
): Effect.Effect<void, ProviderAdapterSessionNotFoundError> =>
|
||||
Effect.sync(() => sessions.get(threadId)).pipe(
|
||||
Effect.flatMap((state) =>
|
||||
state
|
||||
? Effect.sync(() => {
|
||||
state.queuedResponses.push(response);
|
||||
})
|
||||
: Effect.fail(sessionNotFound(provider, threadId)),
|
||||
),
|
||||
);
|
||||
const getInterruptCalls = (threadId: ThreadId): ReadonlyArray<TurnId | undefined> => {
|
||||
const calls = interruptCallsBySession.get(threadId);
|
||||
if (!calls) {
|
||||
return [];
|
||||
}
|
||||
return [...calls];
|
||||
};
|
||||
|
||||
const queueTurnResponseForNextSession = (
|
||||
response: TestTurnResponse,
|
||||
): Effect.Effect<void, never> =>
|
||||
Effect.sync(() => {
|
||||
queuedResponsesForNextSession.push(response);
|
||||
});
|
||||
const listActiveSessionIds = (): ReadonlyArray<ThreadId> =>
|
||||
Array.from(sessions.values(), (state) => state.session.threadId);
|
||||
|
||||
const getRollbackCalls = (threadId: ThreadId): ReadonlyArray<number> => {
|
||||
const state = sessions.get(threadId);
|
||||
if (!state) {
|
||||
return [];
|
||||
}
|
||||
return [...state.rollbackCalls];
|
||||
};
|
||||
const getApprovalResponses = (
|
||||
threadId: ThreadId,
|
||||
): ReadonlyArray<{
|
||||
readonly threadId: ThreadId;
|
||||
readonly requestId: ApprovalRequestId;
|
||||
readonly decision: ProviderApprovalDecision;
|
||||
}> => {
|
||||
const responses = approvalResponsesBySession.get(threadId);
|
||||
if (!responses) {
|
||||
return [];
|
||||
}
|
||||
return [...responses];
|
||||
};
|
||||
|
||||
const getStartCount = (): number => sessionCount;
|
||||
|
||||
const getInterruptCalls = (threadId: ThreadId): ReadonlyArray<TurnId | undefined> => {
|
||||
const calls = interruptCallsBySession.get(threadId);
|
||||
if (!calls) {
|
||||
return [];
|
||||
}
|
||||
return [...calls];
|
||||
};
|
||||
|
||||
const listActiveSessionIds = (): ReadonlyArray<ThreadId> =>
|
||||
Array.from(sessions.values(), (state) => state.session.threadId);
|
||||
|
||||
const getApprovalResponses = (
|
||||
threadId: ThreadId,
|
||||
): ReadonlyArray<{
|
||||
readonly threadId: ThreadId;
|
||||
readonly requestId: ApprovalRequestId;
|
||||
readonly decision: ProviderApprovalDecision;
|
||||
}> => {
|
||||
const responses = approvalResponsesBySession.get(threadId);
|
||||
if (!responses) {
|
||||
return [];
|
||||
}
|
||||
return [...responses];
|
||||
};
|
||||
|
||||
return {
|
||||
adapter,
|
||||
provider,
|
||||
queueTurnResponse,
|
||||
queueTurnResponseForNextSession,
|
||||
getStartCount,
|
||||
getRollbackCalls,
|
||||
getInterruptCalls,
|
||||
listActiveSessionIds,
|
||||
getApprovalResponses,
|
||||
} satisfies TestProviderAdapterHarness;
|
||||
});
|
||||
return {
|
||||
adapter,
|
||||
provider,
|
||||
queueTurnResponse,
|
||||
queueTurnResponseForNextSession,
|
||||
getStartCount,
|
||||
getRollbackCalls,
|
||||
getInterruptCalls,
|
||||
listActiveSessionIds,
|
||||
getApprovalResponses,
|
||||
} satisfies TestProviderAdapterHarness;
|
||||
});
|
||||
@@ -21,6 +21,10 @@ import {
|
||||
type OrchestrationIntegrationHarness,
|
||||
} from "./OrchestrationEngineHarness.integration.ts";
|
||||
import { checkpointRefForThreadTurn } from "../src/checkpointing/Utils.ts";
|
||||
import type {
|
||||
CheckpointDiffFinalizedReceipt,
|
||||
TurnProcessingQuiescedReceipt,
|
||||
} from "../src/orchestration/Services/RuntimeReceiptBus.ts";
|
||||
|
||||
const asMessageId = (value: string): MessageId => MessageId.makeUnsafe(value);
|
||||
const asProjectId = (value: string): ProjectId => ProjectId.makeUnsafe(value);
|
||||
@@ -187,6 +191,22 @@ it.live("runs a single turn end-to-end and persists checkpoint state in sqlite +
|
||||
messageId: "msg-user-single",
|
||||
text: "Say hello",
|
||||
});
|
||||
const finalizedReceipt = yield* harness.waitForReceipt(
|
||||
(receipt): receipt is CheckpointDiffFinalizedReceipt =>
|
||||
receipt.type === "checkpoint.diff.finalized" &&
|
||||
receipt.threadId === THREAD_ID &&
|
||||
receipt.checkpointTurnCount === 1,
|
||||
);
|
||||
if (finalizedReceipt.type !== "checkpoint.diff.finalized") {
|
||||
throw new Error("Expected checkpoint.diff.finalized receipt.");
|
||||
}
|
||||
assert.equal(finalizedReceipt.status, "ready");
|
||||
yield* harness.waitForReceipt(
|
||||
(receipt): receipt is TurnProcessingQuiescedReceipt =>
|
||||
receipt.type === "turn.processing.quiesced" &&
|
||||
receipt.threadId === THREAD_ID &&
|
||||
receipt.checkpointTurnCount === 1,
|
||||
);
|
||||
|
||||
const thread = yield* harness.waitForThread(
|
||||
THREAD_ID,
|
||||
@@ -208,8 +228,6 @@ it.live("runs a single turn end-to-end and persists checkpoint state in sqlite +
|
||||
assert.equal(checkpointRows[0]?.status, "ready");
|
||||
assert.deepEqual(checkpointRows[0]?.files, []);
|
||||
|
||||
yield* harness.waitForDomainEvent((event) => event.type === "thread.turn-diff-completed");
|
||||
|
||||
const ref0 = checkpointRefForThreadTurn(THREAD_ID, 0);
|
||||
const ref1 = checkpointRefForThreadTurn(THREAD_ID, 1);
|
||||
assert.equal(gitRefExists(harness.workspaceDir, ref0), true);
|
||||
@@ -367,6 +385,12 @@ it.live("runs multi-turn file edits and persists checkpoint diffs", () =>
|
||||
messageId: "msg-user-multi-1",
|
||||
text: "Make first edit",
|
||||
});
|
||||
yield* harness.waitForReceipt(
|
||||
(receipt): receipt is CheckpointDiffFinalizedReceipt =>
|
||||
receipt.type === "checkpoint.diff.finalized" &&
|
||||
receipt.threadId === THREAD_ID &&
|
||||
receipt.checkpointTurnCount === 1,
|
||||
);
|
||||
|
||||
yield* harness.waitForThread(
|
||||
THREAD_ID,
|
||||
@@ -408,6 +432,22 @@ it.live("runs multi-turn file edits and persists checkpoint diffs", () =>
|
||||
messageId: "msg-user-multi-2",
|
||||
text: "Make second edit",
|
||||
});
|
||||
const secondReceipt = yield* harness.waitForReceipt(
|
||||
(receipt): receipt is CheckpointDiffFinalizedReceipt =>
|
||||
receipt.type === "checkpoint.diff.finalized" &&
|
||||
receipt.threadId === THREAD_ID &&
|
||||
receipt.checkpointTurnCount === 2,
|
||||
);
|
||||
if (secondReceipt.type !== "checkpoint.diff.finalized") {
|
||||
throw new Error("Expected checkpoint.diff.finalized receipt.");
|
||||
}
|
||||
assert.equal(secondReceipt.status, "ready");
|
||||
yield* harness.waitForReceipt(
|
||||
(receipt): receipt is TurnProcessingQuiescedReceipt =>
|
||||
receipt.type === "turn.processing.quiesced" &&
|
||||
receipt.threadId === THREAD_ID &&
|
||||
receipt.checkpointTurnCount === 2,
|
||||
);
|
||||
|
||||
const secondTurnThread = yield* harness.waitForThread(
|
||||
THREAD_ID,
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
"directory": "apps/server"
|
||||
},
|
||||
"bin": {
|
||||
"t3": "./dist/index.mjs"
|
||||
"t3": "./dist/bin.mjs"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "bun run src/index.ts",
|
||||
"dev": "bun run src/bin.ts",
|
||||
"build": "node scripts/cli.ts build",
|
||||
"start": "node dist/index.mjs",
|
||||
"start": "node dist/bin.mjs",
|
||||
"prepare": "effect-language-service patch",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "node scripts/typecheck.mjs",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -6,7 +6,10 @@ import { Data, Effect, FileSystem, Logger, Option, Path } from "effect";
|
||||
import { Command, Flag } from "effect/unstable/cli";
|
||||
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
||||
|
||||
import { DEVELOPMENT_ICON_OVERRIDES, PUBLISH_ICON_OVERRIDES } from "../../../scripts/lib/brand-assets.ts";
|
||||
import {
|
||||
DEVELOPMENT_ICON_OVERRIDES,
|
||||
PUBLISH_ICON_OVERRIDES,
|
||||
} from "../../../scripts/lib/brand-assets.ts";
|
||||
import { resolveCatalogDependencies } from "../../../scripts/lib/resolve-catalog.ts";
|
||||
import rootPackageJson from "../../../package.json" with { type: "json" };
|
||||
import serverPackageJson from "../package.json" with { type: "json" };
|
||||
@@ -118,6 +121,7 @@ const buildCmd = Command.make(
|
||||
"build",
|
||||
{
|
||||
verbose: Flag.boolean("verbose").pipe(Flag.withDefault(false)),
|
||||
format: Flag.choice("format", ["esm", "cjs"]).pipe(Flag.withDefault("esm")),
|
||||
},
|
||||
(config) =>
|
||||
Effect.gen(function* () {
|
||||
@@ -134,7 +138,7 @@ const buildCmd = Command.make(
|
||||
stderr: "inherit",
|
||||
// Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
|
||||
shell: process.platform === "win32",
|
||||
})`bun tsdown`,
|
||||
})`bun tsdown --format ${config.format}`,
|
||||
);
|
||||
|
||||
const webDist = path.join(repoRoot, "apps/web/dist");
|
||||
@@ -174,7 +178,7 @@ const publishCmd = Command.make(
|
||||
const backupPath = `${packageJsonPath}.bak`;
|
||||
|
||||
// Assert build assets exist
|
||||
for (const relPath of ["dist/index.mjs", "dist/client/index.html"]) {
|
||||
for (const relPath of ["dist/bin.mjs", "dist/client/index.html"]) {
|
||||
const abs = path.join(serverDir, relPath);
|
||||
if (!(yield* fs.exists(abs))) {
|
||||
return yield* new CliError({
|
||||
@@ -192,8 +196,10 @@ const publishCmd = Command.make(
|
||||
const pkg = {
|
||||
name: serverPackageJson.name,
|
||||
repository: serverPackageJson.repository,
|
||||
bin: serverPackageJson.bin,
|
||||
type: serverPackageJson.type,
|
||||
bin: {
|
||||
t3: "./dist/bin.mjs",
|
||||
},
|
||||
version,
|
||||
engines: serverPackageJson.engines,
|
||||
files: serverPackageJson.files,
|
||||
@@ -237,9 +243,7 @@ const publishCmd = Command.make(
|
||||
Effect.gen(function* () {
|
||||
yield* restorePublishIconOverrides(resource.iconBackups).pipe(
|
||||
Effect.catch((error) =>
|
||||
Effect.logError(
|
||||
`[cli] Failed to restore publish icon overrides: ${String(error)}`,
|
||||
),
|
||||
Effect.logError(`[cli] Failed to restore publish icon overrides: ${String(error)}`),
|
||||
),
|
||||
);
|
||||
yield* fs.rename(backupPath, packageJsonPath);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { createRequire } from "node:module";
|
||||
import path from "node:path";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const tscPath = require.resolve("typescript/bin/tsc");
|
||||
const cwd = path.resolve(import.meta.dirname, "..");
|
||||
|
||||
const child = spawn(process.execPath, [tscPath, "--noEmit"], {
|
||||
cwd,
|
||||
env: process.env,
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
|
||||
let output = "";
|
||||
|
||||
child.stdout.on("data", (chunk) => {
|
||||
const text = chunk.toString();
|
||||
output += text;
|
||||
process.stdout.write(text);
|
||||
});
|
||||
|
||||
child.stderr.on("data", (chunk) => {
|
||||
const text = chunk.toString();
|
||||
output += text;
|
||||
process.stderr.write(text);
|
||||
});
|
||||
|
||||
child.on("exit", (code, signal) => {
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
return;
|
||||
}
|
||||
|
||||
if (code === 0) {
|
||||
process.exit(0);
|
||||
return;
|
||||
}
|
||||
|
||||
const hasTypeScriptErrors = /error TS\d+:/.test(output);
|
||||
process.exit(hasTypeScriptErrors ? (code ?? 1) : 0);
|
||||
});
|
||||
@@ -12,8 +12,7 @@ import { inferImageExtension, SAFE_IMAGE_FILE_EXTENSIONS } from "./imageMime.ts"
|
||||
const ATTACHMENT_FILENAME_EXTENSIONS = [...SAFE_IMAGE_FILE_EXTENSIONS, ".bin"];
|
||||
const ATTACHMENT_ID_THREAD_SEGMENT_MAX_CHARS = 80;
|
||||
const ATTACHMENT_ID_THREAD_SEGMENT_PATTERN = "[a-z0-9_]+(?:-[a-z0-9_]+)*";
|
||||
const ATTACHMENT_ID_UUID_PATTERN =
|
||||
"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
||||
const ATTACHMENT_ID_UUID_PATTERN = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
||||
const ATTACHMENT_ID_PATTERN = new RegExp(
|
||||
`^(${ATTACHMENT_ID_THREAD_SEGMENT_PATTERN})-(${ATTACHMENT_ID_UUID_PATTERN})$`,
|
||||
"i",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import * as Effect from "effect/Effect";
|
||||
import { Command } from "effect/unstable/cli";
|
||||
|
||||
import { t3Cli } from "./cli";
|
||||
import { version } from "../package.json" with { type: "json" };
|
||||
|
||||
const main = Command.run(t3Cli, { version }).pipe(
|
||||
Effect.provide(NodeServices.layer),
|
||||
) as Effect.Effect<void, unknown, never>;
|
||||
|
||||
NodeRuntime.runMain(main);
|
||||
@@ -0,0 +1,113 @@
|
||||
import { NetService } from "@t3tools/shared/Net";
|
||||
import { describe, expect, it } from "@effect/vitest";
|
||||
import * as ConfigProvider from "effect/ConfigProvider";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Option from "effect/Option";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
|
||||
import { resolveServerConfig, type CliInput } from "./cli";
|
||||
|
||||
const emptyInput = (): CliInput => ({
|
||||
mode: Option.none(),
|
||||
port: Option.none(),
|
||||
host: Option.none(),
|
||||
stateDir: Option.none(),
|
||||
devUrl: Option.none(),
|
||||
noBrowser: Option.none(),
|
||||
authToken: Option.none(),
|
||||
autoBootstrapProjectFromCwd: Option.none(),
|
||||
logWebSocketEvents: Option.none(),
|
||||
});
|
||||
|
||||
describe("cli config resolution", () => {
|
||||
it.effect("falls back to environment values when flags are omitted", () =>
|
||||
Effect.gen(function* () {
|
||||
const resolved = yield* resolveServerConfig(emptyInput()).pipe(
|
||||
Effect.provide(NetService.layer),
|
||||
Effect.provide(NodeServices.layer),
|
||||
Effect.provideService(
|
||||
ConfigProvider.ConfigProvider,
|
||||
ConfigProvider.fromEnv({
|
||||
env: {
|
||||
T3CODE_MODE: "desktop",
|
||||
T3CODE_PORT: "4123",
|
||||
T3CODE_HOST: "127.0.0.1",
|
||||
T3CODE_STATE_DIR: "/tmp/t3-state",
|
||||
VITE_DEV_SERVER_URL: "http://127.0.0.1:5173",
|
||||
T3CODE_NO_BROWSER: "true",
|
||||
T3CODE_AUTH_TOKEN: "secret",
|
||||
T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "false",
|
||||
T3CODE_LOG_WS_EVENTS: "true",
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
expect(resolved).toEqual({
|
||||
mode: "desktop",
|
||||
port: 4123,
|
||||
host: "127.0.0.1",
|
||||
cwd: process.cwd(),
|
||||
keybindingsConfigPath: "/tmp/t3-state/keybindings.json",
|
||||
stateDir: "/tmp/t3-state",
|
||||
staticDir: undefined,
|
||||
devUrl: new URL("http://127.0.0.1:5173"),
|
||||
noBrowser: true,
|
||||
authToken: "secret",
|
||||
autoBootstrapProjectFromCwd: false,
|
||||
logWebSocketEvents: true,
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("uses CLI flags as the final override", () =>
|
||||
Effect.gen(function* () {
|
||||
const resolved = yield* resolveServerConfig({
|
||||
...emptyInput(),
|
||||
mode: Option.some("web"),
|
||||
port: Option.some(4444),
|
||||
host: Option.some("0.0.0.0"),
|
||||
stateDir: Option.some("/tmp/t3-override"),
|
||||
devUrl: Option.some(new URL("http://127.0.0.1:4173")),
|
||||
noBrowser: Option.some("false"),
|
||||
authToken: Option.some("override-token"),
|
||||
autoBootstrapProjectFromCwd: Option.some("true"),
|
||||
logWebSocketEvents: Option.some("false"),
|
||||
}).pipe(
|
||||
Effect.provide(NetService.layer),
|
||||
Effect.provide(NodeServices.layer),
|
||||
Effect.provideService(
|
||||
ConfigProvider.ConfigProvider,
|
||||
ConfigProvider.fromEnv({
|
||||
env: {
|
||||
T3CODE_MODE: "desktop",
|
||||
T3CODE_PORT: "4123",
|
||||
T3CODE_HOST: "127.0.0.1",
|
||||
T3CODE_STATE_DIR: "/tmp/t3-state",
|
||||
VITE_DEV_SERVER_URL: "http://127.0.0.1:5173",
|
||||
T3CODE_NO_BROWSER: "true",
|
||||
T3CODE_AUTH_TOKEN: "secret",
|
||||
T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "false",
|
||||
T3CODE_LOG_WS_EVENTS: "true",
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
expect(resolved).toEqual({
|
||||
mode: "web",
|
||||
port: 4444,
|
||||
host: "0.0.0.0",
|
||||
cwd: process.cwd(),
|
||||
keybindingsConfigPath: "/tmp/t3-override/keybindings.json",
|
||||
stateDir: "/tmp/t3-override",
|
||||
staticDir: undefined,
|
||||
devUrl: new URL("http://127.0.0.1:4173"),
|
||||
noBrowser: false,
|
||||
authToken: "override-token",
|
||||
autoBootstrapProjectFromCwd: true,
|
||||
logWebSocketEvents: false,
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,212 @@
|
||||
import { NetService } from "@t3tools/shared/Net";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { Config, Data, Effect, Layer, Option, Path, Schema } from "effect";
|
||||
import { Command, Flag } from "effect/unstable/cli";
|
||||
|
||||
import {
|
||||
DEFAULT_PORT,
|
||||
resolveStaticDir,
|
||||
ServerConfig,
|
||||
type RuntimeMode,
|
||||
type ServerConfigShape,
|
||||
} from "./config";
|
||||
import { fixPath, resolveStateDir } from "./os-jank";
|
||||
import { runServer } from "./server";
|
||||
|
||||
export class StartupError extends Data.TaggedError("StartupError")<{
|
||||
readonly message: string;
|
||||
readonly cause?: unknown;
|
||||
}> {}
|
||||
|
||||
type CliBooleanFlag = "true" | "false";
|
||||
|
||||
const parseCliBoolean = (value: CliBooleanFlag): boolean => value === "true";
|
||||
|
||||
const resolveBooleanSetting = (
|
||||
value: Option.Option<CliBooleanFlag>,
|
||||
envValue: boolean | undefined,
|
||||
fallback: boolean,
|
||||
): boolean =>
|
||||
Option.match(value, {
|
||||
onSome: parseCliBoolean,
|
||||
onNone: () => envValue ?? fallback,
|
||||
});
|
||||
|
||||
export interface CliInput {
|
||||
readonly mode: Option.Option<RuntimeMode>;
|
||||
readonly port: Option.Option<number>;
|
||||
readonly host: Option.Option<string>;
|
||||
readonly stateDir: Option.Option<string>;
|
||||
readonly devUrl: Option.Option<URL>;
|
||||
readonly noBrowser: Option.Option<CliBooleanFlag>;
|
||||
readonly authToken: Option.Option<string>;
|
||||
readonly autoBootstrapProjectFromCwd: Option.Option<CliBooleanFlag>;
|
||||
readonly logWebSocketEvents: Option.Option<CliBooleanFlag>;
|
||||
}
|
||||
|
||||
const CliEnvConfig = Config.all({
|
||||
mode: Config.string("T3CODE_MODE").pipe(
|
||||
Config.option,
|
||||
Config.map(
|
||||
Option.match<RuntimeMode, string>({
|
||||
onNone: () => "web",
|
||||
onSome: (value) => (value === "desktop" ? "desktop" : "web"),
|
||||
}),
|
||||
),
|
||||
),
|
||||
port: Config.port("T3CODE_PORT").pipe(Config.option, Config.map(Option.getOrUndefined)),
|
||||
host: Config.string("T3CODE_HOST").pipe(Config.option, Config.map(Option.getOrUndefined)),
|
||||
stateDir: Config.string("T3CODE_STATE_DIR").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
devUrl: Config.url("VITE_DEV_SERVER_URL").pipe(Config.option, Config.map(Option.getOrUndefined)),
|
||||
noBrowser: Config.boolean("T3CODE_NO_BROWSER").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
authToken: Config.string("T3CODE_AUTH_TOKEN").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
autoBootstrapProjectFromCwd: Config.boolean("T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
logWebSocketEvents: Config.boolean("T3CODE_LOG_WS_EVENTS").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
});
|
||||
|
||||
export const resolveServerConfig = (input: CliInput) =>
|
||||
Effect.gen(function* () {
|
||||
const { findAvailablePort } = yield* NetService;
|
||||
const { join } = yield* Path.Path;
|
||||
|
||||
yield* Effect.sync(fixPath);
|
||||
|
||||
const env = yield* CliEnvConfig.asEffect().pipe(
|
||||
Effect.mapError(
|
||||
(cause) => new StartupError({ message: "Failed to read environment configuration", cause }),
|
||||
),
|
||||
);
|
||||
|
||||
const mode = Option.getOrElse(input.mode, () => env.mode);
|
||||
const port = yield* Option.match(input.port, {
|
||||
onSome: Effect.succeed,
|
||||
onNone: () => {
|
||||
if (env.port) {
|
||||
return Effect.succeed(env.port);
|
||||
}
|
||||
if (mode === "desktop") {
|
||||
return Effect.succeed(DEFAULT_PORT);
|
||||
}
|
||||
return findAvailablePort(DEFAULT_PORT);
|
||||
},
|
||||
});
|
||||
|
||||
const stateDir = yield* resolveStateDir(Option.getOrUndefined(input.stateDir) ?? env.stateDir);
|
||||
const devUrl = Option.getOrElse(input.devUrl, () => env.devUrl);
|
||||
|
||||
return {
|
||||
mode,
|
||||
port,
|
||||
cwd: process.cwd(),
|
||||
keybindingsConfigPath: join(stateDir, "keybindings.json"),
|
||||
host:
|
||||
Option.getOrUndefined(input.host) ??
|
||||
env.host ??
|
||||
(mode === "desktop" ? "127.0.0.1" : undefined),
|
||||
stateDir,
|
||||
staticDir: devUrl ? undefined : yield* resolveStaticDir(),
|
||||
devUrl,
|
||||
noBrowser: resolveBooleanSetting(input.noBrowser, env.noBrowser, mode === "desktop"),
|
||||
authToken: Option.getOrUndefined(input.authToken) ?? env.authToken,
|
||||
autoBootstrapProjectFromCwd: resolveBooleanSetting(
|
||||
input.autoBootstrapProjectFromCwd,
|
||||
env.autoBootstrapProjectFromCwd,
|
||||
mode === "web",
|
||||
),
|
||||
logWebSocketEvents: resolveBooleanSetting(
|
||||
input.logWebSocketEvents,
|
||||
env.logWebSocketEvents,
|
||||
Boolean(devUrl),
|
||||
),
|
||||
} satisfies ServerConfigShape;
|
||||
});
|
||||
|
||||
const modeFlag = Flag.choice("mode", ["web", "desktop"]).pipe(
|
||||
Flag.withDescription("Runtime mode. `desktop` keeps loopback defaults unless overridden."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const portFlag = Flag.integer("port").pipe(
|
||||
Flag.withSchema(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 65535 }))),
|
||||
Flag.withDescription("Port for the HTTP/WebSocket server."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const hostFlag = Flag.string("host").pipe(
|
||||
Flag.withDescription("Host/interface to bind (for example 127.0.0.1, 0.0.0.0, or a Tailnet IP)."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const stateDirFlag = Flag.string("state-dir").pipe(
|
||||
Flag.withDescription("State directory path (equivalent to T3CODE_STATE_DIR)."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const devUrlFlag = Flag.string("dev-url").pipe(
|
||||
Flag.withSchema(Schema.URLFromString),
|
||||
Flag.withDescription("Dev web URL to proxy/redirect to (equivalent to VITE_DEV_SERVER_URL)."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const noBrowserFlag = Flag.choice("no-browser", ["true", "false"]).pipe(
|
||||
Flag.withDescription("Disable automatic browser opening (`true` or `false`)."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const authTokenFlag = Flag.string("auth-token").pipe(
|
||||
Flag.withDescription("Auth token required for WebSocket connections."),
|
||||
Flag.withAlias("token"),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const autoBootstrapProjectFromCwdFlag = Flag.choice(
|
||||
"auto-bootstrap-project-from-cwd",
|
||||
["true", "false"],
|
||||
).pipe(
|
||||
Flag.withDescription(
|
||||
"Create a project for the current working directory on startup when missing (`true` or `false`).",
|
||||
),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const logWebSocketEventsFlag = Flag.choice("log-websocket-events", ["true", "false"]).pipe(
|
||||
Flag.withDescription(
|
||||
"Emit server-side logs for outbound WebSocket push traffic (`true` or `false`).",
|
||||
),
|
||||
Flag.withAlias("log-ws-events"),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
export const t3Cli = Command.make("t3", {
|
||||
mode: modeFlag,
|
||||
port: portFlag,
|
||||
host: hostFlag,
|
||||
stateDir: stateDirFlag,
|
||||
devUrl: devUrlFlag,
|
||||
noBrowser: noBrowserFlag,
|
||||
authToken: authTokenFlag,
|
||||
autoBootstrapProjectFromCwd: autoBootstrapProjectFromCwdFlag,
|
||||
logWebSocketEvents: logWebSocketEventsFlag,
|
||||
}).pipe(
|
||||
Command.withDescription("Run the T3 Code server."),
|
||||
Command.withHandler((input: CliInput) =>
|
||||
Effect.flatMap(resolveServerConfig(input), (config) =>
|
||||
runServer.pipe(Effect.provideService(ServerConfig, config)),
|
||||
).pipe(Effect.provide(Layer.mergeAll(NetService.layer, NodeServices.layer))),
|
||||
),
|
||||
);
|
||||
@@ -749,88 +749,82 @@ describe("respondToUserInput", () => {
|
||||
});
|
||||
|
||||
describe.skipIf(!process.env.CODEX_BINARY_PATH)("startSession live Codex resume", () => {
|
||||
it(
|
||||
"keeps prior thread history when resuming with a changed runtime mode",
|
||||
async () => {
|
||||
const workspaceDir = mkdtempSync(path.join(os.tmpdir(), "codex-live-resume-"));
|
||||
writeFileSync(path.join(workspaceDir, "README.md"), "hello\n", "utf8");
|
||||
it("keeps prior thread history when resuming with a changed runtime mode", async () => {
|
||||
const workspaceDir = mkdtempSync(path.join(os.tmpdir(), "codex-live-resume-"));
|
||||
writeFileSync(path.join(workspaceDir, "README.md"), "hello\n", "utf8");
|
||||
|
||||
const manager = new CodexAppServerManager();
|
||||
const manager = new CodexAppServerManager();
|
||||
|
||||
try {
|
||||
const firstSession = await manager.startSession({
|
||||
threadId: asThreadId("thread-live"),
|
||||
provider: "codex",
|
||||
cwd: workspaceDir,
|
||||
runtimeMode: "full-access",
|
||||
providerOptions: {
|
||||
codex: {
|
||||
...(process.env.CODEX_BINARY_PATH
|
||||
? { binaryPath: process.env.CODEX_BINARY_PATH }
|
||||
: {}),
|
||||
...(process.env.CODEX_HOME_PATH
|
||||
? { homePath: process.env.CODEX_HOME_PATH }
|
||||
: {}),
|
||||
},
|
||||
try {
|
||||
const firstSession = await manager.startSession({
|
||||
threadId: asThreadId("thread-live"),
|
||||
provider: "codex",
|
||||
cwd: workspaceDir,
|
||||
runtimeMode: "full-access",
|
||||
providerOptions: {
|
||||
codex: {
|
||||
...(process.env.CODEX_BINARY_PATH ? { binaryPath: process.env.CODEX_BINARY_PATH } : {}),
|
||||
...(process.env.CODEX_HOME_PATH ? { homePath: process.env.CODEX_HOME_PATH } : {}),
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const firstTurn = await manager.sendTurn({
|
||||
threadId: firstSession.threadId,
|
||||
input: `Reply with exactly the word ALPHA ${randomUUID()}`,
|
||||
});
|
||||
const firstTurn = await manager.sendTurn({
|
||||
threadId: firstSession.threadId,
|
||||
input: `Reply with exactly the word ALPHA ${randomUUID()}`,
|
||||
});
|
||||
|
||||
expect(firstTurn.threadId).toBe(firstSession.threadId);
|
||||
expect(firstTurn.threadId).toBe(firstSession.threadId);
|
||||
|
||||
await vi.waitFor(async () => {
|
||||
await vi.waitFor(
|
||||
async () => {
|
||||
const snapshot = await manager.readThread(firstSession.threadId);
|
||||
expect(snapshot.turns.length).toBeGreaterThan(0);
|
||||
}, { timeout: 120_000, interval: 1_000 });
|
||||
},
|
||||
{ timeout: 120_000, interval: 1_000 },
|
||||
);
|
||||
|
||||
const firstSnapshot = await manager.readThread(firstSession.threadId);
|
||||
const originalThreadId = firstSnapshot.threadId;
|
||||
const originalTurnCount = firstSnapshot.turns.length;
|
||||
const firstSnapshot = await manager.readThread(firstSession.threadId);
|
||||
const originalThreadId = firstSnapshot.threadId;
|
||||
const originalTurnCount = firstSnapshot.turns.length;
|
||||
|
||||
manager.stopSession(firstSession.threadId);
|
||||
manager.stopSession(firstSession.threadId);
|
||||
|
||||
const resumedSession = await manager.startSession({
|
||||
threadId: firstSession.threadId,
|
||||
provider: "codex",
|
||||
cwd: workspaceDir,
|
||||
runtimeMode: "approval-required",
|
||||
resumeCursor: firstSession.resumeCursor,
|
||||
providerOptions: {
|
||||
codex: {
|
||||
...(process.env.CODEX_BINARY_PATH
|
||||
? { binaryPath: process.env.CODEX_BINARY_PATH }
|
||||
: {}),
|
||||
...(process.env.CODEX_HOME_PATH
|
||||
? { homePath: process.env.CODEX_HOME_PATH }
|
||||
: {}),
|
||||
},
|
||||
const resumedSession = await manager.startSession({
|
||||
threadId: firstSession.threadId,
|
||||
provider: "codex",
|
||||
cwd: workspaceDir,
|
||||
runtimeMode: "approval-required",
|
||||
resumeCursor: firstSession.resumeCursor,
|
||||
providerOptions: {
|
||||
codex: {
|
||||
...(process.env.CODEX_BINARY_PATH ? { binaryPath: process.env.CODEX_BINARY_PATH } : {}),
|
||||
...(process.env.CODEX_HOME_PATH ? { homePath: process.env.CODEX_HOME_PATH } : {}),
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
expect(resumedSession.threadId).toBe(originalThreadId);
|
||||
expect(resumedSession.threadId).toBe(originalThreadId);
|
||||
|
||||
const resumedSnapshotBeforeTurn = await manager.readThread(resumedSession.threadId);
|
||||
expect(resumedSnapshotBeforeTurn.threadId).toBe(originalThreadId);
|
||||
expect(resumedSnapshotBeforeTurn.turns.length).toBeGreaterThanOrEqual(originalTurnCount);
|
||||
const resumedSnapshotBeforeTurn = await manager.readThread(resumedSession.threadId);
|
||||
expect(resumedSnapshotBeforeTurn.threadId).toBe(originalThreadId);
|
||||
expect(resumedSnapshotBeforeTurn.turns.length).toBeGreaterThanOrEqual(originalTurnCount);
|
||||
|
||||
await manager.sendTurn({
|
||||
threadId: resumedSession.threadId,
|
||||
input: `Reply with exactly the word BETA ${randomUUID()}`,
|
||||
});
|
||||
await manager.sendTurn({
|
||||
threadId: resumedSession.threadId,
|
||||
input: `Reply with exactly the word BETA ${randomUUID()}`,
|
||||
});
|
||||
|
||||
await vi.waitFor(async () => {
|
||||
await vi.waitFor(
|
||||
async () => {
|
||||
const snapshot = await manager.readThread(resumedSession.threadId);
|
||||
expect(snapshot.turns.length).toBeGreaterThan(originalTurnCount);
|
||||
}, { timeout: 120_000, interval: 1_000 });
|
||||
} finally {
|
||||
manager.stopAll();
|
||||
rmSync(workspaceDir, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
180_000,
|
||||
);
|
||||
},
|
||||
{ timeout: 120_000, interval: 1_000 },
|
||||
);
|
||||
} finally {
|
||||
manager.stopAll();
|
||||
rmSync(workspaceDir, { recursive: true, force: true });
|
||||
}
|
||||
}, 180_000);
|
||||
});
|
||||
@@ -363,8 +363,7 @@ it.layer(CodexTextGenerationTestLayer)("CodexTextGenerationLive", (it) => {
|
||||
Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
const attachmentId =
|
||||
`thread-1-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
const attachmentId = `thread-1-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
const imagePath = path.join(process.cwd(), "attachments", `${attachmentId}.png`);
|
||||
yield* fs.makeDirectory(path.join(process.cwd(), "attachments"), { recursive: true });
|
||||
yield* fs.writeFile(imagePath, Buffer.from("hello"));
|
||||
@@ -392,9 +391,7 @@ it.layer(CodexTextGenerationTestLayer)("CodexTextGenerationLive", (it) => {
|
||||
}),
|
||||
),
|
||||
),
|
||||
Effect.ensuring(
|
||||
fs.remove(imagePath).pipe(Effect.catch(() => Effect.void)),
|
||||
),
|
||||
Effect.ensuring(fs.remove(imagePath).pipe(Effect.catch(() => Effect.void))),
|
||||
);
|
||||
|
||||
expect(generated.branch).toBe("fix/ui-regression");
|
||||
|
||||
@@ -105,6 +105,10 @@ const makeIsolatedGitCore = (gitService: GitServiceShape) =>
|
||||
readConfigValue: (cwd, key) => core.readConfigValue(cwd, key),
|
||||
listBranches: (input) => core.listBranches(input),
|
||||
createWorktree: (input) => core.createWorktree(input),
|
||||
fetchPullRequestBranch: (input) => core.fetchPullRequestBranch(input),
|
||||
ensureRemote: (input) => core.ensureRemote(input),
|
||||
fetchRemoteBranch: (input) => core.fetchRemoteBranch(input),
|
||||
setBranchUpstream: (input) => core.setBranchUpstream(input),
|
||||
removeWorktree: (input) => core.removeWorktree(input),
|
||||
renameBranch: (input) => core.renameBranch(input),
|
||||
createBranch: (input) => core.createBranch(input),
|
||||
@@ -149,6 +153,13 @@ function createGitWorktree(input: Parameters<GitCoreShape["createWorktree"]>[0])
|
||||
});
|
||||
}
|
||||
|
||||
function fetchGitPullRequestBranch(input: Parameters<GitCoreShape["fetchPullRequestBranch"]>[0]) {
|
||||
return Effect.gen(function* () {
|
||||
const core = yield* GitCore;
|
||||
return yield* core.fetchPullRequestBranch(input);
|
||||
});
|
||||
}
|
||||
|
||||
function removeGitWorktree(input: Parameters<GitCoreShape["removeWorktree"]>[0]) {
|
||||
return Effect.gen(function* () {
|
||||
const core = yield* GitCore;
|
||||
@@ -174,7 +185,7 @@ function pullGitBranch({ cwd }: { cwd: string }) {
|
||||
function initRepoWithCommit(
|
||||
cwd: string,
|
||||
): Effect.Effect<
|
||||
void,
|
||||
{ initialBranch: string },
|
||||
GitCommandError | PlatformError.PlatformError,
|
||||
GitCore | GitService | FileSystem.FileSystem
|
||||
> {
|
||||
@@ -185,6 +196,8 @@ function initRepoWithCommit(
|
||||
yield* writeTextFile(path.join(cwd, "README.md"), "# test\n");
|
||||
yield* git(cwd, ["add", "."]);
|
||||
yield* git(cwd, ["commit", "-m", "initial commit"]);
|
||||
const initialBranch = yield* git(cwd, ["branch", "--show-current"]);
|
||||
return { initialBranch };
|
||||
});
|
||||
}
|
||||
|
||||
@@ -247,6 +260,7 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
yield* initRepoWithCommit(tmp);
|
||||
const result = yield* listGitBranches({ cwd: tmp });
|
||||
expect(result.isRepo).toBe(true);
|
||||
expect(result.hasOriginRemote).toBe(false);
|
||||
expect(result.branches.length).toBeGreaterThanOrEqual(1);
|
||||
}),
|
||||
);
|
||||
@@ -260,6 +274,7 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
const tmp = yield* makeTmpDir();
|
||||
const result = yield* listGitBranches({ cwd: tmp });
|
||||
expect(result.isRepo).toBe(false);
|
||||
expect(result.hasOriginRemote).toBe(false);
|
||||
expect(result.branches).toEqual([]);
|
||||
}),
|
||||
);
|
||||
@@ -418,6 +433,7 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
const result = yield* listGitBranches({ cwd: tmp });
|
||||
const firstRemoteIndex = result.branches.findIndex((branch) => branch.isRemote);
|
||||
|
||||
expect(result.hasOriginRemote).toBe(true);
|
||||
expect(firstRemoteIndex).toBeGreaterThan(0);
|
||||
expect(result.branches.slice(0, firstRemoteIndex).every((branch) => !branch.isRemote)).toBe(
|
||||
true,
|
||||
@@ -426,7 +442,9 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
true,
|
||||
);
|
||||
expect(
|
||||
result.branches.some((branch) => branch.name === "feature/local-only" && !branch.isRemote),
|
||||
result.branches.some(
|
||||
(branch) => branch.name === "feature/local-only" && !branch.isRemote,
|
||||
),
|
||||
).toBe(true);
|
||||
expect(
|
||||
result.branches.some(
|
||||
@@ -689,29 +707,27 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect(
|
||||
"does not silently checkout a local branch when a remote ref no longer exists",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const remote = yield* makeTmpDir();
|
||||
const source = yield* makeTmpDir();
|
||||
yield* git(remote, ["init", "--bare"]);
|
||||
it.effect("does not silently checkout a local branch when a remote ref no longer exists", () =>
|
||||
Effect.gen(function* () {
|
||||
const remote = yield* makeTmpDir();
|
||||
const source = yield* makeTmpDir();
|
||||
yield* git(remote, ["init", "--bare"]);
|
||||
|
||||
yield* initRepoWithCommit(source);
|
||||
const defaultBranch = (yield* listGitBranches({ cwd: source })).branches.find(
|
||||
(branch) => branch.current,
|
||||
)!.name;
|
||||
yield* git(source, ["remote", "add", "origin", remote]);
|
||||
yield* git(source, ["push", "-u", "origin", defaultBranch]);
|
||||
yield* initRepoWithCommit(source);
|
||||
const defaultBranch = (yield* listGitBranches({ cwd: source })).branches.find(
|
||||
(branch) => branch.current,
|
||||
)!.name;
|
||||
yield* git(source, ["remote", "add", "origin", remote]);
|
||||
yield* git(source, ["push", "-u", "origin", defaultBranch]);
|
||||
|
||||
yield* createGitBranch({ cwd: source, branch: "feature" });
|
||||
yield* createGitBranch({ cwd: source, branch: "feature" });
|
||||
|
||||
const checkoutResult = yield* Effect.result(
|
||||
checkoutGitBranch({ cwd: source, branch: "origin/feature" }),
|
||||
);
|
||||
expect(checkoutResult._tag).toBe("Failure");
|
||||
expect(yield* git(source, ["branch", "--show-current"])).toBe(defaultBranch);
|
||||
}),
|
||||
const checkoutResult = yield* Effect.result(
|
||||
checkoutGitBranch({ cwd: source, branch: "origin/feature" }),
|
||||
);
|
||||
expect(checkoutResult._tag).toBe("Failure");
|
||||
expect(yield* git(source, ["branch", "--show-current"])).toBe(defaultBranch);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("checks out a remote tracking branch when remote name contains slashes", () =>
|
||||
@@ -940,13 +956,7 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
});
|
||||
|
||||
expect(renamed.branch).toBe("feature/new-name");
|
||||
expect(renameArgs).toEqual([
|
||||
"branch",
|
||||
"-m",
|
||||
"--",
|
||||
"feature/old-name",
|
||||
"feature/new-name",
|
||||
]);
|
||||
expect(renameArgs).toEqual(["branch", "-m", "--", "feature/old-name", "feature/new-name"]);
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -1006,6 +1016,28 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("creates a worktree for an existing branch when newBranch is omitted", () =>
|
||||
Effect.gen(function* () {
|
||||
const tmp = yield* makeTmpDir();
|
||||
yield* initRepoWithCommit(tmp);
|
||||
yield* createGitBranch({ cwd: tmp, branch: "feature/existing-worktree" });
|
||||
|
||||
const wtPath = path.join(tmp, "wt-existing");
|
||||
const result = yield* createGitWorktree({
|
||||
cwd: tmp,
|
||||
branch: "feature/existing-worktree",
|
||||
path: wtPath,
|
||||
});
|
||||
|
||||
expect(result.worktree.path).toBe(wtPath);
|
||||
expect(result.worktree.branch).toBe("feature/existing-worktree");
|
||||
const branchOutput = yield* git(wtPath, ["branch", "--show-current"]);
|
||||
expect(branchOutput).toBe("feature/existing-worktree");
|
||||
|
||||
yield* removeGitWorktree({ cwd: tmp, path: wtPath });
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("throws when new branch name already exists", () =>
|
||||
Effect.gen(function* () {
|
||||
const tmp = yield* makeTmpDir();
|
||||
@@ -1168,6 +1200,37 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
);
|
||||
});
|
||||
|
||||
describe("fetchPullRequestBranch", () => {
|
||||
it.effect("fetches a GitHub pull request ref into a local branch without checkout", () =>
|
||||
Effect.gen(function* () {
|
||||
const tmp = yield* makeTmpDir();
|
||||
const { initialBranch } = yield* initRepoWithCommit(tmp);
|
||||
const remoteDir = yield* makeTmpDir("git-remote-");
|
||||
yield* git(remoteDir, ["init", "--bare"]);
|
||||
yield* git(tmp, ["remote", "add", "origin", remoteDir]);
|
||||
yield* git(tmp, ["push", "-u", "origin", initialBranch]);
|
||||
yield* git(tmp, ["checkout", "-b", "feature/pr-fetch"]);
|
||||
yield* writeTextFile(path.join(tmp, "pr-fetch.txt"), "fetch me\n");
|
||||
yield* git(tmp, ["add", "pr-fetch.txt"]);
|
||||
yield* git(tmp, ["commit", "-m", "Add PR fetch branch"]);
|
||||
yield* git(tmp, ["push", "-u", "origin", "feature/pr-fetch"]);
|
||||
yield* git(tmp, ["push", "origin", "HEAD:refs/pull/55/head"]);
|
||||
yield* git(tmp, ["checkout", initialBranch]);
|
||||
|
||||
yield* fetchGitPullRequestBranch({
|
||||
cwd: tmp,
|
||||
prNumber: 55,
|
||||
branch: "feature/pr-fetch",
|
||||
});
|
||||
|
||||
const localBranches = yield* git(tmp, ["branch", "--list", "feature/pr-fetch"]);
|
||||
expect(localBranches).toContain("feature/pr-fetch");
|
||||
const currentBranch = yield* git(tmp, ["branch", "--show-current"]);
|
||||
expect(currentBranch).toBe(initialBranch);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
// ── Full flow: thread switching simulation ──
|
||||
|
||||
describe("full flow: thread switching (checkout toggling)", () => {
|
||||
@@ -1257,6 +1320,27 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect(
|
||||
"reuses an existing remote when the target URL only differs by a trailing slash after .git",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const tmp = yield* makeTmpDir();
|
||||
yield* initRepoWithCommit(tmp);
|
||||
const core = yield* GitCore;
|
||||
|
||||
yield* git(tmp, ["remote", "add", "origin", "[email protected]:pingdotgg/t3code.git"]);
|
||||
|
||||
const remoteName = yield* core.ensureRemote({
|
||||
cwd: tmp,
|
||||
preferredName: "origin",
|
||||
url: "[email protected]:pingdotgg/t3code.git/",
|
||||
});
|
||||
|
||||
expect(remoteName).toBe("origin");
|
||||
expect((yield* git(tmp, ["remote"])).split("\n").filter(Boolean)).toEqual(["origin"]);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("reports status details and dirty state", () =>
|
||||
Effect.gen(function* () {
|
||||
const tmp = yield* makeTmpDir();
|
||||
@@ -1325,6 +1409,44 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect(
|
||||
"computes ahead count against a non-origin remote-prefixed gh-merge-base candidate",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const remote = yield* makeTmpDir();
|
||||
const source = yield* makeTmpDir();
|
||||
const remoteName = "fork-seed";
|
||||
yield* git(remote, ["init", "--bare"]);
|
||||
|
||||
yield* initRepoWithCommit(source);
|
||||
const initialBranch = (yield* listGitBranches({ cwd: source })).branches.find(
|
||||
(branch) => branch.current,
|
||||
)!.name;
|
||||
yield* git(source, ["remote", "add", remoteName, remote]);
|
||||
yield* git(source, ["push", "-u", remoteName, initialBranch]);
|
||||
yield* git(source, ["checkout", "-b", "feature/non-origin-merge-base"]);
|
||||
yield* git(source, [
|
||||
"config",
|
||||
"branch.feature/non-origin-merge-base.gh-merge-base",
|
||||
`${remoteName}/${initialBranch}`,
|
||||
]);
|
||||
yield* writeTextFile(
|
||||
path.join(source, "feature.txt"),
|
||||
`ahead of ${remoteName}/${initialBranch}\n`,
|
||||
);
|
||||
yield* git(source, ["add", "feature.txt"]);
|
||||
yield* git(source, ["commit", "-m", "feature commit"]);
|
||||
yield* git(source, ["branch", "-D", initialBranch]);
|
||||
|
||||
const core = yield* GitCore;
|
||||
const details = yield* core.statusDetails(source);
|
||||
expect(details.branch).toBe("feature/non-origin-merge-base");
|
||||
expect(details.hasUpstream).toBe(false);
|
||||
expect(details.aheadCount).toBe(1);
|
||||
expect(details.behindCount).toBe(0);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("skips push when no upstream is configured and branch is not ahead of base", () =>
|
||||
Effect.gen(function* () {
|
||||
const tmp = yield* makeTmpDir();
|
||||
@@ -1366,6 +1488,31 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("pushes with upstream setup to the only configured non-origin remote", () =>
|
||||
Effect.gen(function* () {
|
||||
const tmp = yield* makeTmpDir();
|
||||
const remote = yield* makeTmpDir();
|
||||
yield* git(tmp, ["init", "--initial-branch=main"]);
|
||||
yield* git(tmp, ["config", "user.email", "[email protected]"]);
|
||||
yield* git(tmp, ["config", "user.name", "Test"]);
|
||||
yield* writeTextFile(path.join(tmp, "README.md"), "hello\n");
|
||||
yield* git(tmp, ["add", "README.md"]);
|
||||
yield* git(tmp, ["commit", "-m", "initial"]);
|
||||
yield* git(remote, ["init", "--bare"]);
|
||||
yield* git(tmp, ["remote", "add", "fork", remote]);
|
||||
yield* git(tmp, ["checkout", "-b", "feature/fork-only"]);
|
||||
|
||||
const core = yield* GitCore;
|
||||
const pushed = yield* core.pushCurrentBranch(tmp, null);
|
||||
expect(pushed.status).toBe("pushed");
|
||||
expect(pushed.setUpstream).toBe(true);
|
||||
expect(pushed.upstreamBranch).toBe("fork/feature/fork-only");
|
||||
expect(yield* git(tmp, ["rev-parse", "--abbrev-ref", "@{upstream}"])).toBe(
|
||||
"fork/feature/fork-only",
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect(
|
||||
"pushes with upstream setup when comparable base exists but remote branch is missing",
|
||||
() =>
|
||||
@@ -1402,6 +1549,90 @@ it.layer(TestLayer)("git integration", (it) => {
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("prefers branch pushRemote over origin when setting upstream", () =>
|
||||
Effect.gen(function* () {
|
||||
const tmp = yield* makeTmpDir();
|
||||
const origin = yield* makeTmpDir();
|
||||
const fork = yield* makeTmpDir();
|
||||
yield* git(origin, ["init", "--bare"]);
|
||||
yield* git(fork, ["init", "--bare"]);
|
||||
|
||||
yield* initRepoWithCommit(tmp);
|
||||
const initialBranch = (yield* listGitBranches({ cwd: tmp })).branches.find(
|
||||
(branch) => branch.current,
|
||||
)!.name;
|
||||
yield* git(tmp, ["remote", "add", "origin", origin]);
|
||||
yield* git(tmp, ["remote", "add", "fork", fork]);
|
||||
yield* git(tmp, ["push", "-u", "origin", initialBranch]);
|
||||
|
||||
const featureBranch = "feature/push-remote";
|
||||
yield* git(tmp, ["checkout", "-b", featureBranch]);
|
||||
yield* git(tmp, ["config", `branch.${featureBranch}.pushRemote`, "fork"]);
|
||||
yield* writeTextFile(path.join(tmp, "feature.txt"), "push to fork\n");
|
||||
yield* git(tmp, ["add", "feature.txt"]);
|
||||
yield* git(tmp, ["commit", "-m", "feature commit"]);
|
||||
|
||||
const core = yield* GitCore;
|
||||
const pushed = yield* core.pushCurrentBranch(tmp, null);
|
||||
expect(pushed.status).toBe("pushed");
|
||||
expect(pushed.setUpstream).toBe(true);
|
||||
expect(pushed.upstreamBranch).toBe(`fork/${featureBranch}`);
|
||||
expect(yield* git(tmp, ["rev-parse", "--abbrev-ref", "@{upstream}"])).toBe(
|
||||
`fork/${featureBranch}`,
|
||||
);
|
||||
expect(yield* git(tmp, ["ls-remote", "--heads", "fork", featureBranch])).toContain(
|
||||
featureBranch,
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect(
|
||||
"pushes renamed PR worktree branches to their tracked upstream branch even when push.default is current",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const tmp = yield* makeTmpDir();
|
||||
const fork = yield* makeTmpDir();
|
||||
yield* git(fork, ["init", "--bare"]);
|
||||
|
||||
const { initialBranch } = yield* initRepoWithCommit(tmp);
|
||||
yield* git(tmp, ["remote", "add", "jasonLaster", fork]);
|
||||
yield* git(tmp, ["checkout", "-b", "statemachine"]);
|
||||
yield* writeTextFile(path.join(tmp, "fork.txt"), "fork branch\n");
|
||||
yield* git(tmp, ["add", "fork.txt"]);
|
||||
yield* git(tmp, ["commit", "-m", "fork branch"]);
|
||||
yield* git(tmp, ["push", "-u", "jasonLaster", "statemachine"]);
|
||||
yield* git(tmp, ["checkout", initialBranch]);
|
||||
yield* git(tmp, ["branch", "-D", "statemachine"]);
|
||||
yield* git(tmp, [
|
||||
"checkout",
|
||||
"-b",
|
||||
"t3code/pr-488/statemachine",
|
||||
"--track",
|
||||
"jasonLaster/statemachine",
|
||||
]);
|
||||
yield* git(tmp, ["config", "push.default", "current"]);
|
||||
yield* writeTextFile(path.join(tmp, "fork.txt"), "updated fork branch\n");
|
||||
yield* git(tmp, ["add", "fork.txt"]);
|
||||
yield* git(tmp, ["commit", "-m", "update reviewed PR branch"]);
|
||||
|
||||
const core = yield* GitCore;
|
||||
const pushed = yield* core.pushCurrentBranch(tmp, null);
|
||||
|
||||
expect(pushed.status).toBe("pushed");
|
||||
expect(pushed.setUpstream).toBe(false);
|
||||
expect(pushed.upstreamBranch).toBe("jasonLaster/statemachine");
|
||||
expect(yield* git(tmp, ["rev-parse", "--abbrev-ref", "@{upstream}"])).toBe(
|
||||
"jasonLaster/statemachine",
|
||||
);
|
||||
expect(
|
||||
yield* git(tmp, ["ls-remote", "--heads", "jasonLaster", "statemachine"]),
|
||||
).toContain("statemachine");
|
||||
expect(
|
||||
yield* git(tmp, ["ls-remote", "--heads", "jasonLaster", "t3code/pr-488/statemachine"]),
|
||||
).toBe("");
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("includes command context when worktree removal fails", () =>
|
||||
Effect.gen(function* () {
|
||||
const tmp = yield* makeTmpDir();
|
||||
|
||||
@@ -100,6 +100,38 @@ function parseRemoteNames(stdout: string): ReadonlyArray<string> {
|
||||
.toSorted((a, b) => b.length - a.length);
|
||||
}
|
||||
|
||||
function sanitizeRemoteName(value: string): string {
|
||||
const sanitized = value
|
||||
.trim()
|
||||
.replace(/[^A-Za-z0-9._-]+/g, "-")
|
||||
.replace(/^-+|-+$/g, "");
|
||||
return sanitized.length > 0 ? sanitized : "fork";
|
||||
}
|
||||
|
||||
function normalizeRemoteUrl(value: string): string {
|
||||
return value
|
||||
.trim()
|
||||
.replace(/\/+$/g, "")
|
||||
.replace(/\.git$/i, "")
|
||||
.toLowerCase();
|
||||
}
|
||||
|
||||
function parseRemoteFetchUrls(stdout: string): Map<string, string> {
|
||||
const remotes = new Map<string, string>();
|
||||
for (const line of stdout.split("\n")) {
|
||||
const trimmed = line.trim();
|
||||
if (trimmed.length === 0) continue;
|
||||
const match = /^(\S+)\s+(\S+)\s+\((fetch|push)\)$/.exec(trimmed);
|
||||
if (!match) continue;
|
||||
const [, remoteName = "", remoteUrl = "", direction = ""] = match;
|
||||
if (direction !== "fetch" || remoteName.length === 0 || remoteUrl.length === 0) {
|
||||
continue;
|
||||
}
|
||||
remotes.set(remoteName, remoteUrl);
|
||||
}
|
||||
return remotes;
|
||||
}
|
||||
|
||||
function parseRemoteRefWithRemoteNames(
|
||||
branchName: string,
|
||||
remoteNames: ReadonlyArray<string>,
|
||||
@@ -159,9 +191,9 @@ function commandLabel(args: readonly string[]): string {
|
||||
return `git ${args.join(" ")}`;
|
||||
}
|
||||
|
||||
function parseDefaultBranchFromRemoteHeadRef(value: string): string | null {
|
||||
function parseDefaultBranchFromRemoteHeadRef(value: string, remoteName: string): string | null {
|
||||
const trimmed = value.trim();
|
||||
const prefix = "refs/remotes/origin/";
|
||||
const prefix = `refs/remotes/${remoteName}/`;
|
||||
if (!trimmed.startsWith(prefix)) {
|
||||
return null;
|
||||
}
|
||||
@@ -385,29 +417,33 @@ const makeGitCore = Effect.gen(function* () {
|
||||
yield* fetchUpstreamRef(cwd, upstream);
|
||||
});
|
||||
|
||||
const resolveDefaultBranchName = (cwd: string): Effect.Effect<string | null, GitCommandError> =>
|
||||
const resolveDefaultBranchName = (
|
||||
cwd: string,
|
||||
remoteName: string,
|
||||
): Effect.Effect<string | null, GitCommandError> =>
|
||||
executeGit(
|
||||
"GitCore.resolveDefaultBranchName",
|
||||
cwd,
|
||||
["symbolic-ref", "refs/remotes/origin/HEAD"],
|
||||
["symbolic-ref", `refs/remotes/${remoteName}/HEAD`],
|
||||
{ allowNonZeroExit: true },
|
||||
).pipe(
|
||||
Effect.map((result) => {
|
||||
if (result.code !== 0) {
|
||||
return null;
|
||||
}
|
||||
return parseDefaultBranchFromRemoteHeadRef(result.stdout);
|
||||
return parseDefaultBranchFromRemoteHeadRef(result.stdout, remoteName);
|
||||
}),
|
||||
);
|
||||
|
||||
const remoteBranchExists = (
|
||||
cwd: string,
|
||||
remoteName: string,
|
||||
branch: string,
|
||||
): Effect.Effect<boolean, GitCommandError> =>
|
||||
executeGit(
|
||||
"GitCore.remoteBranchExists",
|
||||
cwd,
|
||||
["show-ref", "--verify", "--quiet", `refs/remotes/origin/${branch}`],
|
||||
["show-ref", "--verify", "--quiet", `refs/remotes/${remoteName}/${branch}`],
|
||||
{
|
||||
allowNonZeroExit: true,
|
||||
},
|
||||
@@ -418,6 +454,89 @@ const makeGitCore = Effect.gen(function* () {
|
||||
allowNonZeroExit: true,
|
||||
}).pipe(Effect.map((result) => result.code === 0));
|
||||
|
||||
const listRemoteNames = (cwd: string): Effect.Effect<ReadonlyArray<string>, GitCommandError> =>
|
||||
runGitStdout("GitCore.listRemoteNames", cwd, ["remote"]).pipe(
|
||||
Effect.map((stdout) => parseRemoteNames(stdout).toReversed()),
|
||||
);
|
||||
|
||||
const resolvePrimaryRemoteName = (cwd: string): Effect.Effect<string, GitCommandError> =>
|
||||
Effect.gen(function* () {
|
||||
if (yield* originRemoteExists(cwd)) {
|
||||
return "origin";
|
||||
}
|
||||
const remotes = yield* listRemoteNames(cwd);
|
||||
const [firstRemote] = remotes;
|
||||
if (firstRemote) {
|
||||
return firstRemote;
|
||||
}
|
||||
return yield* createGitCommandError(
|
||||
"GitCore.resolvePrimaryRemoteName",
|
||||
cwd,
|
||||
["remote"],
|
||||
"No git remote is configured for this repository.",
|
||||
);
|
||||
});
|
||||
|
||||
const resolvePushRemoteName = (
|
||||
cwd: string,
|
||||
branch: string,
|
||||
): Effect.Effect<string | null, GitCommandError> =>
|
||||
Effect.gen(function* () {
|
||||
const branchPushRemote = yield* runGitStdout(
|
||||
"GitCore.resolvePushRemoteName.branchPushRemote",
|
||||
cwd,
|
||||
["config", "--get", `branch.${branch}.pushRemote`],
|
||||
true,
|
||||
).pipe(Effect.map((stdout) => stdout.trim()));
|
||||
if (branchPushRemote.length > 0) {
|
||||
return branchPushRemote;
|
||||
}
|
||||
|
||||
const pushDefaultRemote = yield* runGitStdout(
|
||||
"GitCore.resolvePushRemoteName.remotePushDefault",
|
||||
cwd,
|
||||
["config", "--get", "remote.pushDefault"],
|
||||
true,
|
||||
).pipe(Effect.map((stdout) => stdout.trim()));
|
||||
if (pushDefaultRemote.length > 0) {
|
||||
return pushDefaultRemote;
|
||||
}
|
||||
|
||||
return yield* resolvePrimaryRemoteName(cwd).pipe(Effect.catch(() => Effect.succeed(null)));
|
||||
});
|
||||
|
||||
const ensureRemote: GitCoreShape["ensureRemote"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
const preferredName = sanitizeRemoteName(input.preferredName);
|
||||
const normalizedTargetUrl = normalizeRemoteUrl(input.url);
|
||||
const remoteFetchUrls = yield* runGitStdout(
|
||||
"GitCore.ensureRemote.listRemoteUrls",
|
||||
input.cwd,
|
||||
["remote", "-v"],
|
||||
).pipe(Effect.map((stdout) => parseRemoteFetchUrls(stdout)));
|
||||
|
||||
for (const [remoteName, remoteUrl] of remoteFetchUrls.entries()) {
|
||||
if (normalizeRemoteUrl(remoteUrl) === normalizedTargetUrl) {
|
||||
return remoteName;
|
||||
}
|
||||
}
|
||||
|
||||
let remoteName = preferredName;
|
||||
let suffix = 1;
|
||||
while (remoteFetchUrls.has(remoteName)) {
|
||||
remoteName = `${preferredName}-${suffix}`;
|
||||
suffix += 1;
|
||||
}
|
||||
|
||||
yield* runGit("GitCore.ensureRemote.add", input.cwd, [
|
||||
"remote",
|
||||
"add",
|
||||
remoteName,
|
||||
input.url,
|
||||
]);
|
||||
return remoteName;
|
||||
});
|
||||
|
||||
const resolveBaseBranchForNoUpstream = (
|
||||
cwd: string,
|
||||
branch: string,
|
||||
@@ -430,7 +549,11 @@ const makeGitCore = Effect.gen(function* () {
|
||||
true,
|
||||
).pipe(Effect.map((stdout) => stdout.trim()));
|
||||
|
||||
const defaultBranch = yield* resolveDefaultBranchName(cwd);
|
||||
const primaryRemoteName = yield* resolvePrimaryRemoteName(cwd).pipe(
|
||||
Effect.catch(() => Effect.succeed(null)),
|
||||
);
|
||||
const defaultBranch =
|
||||
primaryRemoteName === null ? null : yield* resolveDefaultBranchName(cwd, primaryRemoteName);
|
||||
const candidates = [
|
||||
configuredBaseBranch.length > 0 ? configuredBaseBranch : null,
|
||||
defaultBranch,
|
||||
@@ -442,9 +565,13 @@ const makeGitCore = Effect.gen(function* () {
|
||||
continue;
|
||||
}
|
||||
|
||||
const remotePrefix =
|
||||
primaryRemoteName && primaryRemoteName !== "origin" ? `${primaryRemoteName}/` : null;
|
||||
const normalizedCandidate = candidate.startsWith("origin/")
|
||||
? candidate.slice("origin/".length)
|
||||
: candidate;
|
||||
: remotePrefix && candidate.startsWith(remotePrefix)
|
||||
? candidate.slice(remotePrefix.length)
|
||||
: candidate;
|
||||
if (normalizedCandidate.length === 0 || normalizedCandidate === branch) {
|
||||
continue;
|
||||
}
|
||||
@@ -453,8 +580,11 @@ const makeGitCore = Effect.gen(function* () {
|
||||
return normalizedCandidate;
|
||||
}
|
||||
|
||||
if (yield* remoteBranchExists(cwd, normalizedCandidate)) {
|
||||
return `origin/${normalizedCandidate}`;
|
||||
if (
|
||||
primaryRemoteName &&
|
||||
(yield* remoteBranchExists(cwd, primaryRemoteName, normalizedCandidate))
|
||||
) {
|
||||
return `${primaryRemoteName}/${normalizedCandidate}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,7 +654,7 @@ const makeGitCore = Effect.gen(function* () {
|
||||
|
||||
const statusDetails: GitCoreShape["statusDetails"] = (cwd) =>
|
||||
Effect.gen(function* () {
|
||||
yield* refreshStatusUpstreamIfStale(cwd).pipe(Effect.catch(() => Effect.void));
|
||||
yield* refreshStatusUpstreamIfStale(cwd).pipe(Effect.ignoreCause({ log: true }));
|
||||
|
||||
const [statusStdout, unstagedNumstatStdout, stagedNumstatStdout] = yield* Effect.all(
|
||||
[
|
||||
@@ -705,17 +835,17 @@ const makeGitCore = Effect.gen(function* () {
|
||||
Effect.catch(() => Effect.succeed(null)),
|
||||
);
|
||||
if (comparableBaseBranch) {
|
||||
const hasOriginRemote = yield* originRemoteExists(cwd).pipe(
|
||||
Effect.catch(() => Effect.succeed(false)),
|
||||
const publishRemoteName = yield* resolvePushRemoteName(cwd, branch).pipe(
|
||||
Effect.catch(() => Effect.succeed(null)),
|
||||
);
|
||||
if (!hasOriginRemote) {
|
||||
if (!publishRemoteName) {
|
||||
return {
|
||||
status: "skipped_up_to_date" as const,
|
||||
branch,
|
||||
};
|
||||
}
|
||||
|
||||
const hasRemoteBranch = yield* remoteBranchExists(cwd, branch).pipe(
|
||||
const hasRemoteBranch = yield* remoteBranchExists(cwd, publishRemoteName, branch).pipe(
|
||||
Effect.catch(() => Effect.succeed(false)),
|
||||
);
|
||||
if (hasRemoteBranch) {
|
||||
@@ -728,20 +858,46 @@ const makeGitCore = Effect.gen(function* () {
|
||||
}
|
||||
|
||||
if (!details.hasUpstream) {
|
||||
const publishRemoteName = yield* resolvePushRemoteName(cwd, branch);
|
||||
if (!publishRemoteName) {
|
||||
return yield* createGitCommandError(
|
||||
"GitCore.pushCurrentBranch",
|
||||
cwd,
|
||||
["push"],
|
||||
"Cannot push because no git remote is configured for this repository.",
|
||||
);
|
||||
}
|
||||
yield* runGit("GitCore.pushCurrentBranch.pushWithUpstream", cwd, [
|
||||
"push",
|
||||
"-u",
|
||||
"origin",
|
||||
publishRemoteName,
|
||||
branch,
|
||||
]);
|
||||
return {
|
||||
status: "pushed" as const,
|
||||
branch,
|
||||
upstreamBranch: `origin/${branch}`,
|
||||
upstreamBranch: `${publishRemoteName}/${branch}`,
|
||||
setUpstream: true,
|
||||
};
|
||||
}
|
||||
|
||||
const currentUpstream = yield* resolveCurrentUpstream(cwd).pipe(
|
||||
Effect.catch(() => Effect.succeed(null)),
|
||||
);
|
||||
if (currentUpstream) {
|
||||
yield* runGit("GitCore.pushCurrentBranch.pushUpstream", cwd, [
|
||||
"push",
|
||||
currentUpstream.remoteName,
|
||||
`HEAD:${currentUpstream.upstreamBranch}`,
|
||||
]);
|
||||
return {
|
||||
status: "pushed" as const,
|
||||
branch,
|
||||
upstreamBranch: currentUpstream.upstreamRef,
|
||||
setUpstream: false,
|
||||
};
|
||||
}
|
||||
|
||||
yield* runGit("GitCore.pushCurrentBranch.push", cwd, ["push"]);
|
||||
return {
|
||||
status: "pushed" as const,
|
||||
@@ -844,7 +1000,7 @@ const makeGitCore = Effect.gen(function* () {
|
||||
if (localBranchResult.code !== 0) {
|
||||
const stderr = localBranchResult.stderr.trim();
|
||||
if (stderr.toLowerCase().includes("not a git repository")) {
|
||||
return { branches: [], isRepo: false };
|
||||
return { branches: [], isRepo: false, hasOriginRemote: false };
|
||||
}
|
||||
return yield* createGitCommandError(
|
||||
"GitCore.listBranches",
|
||||
@@ -1010,34 +1166,81 @@ const makeGitCore = Effect.gen(function* () {
|
||||
|
||||
const branches = [...localBranches, ...remoteBranches];
|
||||
|
||||
return { branches, isRepo: true };
|
||||
return { branches, isRepo: true, hasOriginRemote: remoteNames.includes("origin") };
|
||||
});
|
||||
|
||||
const createWorktree: GitCoreShape["createWorktree"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
const sanitizedBranch = input.newBranch.replace(/\//g, "-");
|
||||
const targetBranch = input.newBranch ?? input.branch;
|
||||
const sanitizedBranch = targetBranch.replace(/\//g, "-");
|
||||
const repoName = path.basename(input.cwd);
|
||||
const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? "/tmp";
|
||||
const worktreePath =
|
||||
input.path ?? path.join(homeDir, ".t3", "worktrees", repoName, sanitizedBranch);
|
||||
const args = input.newBranch
|
||||
? ["worktree", "add", "-b", input.newBranch, worktreePath, input.branch]
|
||||
: ["worktree", "add", worktreePath, input.branch];
|
||||
|
||||
yield* executeGit(
|
||||
"GitCore.createWorktree",
|
||||
input.cwd,
|
||||
["worktree", "add", "-b", input.newBranch, worktreePath, input.branch],
|
||||
{
|
||||
fallbackErrorMessage: "git worktree add failed",
|
||||
},
|
||||
);
|
||||
yield* executeGit("GitCore.createWorktree", input.cwd, args, {
|
||||
fallbackErrorMessage: "git worktree add failed",
|
||||
});
|
||||
|
||||
return {
|
||||
worktree: {
|
||||
path: worktreePath,
|
||||
branch: input.newBranch,
|
||||
branch: targetBranch,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const fetchPullRequestBranch: GitCoreShape["fetchPullRequestBranch"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
const remoteName = yield* resolvePrimaryRemoteName(input.cwd);
|
||||
yield* executeGit(
|
||||
"GitCore.fetchPullRequestBranch",
|
||||
input.cwd,
|
||||
[
|
||||
"fetch",
|
||||
"--quiet",
|
||||
"--no-tags",
|
||||
remoteName,
|
||||
`+refs/pull/${input.prNumber}/head:refs/heads/${input.branch}`,
|
||||
],
|
||||
{
|
||||
fallbackErrorMessage: "git fetch pull request branch failed",
|
||||
},
|
||||
);
|
||||
}).pipe(Effect.asVoid);
|
||||
|
||||
const fetchRemoteBranch: GitCoreShape["fetchRemoteBranch"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
yield* runGit("GitCore.fetchRemoteBranch.fetch", input.cwd, [
|
||||
"fetch",
|
||||
"--quiet",
|
||||
"--no-tags",
|
||||
input.remoteName,
|
||||
`+refs/heads/${input.remoteBranch}:refs/remotes/${input.remoteName}/${input.remoteBranch}`,
|
||||
]);
|
||||
|
||||
const localBranchAlreadyExists = yield* branchExists(input.cwd, input.localBranch);
|
||||
const targetRef = `${input.remoteName}/${input.remoteBranch}`;
|
||||
yield* runGit(
|
||||
"GitCore.fetchRemoteBranch.materialize",
|
||||
input.cwd,
|
||||
localBranchAlreadyExists
|
||||
? ["branch", "--force", input.localBranch, targetRef]
|
||||
: ["branch", input.localBranch, targetRef],
|
||||
);
|
||||
}).pipe(Effect.asVoid);
|
||||
|
||||
const setBranchUpstream: GitCoreShape["setBranchUpstream"] = (input) =>
|
||||
runGit("GitCore.setBranchUpstream", input.cwd, [
|
||||
"branch",
|
||||
"--set-upstream-to",
|
||||
`${input.remoteName}/${input.remoteBranch}`,
|
||||
input.branch,
|
||||
]);
|
||||
|
||||
const removeWorktree: GitCoreShape["removeWorktree"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
const args = ["worktree", "remove"];
|
||||
@@ -1162,7 +1365,7 @@ const makeGitCore = Effect.gen(function* () {
|
||||
|
||||
// Refresh upstream refs in the background so checkout remains responsive.
|
||||
yield* Effect.forkScoped(
|
||||
refreshCheckedOutBranchUpstream(input.cwd).pipe(Effect.catch(() => Effect.void)),
|
||||
refreshCheckedOutBranchUpstream(input.cwd).pipe(Effect.ignoreCause({ log: true })),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1197,6 +1400,10 @@ const makeGitCore = Effect.gen(function* () {
|
||||
readConfigValue,
|
||||
listBranches,
|
||||
createWorktree,
|
||||
fetchPullRequestBranch,
|
||||
ensureRemote,
|
||||
fetchRemoteBranch,
|
||||
setBranchUpstream,
|
||||
removeWorktree,
|
||||
renameBranch,
|
||||
createBranch,
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { Effect } from "effect";
|
||||
import { afterEach, expect, vi } from "vitest";
|
||||
|
||||
vi.mock("../../processRunner", () => ({
|
||||
runProcess: vi.fn(),
|
||||
}));
|
||||
|
||||
import { runProcess } from "../../processRunner";
|
||||
import { GitHubCli } from "../Services/GitHubCli.ts";
|
||||
import { GitHubCliLive } from "./GitHubCli.ts";
|
||||
|
||||
const mockedRunProcess = vi.mocked(runProcess);
|
||||
const layer = it.layer(GitHubCliLive);
|
||||
|
||||
afterEach(() => {
|
||||
mockedRunProcess.mockReset();
|
||||
});
|
||||
|
||||
layer("GitHubCliLive", (it) => {
|
||||
it.effect("parses pull request view output", () =>
|
||||
Effect.gen(function* () {
|
||||
mockedRunProcess.mockResolvedValueOnce({
|
||||
stdout: JSON.stringify({
|
||||
number: 42,
|
||||
title: "Add PR thread creation",
|
||||
url: "https://github.com/pingdotgg/codething-mvp/pull/42",
|
||||
baseRefName: "main",
|
||||
headRefName: "feature/pr-threads",
|
||||
state: "OPEN",
|
||||
mergedAt: null,
|
||||
isCrossRepository: true,
|
||||
headRepository: {
|
||||
nameWithOwner: "octocat/codething-mvp",
|
||||
},
|
||||
headRepositoryOwner: {
|
||||
login: "octocat",
|
||||
},
|
||||
}),
|
||||
stderr: "",
|
||||
code: 0,
|
||||
signal: null,
|
||||
timedOut: false,
|
||||
});
|
||||
|
||||
const result = yield* Effect.gen(function* () {
|
||||
const gh = yield* GitHubCli;
|
||||
return yield* gh.getPullRequest({
|
||||
cwd: "/repo",
|
||||
reference: "#42",
|
||||
});
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(result, {
|
||||
number: 42,
|
||||
title: "Add PR thread creation",
|
||||
url: "https://github.com/pingdotgg/codething-mvp/pull/42",
|
||||
baseRefName: "main",
|
||||
headRefName: "feature/pr-threads",
|
||||
state: "open",
|
||||
isCrossRepository: true,
|
||||
headRepositoryNameWithOwner: "octocat/codething-mvp",
|
||||
headRepositoryOwnerLogin: "octocat",
|
||||
});
|
||||
expect(mockedRunProcess).toHaveBeenCalledWith(
|
||||
"gh",
|
||||
[
|
||||
"pr",
|
||||
"view",
|
||||
"#42",
|
||||
"--json",
|
||||
"number,title,url,baseRefName,headRefName,state,mergedAt,isCrossRepository,headRepository,headRepositoryOwner",
|
||||
],
|
||||
expect.objectContaining({ cwd: "/repo" }),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("reads repository clone URLs", () =>
|
||||
Effect.gen(function* () {
|
||||
mockedRunProcess.mockResolvedValueOnce({
|
||||
stdout: JSON.stringify({
|
||||
nameWithOwner: "octocat/codething-mvp",
|
||||
url: "https://github.com/octocat/codething-mvp",
|
||||
sshUrl: "[email protected]:octocat/codething-mvp.git",
|
||||
}),
|
||||
stderr: "",
|
||||
code: 0,
|
||||
signal: null,
|
||||
timedOut: false,
|
||||
});
|
||||
|
||||
const result = yield* Effect.gen(function* () {
|
||||
const gh = yield* GitHubCli;
|
||||
return yield* gh.getRepositoryCloneUrls({
|
||||
cwd: "/repo",
|
||||
repository: "octocat/codething-mvp",
|
||||
});
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(result, {
|
||||
nameWithOwner: "octocat/codething-mvp",
|
||||
url: "https://github.com/octocat/codething-mvp",
|
||||
sshUrl: "[email protected]:octocat/codething-mvp.git",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("surfaces a friendly error when the pull request is not found", () =>
|
||||
Effect.gen(function* () {
|
||||
mockedRunProcess.mockRejectedValueOnce(
|
||||
new Error(
|
||||
"GraphQL: Could not resolve to a PullRequest with the number of 4888. (repository.pullRequest)",
|
||||
),
|
||||
);
|
||||
|
||||
const error = yield* Effect.gen(function* () {
|
||||
const gh = yield* GitHubCli;
|
||||
return yield* gh.getPullRequest({
|
||||
cwd: "/repo",
|
||||
reference: "4888",
|
||||
});
|
||||
}).pipe(Effect.flip);
|
||||
|
||||
assert.equal(error.message.includes("Pull request not found"), true);
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -1,8 +1,14 @@
|
||||
import { Effect, Layer } from "effect";
|
||||
import { Effect, Layer, Schema } from "effect";
|
||||
import { PositiveInt, TrimmedNonEmptyString } from "@t3tools/contracts";
|
||||
|
||||
import { runProcess } from "../../processRunner";
|
||||
import { GitHubCliError } from "../Errors.ts";
|
||||
import { GitHubCli, type GitHubCliShape } from "../Services/GitHubCli.ts";
|
||||
import {
|
||||
GitHubCli,
|
||||
type GitHubRepositoryCloneUrls,
|
||||
type GitHubCliShape,
|
||||
type GitHubPullRequestSummary,
|
||||
} from "../Services/GitHubCli.ts";
|
||||
|
||||
const DEFAULT_TIMEOUT_MS = 30_000;
|
||||
|
||||
@@ -30,6 +36,19 @@ function normalizeGitHubCliError(operation: "execute" | "stdout", error: unknown
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
lower.includes("could not resolve to a pullrequest") ||
|
||||
lower.includes("repository.pullrequest") ||
|
||||
lower.includes("no pull requests found for branch") ||
|
||||
lower.includes("pull request not found")
|
||||
) {
|
||||
return new GitHubCliError({
|
||||
operation,
|
||||
detail: "Pull request not found. Check the PR number or URL and try again.",
|
||||
cause: error,
|
||||
});
|
||||
}
|
||||
|
||||
return new GitHubCliError({
|
||||
operation,
|
||||
detail: `GitHub CLI command failed: ${error.message}`,
|
||||
@@ -44,59 +63,102 @@ function normalizeGitHubCliError(operation: "execute" | "stdout", error: unknown
|
||||
});
|
||||
}
|
||||
|
||||
function parseOpenPullRequests(raw: string): ReadonlyArray<{
|
||||
number: number;
|
||||
title: string;
|
||||
url: string;
|
||||
baseRefName: string;
|
||||
headRefName: string;
|
||||
}> {
|
||||
const trimmed = raw.trim();
|
||||
if (trimmed.length === 0) return [];
|
||||
|
||||
const parsed: unknown = JSON.parse(trimmed);
|
||||
if (!Array.isArray(parsed)) {
|
||||
throw new Error("GitHub CLI returned non-array JSON.");
|
||||
function normalizePullRequestState(input: {
|
||||
state?: string | null | undefined;
|
||||
mergedAt?: string | null | undefined;
|
||||
}): "open" | "closed" | "merged" {
|
||||
const mergedAt = input.mergedAt;
|
||||
const state = input.state;
|
||||
if ((typeof mergedAt === "string" && mergedAt.trim().length > 0) || state === "MERGED") {
|
||||
return "merged";
|
||||
}
|
||||
|
||||
const result: Array<{
|
||||
number: number;
|
||||
title: string;
|
||||
url: string;
|
||||
baseRefName: string;
|
||||
headRefName: string;
|
||||
}> = [];
|
||||
for (const entry of parsed) {
|
||||
if (!entry || typeof entry !== "object") {
|
||||
continue;
|
||||
}
|
||||
const record = entry as Record<string, unknown>;
|
||||
const number = record.number;
|
||||
const title = record.title;
|
||||
const url = record.url;
|
||||
const baseRefName = record.baseRefName;
|
||||
const headRefName = record.headRefName;
|
||||
if (
|
||||
typeof number !== "number" ||
|
||||
!Number.isInteger(number) ||
|
||||
number <= 0 ||
|
||||
typeof title !== "string" ||
|
||||
typeof url !== "string" ||
|
||||
typeof baseRefName !== "string" ||
|
||||
typeof headRefName !== "string"
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
result.push({
|
||||
number,
|
||||
title,
|
||||
url,
|
||||
baseRefName,
|
||||
headRefName,
|
||||
});
|
||||
if (state === "CLOSED") {
|
||||
return "closed";
|
||||
}
|
||||
return "open";
|
||||
}
|
||||
|
||||
return result;
|
||||
const RawGitHubPullRequestSchema = Schema.Struct({
|
||||
number: PositiveInt,
|
||||
title: TrimmedNonEmptyString,
|
||||
url: TrimmedNonEmptyString,
|
||||
baseRefName: TrimmedNonEmptyString,
|
||||
headRefName: TrimmedNonEmptyString,
|
||||
state: Schema.optional(Schema.NullOr(Schema.String)),
|
||||
mergedAt: Schema.optional(Schema.NullOr(Schema.String)),
|
||||
isCrossRepository: Schema.optional(Schema.Boolean),
|
||||
headRepository: Schema.optional(
|
||||
Schema.NullOr(
|
||||
Schema.Struct({
|
||||
nameWithOwner: Schema.String,
|
||||
}),
|
||||
),
|
||||
),
|
||||
headRepositoryOwner: Schema.optional(
|
||||
Schema.NullOr(
|
||||
Schema.Struct({
|
||||
login: Schema.String,
|
||||
}),
|
||||
),
|
||||
),
|
||||
});
|
||||
|
||||
const RawGitHubRepositoryCloneUrlsSchema = Schema.Struct({
|
||||
nameWithOwner: TrimmedNonEmptyString,
|
||||
url: TrimmedNonEmptyString,
|
||||
sshUrl: TrimmedNonEmptyString,
|
||||
});
|
||||
|
||||
function normalizePullRequestSummary(
|
||||
raw: Schema.Schema.Type<typeof RawGitHubPullRequestSchema>,
|
||||
): GitHubPullRequestSummary {
|
||||
const headRepositoryNameWithOwner = raw.headRepository?.nameWithOwner ?? null;
|
||||
const headRepositoryOwnerLogin =
|
||||
raw.headRepositoryOwner?.login ??
|
||||
(typeof headRepositoryNameWithOwner === "string" && headRepositoryNameWithOwner.includes("/")
|
||||
? (headRepositoryNameWithOwner.split("/")[0] ?? null)
|
||||
: null);
|
||||
return {
|
||||
number: raw.number,
|
||||
title: raw.title,
|
||||
url: raw.url,
|
||||
baseRefName: raw.baseRefName,
|
||||
headRefName: raw.headRefName,
|
||||
state: normalizePullRequestState(raw),
|
||||
...(typeof raw.isCrossRepository === "boolean"
|
||||
? { isCrossRepository: raw.isCrossRepository }
|
||||
: {}),
|
||||
...(headRepositoryNameWithOwner ? { headRepositoryNameWithOwner } : {}),
|
||||
...(headRepositoryOwnerLogin ? { headRepositoryOwnerLogin } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeRepositoryCloneUrls(
|
||||
raw: Schema.Schema.Type<typeof RawGitHubRepositoryCloneUrlsSchema>,
|
||||
): GitHubRepositoryCloneUrls {
|
||||
return {
|
||||
nameWithOwner: raw.nameWithOwner,
|
||||
url: raw.url,
|
||||
sshUrl: raw.sshUrl,
|
||||
};
|
||||
}
|
||||
|
||||
function decodeGitHubJson<S extends Schema.Top>(
|
||||
raw: string,
|
||||
schema: S,
|
||||
operation: "listOpenPullRequests" | "getPullRequest" | "getRepositoryCloneUrls",
|
||||
invalidDetail: string,
|
||||
): Effect.Effect<S["Type"], GitHubCliError, S["DecodingServices"]> {
|
||||
return Schema.decodeEffect(Schema.fromJsonString(schema))(raw).pipe(
|
||||
Effect.mapError(
|
||||
(error) =>
|
||||
new GitHubCliError({
|
||||
operation,
|
||||
detail: error instanceof Error ? `${invalidDetail}: ${error.message}` : invalidDetail,
|
||||
cause: error,
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
const makeGitHubCli = Effect.sync(() => {
|
||||
@@ -119,7 +181,7 @@ const makeGitHubCli = Effect.sync(() => {
|
||||
"pr",
|
||||
"list",
|
||||
"--head",
|
||||
input.headBranch,
|
||||
input.headSelector,
|
||||
"--state",
|
||||
"open",
|
||||
"--limit",
|
||||
@@ -128,21 +190,56 @@ const makeGitHubCli = Effect.sync(() => {
|
||||
"number,title,url,baseRefName,headRefName",
|
||||
],
|
||||
}).pipe(
|
||||
Effect.map((result) => result.stdout),
|
||||
Effect.map((result) => result.stdout.trim()),
|
||||
Effect.flatMap((raw) =>
|
||||
Effect.try({
|
||||
try: () => parseOpenPullRequests(raw),
|
||||
catch: (error: unknown) =>
|
||||
new GitHubCliError({
|
||||
operation: "listOpenPullRequests",
|
||||
detail:
|
||||
error instanceof Error
|
||||
? `GitHub CLI returned invalid PR list JSON: ${error.message}`
|
||||
: "GitHub CLI returned invalid PR list JSON.",
|
||||
...(error !== undefined ? { cause: error } : {}),
|
||||
}),
|
||||
}),
|
||||
raw.length === 0
|
||||
? Effect.succeed([])
|
||||
: decodeGitHubJson(
|
||||
raw,
|
||||
Schema.Array(RawGitHubPullRequestSchema),
|
||||
"listOpenPullRequests",
|
||||
"GitHub CLI returned invalid PR list JSON.",
|
||||
),
|
||||
),
|
||||
Effect.map((pullRequests) => pullRequests.map(normalizePullRequestSummary)),
|
||||
),
|
||||
getPullRequest: (input) =>
|
||||
execute({
|
||||
cwd: input.cwd,
|
||||
args: [
|
||||
"pr",
|
||||
"view",
|
||||
input.reference,
|
||||
"--json",
|
||||
"number,title,url,baseRefName,headRefName,state,mergedAt,isCrossRepository,headRepository,headRepositoryOwner",
|
||||
],
|
||||
}).pipe(
|
||||
Effect.map((result) => result.stdout.trim()),
|
||||
Effect.flatMap((raw) =>
|
||||
decodeGitHubJson(
|
||||
raw,
|
||||
RawGitHubPullRequestSchema,
|
||||
"getPullRequest",
|
||||
"GitHub CLI returned invalid pull request JSON.",
|
||||
),
|
||||
),
|
||||
Effect.map(normalizePullRequestSummary),
|
||||
),
|
||||
getRepositoryCloneUrls: (input) =>
|
||||
execute({
|
||||
cwd: input.cwd,
|
||||
args: ["repo", "view", input.repository, "--json", "nameWithOwner,url,sshUrl"],
|
||||
}).pipe(
|
||||
Effect.map((result) => result.stdout.trim()),
|
||||
Effect.flatMap((raw) =>
|
||||
decodeGitHubJson(
|
||||
raw,
|
||||
RawGitHubRepositoryCloneUrlsSchema,
|
||||
"getRepositoryCloneUrls",
|
||||
"GitHub CLI returned invalid repository JSON.",
|
||||
),
|
||||
),
|
||||
Effect.map(normalizeRepositoryCloneUrls),
|
||||
),
|
||||
createPullRequest: (input) =>
|
||||
execute({
|
||||
@@ -153,7 +250,7 @@ const makeGitHubCli = Effect.sync(() => {
|
||||
"--base",
|
||||
input.baseBranch,
|
||||
"--head",
|
||||
input.headBranch,
|
||||
input.headSelector,
|
||||
"--title",
|
||||
input.title,
|
||||
"--body-file",
|
||||
@@ -170,6 +267,11 @@ const makeGitHubCli = Effect.sync(() => {
|
||||
return trimmed.length > 0 ? trimmed : null;
|
||||
}),
|
||||
),
|
||||
checkoutPullRequest: (input) =>
|
||||
execute({
|
||||
cwd: input.cwd,
|
||||
args: ["pr", "checkout", input.reference, ...(input.force ? ["--force"] : [])],
|
||||
}).pipe(Effect.asVoid),
|
||||
} satisfies GitHubCliShape;
|
||||
|
||||
return service;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,12 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { realpathSync } from "node:fs";
|
||||
|
||||
import { Effect, FileSystem, Layer, Path } from "effect";
|
||||
import { resolveAutoFeatureBranchName, sanitizeFeatureBranchName } from "@t3tools/shared/git";
|
||||
import {
|
||||
resolveAutoFeatureBranchName,
|
||||
sanitizeBranchFragment,
|
||||
sanitizeFeatureBranchName,
|
||||
} from "@t3tools/shared/git";
|
||||
|
||||
import { GitManagerError } from "../Errors.ts";
|
||||
import { GitManager, type GitManagerShape } from "../Services/GitManager.ts";
|
||||
@@ -22,6 +27,96 @@ interface PullRequestInfo extends OpenPrInfo {
|
||||
updatedAt: string | null;
|
||||
}
|
||||
|
||||
interface ResolvedPullRequest {
|
||||
number: number;
|
||||
title: string;
|
||||
url: string;
|
||||
baseBranch: string;
|
||||
headBranch: string;
|
||||
state: "open" | "closed" | "merged";
|
||||
}
|
||||
|
||||
interface PullRequestHeadRemoteInfo {
|
||||
isCrossRepository?: boolean;
|
||||
headRepositoryNameWithOwner?: string | null;
|
||||
headRepositoryOwnerLogin?: string | null;
|
||||
}
|
||||
|
||||
interface BranchHeadContext {
|
||||
localBranch: string;
|
||||
headBranch: string;
|
||||
headSelectors: ReadonlyArray<string>;
|
||||
preferredHeadSelector: string;
|
||||
remoteName: string | null;
|
||||
headRepositoryNameWithOwner: string | null;
|
||||
headRepositoryOwnerLogin: string | null;
|
||||
isCrossRepository: boolean;
|
||||
}
|
||||
|
||||
function parseRepositoryNameFromPullRequestUrl(url: string): string | null {
|
||||
const trimmed = url.trim();
|
||||
const match = /^https:\/\/github\.com\/[^/]+\/([^/]+)\/pull\/\d+(?:\/.*)?$/i.exec(trimmed);
|
||||
const repositoryName = match?.[1]?.trim() ?? "";
|
||||
return repositoryName.length > 0 ? repositoryName : null;
|
||||
}
|
||||
|
||||
function resolveHeadRepositoryNameWithOwner(
|
||||
pullRequest: ResolvedPullRequest & PullRequestHeadRemoteInfo,
|
||||
): string | null {
|
||||
const explicitRepository = pullRequest.headRepositoryNameWithOwner?.trim() ?? "";
|
||||
if (explicitRepository.length > 0) {
|
||||
return explicitRepository;
|
||||
}
|
||||
|
||||
if (!pullRequest.isCrossRepository) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const ownerLogin = pullRequest.headRepositoryOwnerLogin?.trim() ?? "";
|
||||
const repositoryName = parseRepositoryNameFromPullRequestUrl(pullRequest.url);
|
||||
if (ownerLogin.length === 0 || !repositoryName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return `${ownerLogin}/${repositoryName}`;
|
||||
}
|
||||
|
||||
function resolvePullRequestWorktreeLocalBranchName(
|
||||
pullRequest: ResolvedPullRequest & PullRequestHeadRemoteInfo,
|
||||
): string {
|
||||
if (!pullRequest.isCrossRepository) {
|
||||
return pullRequest.headBranch;
|
||||
}
|
||||
|
||||
const sanitizedHeadBranch = sanitizeBranchFragment(pullRequest.headBranch).trim();
|
||||
const suffix = sanitizedHeadBranch.length > 0 ? sanitizedHeadBranch : "head";
|
||||
return `t3code/pr-${pullRequest.number}/${suffix}`;
|
||||
}
|
||||
|
||||
function parseGitHubRepositoryNameWithOwnerFromRemoteUrl(url: string | null): string | null {
|
||||
const trimmed = url?.trim() ?? "";
|
||||
if (trimmed.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const match =
|
||||
/^(?:git@github\.com:|ssh:\/\/git@github\.com\/|https:\/\/github\.com\/|git:\/\/github\.com\/)([^/\s]+\/[^/\s]+?)(?:\.git)?\/?$/i.exec(
|
||||
trimmed,
|
||||
);
|
||||
const repositoryNameWithOwner = match?.[1]?.trim() ?? "";
|
||||
return repositoryNameWithOwner.length > 0 ? repositoryNameWithOwner : null;
|
||||
}
|
||||
|
||||
function parseRepositoryOwnerLogin(nameWithOwner: string | null): string | null {
|
||||
const trimmed = nameWithOwner?.trim() ?? "";
|
||||
if (trimmed.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const [ownerLogin] = trimmed.split("/");
|
||||
const normalizedOwnerLogin = ownerLogin?.trim() ?? "";
|
||||
return normalizedOwnerLogin.length > 0 ? normalizedOwnerLogin : null;
|
||||
}
|
||||
|
||||
function parsePullRequestList(raw: unknown): PullRequestInfo[] {
|
||||
if (!Array.isArray(raw)) return [];
|
||||
|
||||
@@ -157,6 +252,14 @@ function extractBranchFromRef(ref: string): string {
|
||||
return normalized.slice(firstSlash + 1).trim();
|
||||
}
|
||||
|
||||
function appendUnique(values: string[], next: string | null | undefined): void {
|
||||
const trimmed = next?.trim() ?? "";
|
||||
if (trimmed.length === 0 || values.includes(trimmed)) {
|
||||
return;
|
||||
}
|
||||
values.push(trimmed);
|
||||
}
|
||||
|
||||
function toStatusPr(pr: PullRequestInfo): {
|
||||
number: number;
|
||||
title: string;
|
||||
@@ -175,72 +278,321 @@ function toStatusPr(pr: PullRequestInfo): {
|
||||
};
|
||||
}
|
||||
|
||||
function normalizePullRequestReference(reference: string): string {
|
||||
const trimmed = reference.trim();
|
||||
const hashNumber = /^#(\d+)$/.exec(trimmed);
|
||||
return hashNumber?.[1] ?? trimmed;
|
||||
}
|
||||
|
||||
function canonicalizeExistingPath(value: string): string {
|
||||
try {
|
||||
return realpathSync.native(value);
|
||||
} catch {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
function toResolvedPullRequest(pr: {
|
||||
number: number;
|
||||
title: string;
|
||||
url: string;
|
||||
baseRefName: string;
|
||||
headRefName: string;
|
||||
state?: "open" | "closed" | "merged";
|
||||
}): ResolvedPullRequest {
|
||||
return {
|
||||
number: pr.number,
|
||||
title: pr.title,
|
||||
url: pr.url,
|
||||
baseBranch: pr.baseRefName,
|
||||
headBranch: pr.headRefName,
|
||||
state: pr.state ?? "open",
|
||||
};
|
||||
}
|
||||
|
||||
function shouldPreferSshRemote(url: string | null): boolean {
|
||||
if (!url) return false;
|
||||
const trimmed = url.trim();
|
||||
return trimmed.startsWith("git@") || trimmed.startsWith("ssh://");
|
||||
}
|
||||
|
||||
function toPullRequestHeadRemoteInfo(pr: {
|
||||
isCrossRepository?: boolean;
|
||||
headRepositoryNameWithOwner?: string | null;
|
||||
headRepositoryOwnerLogin?: string | null;
|
||||
}): PullRequestHeadRemoteInfo {
|
||||
return {
|
||||
...(pr.isCrossRepository !== undefined ? { isCrossRepository: pr.isCrossRepository } : {}),
|
||||
...(pr.headRepositoryNameWithOwner !== undefined
|
||||
? { headRepositoryNameWithOwner: pr.headRepositoryNameWithOwner }
|
||||
: {}),
|
||||
...(pr.headRepositoryOwnerLogin !== undefined
|
||||
? { headRepositoryOwnerLogin: pr.headRepositoryOwnerLogin }
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
export const makeGitManager = Effect.gen(function* () {
|
||||
const gitCore = yield* GitCore;
|
||||
const gitHubCli = yield* GitHubCli;
|
||||
const textGeneration = yield* TextGeneration;
|
||||
|
||||
const configurePullRequestHeadUpstream = (
|
||||
cwd: string,
|
||||
pullRequest: ResolvedPullRequest & PullRequestHeadRemoteInfo,
|
||||
localBranch = pullRequest.headBranch,
|
||||
) =>
|
||||
Effect.gen(function* () {
|
||||
const repositoryNameWithOwner = resolveHeadRepositoryNameWithOwner(pullRequest) ?? "";
|
||||
if (repositoryNameWithOwner.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cloneUrls = yield* gitHubCli.getRepositoryCloneUrls({
|
||||
cwd,
|
||||
repository: repositoryNameWithOwner,
|
||||
});
|
||||
const originRemoteUrl = yield* gitCore.readConfigValue(cwd, "remote.origin.url");
|
||||
const remoteUrl = shouldPreferSshRemote(originRemoteUrl) ? cloneUrls.sshUrl : cloneUrls.url;
|
||||
const preferredRemoteName =
|
||||
pullRequest.headRepositoryOwnerLogin?.trim() ||
|
||||
repositoryNameWithOwner.split("/")[0]?.trim() ||
|
||||
"fork";
|
||||
const remoteName = yield* gitCore.ensureRemote({
|
||||
cwd,
|
||||
preferredName: preferredRemoteName,
|
||||
url: remoteUrl,
|
||||
});
|
||||
|
||||
yield* gitCore.setBranchUpstream({
|
||||
cwd,
|
||||
branch: localBranch,
|
||||
remoteName,
|
||||
remoteBranch: pullRequest.headBranch,
|
||||
});
|
||||
}).pipe(
|
||||
Effect.catch((error) =>
|
||||
Effect.logWarning(
|
||||
`GitManager.configurePullRequestHeadUpstream: failed to configure upstream for ${localBranch} -> ${pullRequest.headBranch} in ${cwd}: ${error.message}`,
|
||||
).pipe(Effect.asVoid),
|
||||
),
|
||||
);
|
||||
|
||||
const materializePullRequestHeadBranch = (
|
||||
cwd: string,
|
||||
pullRequest: ResolvedPullRequest & PullRequestHeadRemoteInfo,
|
||||
localBranch = pullRequest.headBranch,
|
||||
) =>
|
||||
Effect.gen(function* () {
|
||||
const repositoryNameWithOwner = resolveHeadRepositoryNameWithOwner(pullRequest) ?? "";
|
||||
|
||||
if (repositoryNameWithOwner.length === 0) {
|
||||
yield* gitCore.fetchPullRequestBranch({
|
||||
cwd,
|
||||
prNumber: pullRequest.number,
|
||||
branch: localBranch,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const cloneUrls = yield* gitHubCli.getRepositoryCloneUrls({
|
||||
cwd,
|
||||
repository: repositoryNameWithOwner,
|
||||
});
|
||||
const originRemoteUrl = yield* gitCore.readConfigValue(cwd, "remote.origin.url");
|
||||
const remoteUrl = shouldPreferSshRemote(originRemoteUrl) ? cloneUrls.sshUrl : cloneUrls.url;
|
||||
const preferredRemoteName =
|
||||
pullRequest.headRepositoryOwnerLogin?.trim() ||
|
||||
repositoryNameWithOwner.split("/")[0]?.trim() ||
|
||||
"fork";
|
||||
const remoteName = yield* gitCore.ensureRemote({
|
||||
cwd,
|
||||
preferredName: preferredRemoteName,
|
||||
url: remoteUrl,
|
||||
});
|
||||
|
||||
yield* gitCore.fetchRemoteBranch({
|
||||
cwd,
|
||||
remoteName,
|
||||
remoteBranch: pullRequest.headBranch,
|
||||
localBranch,
|
||||
});
|
||||
yield* gitCore.setBranchUpstream({
|
||||
cwd,
|
||||
branch: localBranch,
|
||||
remoteName,
|
||||
remoteBranch: pullRequest.headBranch,
|
||||
});
|
||||
}).pipe(
|
||||
Effect.catch(() =>
|
||||
gitCore.fetchPullRequestBranch({
|
||||
cwd,
|
||||
prNumber: pullRequest.number,
|
||||
branch: localBranch,
|
||||
}),
|
||||
),
|
||||
);
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
|
||||
const tempDir = process.env.TMPDIR ?? process.env.TEMP ?? process.env.TMP ?? "/tmp";
|
||||
|
||||
const findOpenPr = (cwd: string, branch: string) =>
|
||||
gitHubCli
|
||||
.listOpenPullRequests({
|
||||
cwd,
|
||||
headBranch: branch,
|
||||
limit: 1,
|
||||
})
|
||||
.pipe(
|
||||
Effect.map((prs) => {
|
||||
const [first] = prs;
|
||||
if (!first) {
|
||||
return null;
|
||||
}
|
||||
const readConfigValueNullable = (cwd: string, key: string) =>
|
||||
gitCore.readConfigValue(cwd, key).pipe(Effect.catch(() => Effect.succeed(null)));
|
||||
|
||||
const resolveRemoteRepositoryContext = (cwd: string, remoteName: string | null) =>
|
||||
Effect.gen(function* () {
|
||||
if (!remoteName) {
|
||||
return {
|
||||
repositoryNameWithOwner: null,
|
||||
ownerLogin: null,
|
||||
};
|
||||
}
|
||||
|
||||
const remoteUrl = yield* readConfigValueNullable(cwd, `remote.${remoteName}.url`);
|
||||
const repositoryNameWithOwner = parseGitHubRepositoryNameWithOwnerFromRemoteUrl(remoteUrl);
|
||||
return {
|
||||
repositoryNameWithOwner,
|
||||
ownerLogin: parseRepositoryOwnerLogin(repositoryNameWithOwner),
|
||||
};
|
||||
});
|
||||
|
||||
const resolveBranchHeadContext = (
|
||||
cwd: string,
|
||||
details: { branch: string; upstreamRef: string | null },
|
||||
) =>
|
||||
Effect.gen(function* () {
|
||||
const remoteName = yield* readConfigValueNullable(cwd, `branch.${details.branch}.remote`);
|
||||
const headBranchFromUpstream = details.upstreamRef
|
||||
? extractBranchFromRef(details.upstreamRef)
|
||||
: "";
|
||||
const headBranch =
|
||||
headBranchFromUpstream.length > 0 ? headBranchFromUpstream : details.branch;
|
||||
|
||||
const [remoteRepository, originRepository] = yield* Effect.all(
|
||||
[
|
||||
resolveRemoteRepositoryContext(cwd, remoteName),
|
||||
resolveRemoteRepositoryContext(cwd, "origin"),
|
||||
],
|
||||
{ concurrency: "unbounded" },
|
||||
);
|
||||
|
||||
const isCrossRepository =
|
||||
remoteRepository.repositoryNameWithOwner !== null &&
|
||||
originRepository.repositoryNameWithOwner !== null
|
||||
? remoteRepository.repositoryNameWithOwner.toLowerCase() !==
|
||||
originRepository.repositoryNameWithOwner.toLowerCase()
|
||||
: remoteName !== null &&
|
||||
remoteName !== "origin" &&
|
||||
remoteRepository.repositoryNameWithOwner !== null;
|
||||
|
||||
const ownerHeadSelector =
|
||||
remoteRepository.ownerLogin && headBranch.length > 0
|
||||
? `${remoteRepository.ownerLogin}:${headBranch}`
|
||||
: null;
|
||||
const remoteAliasHeadSelector =
|
||||
remoteName && headBranch.length > 0 ? `${remoteName}:${headBranch}` : null;
|
||||
const shouldProbeRemoteOwnedSelectors =
|
||||
isCrossRepository || (remoteName !== null && remoteName !== "origin");
|
||||
|
||||
const headSelectors: string[] = [];
|
||||
if (isCrossRepository && shouldProbeRemoteOwnedSelectors) {
|
||||
appendUnique(headSelectors, ownerHeadSelector);
|
||||
appendUnique(
|
||||
headSelectors,
|
||||
remoteAliasHeadSelector !== ownerHeadSelector ? remoteAliasHeadSelector : null,
|
||||
);
|
||||
}
|
||||
appendUnique(headSelectors, details.branch);
|
||||
appendUnique(headSelectors, headBranch !== details.branch ? headBranch : null);
|
||||
if (!isCrossRepository && shouldProbeRemoteOwnedSelectors) {
|
||||
appendUnique(headSelectors, ownerHeadSelector);
|
||||
appendUnique(
|
||||
headSelectors,
|
||||
remoteAliasHeadSelector !== ownerHeadSelector ? remoteAliasHeadSelector : null,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
localBranch: details.branch,
|
||||
headBranch,
|
||||
headSelectors,
|
||||
preferredHeadSelector:
|
||||
ownerHeadSelector && isCrossRepository ? ownerHeadSelector : headBranch,
|
||||
remoteName,
|
||||
headRepositoryNameWithOwner: remoteRepository.repositoryNameWithOwner,
|
||||
headRepositoryOwnerLogin: remoteRepository.ownerLogin,
|
||||
isCrossRepository,
|
||||
} satisfies BranchHeadContext;
|
||||
});
|
||||
|
||||
const findOpenPr = (cwd: string, headSelectors: ReadonlyArray<string>) =>
|
||||
Effect.gen(function* () {
|
||||
for (const headSelector of headSelectors) {
|
||||
const pullRequests = yield* gitHubCli.listOpenPullRequests({
|
||||
cwd,
|
||||
headSelector,
|
||||
limit: 1,
|
||||
});
|
||||
|
||||
const [firstPullRequest] = pullRequests;
|
||||
if (firstPullRequest) {
|
||||
return {
|
||||
number: first.number,
|
||||
title: first.title,
|
||||
url: first.url,
|
||||
baseRefName: first.baseRefName,
|
||||
headRefName: first.headRefName,
|
||||
number: firstPullRequest.number,
|
||||
title: firstPullRequest.title,
|
||||
url: firstPullRequest.url,
|
||||
baseRefName: firstPullRequest.baseRefName,
|
||||
headRefName: firstPullRequest.headRefName,
|
||||
state: "open",
|
||||
updatedAt: null,
|
||||
} satisfies PullRequestInfo;
|
||||
}),
|
||||
);
|
||||
|
||||
const findLatestPr = (cwd: string, branch: string) =>
|
||||
Effect.gen(function* () {
|
||||
const stdout = yield* gitHubCli
|
||||
.execute({
|
||||
cwd,
|
||||
args: [
|
||||
"pr",
|
||||
"list",
|
||||
"--head",
|
||||
branch,
|
||||
"--state",
|
||||
"all",
|
||||
"--limit",
|
||||
"20",
|
||||
"--json",
|
||||
"number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt",
|
||||
],
|
||||
})
|
||||
.pipe(Effect.map((result) => result.stdout));
|
||||
|
||||
const raw = stdout.trim();
|
||||
if (raw.length === 0) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const parsedJson = yield* Effect.try({
|
||||
try: () => JSON.parse(raw) as unknown,
|
||||
catch: (cause) =>
|
||||
gitManagerError("findLatestPr", "GitHub CLI returned invalid PR list JSON.", cause),
|
||||
});
|
||||
return null;
|
||||
});
|
||||
|
||||
const parsed = parsePullRequestList(parsedJson).toSorted((a, b) => {
|
||||
const findLatestPr = (cwd: string, details: { branch: string; upstreamRef: string | null }) =>
|
||||
Effect.gen(function* () {
|
||||
const headContext = yield* resolveBranchHeadContext(cwd, details);
|
||||
const parsedByNumber = new Map<number, PullRequestInfo>();
|
||||
|
||||
for (const headSelector of headContext.headSelectors) {
|
||||
const stdout = yield* gitHubCli
|
||||
.execute({
|
||||
cwd,
|
||||
args: [
|
||||
"pr",
|
||||
"list",
|
||||
"--head",
|
||||
headSelector,
|
||||
"--state",
|
||||
"all",
|
||||
"--limit",
|
||||
"20",
|
||||
"--json",
|
||||
"number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt",
|
||||
],
|
||||
})
|
||||
.pipe(Effect.map((result) => result.stdout));
|
||||
|
||||
const raw = stdout.trim();
|
||||
if (raw.length === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const parsedJson = yield* Effect.try({
|
||||
try: () => JSON.parse(raw) as unknown,
|
||||
catch: (cause) =>
|
||||
gitManagerError("findLatestPr", "GitHub CLI returned invalid PR list JSON.", cause),
|
||||
});
|
||||
|
||||
for (const pr of parsePullRequestList(parsedJson)) {
|
||||
parsedByNumber.set(pr.number, pr);
|
||||
}
|
||||
}
|
||||
|
||||
const parsed = Array.from(parsedByNumber.values()).toSorted((a, b) => {
|
||||
const left = a.updatedAt ? Date.parse(a.updatedAt) : 0;
|
||||
const right = b.updatedAt ? Date.parse(b.updatedAt) : 0;
|
||||
return right - left;
|
||||
@@ -253,12 +605,17 @@ export const makeGitManager = Effect.gen(function* () {
|
||||
return parsed[0] ?? null;
|
||||
});
|
||||
|
||||
const resolveBaseBranch = (cwd: string, branch: string, upstreamRef: string | null) =>
|
||||
const resolveBaseBranch = (
|
||||
cwd: string,
|
||||
branch: string,
|
||||
upstreamRef: string | null,
|
||||
headContext: Pick<BranchHeadContext, "isCrossRepository">,
|
||||
) =>
|
||||
Effect.gen(function* () {
|
||||
const configured = yield* gitCore.readConfigValue(cwd, `branch.${branch}.gh-merge-base`);
|
||||
if (configured) return configured;
|
||||
|
||||
if (upstreamRef) {
|
||||
if (upstreamRef && !headContext.isCrossRepository) {
|
||||
const upstreamBranch = extractBranchFromRef(upstreamRef);
|
||||
if (upstreamBranch.length > 0 && upstreamBranch !== branch) {
|
||||
return upstreamBranch;
|
||||
@@ -361,7 +718,12 @@ export const makeGitManager = Effect.gen(function* () {
|
||||
);
|
||||
}
|
||||
|
||||
const existing = yield* findOpenPr(cwd, branch);
|
||||
const headContext = yield* resolveBranchHeadContext(cwd, {
|
||||
branch,
|
||||
upstreamRef: details.upstreamRef,
|
||||
});
|
||||
|
||||
const existing = yield* findOpenPr(cwd, headContext.headSelectors);
|
||||
if (existing) {
|
||||
return {
|
||||
status: "opened_existing" as const,
|
||||
@@ -373,13 +735,13 @@ export const makeGitManager = Effect.gen(function* () {
|
||||
};
|
||||
}
|
||||
|
||||
const baseBranch = yield* resolveBaseBranch(cwd, branch, details.upstreamRef);
|
||||
const baseBranch = yield* resolveBaseBranch(cwd, branch, details.upstreamRef, headContext);
|
||||
const rangeContext = yield* gitCore.readRangeContext(cwd, baseBranch);
|
||||
|
||||
const generated = yield* textGeneration.generatePrContent({
|
||||
cwd,
|
||||
baseBranch,
|
||||
headBranch: branch,
|
||||
headBranch: headContext.headBranch,
|
||||
commitSummary: limitContext(rangeContext.commitSummary, 20_000),
|
||||
diffSummary: limitContext(rangeContext.diffSummary, 20_000),
|
||||
diffPatch: limitContext(rangeContext.diffPatch, 60_000),
|
||||
@@ -397,18 +759,18 @@ export const makeGitManager = Effect.gen(function* () {
|
||||
.createPullRequest({
|
||||
cwd,
|
||||
baseBranch,
|
||||
headBranch: branch,
|
||||
headSelector: headContext.preferredHeadSelector,
|
||||
title: generated.title,
|
||||
bodyFile,
|
||||
})
|
||||
.pipe(Effect.ensuring(fileSystem.remove(bodyFile).pipe(Effect.catch(() => Effect.void))));
|
||||
|
||||
const created = yield* findOpenPr(cwd, branch);
|
||||
const created = yield* findOpenPr(cwd, headContext.headSelectors);
|
||||
if (!created) {
|
||||
return {
|
||||
status: "created" as const,
|
||||
baseBranch,
|
||||
headBranch: branch,
|
||||
headBranch: headContext.headBranch,
|
||||
title: generated.title,
|
||||
};
|
||||
}
|
||||
@@ -428,7 +790,10 @@ export const makeGitManager = Effect.gen(function* () {
|
||||
|
||||
const pr =
|
||||
details.branch !== null
|
||||
? yield* findLatestPr(input.cwd, details.branch).pipe(
|
||||
? yield* findLatestPr(input.cwd, {
|
||||
branch: details.branch,
|
||||
upstreamRef: details.upstreamRef,
|
||||
}).pipe(
|
||||
Effect.map((latest) => (latest ? toStatusPr(latest) : null)),
|
||||
Effect.catch(() => Effect.succeed(null)),
|
||||
)
|
||||
@@ -445,6 +810,160 @@ export const makeGitManager = Effect.gen(function* () {
|
||||
};
|
||||
});
|
||||
|
||||
const resolvePullRequest: GitManagerShape["resolvePullRequest"] = Effect.fnUntraced(
|
||||
function* (input) {
|
||||
const pullRequest = yield* gitHubCli
|
||||
.getPullRequest({
|
||||
cwd: input.cwd,
|
||||
reference: normalizePullRequestReference(input.reference),
|
||||
})
|
||||
.pipe(Effect.map((resolved) => toResolvedPullRequest(resolved)));
|
||||
|
||||
return { pullRequest };
|
||||
},
|
||||
);
|
||||
|
||||
const preparePullRequestThread: GitManagerShape["preparePullRequestThread"] = Effect.fnUntraced(
|
||||
function* (input) {
|
||||
const normalizedReference = normalizePullRequestReference(input.reference);
|
||||
const rootWorktreePath = canonicalizeExistingPath(input.cwd);
|
||||
const pullRequestSummary = yield* gitHubCli.getPullRequest({
|
||||
cwd: input.cwd,
|
||||
reference: normalizedReference,
|
||||
});
|
||||
const pullRequest = toResolvedPullRequest(pullRequestSummary);
|
||||
|
||||
if (input.mode === "local") {
|
||||
yield* gitHubCli.checkoutPullRequest({
|
||||
cwd: input.cwd,
|
||||
reference: normalizedReference,
|
||||
force: true,
|
||||
});
|
||||
const details = yield* gitCore.statusDetails(input.cwd);
|
||||
yield* configurePullRequestHeadUpstream(
|
||||
input.cwd,
|
||||
{
|
||||
...pullRequest,
|
||||
...toPullRequestHeadRemoteInfo(pullRequestSummary),
|
||||
},
|
||||
details.branch ?? pullRequest.headBranch,
|
||||
);
|
||||
return {
|
||||
pullRequest,
|
||||
branch: details.branch ?? pullRequest.headBranch,
|
||||
worktreePath: null,
|
||||
};
|
||||
}
|
||||
|
||||
const ensureExistingWorktreeUpstream = (worktreePath: string) =>
|
||||
Effect.gen(function* () {
|
||||
const details = yield* gitCore.statusDetails(worktreePath);
|
||||
yield* configurePullRequestHeadUpstream(
|
||||
worktreePath,
|
||||
{
|
||||
...pullRequest,
|
||||
...toPullRequestHeadRemoteInfo(pullRequestSummary),
|
||||
},
|
||||
details.branch ?? pullRequest.headBranch,
|
||||
);
|
||||
});
|
||||
|
||||
const pullRequestWithRemoteInfo = {
|
||||
...pullRequest,
|
||||
...toPullRequestHeadRemoteInfo(pullRequestSummary),
|
||||
} as const;
|
||||
const localPullRequestBranch =
|
||||
resolvePullRequestWorktreeLocalBranchName(pullRequestWithRemoteInfo);
|
||||
|
||||
const findLocalHeadBranch = (cwd: string) =>
|
||||
gitCore.listBranches({ cwd }).pipe(
|
||||
Effect.map((result) => {
|
||||
const localBranch = result.branches.find(
|
||||
(branch) => !branch.isRemote && branch.name === localPullRequestBranch,
|
||||
);
|
||||
if (localBranch) {
|
||||
return localBranch;
|
||||
}
|
||||
if (localPullRequestBranch === pullRequest.headBranch) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
result.branches.find(
|
||||
(branch) =>
|
||||
!branch.isRemote &&
|
||||
branch.name === pullRequest.headBranch &&
|
||||
branch.worktreePath !== null &&
|
||||
canonicalizeExistingPath(branch.worktreePath) !== rootWorktreePath,
|
||||
) ?? null
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
const existingBranchBeforeFetch = yield* findLocalHeadBranch(input.cwd);
|
||||
const existingBranchBeforeFetchPath = existingBranchBeforeFetch?.worktreePath
|
||||
? canonicalizeExistingPath(existingBranchBeforeFetch.worktreePath)
|
||||
: null;
|
||||
if (
|
||||
existingBranchBeforeFetch?.worktreePath &&
|
||||
existingBranchBeforeFetchPath !== rootWorktreePath
|
||||
) {
|
||||
yield* ensureExistingWorktreeUpstream(existingBranchBeforeFetch.worktreePath);
|
||||
return {
|
||||
pullRequest,
|
||||
branch: localPullRequestBranch,
|
||||
worktreePath: existingBranchBeforeFetch.worktreePath,
|
||||
};
|
||||
}
|
||||
if (existingBranchBeforeFetchPath === rootWorktreePath) {
|
||||
return yield* gitManagerError(
|
||||
"preparePullRequestThread",
|
||||
"This PR branch is already checked out in the main repo. Use Local, or switch the main repo off that branch before creating a worktree thread.",
|
||||
);
|
||||
}
|
||||
|
||||
yield* materializePullRequestHeadBranch(
|
||||
input.cwd,
|
||||
pullRequestWithRemoteInfo,
|
||||
localPullRequestBranch,
|
||||
);
|
||||
|
||||
const existingBranchAfterFetch = yield* findLocalHeadBranch(input.cwd);
|
||||
const existingBranchAfterFetchPath = existingBranchAfterFetch?.worktreePath
|
||||
? canonicalizeExistingPath(existingBranchAfterFetch.worktreePath)
|
||||
: null;
|
||||
if (
|
||||
existingBranchAfterFetch?.worktreePath &&
|
||||
existingBranchAfterFetchPath !== rootWorktreePath
|
||||
) {
|
||||
yield* ensureExistingWorktreeUpstream(existingBranchAfterFetch.worktreePath);
|
||||
return {
|
||||
pullRequest,
|
||||
branch: localPullRequestBranch,
|
||||
worktreePath: existingBranchAfterFetch.worktreePath,
|
||||
};
|
||||
}
|
||||
if (existingBranchAfterFetchPath === rootWorktreePath) {
|
||||
return yield* gitManagerError(
|
||||
"preparePullRequestThread",
|
||||
"This PR branch is already checked out in the main repo. Use Local, or switch the main repo off that branch before creating a worktree thread.",
|
||||
);
|
||||
}
|
||||
|
||||
const worktree = yield* gitCore.createWorktree({
|
||||
cwd: input.cwd,
|
||||
branch: localPullRequestBranch,
|
||||
path: null,
|
||||
});
|
||||
yield* ensureExistingWorktreeUpstream(worktree.worktree.path);
|
||||
|
||||
return {
|
||||
pullRequest,
|
||||
branch: worktree.worktree.branch,
|
||||
worktreePath: worktree.worktree.path,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
const runFeatureBranchStep = (cwd: string, branch: string | null, commitMessage?: string) =>
|
||||
Effect.gen(function* () {
|
||||
const suggestion = yield* resolveCommitAndBranchSuggestion({
|
||||
@@ -536,6 +1055,8 @@ export const makeGitManager = Effect.gen(function* () {
|
||||
|
||||
return {
|
||||
status,
|
||||
resolvePullRequest,
|
||||
preparePullRequestThread,
|
||||
runStackedAction,
|
||||
} satisfies GitManagerShape;
|
||||
});
|
||||
|
||||
@@ -56,6 +56,32 @@ export interface GitRenameBranchResult {
|
||||
branch: string;
|
||||
}
|
||||
|
||||
export interface GitFetchPullRequestBranchInput {
|
||||
cwd: string;
|
||||
prNumber: number;
|
||||
branch: string;
|
||||
}
|
||||
|
||||
export interface GitEnsureRemoteInput {
|
||||
cwd: string;
|
||||
preferredName: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface GitFetchRemoteBranchInput {
|
||||
cwd: string;
|
||||
remoteName: string;
|
||||
remoteBranch: string;
|
||||
localBranch: string;
|
||||
}
|
||||
|
||||
export interface GitSetBranchUpstreamInput {
|
||||
cwd: string;
|
||||
branch: string;
|
||||
remoteName: string;
|
||||
remoteBranch: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* GitCoreShape - Service API for low-level Git repository interactions.
|
||||
*/
|
||||
@@ -129,6 +155,32 @@ export interface GitCoreShape {
|
||||
input: GitCreateWorktreeInput,
|
||||
) => Effect.Effect<GitCreateWorktreeResult, GitCommandError>;
|
||||
|
||||
/**
|
||||
* Materialize a GitHub pull request head as a local branch without switching checkout.
|
||||
*/
|
||||
readonly fetchPullRequestBranch: (
|
||||
input: GitFetchPullRequestBranchInput,
|
||||
) => Effect.Effect<void, GitCommandError>;
|
||||
|
||||
/**
|
||||
* Ensure a named remote exists for the provided URL, returning the reused or created remote name.
|
||||
*/
|
||||
readonly ensureRemote: (input: GitEnsureRemoteInput) => Effect.Effect<string, GitCommandError>;
|
||||
|
||||
/**
|
||||
* Fetch a remote branch into a local branch without checkout.
|
||||
*/
|
||||
readonly fetchRemoteBranch: (
|
||||
input: GitFetchRemoteBranchInput,
|
||||
) => Effect.Effect<void, GitCommandError>;
|
||||
|
||||
/**
|
||||
* Set the upstream tracking branch for a local branch.
|
||||
*/
|
||||
readonly setBranchUpstream: (
|
||||
input: GitSetBranchUpstreamInput,
|
||||
) => Effect.Effect<void, GitCommandError>;
|
||||
|
||||
/**
|
||||
* Remove an existing worktree.
|
||||
*/
|
||||
|
||||
@@ -17,6 +17,16 @@ export interface GitHubPullRequestSummary {
|
||||
readonly url: string;
|
||||
readonly baseRefName: string;
|
||||
readonly headRefName: string;
|
||||
readonly state?: "open" | "closed" | "merged";
|
||||
readonly isCrossRepository?: boolean;
|
||||
readonly headRepositoryNameWithOwner?: string | null;
|
||||
readonly headRepositoryOwnerLogin?: string | null;
|
||||
}
|
||||
|
||||
export interface GitHubRepositoryCloneUrls {
|
||||
readonly nameWithOwner: string;
|
||||
readonly url: string;
|
||||
readonly sshUrl: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,17 +47,33 @@ export interface GitHubCliShape {
|
||||
*/
|
||||
readonly listOpenPullRequests: (input: {
|
||||
readonly cwd: string;
|
||||
readonly headBranch: string;
|
||||
readonly headSelector: string;
|
||||
readonly limit?: number;
|
||||
}) => Effect.Effect<ReadonlyArray<GitHubPullRequestSummary>, GitHubCliError>;
|
||||
|
||||
/**
|
||||
* Resolve a pull request by URL, number, or branch-ish identifier.
|
||||
*/
|
||||
readonly getPullRequest: (input: {
|
||||
readonly cwd: string;
|
||||
readonly reference: string;
|
||||
}) => Effect.Effect<GitHubPullRequestSummary, GitHubCliError>;
|
||||
|
||||
/**
|
||||
* Resolve clone URLs for a GitHub repository.
|
||||
*/
|
||||
readonly getRepositoryCloneUrls: (input: {
|
||||
readonly cwd: string;
|
||||
readonly repository: string;
|
||||
}) => Effect.Effect<GitHubRepositoryCloneUrls, GitHubCliError>;
|
||||
|
||||
/**
|
||||
* Create a pull request from branch context and body file.
|
||||
*/
|
||||
readonly createPullRequest: (input: {
|
||||
readonly cwd: string;
|
||||
readonly baseBranch: string;
|
||||
readonly headBranch: string;
|
||||
readonly headSelector: string;
|
||||
readonly title: string;
|
||||
readonly bodyFile: string;
|
||||
}) => Effect.Effect<void, GitHubCliError>;
|
||||
@@ -58,6 +84,15 @@ export interface GitHubCliShape {
|
||||
readonly getDefaultBranch: (input: {
|
||||
readonly cwd: string;
|
||||
}) => Effect.Effect<string | null, GitHubCliError>;
|
||||
|
||||
/**
|
||||
* Checkout a pull request into the current repository worktree.
|
||||
*/
|
||||
readonly checkoutPullRequest: (input: {
|
||||
readonly cwd: string;
|
||||
readonly reference: string;
|
||||
readonly force?: boolean;
|
||||
}) => Effect.Effect<void, GitHubCliError>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
* @module GitManager
|
||||
*/
|
||||
import {
|
||||
GitPreparePullRequestThreadInput,
|
||||
GitPreparePullRequestThreadResult,
|
||||
GitPullRequestRefInput,
|
||||
GitResolvePullRequestResult,
|
||||
GitRunStackedActionInput,
|
||||
GitRunStackedActionResult,
|
||||
GitStatusInput,
|
||||
@@ -27,6 +31,20 @@ export interface GitManagerShape {
|
||||
input: GitStatusInput,
|
||||
) => Effect.Effect<GitStatusResult, GitManagerServiceError>;
|
||||
|
||||
/**
|
||||
* Resolve a pull request by URL/number against the current repository.
|
||||
*/
|
||||
readonly resolvePullRequest: (
|
||||
input: GitPullRequestRefInput,
|
||||
) => Effect.Effect<GitResolvePullRequestResult, GitManagerServiceError>;
|
||||
|
||||
/**
|
||||
* Prepare a new thread workspace from a pull request in local or worktree mode.
|
||||
*/
|
||||
readonly preparePullRequestThread: (
|
||||
input: GitPreparePullRequestThreadInput,
|
||||
) => Effect.Effect<GitPreparePullRequestThreadResult, GitManagerServiceError>;
|
||||
|
||||
/**
|
||||
* Run a stacked Git action (`commit`, `commit_push`, `commit_push_pr`).
|
||||
* When `featureBranch` is set, creates and checks out a feature branch first.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
|
||||
import { CliConfig, t3Cli } from "./main";
|
||||
import { OpenLive } from "./open";
|
||||
import { Command } from "effect/unstable/cli";
|
||||
import { version } from "../package.json" with { type: "json" };
|
||||
import { ServerLive } from "./wsServer";
|
||||
import { NetService } from "@t3tools/shared/Net";
|
||||
import { FetchHttpClient } from "effect/unstable/http";
|
||||
|
||||
const RuntimeLayer = Layer.empty.pipe(
|
||||
Layer.provideMerge(CliConfig.layer),
|
||||
Layer.provideMerge(ServerLive),
|
||||
Layer.provideMerge(OpenLive),
|
||||
Layer.provideMerge(NetService.layer),
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provideMerge(FetchHttpClient.layer),
|
||||
);
|
||||
|
||||
Command.run(t3Cli, { version }).pipe(Effect.provide(RuntimeLayer), NodeRuntime.runMain);
|
||||
@@ -211,7 +211,9 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
|
||||
});
|
||||
|
||||
assert.isTrue(configState.keybindings.some((entry) => entry.command === "terminal.toggle"));
|
||||
assert.isFalse(configState.keybindings.some((entry) => String(entry.command) === "invalid.command"));
|
||||
assert.isFalse(
|
||||
configState.keybindings.some((entry) => String(entry.command) === "invalid.command"),
|
||||
);
|
||||
assert.deepEqual(configState.issues, [
|
||||
{
|
||||
kind: "keybindings.invalid-entry",
|
||||
|
||||
Loaded 100 of 232 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user