Compare commits
30
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac7da4e9a8 | ||
|
|
1e6b589c5a | ||
|
|
99dbe4ff02 | ||
|
|
2fc0b01c18 | ||
|
|
3a86b60680 | ||
|
|
eb7c428a2d | ||
|
|
9fb9467ed1 | ||
|
|
e42036485f | ||
|
|
f9c3aff294 | ||
|
|
3503dbc7d5 | ||
|
|
b5dde6b9d8 | ||
|
|
a6b22ec1c9 | ||
|
|
bb49ebf6e5 | ||
|
|
2f5e626029 | ||
|
|
82c0a45ea0 | ||
|
|
e765051f14 | ||
|
|
f5e4df5cab | ||
|
|
1f47cc6f4e | ||
|
|
074d3af79c | ||
|
|
6593645c80 | ||
|
|
296eb82c31 | ||
|
|
7a377fc5e4 | ||
|
|
90e0c2ab15 | ||
|
|
7a3d4d1f31 | ||
|
|
e354e8697f | ||
|
|
993b578512 | ||
|
|
ed518ef19f | ||
|
|
47117a7d85 | ||
|
|
f623810903 | ||
|
|
e9ffd5752b |
No files matched your search
+3
-125
@@ -5,139 +5,17 @@ T3 Code runs as a **Node.js WebSocket server** that wraps `codex app-server` (JS
|
||||
```
|
||||
┌─────────────────────────────────┐
|
||||
│ Browser (React + Vite) │
|
||||
│ wsTransport (state machine) │
|
||||
│ Typed push decode at boundary │
|
||||
│ Connected via WebSocket │
|
||||
└──────────┬──────────────────────┘
|
||||
│ ws://localhost:3773
|
||||
┌──────────▼──────────────────────┐
|
||||
│ apps/server (Node.js) │
|
||||
│ WebSocket + HTTP static server │
|
||||
│ ServerPushBus (ordered pushes) │
|
||||
│ ServerReadiness (startup gate) │
|
||||
│ OrchestrationEngine │
|
||||
│ ProviderService │
|
||||
│ CheckpointReactor │
|
||||
│ RuntimeReceiptBus │
|
||||
│ ProviderManager │
|
||||
│ CodexAppServerManager │
|
||||
└──────────┬──────────────────────┘
|
||||
│ 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,9 +3,7 @@
|
||||
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**: 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.
|
||||
- **Push events**: `{ type: "push", channel, data }` for orchestration read-model updates
|
||||
|
||||
Methods mirror the `NativeApi` interface defined in `@t3tools/contracts`:
|
||||
|
||||
@@ -14,17 +12,3 @@ 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,5 +3,4 @@
|
||||
- `/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 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.
|
||||
- `/packages/contracts`: Shared Zod schemas and TypeScript contracts for provider events, WebSocket protocol, and model/session types.
|
||||
@@ -1,3 +0,0 @@
|
||||
[tools]
|
||||
node = "24.13.1"
|
||||
bun = "1.3.9"
|
||||
@@ -1,88 +0,0 @@
|
||||
# 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.
|
||||
|
||||
## Key Changes
|
||||
### 1. Strengthen the generic boundaries, not the Codex boundary
|
||||
- Keep `ProviderRuntimeEvent` as the canonical provider event contract and `ProviderService` as the only cross-provider facade.
|
||||
- Do not expose raw Codex payloads or Codex event ordering outside `CodexAdapter.ts` and `codexAppServerManager.ts`.
|
||||
- Do not expand `ProviderKind` in this change. The runtime stays provider-neutral by contract, while the product remains Codex-only in concrete support.
|
||||
|
||||
### 2. Replace loose websocket envelopes with channel-indexed typed pushes
|
||||
- Refactor `packages/contracts/src/ws.ts` so push messages are derived from a channel-to-schema map instead of `channel: string` plus `data: unknown`.
|
||||
- Add `sequence: number` to every server push. Ordering becomes explicit and testable.
|
||||
- Add structured decode diagnostics with stable machine fields: `code`, `reason`, `expected`, `actual`, `path`, optional `jsonOffset`.
|
||||
- Remove runtime/test dependence on engine-specific pretty strings. Human-readable formatting remains a logging helper only.
|
||||
|
||||
### 3. Introduce explicit server readiness and a single push pipeline
|
||||
- Add a `ServerPushBus` service in `apps/server` backed by one ordered queue/pubsub path. All pushes go through it: `server.welcome`, `server.configUpdated`, terminal events, orchestration domain events.
|
||||
- Add a `ServerReadiness` service with explicit barriers for:
|
||||
- HTTP listening
|
||||
- push bus ready
|
||||
- keybindings runtime ready
|
||||
- terminal subscriptions ready
|
||||
- orchestration subscriptions ready
|
||||
- Strengthen `server.welcome` semantics: it is emitted only after connection-scoped and server-scoped readiness is complete.
|
||||
- `wsServer` should never publish directly from ad hoc background streams once the bus exists.
|
||||
|
||||
### 4. Turn background watchers into explicit runtimes
|
||||
- Extract keybindings watching into a `KeybindingsRuntime` service with `start`, `ready`, `snapshot`, and `changes`.
|
||||
- Initial config load, startup sync, cache warmup, and watcher attachment complete before `ready` resolves.
|
||||
- Keep the real `fs.watch` adapter thin. Most behavior tests use a fake watch source and deterministic change stream.
|
||||
|
||||
### 5. Replace polling-based orchestration waiting with receipts
|
||||
- Add server-owned completion receipts for operations that tests currently infer by polling:
|
||||
- checkpoint capture complete
|
||||
- checkpoint diff finalized
|
||||
- turn processing quiesced
|
||||
- A receipt means append, projection, and required side effects are complete. It must not mean the provider emitted a certain event sequence.
|
||||
- Update the orchestration harness and checkpoint tests to await receipts/barriers instead of polling snapshots and git refs.
|
||||
|
||||
### 6. Centralize client transport state and decoding
|
||||
- Refactor `apps/web/src/wsTransport.ts` into an explicit connection state machine: `connecting`, `open`, `reconnecting`, `closed`, `disposed`.
|
||||
- Decode and validate typed push payloads at the transport boundary, not downstream in `apps/web/src/wsNativeApi.ts`.
|
||||
- Keep cached latest welcome/config behavior only if it is modeled as explicit state, not as a late-subscriber race workaround.
|
||||
|
||||
### 7. Replace ad hoc test helpers with semantic test clients
|
||||
- Add a shared `WsTestClient` for server/websocket tests:
|
||||
- connect
|
||||
- await semantic welcome
|
||||
- await typed push by channel and optional predicate
|
||||
- track `sequence`
|
||||
- match RPC responses by id
|
||||
- Add one orchestration test harness that waits on receipts/barriers instead of custom `waitForThread`, `waitForGitRef`, and arbitrary retry loops.
|
||||
- Keep only a narrow set of integration tests for real filesystem/watch/socket behavior. Move behavioral assertions to deterministic unit-style harnesses.
|
||||
|
||||
## 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.
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
Layer,
|
||||
ManagedRuntime,
|
||||
Option,
|
||||
Ref,
|
||||
Schedule,
|
||||
Schema,
|
||||
Scope,
|
||||
@@ -46,7 +45,6 @@ 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";
|
||||
@@ -56,10 +54,6 @@ 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,
|
||||
@@ -120,7 +114,7 @@ function waitFor<A, E>(
|
||||
read: Effect.Effect<A, E>,
|
||||
predicate: (value: A) => boolean,
|
||||
description: string,
|
||||
timeoutMs = 10_000,
|
||||
timeoutMs = 3000,
|
||||
): Effect.Effect<A, never> {
|
||||
const RETRY_SIGNAL = "wait_for_retry";
|
||||
const retryIntervalMs = 10;
|
||||
@@ -191,16 +185,6 @@ 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>;
|
||||
}
|
||||
|
||||
@@ -284,7 +268,6 @@ export const makeOrchestrationIntegrationHarness = (
|
||||
ProjectionPendingApprovalRepositoryLive,
|
||||
CheckpointStoreLive,
|
||||
providerLayer,
|
||||
RuntimeReceiptBusLive,
|
||||
);
|
||||
const runtimeIngestionLayer = ProviderRuntimeIngestionLive.pipe(
|
||||
Layer.provideMerge(runtimeServicesLayer),
|
||||
@@ -339,18 +322,11 @@ 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"] = (
|
||||
@@ -422,32 +398,6 @@ 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) {
|
||||
@@ -493,7 +443,6 @@ export const makeOrchestrationIntegrationHarness = (
|
||||
waitForThread,
|
||||
waitForDomainEvent,
|
||||
waitForPendingApproval,
|
||||
waitForReceipt,
|
||||
dispose,
|
||||
} satisfies OrchestrationIntegrationHarness;
|
||||
});
|
||||
@@ -21,10 +21,6 @@ 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);
|
||||
@@ -191,22 +187,6 @@ 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,
|
||||
@@ -228,6 +208,8 @@ 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);
|
||||
@@ -385,12 +367,6 @@ 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,
|
||||
@@ -432,22 +408,6 @@ 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,
|
||||
|
||||
@@ -524,7 +524,7 @@ const makeGitCore = Effect.gen(function* () {
|
||||
|
||||
const statusDetails: GitCoreShape["statusDetails"] = (cwd) =>
|
||||
Effect.gen(function* () {
|
||||
yield* refreshStatusUpstreamIfStale(cwd).pipe(Effect.ignoreCause({ log: true }));
|
||||
yield* refreshStatusUpstreamIfStale(cwd).pipe(Effect.catch(() => Effect.void));
|
||||
|
||||
const [statusStdout, unstagedNumstatStdout, stagedNumstatStdout] = yield* Effect.all(
|
||||
[
|
||||
@@ -1162,7 +1162,7 @@ const makeGitCore = Effect.gen(function* () {
|
||||
|
||||
// Refresh upstream refs in the background so checkout remains responsive.
|
||||
yield* Effect.forkScoped(
|
||||
refreshCheckedOutBranchUpstream(input.cwd).pipe(Effect.ignoreCause({ log: true })),
|
||||
refreshCheckedOutBranchUpstream(input.cwd).pipe(Effect.catch(() => Effect.void)),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
+42
-125
@@ -22,9 +22,7 @@ import {
|
||||
Array,
|
||||
Cache,
|
||||
Cause,
|
||||
Deferred,
|
||||
Effect,
|
||||
Exit,
|
||||
FileSystem,
|
||||
Path,
|
||||
Layer,
|
||||
@@ -35,14 +33,11 @@ import {
|
||||
SchemaGetter,
|
||||
SchemaIssue,
|
||||
SchemaTransformation,
|
||||
Ref,
|
||||
ServiceMap,
|
||||
Scope,
|
||||
Stream,
|
||||
} from "effect";
|
||||
import * as Semaphore from "effect/Semaphore";
|
||||
import { ServerConfig } from "./config";
|
||||
import { watchFileWithStatPolling } from "./watchFileWithStatPolling";
|
||||
|
||||
export class KeybindingsConfigError extends Schema.TaggedErrorClass<KeybindingsConfigError>()(
|
||||
"KeybindingsConfigParseError",
|
||||
@@ -427,7 +422,6 @@ export interface KeybindingsConfigState {
|
||||
}
|
||||
|
||||
export interface KeybindingsChangeEvent {
|
||||
readonly keybindings: ResolvedKeybindingsConfig;
|
||||
readonly issues: readonly ServerConfigIssue[];
|
||||
}
|
||||
|
||||
@@ -474,22 +468,6 @@ function mergeWithDefaultKeybindings(custom: ResolvedKeybindingsConfig): Resolve
|
||||
* KeybindingsShape - Service API for keybinding configuration operations.
|
||||
*/
|
||||
export interface KeybindingsShape {
|
||||
/**
|
||||
* Start the keybindings runtime and attach file watching.
|
||||
*
|
||||
* Safe to call multiple times. The first successful call establishes the
|
||||
* runtime; later calls await the same startup.
|
||||
*/
|
||||
readonly start: Effect.Effect<void, KeybindingsConfigError>;
|
||||
|
||||
/**
|
||||
* Await keybindings runtime readiness.
|
||||
*
|
||||
* Readiness means the config directory exists, the watcher is attached, the
|
||||
* startup sync has completed, and the current snapshot has been loaded.
|
||||
*/
|
||||
readonly ready: Effect.Effect<void, KeybindingsConfigError>;
|
||||
|
||||
/**
|
||||
* Ensure the on-disk keybindings file exists and includes all default
|
||||
* commands so newly-added defaults are backfilled on startup.
|
||||
@@ -502,22 +480,9 @@ export interface KeybindingsShape {
|
||||
readonly loadConfigState: Effect.Effect<KeybindingsConfigState, KeybindingsConfigError>;
|
||||
|
||||
/**
|
||||
* Read the latest keybindings snapshot from cache/disk.
|
||||
* Stream keybindings config change events.
|
||||
*/
|
||||
readonly getSnapshot: Effect.Effect<KeybindingsConfigState, KeybindingsConfigError>;
|
||||
|
||||
/**
|
||||
* Subscribe to keybindings config change events.
|
||||
*
|
||||
* Returns a scoped subscription. Callers should subscribe in the
|
||||
* current fiber (not inside a fork) to avoid missing events due to
|
||||
* lazy subscription setup in `Stream.fromPubSub`.
|
||||
*/
|
||||
readonly subscribeChanges: Effect.Effect<
|
||||
PubSub.Subscription<KeybindingsChangeEvent>,
|
||||
never,
|
||||
Scope.Scope
|
||||
>;
|
||||
readonly changes: Stream.Stream<KeybindingsChangeEvent>;
|
||||
|
||||
/**
|
||||
* Upsert a keybinding rule and persist the resulting configuration.
|
||||
@@ -544,12 +509,9 @@ const makeKeybindings = Effect.gen(function* () {
|
||||
const upsertSemaphore = yield* Semaphore.make(1);
|
||||
const resolvedConfigCacheKey = "resolved" as const;
|
||||
const changesPubSub = yield* PubSub.unbounded<KeybindingsChangeEvent>();
|
||||
const startedRef = yield* Ref.make(false);
|
||||
const startedDeferred = yield* Deferred.make<void, KeybindingsConfigError>();
|
||||
const watcherScope = yield* Scope.make("sequential");
|
||||
yield* Effect.addFinalizer(() => Scope.close(watcherScope, Exit.void));
|
||||
const emitChange = (configState: KeybindingsConfigState) =>
|
||||
PubSub.publish(changesPubSub, configState).pipe(Effect.asVoid);
|
||||
|
||||
const emitChange = (issues: readonly ServerConfigIssue[]) =>
|
||||
PubSub.publish(changesPubSub, { issues }).pipe(Effect.asVoid);
|
||||
|
||||
const readConfigExists = fs.exists(keybindingsConfigPath).pipe(
|
||||
Effect.mapError(
|
||||
@@ -569,7 +531,7 @@ const makeKeybindings = Effect.gen(function* () {
|
||||
configPath: keybindingsConfigPath,
|
||||
detail: "failed to read keybindings config",
|
||||
cause,
|
||||
}),
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -714,10 +676,43 @@ const makeKeybindings = Effect.gen(function* () {
|
||||
Effect.gen(function* () {
|
||||
yield* Cache.invalidate(resolvedConfigCache, resolvedConfigCacheKey);
|
||||
const configState = yield* loadConfigStateFromCacheOrDisk;
|
||||
yield* emitChange(configState);
|
||||
yield* emitChange(configState.issues);
|
||||
}),
|
||||
);
|
||||
|
||||
const keybindingsConfigDir = path.dirname(keybindingsConfigPath);
|
||||
const keybindingsConfigFile = path.basename(keybindingsConfigPath);
|
||||
const keybindingsConfigPathResolved = path.resolve(keybindingsConfigPath);
|
||||
yield* fs
|
||||
.makeDirectory(keybindingsConfigDir, { recursive: true })
|
||||
.pipe(Effect.orElseSucceed(() => undefined));
|
||||
yield* Stream.runForEach(fs.watch(keybindingsConfigDir), (event) => {
|
||||
const isTargetConfigEvent =
|
||||
event.path === keybindingsConfigFile ||
|
||||
event.path === keybindingsConfigPath ||
|
||||
path.resolve(keybindingsConfigDir, event.path) === keybindingsConfigPathResolved;
|
||||
if (!isTargetConfigEvent) {
|
||||
return Effect.void;
|
||||
}
|
||||
return revalidateAndEmit.pipe(
|
||||
Effect.catch((error) =>
|
||||
Effect.logWarning("failed to revalidate keybindings config after file update", {
|
||||
path: keybindingsConfigPath,
|
||||
detail: error.detail,
|
||||
cause: error.cause,
|
||||
}),
|
||||
),
|
||||
);
|
||||
}).pipe(
|
||||
Effect.catch((cause) =>
|
||||
Effect.logWarning("keybindings config watcher stopped unexpectedly", {
|
||||
path: keybindingsConfigPath,
|
||||
cause,
|
||||
}),
|
||||
),
|
||||
Effect.forkScoped,
|
||||
);
|
||||
|
||||
const syncDefaultKeybindingsOnStartup = upsertSemaphore.withPermits(1)(
|
||||
Effect.gen(function* () {
|
||||
const configExists = yield* readConfigExists;
|
||||
@@ -808,85 +803,10 @@ const makeKeybindings = Effect.gen(function* () {
|
||||
}),
|
||||
);
|
||||
|
||||
const startWatcher = Effect.gen(function* () {
|
||||
const keybindingsConfigDir = path.dirname(keybindingsConfigPath);
|
||||
const keybindingsConfigFile = path.basename(keybindingsConfigPath);
|
||||
const keybindingsConfigPathResolved = path.resolve(keybindingsConfigPath);
|
||||
|
||||
yield* fs.makeDirectory(keybindingsConfigDir, { recursive: true }).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new KeybindingsConfigError({
|
||||
configPath: keybindingsConfigPath,
|
||||
detail: "failed to prepare keybindings config directory",
|
||||
cause,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
const revalidateAndEmitSafely = revalidateAndEmit.pipe(
|
||||
Effect.ignoreCause({ log: true }),
|
||||
);
|
||||
|
||||
// fs.watch (inotify/kqueue) gives instant detection on most platforms
|
||||
// but can silently miss events on Linux containers.
|
||||
yield* Stream.runForEach(fs.watch(keybindingsConfigDir), (event) => {
|
||||
const isTargetConfigEvent =
|
||||
event.path === keybindingsConfigFile ||
|
||||
event.path === keybindingsConfigPath ||
|
||||
path.resolve(keybindingsConfigDir, event.path) === keybindingsConfigPathResolved;
|
||||
if (!isTargetConfigEvent) {
|
||||
return Effect.void;
|
||||
}
|
||||
return revalidateAndEmitSafely;
|
||||
}).pipe(
|
||||
Effect.ignoreCause({ log: true }),
|
||||
Effect.forkIn(watcherScope),
|
||||
Effect.asVoid,
|
||||
);
|
||||
|
||||
// fs.watchFile (stat-based polling on libuv timers) as a reliable
|
||||
// backup. Unlike an Effect.sleep loop in a forked fiber, libuv
|
||||
// timers fire regardless of Effect fiber scheduling pressure.
|
||||
yield* Stream.runForEach(
|
||||
watchFileWithStatPolling({
|
||||
filePath: keybindingsConfigPath,
|
||||
pollIntervalMs: 100,
|
||||
}),
|
||||
() => revalidateAndEmitSafely,
|
||||
).pipe(Effect.forkIn(watcherScope), Effect.asVoid);
|
||||
});
|
||||
|
||||
const start = Effect.gen(function* () {
|
||||
const alreadyStarted = yield* Ref.get(startedRef);
|
||||
if (alreadyStarted) {
|
||||
return yield* Deferred.await(startedDeferred);
|
||||
}
|
||||
|
||||
yield* Ref.set(startedRef, true);
|
||||
const startup = Effect.gen(function* () {
|
||||
yield* startWatcher;
|
||||
yield* syncDefaultKeybindingsOnStartup;
|
||||
yield* Cache.invalidate(resolvedConfigCache, resolvedConfigCacheKey);
|
||||
yield* loadConfigStateFromCacheOrDisk;
|
||||
});
|
||||
|
||||
const startupExit = yield* Effect.exit(startup);
|
||||
if (startupExit._tag === "Failure") {
|
||||
yield* Deferred.failCause(startedDeferred, startupExit.cause).pipe(Effect.orDie);
|
||||
return yield* Effect.failCause(startupExit.cause);
|
||||
}
|
||||
|
||||
yield* Deferred.succeed(startedDeferred, undefined).pipe(Effect.orDie);
|
||||
});
|
||||
|
||||
return {
|
||||
start,
|
||||
ready: Deferred.await(startedDeferred),
|
||||
syncDefaultKeybindingsOnStartup,
|
||||
loadConfigState: loadConfigStateFromCacheOrDisk,
|
||||
getSnapshot: loadConfigStateFromCacheOrDisk,
|
||||
subscribeChanges: PubSub.subscribe(changesPubSub),
|
||||
changes: Stream.fromPubSub(changesPubSub),
|
||||
upsertKeybindingRule: (rule) =>
|
||||
upsertSemaphore.withPermits(1)(
|
||||
Effect.gen(function* () {
|
||||
@@ -913,10 +833,7 @@ const makeKeybindings = Effect.gen(function* () {
|
||||
keybindings: nextResolved,
|
||||
issues: [],
|
||||
});
|
||||
yield* emitChange({
|
||||
keybindings: nextResolved,
|
||||
issues: [],
|
||||
});
|
||||
yield* emitChange([]);
|
||||
return nextResolved;
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -22,7 +22,6 @@ import { CheckpointStore } from "../../checkpointing/Services/CheckpointStore.ts
|
||||
import { CheckpointReactorLive } from "./CheckpointReactor.ts";
|
||||
import { OrchestrationEngineLive } from "./OrchestrationEngine.ts";
|
||||
import { OrchestrationProjectionPipelineLive } from "./ProjectionPipeline.ts";
|
||||
import { RuntimeReceiptBusLive } from "./RuntimeReceiptBus.ts";
|
||||
import { OrchestrationEventStoreLive } from "../../persistence/Layers/OrchestrationEventStore.ts";
|
||||
import { OrchestrationCommandReceiptRepositoryLive } from "../../persistence/Layers/OrchestrationCommandReceipts.ts";
|
||||
import { SqlitePersistenceMemory } from "../../persistence/Layers/Sqlite.ts";
|
||||
@@ -113,7 +112,7 @@ async function waitForThread(
|
||||
checkpoints: ReadonlyArray<{ checkpointTurnCount: number }>;
|
||||
activities: ReadonlyArray<{ kind: string }>;
|
||||
}) => boolean,
|
||||
timeoutMs = 5000,
|
||||
timeoutMs = 2000,
|
||||
) {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
const poll = async (): Promise<{
|
||||
@@ -138,7 +137,7 @@ async function waitForThread(
|
||||
async function waitForEvent(
|
||||
engine: OrchestrationEngineShape,
|
||||
predicate: (event: { type: string }) => boolean,
|
||||
timeoutMs = 5000,
|
||||
timeoutMs = 2000,
|
||||
) {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
const poll = async () => {
|
||||
@@ -189,7 +188,7 @@ function gitShowFileAtRef(cwd: string, ref: string, filePath: string): string {
|
||||
return runGit(cwd, ["show", `${ref}:${filePath}`]);
|
||||
}
|
||||
|
||||
async function waitForGitRefExists(cwd: string, ref: string, timeoutMs = 5000) {
|
||||
async function waitForGitRefExists(cwd: string, ref: string, timeoutMs = 2000) {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
const poll = async (): Promise<void> => {
|
||||
if (gitRefExists(cwd, ref)) {
|
||||
@@ -253,7 +252,6 @@ describe("CheckpointReactor", () => {
|
||||
|
||||
const layer = CheckpointReactorLive.pipe(
|
||||
Layer.provideMerge(orchestrationLayer),
|
||||
Layer.provideMerge(RuntimeReceiptBusLive),
|
||||
Layer.provideMerge(Layer.succeed(ProviderService, provider.service)),
|
||||
Layer.provideMerge(CheckpointStoreLive),
|
||||
Layer.provideMerge(ServerConfig.layerTest(process.cwd(), process.cwd())),
|
||||
@@ -266,7 +264,7 @@ describe("CheckpointReactor", () => {
|
||||
const checkpointStore = await runtime.runPromise(Effect.service(CheckpointStore));
|
||||
scope = await Effect.runPromise(Scope.make("sequential"));
|
||||
await Effect.runPromise(reactor.start.pipe(Scope.provide(scope)));
|
||||
const drain = () => Effect.runPromise(reactor.drain);
|
||||
await Effect.runPromise(Effect.sleep("10 millis"));
|
||||
|
||||
const createdAt = new Date().toISOString();
|
||||
await Effect.runPromise(
|
||||
@@ -323,7 +321,6 @@ describe("CheckpointReactor", () => {
|
||||
engine,
|
||||
provider,
|
||||
cwd,
|
||||
drain,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -452,7 +449,7 @@ describe("CheckpointReactor", () => {
|
||||
payload: { state: "completed" },
|
||||
});
|
||||
|
||||
await harness.drain();
|
||||
await Effect.runPromise(Effect.sleep("40 millis"));
|
||||
const midReadModel = await Effect.runPromise(harness.engine.getReadModel());
|
||||
const midThread = midReadModel.threads.find(
|
||||
(entry) => entry.id === ThreadId.makeUnsafe("thread-1"),
|
||||
@@ -646,7 +643,7 @@ describe("CheckpointReactor", () => {
|
||||
status: "completed",
|
||||
});
|
||||
|
||||
await harness.drain();
|
||||
await Effect.runPromise(Effect.sleep("40 millis"));
|
||||
const readModel = await Effect.runPromise(harness.engine.getReadModel());
|
||||
const thread = readModel.threads.find((entry) => entry.id === ThreadId.makeUnsafe("thread-1"));
|
||||
expect(thread?.checkpoints.some((checkpoint) => checkpoint.checkpointTurnCount === 3)).toBe(
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
type OrchestrationEvent,
|
||||
type ProviderRuntimeEvent,
|
||||
} from "@t3tools/contracts";
|
||||
import { Cause, Effect, Layer, Option, Stream } from "effect";
|
||||
import { makeDrainableWorker } from "@t3tools/shared/DrainableWorker";
|
||||
import { Cause, Effect, Layer, Option, Queue, Stream } from "effect";
|
||||
|
||||
import { parseTurnDiffFilesFromUnifiedDiff } from "../../checkpointing/Diffs.ts";
|
||||
import {
|
||||
@@ -19,7 +18,6 @@ import { CheckpointStore } from "../../checkpointing/Services/CheckpointStore.ts
|
||||
import { ProviderService } from "../../provider/Services/ProviderService.ts";
|
||||
import { CheckpointReactor, type CheckpointReactorShape } from "../Services/CheckpointReactor.ts";
|
||||
import { OrchestrationEngineService } from "../Services/OrchestrationEngine.ts";
|
||||
import { RuntimeReceiptBus } from "../Services/RuntimeReceiptBus.ts";
|
||||
import { CheckpointStoreError } from "../../checkpointing/Errors.ts";
|
||||
import { OrchestrationDispatchError } from "../Errors.ts";
|
||||
import { isGitRepository } from "../../git/isRepo.ts";
|
||||
@@ -65,7 +63,6 @@ const make = Effect.gen(function* () {
|
||||
const orchestrationEngine = yield* OrchestrationEngineService;
|
||||
const providerService = yield* ProviderService;
|
||||
const checkpointStore = yield* CheckpointStore;
|
||||
const receiptBus = yield* RuntimeReceiptBus;
|
||||
|
||||
const appendRevertFailureActivity = (input: {
|
||||
readonly threadId: ThreadId;
|
||||
@@ -118,7 +115,9 @@ const make = Effect.gen(function* () {
|
||||
|
||||
const resolveSessionRuntimeForThread = Effect.fnUntraced(function* (
|
||||
threadId: ThreadId,
|
||||
): Effect.fn.Return<Option.Option<{ readonly threadId: ThreadId; readonly cwd: string }>> {
|
||||
): Effect.fn.Return<
|
||||
Option.Option<{ readonly threadId: ThreadId; readonly cwd: string }>
|
||||
> {
|
||||
const readModel = yield* orchestrationEngine.getReadModel();
|
||||
const thread = readModel.threads.find((entry) => entry.id === threadId);
|
||||
|
||||
@@ -134,7 +133,9 @@ const make = Effect.gen(function* () {
|
||||
};
|
||||
|
||||
if (thread) {
|
||||
const projectedSession = sessions.find((session) => session.threadId === thread.id);
|
||||
const projectedSession = sessions.find(
|
||||
(session) => session.threadId === thread.id,
|
||||
);
|
||||
const fromProjected = findSessionWithCwd(projectedSession);
|
||||
if (Option.isSome(fromProjected)) {
|
||||
return fromProjected;
|
||||
@@ -275,22 +276,6 @@ const make = Effect.gen(function* () {
|
||||
checkpointTurnCount: nextTurnCount,
|
||||
createdAt: now,
|
||||
});
|
||||
yield* receiptBus.publish({
|
||||
type: "checkpoint.diff.finalized",
|
||||
threadId: thread.id,
|
||||
turnId,
|
||||
checkpointTurnCount: nextTurnCount,
|
||||
checkpointRef: targetCheckpointRef,
|
||||
status: checkpointStatusFromRuntime(event.payload.state),
|
||||
createdAt: now,
|
||||
});
|
||||
yield* receiptBus.publish({
|
||||
type: "turn.processing.quiesced",
|
||||
threadId: thread.id,
|
||||
turnId,
|
||||
checkpointTurnCount: nextTurnCount,
|
||||
createdAt: now,
|
||||
});
|
||||
|
||||
yield* orchestrationEngine.dispatch({
|
||||
type: "thread.activity.append",
|
||||
@@ -321,7 +306,9 @@ const make = Effect.gen(function* () {
|
||||
}
|
||||
|
||||
const readModel = yield* orchestrationEngine.getReadModel();
|
||||
const thread = readModel.threads.find((entry) => entry.id === event.threadId);
|
||||
const thread = readModel.threads.find(
|
||||
(entry) => entry.id === event.threadId,
|
||||
);
|
||||
if (!thread) {
|
||||
return;
|
||||
}
|
||||
@@ -364,13 +351,6 @@ const make = Effect.gen(function* () {
|
||||
cwd: checkpointCwd,
|
||||
checkpointRef: baselineCheckpointRef,
|
||||
});
|
||||
yield* receiptBus.publish({
|
||||
type: "checkpoint.baseline.captured",
|
||||
threadId: thread.id,
|
||||
checkpointTurnCount: currentTurnCount,
|
||||
checkpointRef: baselineCheckpointRef,
|
||||
createdAt: event.createdAt,
|
||||
});
|
||||
});
|
||||
|
||||
const ensurePreTurnBaselineFromDomainTurnStart = Effect.fnUntraced(function* (
|
||||
@@ -433,13 +413,6 @@ const make = Effect.gen(function* () {
|
||||
cwd: checkpointCwd,
|
||||
checkpointRef: baselineCheckpointRef,
|
||||
});
|
||||
yield* receiptBus.publish({
|
||||
type: "checkpoint.baseline.captured",
|
||||
threadId,
|
||||
checkpointTurnCount: currentTurnCount,
|
||||
checkpointRef: baselineCheckpointRef,
|
||||
createdAt: event.occurredAt,
|
||||
});
|
||||
});
|
||||
|
||||
const handleRevertRequested = Effect.fnUntraced(function* (
|
||||
@@ -627,9 +600,14 @@ const make = Effect.gen(function* () {
|
||||
}),
|
||||
);
|
||||
|
||||
const worker = yield* makeDrainableWorker(processInputSafely);
|
||||
|
||||
const start: CheckpointReactorShape["start"] = Effect.gen(function* () {
|
||||
const queue = yield* Queue.unbounded<ReactorInput>();
|
||||
yield* Effect.addFinalizer(() => Queue.shutdown(queue).pipe(Effect.asVoid));
|
||||
|
||||
yield* Effect.forkScoped(
|
||||
Effect.forever(Queue.take(queue).pipe(Effect.flatMap(processInputSafely))),
|
||||
);
|
||||
|
||||
yield* Effect.forkScoped(
|
||||
Stream.runForEach(orchestrationEngine.streamDomainEvents, (event) => {
|
||||
if (
|
||||
@@ -639,7 +617,7 @@ const make = Effect.gen(function* () {
|
||||
) {
|
||||
return Effect.void;
|
||||
}
|
||||
return worker.enqueue({ source: "domain", event });
|
||||
return Queue.offer(queue, { source: "domain", event }).pipe(Effect.asVoid);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -648,14 +626,13 @@ const make = Effect.gen(function* () {
|
||||
if (event.type !== "turn.started" && event.type !== "turn.completed") {
|
||||
return Effect.void;
|
||||
}
|
||||
return worker.enqueue({ source: "runtime", event });
|
||||
return Queue.offer(queue, { source: "runtime", event }).pipe(Effect.asVoid);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
return {
|
||||
start,
|
||||
drain: worker.drain,
|
||||
} satisfies CheckpointReactorShape;
|
||||
});
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ describe("OrchestrationReactor", () => {
|
||||
start: Effect.sync(() => {
|
||||
started.push("provider-runtime-ingestion");
|
||||
}),
|
||||
drain: Effect.void,
|
||||
}),
|
||||
),
|
||||
Layer.provideMerge(
|
||||
@@ -35,7 +34,6 @@ describe("OrchestrationReactor", () => {
|
||||
start: Effect.sync(() => {
|
||||
started.push("provider-command-reactor");
|
||||
}),
|
||||
drain: Effect.void,
|
||||
}),
|
||||
),
|
||||
Layer.provideMerge(
|
||||
@@ -43,7 +41,6 @@ describe("OrchestrationReactor", () => {
|
||||
start: Effect.sync(() => {
|
||||
started.push("checkpoint-reactor");
|
||||
}),
|
||||
drain: Effect.void,
|
||||
}),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -213,7 +213,7 @@ describe("ProviderCommandReactor", () => {
|
||||
const reactor = await runtime.runPromise(Effect.service(ProviderCommandReactor));
|
||||
scope = await Effect.runPromise(Scope.make("sequential"));
|
||||
await Effect.runPromise(reactor.start.pipe(Scope.provide(scope)));
|
||||
const drain = () => Effect.runPromise(reactor.drain);
|
||||
await Effect.runPromise(Effect.sleep("10 millis"));
|
||||
|
||||
await Effect.runPromise(
|
||||
engine.dispatch({
|
||||
@@ -253,7 +253,6 @@ describe("ProviderCommandReactor", () => {
|
||||
renameBranch,
|
||||
generateBranchName,
|
||||
stateDir,
|
||||
drain,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -568,7 +567,7 @@ describe("ProviderCommandReactor", () => {
|
||||
return thread?.runtimeMode === "approval-required";
|
||||
});
|
||||
await waitFor(() => harness.startSession.mock.calls.length === 2);
|
||||
await harness.drain();
|
||||
await Effect.runPromise(Effect.sleep("30 millis"));
|
||||
|
||||
expect(harness.stopSession.mock.calls.length).toBe(0);
|
||||
expect(harness.sendTurn.mock.calls.length).toBe(1);
|
||||
|
||||
@@ -12,8 +12,7 @@ import {
|
||||
type RuntimeMode,
|
||||
type TurnId,
|
||||
} from "@t3tools/contracts";
|
||||
import { Cache, Cause, Duration, Effect, Layer, Option, Schema, Stream } from "effect";
|
||||
import { makeDrainableWorker } from "@t3tools/shared/DrainableWorker";
|
||||
import { Cache, Cause, Duration, Effect, Layer, Option, Queue, Schema, Stream } from "effect";
|
||||
|
||||
import { resolveThreadWorkspaceCwd } from "../../checkpointing/Utils.ts";
|
||||
import { GitCore } from "../../git/Services/GitCore.ts";
|
||||
@@ -225,9 +224,9 @@ const make = Effect.gen(function* () {
|
||||
});
|
||||
|
||||
const resolveActiveSession = (threadId: ThreadId) =>
|
||||
providerService
|
||||
.listSessions()
|
||||
.pipe(Effect.map((sessions) => sessions.find((session) => session.threadId === threadId)));
|
||||
providerService.listSessions().pipe(
|
||||
Effect.map((sessions) => sessions.find((session) => session.threadId === threadId)),
|
||||
);
|
||||
|
||||
const startProviderSession = (input?: {
|
||||
readonly resumeCursor?: unknown;
|
||||
@@ -235,7 +234,7 @@ const make = Effect.gen(function* () {
|
||||
}) =>
|
||||
providerService.startSession(threadId, {
|
||||
threadId,
|
||||
...((input?.provider ?? preferredProvider)
|
||||
...(input?.provider ?? preferredProvider
|
||||
? { provider: input?.provider ?? preferredProvider }
|
||||
: {}),
|
||||
...(effectiveCwd ? { cwd: effectiveCwd } : {}),
|
||||
@@ -266,15 +265,16 @@ const make = Effect.gen(function* () {
|
||||
thread.session && thread.session.status !== "stopped" ? thread.id : null;
|
||||
if (existingSessionThreadId) {
|
||||
const runtimeModeChanged = thread.runtimeMode !== thread.session?.runtimeMode;
|
||||
const providerChanged =
|
||||
options?.provider !== undefined && options.provider !== currentProvider;
|
||||
const providerChanged = options?.provider !== undefined && options.provider !== currentProvider;
|
||||
const activeSession = yield* resolveActiveSession(existingSessionThreadId);
|
||||
const sessionModelSwitch =
|
||||
currentProvider === undefined
|
||||
? "in-session"
|
||||
: (yield* providerService.getCapabilities(currentProvider)).sessionModelSwitch;
|
||||
const modelChanged = options?.model !== undefined && options.model !== activeSession?.model;
|
||||
const shouldRestartForModelChange = modelChanged && sessionModelSwitch === "restart-session";
|
||||
const modelChanged =
|
||||
options?.model !== undefined && options.model !== activeSession?.model;
|
||||
const shouldRestartForModelChange =
|
||||
modelChanged && sessionModelSwitch === "restart-session";
|
||||
|
||||
if (!runtimeModeChanged && !providerChanged && !shouldRestartForModelChange) {
|
||||
return existingSessionThreadId;
|
||||
@@ -345,16 +345,15 @@ const make = Effect.gen(function* () {
|
||||
});
|
||||
const normalizedInput = toNonEmptyProviderInput(input.messageText);
|
||||
const normalizedAttachments = input.attachments ?? [];
|
||||
const activeSession = yield* providerService
|
||||
.listSessions()
|
||||
.pipe(
|
||||
Effect.map((sessions) => sessions.find((session) => session.threadId === input.threadId)),
|
||||
);
|
||||
const activeSession = yield* providerService.listSessions().pipe(
|
||||
Effect.map((sessions) => sessions.find((session) => session.threadId === input.threadId)),
|
||||
);
|
||||
const sessionModelSwitch =
|
||||
activeSession === undefined
|
||||
? "in-session"
|
||||
: (yield* providerService.getCapabilities(activeSession.provider)).sessionModelSwitch;
|
||||
const modelForTurn = sessionModelSwitch === "unsupported" ? activeSession?.model : input.model;
|
||||
const modelForTurn =
|
||||
sessionModelSwitch === "unsupported" ? activeSession?.model : input.model;
|
||||
|
||||
yield* providerService.sendTurn({
|
||||
threadId: input.threadId,
|
||||
@@ -475,12 +474,8 @@ const make = Effect.gen(function* () {
|
||||
...(message.attachments !== undefined ? { attachments: message.attachments } : {}),
|
||||
...(event.payload.provider !== undefined ? { provider: event.payload.provider } : {}),
|
||||
...(event.payload.model !== undefined ? { model: event.payload.model } : {}),
|
||||
...(event.payload.modelOptions !== undefined
|
||||
? { modelOptions: event.payload.modelOptions }
|
||||
: {}),
|
||||
...(event.payload.providerOptions !== undefined
|
||||
? { providerOptions: event.payload.providerOptions }
|
||||
: {}),
|
||||
...(event.payload.modelOptions !== undefined ? { modelOptions: event.payload.modelOptions } : {}),
|
||||
...(event.payload.providerOptions !== undefined ? { providerOptions: event.payload.providerOptions } : {}),
|
||||
interactionMode: event.payload.interactionMode,
|
||||
createdAt: event.payload.createdAt,
|
||||
});
|
||||
@@ -637,9 +632,13 @@ const make = Effect.gen(function* () {
|
||||
return;
|
||||
}
|
||||
const cachedProviderOptions = threadProviderOptions.get(event.payload.threadId);
|
||||
yield* ensureSessionForThread(event.payload.threadId, event.occurredAt, {
|
||||
...(cachedProviderOptions !== undefined ? { providerOptions: cachedProviderOptions } : {}),
|
||||
});
|
||||
yield* ensureSessionForThread(
|
||||
event.payload.threadId,
|
||||
event.occurredAt,
|
||||
cachedProviderOptions !== undefined
|
||||
? { providerOptions: cachedProviderOptions }
|
||||
: undefined,
|
||||
);
|
||||
return;
|
||||
}
|
||||
case "thread.turn-start-requested":
|
||||
@@ -673,28 +672,34 @@ const make = Effect.gen(function* () {
|
||||
}),
|
||||
);
|
||||
|
||||
const worker = yield* makeDrainableWorker(processDomainEventSafely);
|
||||
const start: ProviderCommandReactorShape["start"] = Effect.gen(function* () {
|
||||
const queue = yield* Queue.unbounded<ProviderIntentEvent>();
|
||||
yield* Effect.addFinalizer(() => Queue.shutdown(queue).pipe(Effect.asVoid));
|
||||
|
||||
const start: ProviderCommandReactorShape["start"] = Effect.forkScoped(
|
||||
Stream.runForEach(orchestrationEngine.streamDomainEvents, (event) => {
|
||||
if (
|
||||
event.type !== "thread.runtime-mode-set" &&
|
||||
event.type !== "thread.turn-start-requested" &&
|
||||
event.type !== "thread.turn-interrupt-requested" &&
|
||||
event.type !== "thread.approval-response-requested" &&
|
||||
event.type !== "thread.user-input-response-requested" &&
|
||||
event.type !== "thread.session-stop-requested"
|
||||
) {
|
||||
return Effect.void;
|
||||
}
|
||||
yield* Effect.forkScoped(
|
||||
Effect.forever(Queue.take(queue).pipe(Effect.flatMap(processDomainEventSafely))),
|
||||
);
|
||||
|
||||
return worker.enqueue(event);
|
||||
}),
|
||||
).pipe(Effect.asVoid);
|
||||
yield* Effect.forkScoped(
|
||||
Stream.runForEach(orchestrationEngine.streamDomainEvents, (event) => {
|
||||
if (
|
||||
event.type !== "thread.runtime-mode-set" &&
|
||||
event.type !== "thread.turn-start-requested" &&
|
||||
event.type !== "thread.turn-interrupt-requested" &&
|
||||
event.type !== "thread.approval-response-requested" &&
|
||||
event.type !== "thread.user-input-response-requested" &&
|
||||
event.type !== "thread.session-stop-requested"
|
||||
) {
|
||||
return Effect.void;
|
||||
}
|
||||
|
||||
return Queue.offer(queue, event).pipe(Effect.asVoid);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
return {
|
||||
start,
|
||||
drain: worker.drain,
|
||||
} satisfies ProviderCommandReactorShape;
|
||||
});
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ describe("ProviderRuntimeIngestion", () => {
|
||||
const ingestion = await runtime.runPromise(Effect.service(ProviderRuntimeIngestionService));
|
||||
scope = await Effect.runPromise(Scope.make("sequential"));
|
||||
await Effect.runPromise(ingestion.start.pipe(Scope.provide(scope)));
|
||||
const drain = () => Effect.runPromise(ingestion.drain);
|
||||
await Effect.runPromise(Effect.sleep("10 millis"));
|
||||
|
||||
const createdAt = new Date().toISOString();
|
||||
await Effect.runPromise(
|
||||
@@ -209,7 +209,6 @@ describe("ProviderRuntimeIngestion", () => {
|
||||
return {
|
||||
engine,
|
||||
emit: provider.emit,
|
||||
drain,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -378,7 +377,7 @@ describe("ProviderRuntimeIngestion", () => {
|
||||
threadId: asThreadId("thread-1"),
|
||||
});
|
||||
|
||||
await harness.drain();
|
||||
await Effect.runPromise(Effect.sleep("40 millis"));
|
||||
const midReadModel = await Effect.runPromise(harness.engine.getReadModel());
|
||||
const midThread = midReadModel.threads.find((entry) => entry.id === ThreadId.makeUnsafe("thread-1"));
|
||||
expect(midThread?.session?.status).toBe("running");
|
||||
@@ -429,7 +428,7 @@ describe("ProviderRuntimeIngestion", () => {
|
||||
status: "completed",
|
||||
});
|
||||
|
||||
await harness.drain();
|
||||
await Effect.runPromise(Effect.sleep("40 millis"));
|
||||
const midReadModel = await Effect.runPromise(harness.engine.getReadModel());
|
||||
const midThread = midReadModel.threads.find(
|
||||
(entry) => entry.id === ThreadId.makeUnsafe("thread-1"),
|
||||
@@ -483,7 +482,7 @@ describe("ProviderRuntimeIngestion", () => {
|
||||
status: "completed",
|
||||
});
|
||||
|
||||
await harness.drain();
|
||||
await Effect.runPromise(Effect.sleep("40 millis"));
|
||||
const midReadModel = await Effect.runPromise(harness.engine.getReadModel());
|
||||
const midThread = midReadModel.threads.find(
|
||||
(entry) => entry.id === ThreadId.makeUnsafe("thread-1"),
|
||||
@@ -721,7 +720,7 @@ describe("ProviderRuntimeIngestion", () => {
|
||||
},
|
||||
});
|
||||
|
||||
await harness.drain();
|
||||
await Effect.runPromise(Effect.sleep("30 millis"));
|
||||
const midReadModel = await Effect.runPromise(harness.engine.getReadModel());
|
||||
const midThread = midReadModel.threads.find(
|
||||
(entry) => entry.id === ThreadId.makeUnsafe("thread-1"),
|
||||
@@ -780,7 +779,7 @@ describe("ProviderRuntimeIngestion", () => {
|
||||
createdAt: now,
|
||||
}),
|
||||
);
|
||||
await harness.drain();
|
||||
await Effect.runPromise(Effect.sleep("30 millis"));
|
||||
|
||||
harness.emit({
|
||||
type: "turn.started",
|
||||
|
||||
@@ -10,8 +10,7 @@ import {
|
||||
type OrchestrationThreadActivity,
|
||||
type ProviderRuntimeEvent,
|
||||
} from "@t3tools/contracts";
|
||||
import { Cache, Cause, Duration, Effect, Layer, Option, Ref, Stream } from "effect";
|
||||
import { makeDrainableWorker } from "@t3tools/shared/DrainableWorker";
|
||||
import { Cache, Cause, Duration, Effect, Layer, Option, Queue, Ref, Stream } from "effect";
|
||||
|
||||
import { ProviderService } from "../../provider/Services/ProviderService.ts";
|
||||
import { resolveThreadWorkspaceCwd } from "../../checkpointing/Utils.ts";
|
||||
@@ -211,9 +210,9 @@ function runtimeEventToActivities(
|
||||
? "Command approval requested"
|
||||
: requestKind === "file-read"
|
||||
? "File-read approval requested"
|
||||
: requestKind === "file-change"
|
||||
? "File-change approval requested"
|
||||
: "Approval requested",
|
||||
: requestKind === "file-change"
|
||||
? "File-change approval requested"
|
||||
: "Approval requested",
|
||||
payload: {
|
||||
requestId: toApprovalRequestId(event.requestId),
|
||||
...(requestKind ? { requestKind } : {}),
|
||||
@@ -299,9 +298,7 @@ function runtimeEventToActivities(
|
||||
summary: "Plan updated",
|
||||
payload: {
|
||||
plan: event.payload.plan,
|
||||
...(event.payload.explanation !== undefined
|
||||
? { explanation: event.payload.explanation }
|
||||
: {}),
|
||||
...(event.payload.explanation !== undefined ? { explanation: event.payload.explanation } : {}),
|
||||
},
|
||||
turnId: toTurnId(event.turnId) ?? null,
|
||||
...maybeSequence,
|
||||
@@ -361,9 +358,7 @@ function runtimeEventToActivities(
|
||||
payload: {
|
||||
taskId: event.payload.taskId,
|
||||
...(event.payload.taskType ? { taskType: event.payload.taskType } : {}),
|
||||
...(event.payload.description
|
||||
? { detail: truncateDetail(event.payload.description) }
|
||||
: {}),
|
||||
...(event.payload.description ? { detail: truncateDetail(event.payload.description) } : {}),
|
||||
},
|
||||
turnId: toTurnId(event.turnId) ?? null,
|
||||
...maybeSequence,
|
||||
@@ -530,7 +525,11 @@ const make = Effect.gen(function* () {
|
||||
return isGitRepository(workspaceCwd);
|
||||
});
|
||||
|
||||
const rememberAssistantMessageId = (threadId: ThreadId, turnId: TurnId, messageId: MessageId) =>
|
||||
const rememberAssistantMessageId = (
|
||||
threadId: ThreadId,
|
||||
turnId: TurnId,
|
||||
messageId: MessageId,
|
||||
) =>
|
||||
Cache.getOption(turnMessageIdsByTurnKey, providerTurnKey(threadId, turnId)).pipe(
|
||||
Effect.flatMap((existingIds) =>
|
||||
Cache.set(
|
||||
@@ -548,7 +547,11 @@ const make = Effect.gen(function* () {
|
||||
),
|
||||
);
|
||||
|
||||
const forgetAssistantMessageId = (threadId: ThreadId, turnId: TurnId, messageId: MessageId) =>
|
||||
const forgetAssistantMessageId = (
|
||||
threadId: ThreadId,
|
||||
turnId: TurnId,
|
||||
messageId: MessageId,
|
||||
) =>
|
||||
Cache.getOption(turnMessageIdsByTurnKey, providerTurnKey(threadId, turnId)).pipe(
|
||||
Effect.flatMap((existingIds) =>
|
||||
Option.match(existingIds, {
|
||||
@@ -613,8 +616,7 @@ const make = Effect.gen(function* () {
|
||||
const existing = Option.getOrUndefined(existingEntry);
|
||||
return Cache.set(bufferedProposedPlanById, planId, {
|
||||
text: `${existing?.text ?? ""}${delta}`,
|
||||
createdAt:
|
||||
existing?.createdAt && existing.createdAt.length > 0 ? existing.createdAt : createdAt,
|
||||
createdAt: existing?.createdAt && existing.createdAt.length > 0 ? existing.createdAt : createdAt,
|
||||
});
|
||||
}),
|
||||
);
|
||||
@@ -631,8 +633,7 @@ const make = Effect.gen(function* () {
|
||||
const clearBufferedProposedPlan = (planId: string) =>
|
||||
Cache.invalidate(bufferedProposedPlanById, planId);
|
||||
|
||||
const clearAssistantMessageState = (messageId: MessageId) =>
|
||||
clearBufferedAssistantText(messageId);
|
||||
const clearAssistantMessageState = (messageId: MessageId) => clearBufferedAssistantText(messageId);
|
||||
|
||||
const finalizeAssistantMessage = (input: {
|
||||
event: ProviderRuntimeEvent;
|
||||
@@ -861,8 +862,8 @@ const make = Effect.gen(function* () {
|
||||
: event.type === "turn.completed" && runtimeTurnState(event) === "failed"
|
||||
? (runtimeTurnErrorMessage(event) ?? thread.session?.lastError ?? "Turn failed")
|
||||
: status === "ready"
|
||||
? null
|
||||
: (thread.session?.lastError ?? null);
|
||||
? null
|
||||
: (thread.session?.lastError ?? null);
|
||||
|
||||
if (shouldApplyThreadLifecycle) {
|
||||
yield* orchestrationEngine.dispatch({
|
||||
@@ -934,9 +935,7 @@ const make = Effect.gen(function* () {
|
||||
const assistantCompletion =
|
||||
event.type === "item.completed" && event.payload.itemType === "assistant_message"
|
||||
? {
|
||||
messageId: MessageId.makeUnsafe(
|
||||
`assistant:${event.itemId ?? event.turnId ?? event.eventId}`,
|
||||
),
|
||||
messageId: MessageId.makeUnsafe(`assistant:${event.itemId ?? event.turnId ?? event.eventId}`),
|
||||
fallbackText: event.payload.detail,
|
||||
}
|
||||
: undefined;
|
||||
@@ -1030,7 +1029,9 @@ const make = Effect.gen(function* () {
|
||||
|
||||
const shouldApplyRuntimeError = !STRICT_PROVIDER_LIFECYCLE_GUARD
|
||||
? true
|
||||
: activeTurnId === null || eventTurnId === undefined || sameId(activeTurnId, eventTurnId);
|
||||
: activeTurnId === null ||
|
||||
eventTurnId === undefined ||
|
||||
sameId(activeTurnId, eventTurnId);
|
||||
|
||||
if (shouldApplyRuntimeError) {
|
||||
yield* orchestrationEngine.dispatch({
|
||||
@@ -1118,12 +1119,16 @@ const make = Effect.gen(function* () {
|
||||
}),
|
||||
);
|
||||
|
||||
const worker = yield* makeDrainableWorker(processInputSafely);
|
||||
|
||||
const start: ProviderRuntimeIngestionShape["start"] = Effect.gen(function* () {
|
||||
const inputQueue = yield* Queue.unbounded<RuntimeIngestionInput>();
|
||||
yield* Effect.addFinalizer(() => Queue.shutdown(inputQueue).pipe(Effect.asVoid));
|
||||
|
||||
yield* Effect.forkScoped(
|
||||
Effect.forever(Queue.take(inputQueue).pipe(Effect.flatMap(processInputSafely))),
|
||||
);
|
||||
yield* Effect.forkScoped(
|
||||
Stream.runForEach(providerService.streamEvents, (event) =>
|
||||
worker.enqueue({ source: "runtime", event }),
|
||||
Queue.offer(inputQueue, { source: "runtime", event }).pipe(Effect.asVoid),
|
||||
),
|
||||
);
|
||||
yield* Effect.forkScoped(
|
||||
@@ -1131,14 +1136,13 @@ const make = Effect.gen(function* () {
|
||||
if (event.type !== "thread.turn-start-requested") {
|
||||
return Effect.void;
|
||||
}
|
||||
return worker.enqueue({ source: "domain", event });
|
||||
return Queue.offer(inputQueue, { source: "domain", event }).pipe(Effect.asVoid);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
return {
|
||||
start,
|
||||
drain: worker.drain,
|
||||
} satisfies ProviderRuntimeIngestionShape;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Effect, Layer, PubSub, Stream } from "effect";
|
||||
|
||||
import {
|
||||
RuntimeReceiptBus,
|
||||
type RuntimeReceiptBusShape,
|
||||
type OrchestrationRuntimeReceipt,
|
||||
} from "../Services/RuntimeReceiptBus.ts";
|
||||
|
||||
const makeRuntimeReceiptBus = Effect.gen(function* () {
|
||||
const pubSub = yield* PubSub.unbounded<OrchestrationRuntimeReceipt>();
|
||||
|
||||
return {
|
||||
publish: (receipt) => PubSub.publish(pubSub, receipt).pipe(Effect.asVoid),
|
||||
stream: Stream.fromPubSub(pubSub),
|
||||
} satisfies RuntimeReceiptBusShape;
|
||||
});
|
||||
|
||||
export const RuntimeReceiptBusLive = Layer.effect(RuntimeReceiptBus, makeRuntimeReceiptBus);
|
||||
@@ -23,12 +23,6 @@ export interface CheckpointReactorShape {
|
||||
* internal queue.
|
||||
*/
|
||||
readonly start: Effect.Effect<void, never, Scope.Scope>;
|
||||
|
||||
/**
|
||||
* Resolves when the internal processing queue is empty and idle.
|
||||
* Intended for test use to replace timing-sensitive sleeps.
|
||||
*/
|
||||
readonly drain: Effect.Effect<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,12 +23,6 @@ export interface ProviderCommandReactorShape {
|
||||
* processing.
|
||||
*/
|
||||
readonly start: Effect.Effect<void, never, Scope.Scope>;
|
||||
|
||||
/**
|
||||
* Resolves when the internal processing queue is empty and idle.
|
||||
* Intended for test use to replace timing-sensitive sleeps.
|
||||
*/
|
||||
readonly drain: Effect.Effect<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,12 +23,6 @@ export interface ProviderRuntimeIngestionShape {
|
||||
* logging warnings.
|
||||
*/
|
||||
readonly start: Effect.Effect<void, never, Scope.Scope>;
|
||||
|
||||
/**
|
||||
* Resolves when the internal processing queue is empty and idle.
|
||||
* Intended for test use to replace timing-sensitive sleeps.
|
||||
*/
|
||||
readonly drain: Effect.Effect<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
import { CheckpointRef, IsoDateTime, NonNegativeInt, ThreadId, TurnId } from "@t3tools/contracts";
|
||||
import { Schema, ServiceMap } from "effect";
|
||||
import type { Effect, Stream } from "effect";
|
||||
|
||||
export const CheckpointBaselineCapturedReceipt = Schema.Struct({
|
||||
type: Schema.Literal("checkpoint.baseline.captured"),
|
||||
threadId: ThreadId,
|
||||
checkpointTurnCount: NonNegativeInt,
|
||||
checkpointRef: CheckpointRef,
|
||||
createdAt: IsoDateTime,
|
||||
});
|
||||
export type CheckpointBaselineCapturedReceipt = typeof CheckpointBaselineCapturedReceipt.Type;
|
||||
|
||||
export const CheckpointDiffFinalizedReceipt = Schema.Struct({
|
||||
type: Schema.Literal("checkpoint.diff.finalized"),
|
||||
threadId: ThreadId,
|
||||
turnId: TurnId,
|
||||
checkpointTurnCount: NonNegativeInt,
|
||||
checkpointRef: CheckpointRef,
|
||||
status: Schema.Literals(["ready", "missing", "error"]),
|
||||
createdAt: IsoDateTime,
|
||||
});
|
||||
export type CheckpointDiffFinalizedReceipt = typeof CheckpointDiffFinalizedReceipt.Type;
|
||||
|
||||
export const TurnProcessingQuiescedReceipt = Schema.Struct({
|
||||
type: Schema.Literal("turn.processing.quiesced"),
|
||||
threadId: ThreadId,
|
||||
turnId: TurnId,
|
||||
checkpointTurnCount: NonNegativeInt,
|
||||
createdAt: IsoDateTime,
|
||||
});
|
||||
export type TurnProcessingQuiescedReceipt = typeof TurnProcessingQuiescedReceipt.Type;
|
||||
|
||||
export const OrchestrationRuntimeReceipt = Schema.Union([
|
||||
CheckpointBaselineCapturedReceipt,
|
||||
CheckpointDiffFinalizedReceipt,
|
||||
TurnProcessingQuiescedReceipt,
|
||||
]);
|
||||
export type OrchestrationRuntimeReceipt = typeof OrchestrationRuntimeReceipt.Type;
|
||||
|
||||
export interface RuntimeReceiptBusShape {
|
||||
readonly publish: (receipt: OrchestrationRuntimeReceipt) => Effect.Effect<void>;
|
||||
readonly stream: Stream.Stream<OrchestrationRuntimeReceipt>;
|
||||
}
|
||||
|
||||
export class RuntimeReceiptBus extends ServiceMap.Service<
|
||||
RuntimeReceiptBus,
|
||||
RuntimeReceiptBusShape
|
||||
>()("t3/orchestration/Services/RuntimeReceiptBus") {}
|
||||
@@ -13,7 +13,7 @@ import type {
|
||||
ServerProviderStatus,
|
||||
ServerProviderStatusState,
|
||||
} from "@t3tools/contracts";
|
||||
import { Effect, Layer, Option, Result, Stream } from "effect";
|
||||
import { Array, Effect, Fiber, Layer, Option, Result, Stream } from "effect";
|
||||
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
||||
|
||||
import {
|
||||
@@ -312,9 +312,13 @@ export const checkCodexProviderStatus: Effect.Effect<
|
||||
export const ProviderHealthLive = Layer.effect(
|
||||
ProviderHealth,
|
||||
Effect.gen(function* () {
|
||||
const codexStatus = yield* checkCodexProviderStatus;
|
||||
const codexStatusFiber = yield* checkCodexProviderStatus.pipe(
|
||||
Effect.map(Array.of),
|
||||
Effect.forkScoped,
|
||||
);
|
||||
|
||||
return {
|
||||
getStatuses: Effect.succeed([codexStatus]),
|
||||
getStatuses: Fiber.join(codexStatusFiber),
|
||||
} satisfies ProviderHealthShape;
|
||||
}),
|
||||
);
|
||||
@@ -17,7 +17,6 @@ import { ProviderCommandReactorLive } from "./orchestration/Layers/ProviderComma
|
||||
import { OrchestrationProjectionPipelineLive } from "./orchestration/Layers/ProjectionPipeline";
|
||||
import { OrchestrationProjectionSnapshotQueryLive } from "./orchestration/Layers/ProjectionSnapshotQuery";
|
||||
import { ProviderRuntimeIngestionLive } from "./orchestration/Layers/ProviderRuntimeIngestion";
|
||||
import { RuntimeReceiptBusLive } from "./orchestration/Layers/RuntimeReceiptBus";
|
||||
import { ProviderUnsupportedError } from "./provider/Errors";
|
||||
import { makeCodexAdapterLive } from "./provider/Layers/CodexAdapter";
|
||||
import { ProviderAdapterRegistryLive } from "./provider/Layers/ProviderAdapterRegistry";
|
||||
@@ -88,7 +87,6 @@ export function makeServerRuntimeServicesLayer() {
|
||||
OrchestrationProjectionSnapshotQueryLive,
|
||||
CheckpointStoreLive,
|
||||
checkpointDiffQueryLayer,
|
||||
RuntimeReceiptBusLive,
|
||||
);
|
||||
const runtimeIngestionLayer = ProviderRuntimeIngestionLive.pipe(
|
||||
Layer.provideMerge(runtimeServicesLayer),
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
import nodeFs from "node:fs";
|
||||
import { Effect, Queue, Stream } from "effect";
|
||||
|
||||
export interface WatchFileWithStatPollingOptions {
|
||||
readonly filePath: string;
|
||||
readonly pollIntervalMs?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose Node's stat-based file poller as a scoped Effect stream.
|
||||
*
|
||||
* `fs.watchFile` uses libuv timers, so it remains a reliable fallback when
|
||||
* the Effect scheduler is under load and prompt fiber wake-ups are not
|
||||
* guaranteed.
|
||||
*/
|
||||
export const watchFileWithStatPolling = ({
|
||||
filePath,
|
||||
pollIntervalMs = 100,
|
||||
}: WatchFileWithStatPollingOptions) =>
|
||||
Stream.callback<void>((queue) =>
|
||||
Effect.acquireRelease(
|
||||
Effect.sync(() => {
|
||||
const onChange = () => {
|
||||
Queue.offerUnsafe(queue, undefined);
|
||||
};
|
||||
nodeFs.watchFile(filePath, { interval: pollIntervalMs }, onChange);
|
||||
return onChange;
|
||||
}),
|
||||
(onChange) =>
|
||||
Effect.sync(() => {
|
||||
nodeFs.unwatchFile(filePath, onChange);
|
||||
}),
|
||||
),
|
||||
);
|
||||
+157
-203
@@ -27,8 +27,6 @@ import {
|
||||
type ServerProviderStatus,
|
||||
type KeybindingsConfig,
|
||||
type ResolvedKeybindingsConfig,
|
||||
type WsPushChannel,
|
||||
type WsPushMessage,
|
||||
type WsPush,
|
||||
} from "@t3tools/contracts";
|
||||
import { compileResolvedKeybindingRule, DEFAULT_KEYBINDINGS } from "./keybindings";
|
||||
@@ -54,6 +52,13 @@ import { GitCommandError, GitManagerError } from "./git/Errors.ts";
|
||||
import { MigrationError } from "@effect/sql-sqlite-bun/SqliteMigrator";
|
||||
import { AnalyticsService } from "./telemetry/Services/AnalyticsService.ts";
|
||||
|
||||
interface PendingMessages {
|
||||
queue: unknown[];
|
||||
waiters: Array<(message: unknown) => void>;
|
||||
}
|
||||
|
||||
const pendingBySocket = new WeakMap<WebSocket, PendingMessages>();
|
||||
|
||||
const asEventId = (value: string): EventId => EventId.makeUnsafe(value);
|
||||
const asProviderItemId = (value: string): ProviderItemId => ProviderItemId.makeUnsafe(value);
|
||||
const asThreadId = (value: string): ThreadId => ThreadId.makeUnsafe(value);
|
||||
@@ -209,69 +214,44 @@ class MockTerminalManager implements TerminalManagerShape {
|
||||
readonly dispose: TerminalManagerShape["dispose"] = Effect.void;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// WebSocket test harness
|
||||
//
|
||||
// Incoming messages are split into two channels:
|
||||
// - pushChannel: server push envelopes (type === "push")
|
||||
// - responseChannel: request/response envelopes (have an "id" field)
|
||||
//
|
||||
// This means sendRequest never has to skip push messages and waitForPush
|
||||
// never has to skip response messages, eliminating a class of ordering bugs.
|
||||
// ---------------------------------------------------------------------------
|
||||
function connectWs(port: number, token?: string): Promise<WebSocket> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const query = token ? `?token=${encodeURIComponent(token)}` : "";
|
||||
const ws = new WebSocket(`ws://127.0.0.1:${port}/${query}`);
|
||||
const pending: PendingMessages = { queue: [], waiters: [] };
|
||||
pendingBySocket.set(ws, pending);
|
||||
|
||||
interface MessageChannel<T> {
|
||||
queue: T[];
|
||||
waiters: Array<{
|
||||
resolve: (value: T) => void;
|
||||
reject: (error: Error) => void;
|
||||
timeoutId: ReturnType<typeof setTimeout> | null;
|
||||
}>;
|
||||
ws.on("message", (raw) => {
|
||||
const parsed = JSON.parse(String(raw));
|
||||
const waiter = pending.waiters.shift();
|
||||
if (waiter) {
|
||||
waiter(parsed);
|
||||
return;
|
||||
}
|
||||
pending.queue.push(parsed);
|
||||
});
|
||||
|
||||
ws.once("open", () => resolve(ws));
|
||||
ws.once("error", () => reject(new Error("WebSocket connection failed")));
|
||||
});
|
||||
}
|
||||
|
||||
interface SocketChannels {
|
||||
push: MessageChannel<WsPush>;
|
||||
response: MessageChannel<WebSocketResponse>;
|
||||
}
|
||||
|
||||
const channelsBySocket = new WeakMap<WebSocket, SocketChannels>();
|
||||
|
||||
function enqueue<T>(channel: MessageChannel<T>, item: T) {
|
||||
const waiter = channel.waiters.shift();
|
||||
if (waiter) {
|
||||
if (waiter.timeoutId !== null) clearTimeout(waiter.timeoutId);
|
||||
waiter.resolve(item);
|
||||
return;
|
||||
function waitForMessage(ws: WebSocket): Promise<unknown> {
|
||||
const pending = pendingBySocket.get(ws);
|
||||
if (!pending) {
|
||||
return Promise.reject(new Error("WebSocket not initialized"));
|
||||
}
|
||||
channel.queue.push(item);
|
||||
}
|
||||
|
||||
function dequeue<T>(channel: MessageChannel<T>, timeoutMs: number): Promise<T> {
|
||||
const queued = channel.queue.shift();
|
||||
const queued = pending.queue.shift();
|
||||
if (queued !== undefined) {
|
||||
return Promise.resolve(queued);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const waiter = {
|
||||
resolve,
|
||||
reject,
|
||||
timeoutId: setTimeout(() => {
|
||||
const index = channel.waiters.indexOf(waiter);
|
||||
if (index >= 0) channel.waiters.splice(index, 1);
|
||||
reject(new Error(`Timed out waiting for WebSocket message after ${timeoutMs}ms`));
|
||||
}, timeoutMs) as ReturnType<typeof setTimeout>,
|
||||
};
|
||||
channel.waiters.push(waiter);
|
||||
return new Promise((resolve) => {
|
||||
pending.waiters.push(resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function isWsPushEnvelope(message: unknown): message is WsPush {
|
||||
if (typeof message !== "object" || message === null) return false;
|
||||
if (!("type" in message) || !("channel" in message)) return false;
|
||||
return (message as { type?: unknown }).type === "push";
|
||||
}
|
||||
|
||||
function asWebSocketResponse(message: unknown): WebSocketResponse | null {
|
||||
if (typeof message !== "object" || message === null) return null;
|
||||
if (!("id" in message)) return null;
|
||||
@@ -280,68 +260,11 @@ function asWebSocketResponse(message: unknown): WebSocketResponse | null {
|
||||
return message as WebSocketResponse;
|
||||
}
|
||||
|
||||
function connectWsOnce(port: number, token?: string): Promise<WebSocket> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const query = token ? `?token=${encodeURIComponent(token)}` : "";
|
||||
const ws = new WebSocket(`ws://127.0.0.1:${port}/${query}`);
|
||||
const channels: SocketChannels = {
|
||||
push: { queue: [], waiters: [] },
|
||||
response: { queue: [], waiters: [] },
|
||||
};
|
||||
channelsBySocket.set(ws, channels);
|
||||
|
||||
ws.on("message", (raw) => {
|
||||
const parsed = JSON.parse(String(raw));
|
||||
if (isWsPushEnvelope(parsed)) {
|
||||
enqueue(channels.push, parsed);
|
||||
} else {
|
||||
const response = asWebSocketResponse(parsed);
|
||||
if (response) {
|
||||
enqueue(channels.response, response);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ws.once("open", () => resolve(ws));
|
||||
ws.once("error", () => reject(new Error("WebSocket connection failed")));
|
||||
});
|
||||
}
|
||||
|
||||
async function connectWs(port: number, token?: string, attempts = 5): Promise<WebSocket> {
|
||||
let lastError: unknown = new Error("WebSocket connection failed");
|
||||
|
||||
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
||||
try {
|
||||
return await connectWsOnce(port, token);
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
if (attempt < attempts - 1) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 25));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw lastError;
|
||||
}
|
||||
|
||||
/** Connect and wait for the server.welcome push. Returns [ws, welcomeData]. */
|
||||
async function connectAndAwaitWelcome(
|
||||
port: number,
|
||||
token?: string,
|
||||
): Promise<[WebSocket, WsPushMessage<typeof WS_CHANNELS.serverWelcome>]> {
|
||||
const ws = await connectWs(port, token);
|
||||
const welcome = await waitForPush(ws, WS_CHANNELS.serverWelcome);
|
||||
return [ws, welcome];
|
||||
}
|
||||
|
||||
async function sendRequest(
|
||||
ws: WebSocket,
|
||||
method: string,
|
||||
params?: unknown,
|
||||
): Promise<WebSocketResponse> {
|
||||
const channels = channelsBySocket.get(ws);
|
||||
if (!channels) throw new Error("WebSocket not initialized");
|
||||
|
||||
const id = crypto.randomUUID();
|
||||
const body =
|
||||
method === ORCHESTRATION_WS_METHODS.dispatchCommand
|
||||
@@ -349,55 +272,44 @@ async function sendRequest(
|
||||
: params && typeof params === "object" && !Array.isArray(params)
|
||||
? { _tag: method, ...(params as Record<string, unknown>) }
|
||||
: { _tag: method };
|
||||
ws.send(JSON.stringify({ id, body }));
|
||||
const message = JSON.stringify({ id, body });
|
||||
ws.send(message);
|
||||
|
||||
// Response channel only contains responses — no push filtering needed
|
||||
// Wait for response with matching id
|
||||
while (true) {
|
||||
const response = await dequeue(channels.response, 60_000);
|
||||
if (response.id === id || response.id === "unknown") {
|
||||
return response;
|
||||
const parsed = asWebSocketResponse(await waitForMessage(ws));
|
||||
if (!parsed) {
|
||||
continue;
|
||||
}
|
||||
if (parsed.id === id) {
|
||||
return parsed;
|
||||
}
|
||||
if (parsed.id === "unknown") {
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function waitForPush<C extends WsPushChannel>(
|
||||
async function waitForPush(
|
||||
ws: WebSocket,
|
||||
channel: C,
|
||||
predicate?: (push: WsPushMessage<C>) => boolean,
|
||||
channel: string,
|
||||
predicate?: (push: WsPush) => boolean,
|
||||
maxMessages = 120,
|
||||
idleTimeoutMs = 5_000,
|
||||
): Promise<WsPushMessage<C>> {
|
||||
const channels = channelsBySocket.get(ws);
|
||||
if (!channels) throw new Error("WebSocket not initialized");
|
||||
|
||||
for (let remaining = maxMessages; remaining > 0; remaining--) {
|
||||
const push = await dequeue(channels.push, idleTimeoutMs);
|
||||
if (push.channel !== channel) continue;
|
||||
const typed = push as WsPushMessage<C>;
|
||||
if (!predicate || predicate(typed)) return typed;
|
||||
}
|
||||
throw new Error(`Timed out waiting for push on ${channel}`);
|
||||
}
|
||||
|
||||
async function rewriteKeybindingsAndWaitForPush(
|
||||
ws: WebSocket,
|
||||
keybindingsPath: string,
|
||||
contents: string,
|
||||
predicate: (
|
||||
push: WsPushMessage<typeof WS_CHANNELS.serverConfigUpdated>,
|
||||
) => boolean,
|
||||
attempts = 3,
|
||||
): Promise<WsPushMessage<typeof WS_CHANNELS.serverConfigUpdated>> {
|
||||
let lastError: unknown;
|
||||
for (let attempt = 0; attempt < attempts; attempt++) {
|
||||
fs.writeFileSync(keybindingsPath, contents, "utf8");
|
||||
try {
|
||||
return await waitForPush(ws, WS_CHANNELS.serverConfigUpdated, predicate, 20, 3_000);
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
): Promise<WsPush> {
|
||||
const take = async (remaining: number): Promise<WsPush> => {
|
||||
if (remaining <= 0) {
|
||||
throw new Error(`Timed out waiting for push on ${channel}`);
|
||||
}
|
||||
}
|
||||
throw lastError;
|
||||
const message = (await waitForMessage(ws)) as WsPush;
|
||||
if (message.type !== "push" || message.channel !== channel) {
|
||||
return take(remaining - 1);
|
||||
}
|
||||
if (!predicate || predicate(message)) {
|
||||
return message;
|
||||
}
|
||||
return take(remaining - 1);
|
||||
};
|
||||
return take(maxMessages);
|
||||
}
|
||||
|
||||
async function requestPath(
|
||||
@@ -577,15 +489,18 @@ describe("WebSocket Server", () => {
|
||||
|
||||
it("sends welcome message on connect", async () => {
|
||||
server = await createTestServer({ cwd: "/test/project" });
|
||||
// Get the actual port after listen
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
expect(port).toBeGreaterThan(0);
|
||||
|
||||
const [ws, welcome] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
|
||||
expect(welcome.type).toBe("push");
|
||||
expect(welcome.data).toEqual({
|
||||
const message = (await waitForMessage(ws)) as WsPush;
|
||||
expect(message.type).toBe("push");
|
||||
expect(message.channel).toBe(WS_CHANNELS.serverWelcome);
|
||||
expect(message.data).toEqual({
|
||||
cwd: "/test/project",
|
||||
projectName: "project",
|
||||
});
|
||||
@@ -674,8 +589,10 @@ describe("WebSocket Server", () => {
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
expect(port).toBeGreaterThan(0);
|
||||
|
||||
const [ws, welcome] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
const welcome = (await waitForMessage(ws)) as WsPush; // welcome
|
||||
expect(welcome.channel).toBe(WS_CHANNELS.serverWelcome);
|
||||
expect(welcome.data).toEqual(
|
||||
expect.objectContaining({
|
||||
cwd: "/test/bootstrap-workspace",
|
||||
@@ -749,8 +666,9 @@ describe("WebSocket Server", () => {
|
||||
let port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
expect(port).toBeGreaterThan(0);
|
||||
|
||||
const [firstWs, firstWelcome] = await connectAndAwaitWelcome(port);
|
||||
const firstWs = await connectWs(port);
|
||||
connections.push(firstWs);
|
||||
const firstWelcome = (await waitForMessage(firstWs)) as WsPush;
|
||||
const firstBootstrapProjectId = (firstWelcome.data as { bootstrapProjectId?: string })
|
||||
.bootstrapProjectId;
|
||||
const firstBootstrapThreadId = (firstWelcome.data as { bootstrapThreadId?: string })
|
||||
@@ -772,8 +690,10 @@ describe("WebSocket Server", () => {
|
||||
port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
expect(port).toBeGreaterThan(0);
|
||||
|
||||
const [secondWs, secondWelcome] = await connectAndAwaitWelcome(port);
|
||||
const secondWs = await connectWs(port);
|
||||
connections.push(secondWs);
|
||||
const secondWelcome = (await waitForMessage(secondWs)) as WsPush;
|
||||
expect(secondWelcome.channel).toBe(WS_CHANNELS.serverWelcome);
|
||||
expect(secondWelcome.data).toEqual(
|
||||
expect.objectContaining({
|
||||
cwd,
|
||||
@@ -797,8 +717,9 @@ describe("WebSocket Server", () => {
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
expect(port).toBeGreaterThan(0);
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
expect(
|
||||
logSpy.mock.calls.some(([message]) => {
|
||||
@@ -821,9 +742,12 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
|
||||
// Consume welcome message
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.serverGetConfig);
|
||||
expect(response.error).toBeUndefined();
|
||||
expect(response.result).toEqual({
|
||||
@@ -846,8 +770,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.serverGetConfig);
|
||||
expect(response.error).toBeUndefined();
|
||||
@@ -876,8 +801,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.serverGetConfig);
|
||||
expect(response.error).toBeUndefined();
|
||||
@@ -915,8 +841,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.serverGetConfig);
|
||||
expect(response.error).toBeUndefined();
|
||||
@@ -958,28 +885,32 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const malformedPush = await rewriteKeybindingsAndWaitForPush(
|
||||
fs.writeFileSync(keybindingsPath, "{ not-json", "utf8");
|
||||
const malformedPush = await waitForPush(
|
||||
ws,
|
||||
keybindingsPath,
|
||||
"{ not-json",
|
||||
WS_CHANNELS.serverConfigUpdated,
|
||||
(push) =>
|
||||
Array.isArray(push.data.issues) &&
|
||||
Boolean(push.data.issues[0]) &&
|
||||
push.data.issues[0]!.kind === "keybindings.malformed-config",
|
||||
Array.isArray((push.data as { issues?: unknown[] }).issues) &&
|
||||
Boolean((push.data as { issues: Array<{ kind: string }> }).issues[0]) &&
|
||||
(push.data as { issues: Array<{ kind: string }> }).issues[0]!.kind ===
|
||||
"keybindings.malformed-config",
|
||||
);
|
||||
expect(malformedPush.data).toEqual({
|
||||
issues: [{ kind: "keybindings.malformed-config", message: expect.any(String) }],
|
||||
providers: defaultProviderStatuses,
|
||||
});
|
||||
|
||||
const successPush = await rewriteKeybindingsAndWaitForPush(
|
||||
fs.writeFileSync(keybindingsPath, "[]", "utf8");
|
||||
const successPush = await waitForPush(
|
||||
ws,
|
||||
keybindingsPath,
|
||||
"[]",
|
||||
(push) => Array.isArray(push.data.issues) && push.data.issues.length === 0,
|
||||
WS_CHANNELS.serverConfigUpdated,
|
||||
(push) =>
|
||||
Array.isArray((push.data as { issues?: unknown[] }).issues) &&
|
||||
(push.data as { issues: unknown[] }).issues.length === 0,
|
||||
);
|
||||
expect(successPush.data).toEqual({ issues: [], providers: defaultProviderStatuses });
|
||||
});
|
||||
@@ -998,8 +929,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.shellOpenInEditor, {
|
||||
cwd: "/my/workspace",
|
||||
@@ -1025,9 +957,11 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.serverGetConfig);
|
||||
expect(response.error).toBeUndefined();
|
||||
const persistedConfig = JSON.parse(
|
||||
@@ -1057,8 +991,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const upsertResponse = await sendRequest(ws, WS_METHODS.serverUpsertKeybinding, {
|
||||
key: "mod+shift+r",
|
||||
@@ -1098,9 +1033,12 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
|
||||
// Consume welcome push
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, "nonexistent.method");
|
||||
expect(response.error).toBeDefined();
|
||||
expect(response.error!.message).toContain("Invalid request format");
|
||||
@@ -1111,8 +1049,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, ORCHESTRATION_WS_METHODS.getTurnDiff, {
|
||||
threadId: "thread-missing",
|
||||
@@ -1128,8 +1067,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, ORCHESTRATION_WS_METHODS.getTurnDiff, {
|
||||
threadId: "thread-any",
|
||||
@@ -1147,8 +1087,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, ORCHESTRATION_WS_METHODS.getFullThreadDiff, {
|
||||
threadId: "thread-missing",
|
||||
@@ -1163,8 +1104,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const workspaceRoot = makeTempDir("t3code-ws-diff-project-");
|
||||
const createdAt = new Date().toISOString();
|
||||
@@ -1241,8 +1183,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const workspaceRoot = makeTempDir("t3code-ws-project-");
|
||||
const createdAt = new Date().toISOString();
|
||||
@@ -1335,8 +1278,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const open = await sendRequest(ws, WS_METHODS.terminalOpen, {
|
||||
threadId: "thread-1",
|
||||
@@ -1389,13 +1333,8 @@ describe("WebSocket Server", () => {
|
||||
};
|
||||
terminalManager.emitEvent(manualEvent);
|
||||
|
||||
const push = await waitForPush(
|
||||
ws,
|
||||
WS_CHANNELS.terminalEvent,
|
||||
(candidate) => (candidate.data as TerminalEvent).type === "output",
|
||||
);
|
||||
expect(push.type).toBe("push");
|
||||
expect(push.channel).toBe(WS_CHANNELS.terminalEvent);
|
||||
const push = await waitForPush(ws, WS_CHANNELS.terminalEvent);
|
||||
expect((push.data as TerminalEvent).type).toBe("output");
|
||||
});
|
||||
|
||||
it("detaches terminal event listener on stop for injected manager", async () => {
|
||||
@@ -1418,8 +1357,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.terminalOpen, {
|
||||
threadId: "",
|
||||
@@ -1435,17 +1375,21 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
|
||||
// Consume welcome
|
||||
await waitForMessage(ws);
|
||||
|
||||
// Send garbage
|
||||
ws.send("not json at all");
|
||||
|
||||
// Error response goes to the response channel
|
||||
const channels = channelsBySocket.get(ws)!;
|
||||
let response: WebSocketResponse | null = null;
|
||||
for (let attempt = 0; attempt < 5; attempt += 1) {
|
||||
const message = await dequeue(channels.response, 5_000);
|
||||
const message = asWebSocketResponse(await waitForMessage(ws));
|
||||
if (!message) {
|
||||
continue;
|
||||
}
|
||||
if (message.id === "unknown") {
|
||||
response = message;
|
||||
break;
|
||||
@@ -1478,8 +1422,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
@@ -1523,8 +1468,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const listResponse = await sendRequest(ws, WS_METHODS.projectsList);
|
||||
expect(listResponse.result).toBeUndefined();
|
||||
@@ -1559,8 +1505,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.projectsSearchEntries, {
|
||||
cwd: workspace,
|
||||
@@ -1584,8 +1531,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.projectsWriteFile, {
|
||||
cwd: workspace,
|
||||
@@ -1609,8 +1557,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.projectsWriteFile, {
|
||||
cwd: workspace,
|
||||
@@ -1653,8 +1602,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const listResponse = await sendRequest(ws, WS_METHODS.gitListBranches, { cwd: "/repo/path" });
|
||||
expect(listResponse.error).toBeUndefined();
|
||||
@@ -1694,8 +1644,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.gitStatus, {
|
||||
cwd: "/test",
|
||||
@@ -1723,8 +1674,9 @@ describe("WebSocket Server", () => {
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr !== null ? addr.port : 0;
|
||||
|
||||
const [ws] = await connectAndAwaitWelcome(port);
|
||||
const ws = await connectWs(port);
|
||||
connections.push(ws);
|
||||
await waitForMessage(ws);
|
||||
|
||||
const response = await sendRequest(ws, WS_METHODS.gitRunStackedAction, {
|
||||
cwd: "/test",
|
||||
@@ -1745,7 +1697,9 @@ describe("WebSocket Server", () => {
|
||||
|
||||
await expect(connectWs(port)).rejects.toThrow("WebSocket connection failed");
|
||||
|
||||
const [authorizedWs] = await connectAndAwaitWelcome(port, "secret-token");
|
||||
const authorizedWs = await connectWs(port, "secret-token");
|
||||
connections.push(authorizedWs);
|
||||
const welcome = (await waitForMessage(authorizedWs)) as WsPush;
|
||||
expect(welcome.channel).toBe(WS_CHANNELS.serverWelcome);
|
||||
});
|
||||
});
|
||||
+98
-66
@@ -20,11 +20,13 @@ import {
|
||||
PROVIDER_SEND_TURN_MAX_IMAGE_BYTES,
|
||||
ProjectId,
|
||||
ThreadId,
|
||||
TerminalEvent,
|
||||
WS_CHANNELS,
|
||||
WS_METHODS,
|
||||
WebSocketRequest,
|
||||
WsPush,
|
||||
WsResponse,
|
||||
ServerProviderStatus,
|
||||
} from "@t3tools/contracts";
|
||||
import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
|
||||
import {
|
||||
@@ -34,7 +36,6 @@ import {
|
||||
FileSystem,
|
||||
Layer,
|
||||
Path,
|
||||
PubSub,
|
||||
Ref,
|
||||
Schema,
|
||||
Scope,
|
||||
@@ -73,8 +74,6 @@ import {
|
||||
import { parseBase64DataUrl } from "./imageMime.ts";
|
||||
import { AnalyticsService } from "./telemetry/Services/AnalyticsService.ts";
|
||||
import { expandHomePath } from "./os-jank.ts";
|
||||
import { makeServerPushBus } from "./wsServer/pushBus.ts";
|
||||
import { makeServerReadiness } from "./wsServer/readiness.ts";
|
||||
|
||||
/**
|
||||
* ServerShape - Service API for server lifecycle control.
|
||||
@@ -199,7 +198,8 @@ function stripRequestTag<T extends { _tag: string }>(body: T) {
|
||||
|
||||
function messageFromCause(cause: Cause.Cause<unknown>): string {
|
||||
const squashed = Cause.squash(cause);
|
||||
const message = squashed instanceof Error ? squashed.message.trim() : String(squashed).trim();
|
||||
const message =
|
||||
squashed instanceof Error ? squashed.message.trim() : String(squashed).trim();
|
||||
return message.length > 0 ? message : Cause.pretty(cause);
|
||||
}
|
||||
|
||||
@@ -259,33 +259,48 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
|
||||
const providerStatuses = yield* providerHealth.getStatuses;
|
||||
yield* keybindingsManager.syncDefaultKeybindingsOnStartup.pipe(
|
||||
Effect.catch((error) =>
|
||||
Effect.logWarning("failed to sync keybindings defaults on startup", {
|
||||
path: error.configPath,
|
||||
detail: error.detail,
|
||||
cause: error.cause,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
const clients = yield* Ref.make(new Set<WebSocket>());
|
||||
const logger = createLogger("ws");
|
||||
const readiness = yield* makeServerReadiness;
|
||||
|
||||
function logOutgoingPush(push: WsPush, recipients: number) {
|
||||
if (!logWebSocketEvents) return;
|
||||
logger.event("outgoing push", {
|
||||
channel: push.channel,
|
||||
sequence: push.sequence,
|
||||
recipients,
|
||||
payload: push.data,
|
||||
});
|
||||
}
|
||||
|
||||
const pushBus = yield* makeServerPushBus({
|
||||
clients,
|
||||
logOutgoingPush,
|
||||
const encodePush = Schema.encodeEffect(Schema.fromJsonString(WsPush));
|
||||
const broadcastPush = Effect.fnUntraced(function* (push: WsPush) {
|
||||
const message = yield* encodePush(push);
|
||||
let recipients = 0;
|
||||
for (const client of yield* Ref.get(clients)) {
|
||||
if (client.readyState === client.OPEN) {
|
||||
client.send(message);
|
||||
recipients += 1;
|
||||
}
|
||||
}
|
||||
logOutgoingPush(push, recipients);
|
||||
});
|
||||
|
||||
const onTerminalEvent = Effect.fnUntraced(function* (event: TerminalEvent) {
|
||||
yield* broadcastPush({
|
||||
type: "push",
|
||||
channel: WS_CHANNELS.terminalEvent,
|
||||
data: event,
|
||||
});
|
||||
});
|
||||
yield* readiness.markPushBusReady;
|
||||
yield* keybindingsManager.start.pipe(
|
||||
Effect.mapError(
|
||||
(cause) => new ServerLifecycleError({ operation: "keybindingsRuntimeStart", cause }),
|
||||
),
|
||||
);
|
||||
yield* readiness.markKeybindingsReady;
|
||||
|
||||
const normalizeDispatchCommand = Effect.fnUntraced(function* (input: {
|
||||
readonly command: ClientOrchestrationCommand;
|
||||
@@ -315,7 +330,10 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<
|
||||
} satisfies OrchestrationCommand;
|
||||
}
|
||||
|
||||
if (input.command.type === "project.meta.update" && input.command.workspaceRoot !== undefined) {
|
||||
if (
|
||||
input.command.type === "project.meta.update" &&
|
||||
input.command.workspaceRoot !== undefined
|
||||
) {
|
||||
return {
|
||||
...input.command,
|
||||
workspaceRoot: yield* normalizeProjectWorkspaceRoot(input.command.workspaceRoot),
|
||||
@@ -598,29 +616,43 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<
|
||||
const subscriptionsScope = yield* Scope.make("sequential");
|
||||
yield* Effect.addFinalizer(() => Scope.close(subscriptionsScope, Exit.void));
|
||||
|
||||
// Push updated provider statuses to connected clients once background health checks finish.
|
||||
let providers: ReadonlyArray<ServerProviderStatus> = [];
|
||||
yield* providerHealth.getStatuses.pipe(
|
||||
Effect.flatMap((statuses) => {
|
||||
providers = statuses;
|
||||
return broadcastPush({
|
||||
type: "push",
|
||||
channel: WS_CHANNELS.serverConfigUpdated,
|
||||
data: {
|
||||
issues: [],
|
||||
providers: statuses,
|
||||
},
|
||||
});
|
||||
}),
|
||||
Effect.forkIn(subscriptionsScope),
|
||||
);
|
||||
|
||||
yield* Stream.runForEach(orchestrationEngine.streamDomainEvents, (event) =>
|
||||
pushBus.publishAll(ORCHESTRATION_WS_CHANNELS.domainEvent, event),
|
||||
broadcastPush({
|
||||
type: "push",
|
||||
channel: ORCHESTRATION_WS_CHANNELS.domainEvent,
|
||||
data: event,
|
||||
}),
|
||||
).pipe(Effect.forkIn(subscriptionsScope));
|
||||
|
||||
// Subscribe synchronously so the subscription exists before the
|
||||
// readiness barrier — avoids a race where the polling watcher
|
||||
// publishes before a lazily-created Stream.fromPubSub subscription.
|
||||
const keybindingsChangesSub = yield* keybindingsManager.subscribeChanges.pipe(
|
||||
Scope.provide(subscriptionsScope),
|
||||
);
|
||||
yield* Effect.forever(
|
||||
PubSub.take(keybindingsChangesSub).pipe(
|
||||
Effect.flatMap((event) =>
|
||||
pushBus.publishAll(WS_CHANNELS.serverConfigUpdated, {
|
||||
issues: event.issues,
|
||||
providers: providerStatuses,
|
||||
}),
|
||||
),
|
||||
),
|
||||
yield* Stream.runForEach(keybindingsManager.changes, (event) =>
|
||||
broadcastPush({
|
||||
type: "push",
|
||||
channel: WS_CHANNELS.serverConfigUpdated,
|
||||
data: {
|
||||
issues: event.issues,
|
||||
providers,
|
||||
},
|
||||
}),
|
||||
).pipe(Effect.forkIn(subscriptionsScope));
|
||||
|
||||
yield* Scope.provide(orchestrationReactor.start, subscriptionsScope);
|
||||
yield* readiness.markOrchestrationSubscriptionsReady;
|
||||
|
||||
let welcomeBootstrapProjectId: ProjectId | undefined;
|
||||
let welcomeBootstrapThreadId: ThreadId | undefined;
|
||||
@@ -691,20 +723,22 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<
|
||||
const runPromise = Effect.runPromiseWith(runtimeServices);
|
||||
|
||||
const unsubscribeTerminalEvents = yield* terminalManager.subscribe(
|
||||
(event) => void Effect.runPromise(pushBus.publishAll(WS_CHANNELS.terminalEvent, event)),
|
||||
(event) => void Effect.runPromise(onTerminalEvent(event)),
|
||||
);
|
||||
yield* Effect.addFinalizer(() => Effect.sync(() => unsubscribeTerminalEvents()));
|
||||
yield* readiness.markTerminalSubscriptionsReady;
|
||||
|
||||
yield* NodeHttpServer.make(() => httpServer, listenOptions).pipe(
|
||||
Effect.mapError((cause) => new ServerLifecycleError({ operation: "httpServerListen", cause })),
|
||||
);
|
||||
yield* readiness.markHttpListening;
|
||||
|
||||
yield* Effect.addFinalizer(() =>
|
||||
Effect.all([
|
||||
closeAllClients,
|
||||
closeWebSocketServer.pipe(Effect.ignoreCause({ log: true })),
|
||||
closeWebSocketServer.pipe(
|
||||
Effect.catch((error) =>
|
||||
Effect.logWarning("failed to close web socket server", { cause: error }),
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
@@ -759,16 +793,14 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<
|
||||
relativePath: body.relativePath,
|
||||
path,
|
||||
});
|
||||
yield* fileSystem
|
||||
.makeDirectory(path.dirname(target.absolutePath), { recursive: true })
|
||||
.pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new RouteRequestError({
|
||||
message: `Failed to prepare workspace path: ${String(cause)}`,
|
||||
}),
|
||||
),
|
||||
);
|
||||
yield* fileSystem.makeDirectory(path.dirname(target.absolutePath), { recursive: true }).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new RouteRequestError({
|
||||
message: `Failed to prepare workspace path: ${String(cause)}`,
|
||||
}),
|
||||
),
|
||||
);
|
||||
yield* fileSystem.writeFileString(target.absolutePath, body.contents).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
@@ -867,7 +899,7 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<
|
||||
keybindingsConfigPath,
|
||||
keybindings: keybindingsConfig.keybindings,
|
||||
issues: keybindingsConfig.issues,
|
||||
providers: providerStatuses,
|
||||
providers,
|
||||
availableEditors,
|
||||
};
|
||||
|
||||
@@ -952,29 +984,29 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<
|
||||
});
|
||||
|
||||
wss.on("connection", (ws) => {
|
||||
void runPromise(Ref.update(clients, (clients) => clients.add(ws)));
|
||||
|
||||
const segments = cwd.split(/[/\\]/).filter(Boolean);
|
||||
const projectName = segments[segments.length - 1] ?? "project";
|
||||
|
||||
const welcomeData = {
|
||||
cwd,
|
||||
projectName,
|
||||
...(welcomeBootstrapProjectId ? { bootstrapProjectId: welcomeBootstrapProjectId } : {}),
|
||||
...(welcomeBootstrapThreadId ? { bootstrapThreadId: welcomeBootstrapThreadId } : {}),
|
||||
const welcome: WsPush = {
|
||||
type: "push",
|
||||
channel: WS_CHANNELS.serverWelcome,
|
||||
data: {
|
||||
cwd,
|
||||
projectName,
|
||||
...(welcomeBootstrapProjectId ? { bootstrapProjectId: welcomeBootstrapProjectId } : {}),
|
||||
...(welcomeBootstrapThreadId ? { bootstrapThreadId: welcomeBootstrapThreadId } : {}),
|
||||
},
|
||||
};
|
||||
// Send welcome before adding to broadcast set so publishAll calls
|
||||
// cannot reach this client before the welcome arrives.
|
||||
void runPromise(
|
||||
readiness.awaitServerReady.pipe(
|
||||
Effect.flatMap(() => pushBus.publishClient(ws, WS_CHANNELS.serverWelcome, welcomeData)),
|
||||
Effect.flatMap((delivered) =>
|
||||
delivered ? Ref.update(clients, (clients) => clients.add(ws)) : Effect.void,
|
||||
),
|
||||
),
|
||||
);
|
||||
logOutgoingPush(welcome, 1);
|
||||
ws.send(JSON.stringify(welcome));
|
||||
|
||||
ws.on("message", (raw) => {
|
||||
void runPromise(
|
||||
handleMessage(ws, raw).pipe(Effect.ignoreCause({ log: true })),
|
||||
handleMessage(ws, raw).pipe(
|
||||
Effect.catch((error) => Effect.logError("Error handling message", error)),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
import type { WebSocket } from "ws";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { Effect, Exit, Ref, Scope } from "effect";
|
||||
import { WS_CHANNELS } from "@t3tools/contracts";
|
||||
|
||||
import { makeServerPushBus } from "./pushBus";
|
||||
|
||||
class MockWebSocket {
|
||||
static readonly OPEN = 1;
|
||||
|
||||
readonly OPEN = MockWebSocket.OPEN;
|
||||
readyState = MockWebSocket.OPEN;
|
||||
readonly sent: string[] = [];
|
||||
private readonly waiters = new Set<() => void>();
|
||||
|
||||
send(message: string) {
|
||||
this.sent.push(message);
|
||||
for (const waiter of this.waiters) {
|
||||
waiter();
|
||||
}
|
||||
}
|
||||
|
||||
waitForSentCount(count: number): Promise<void> {
|
||||
if (this.sent.length >= count) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const check = () => {
|
||||
if (this.sent.length < count) {
|
||||
return;
|
||||
}
|
||||
this.waiters.delete(check);
|
||||
resolve();
|
||||
};
|
||||
|
||||
this.waiters.add(check);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
describe("makeServerPushBus", () => {
|
||||
let scope: Scope.Closeable | null = null;
|
||||
|
||||
afterEach(async () => {
|
||||
if (scope) {
|
||||
await Effect.runPromise(Scope.close(scope, Exit.void));
|
||||
}
|
||||
scope = null;
|
||||
});
|
||||
|
||||
it("waits for the welcome push before a new client joins broadcast delivery", async () => {
|
||||
scope = await Effect.runPromise(Scope.make("sequential"));
|
||||
|
||||
const client = new MockWebSocket();
|
||||
const { clients, pushBus } = await Effect.runPromise(
|
||||
Effect.gen(function* () {
|
||||
const clients = yield* Ref.make(new Set<WebSocket>());
|
||||
const pushBus = yield* makeServerPushBus({
|
||||
clients,
|
||||
logOutgoingPush: () => {},
|
||||
});
|
||||
|
||||
return { clients, pushBus };
|
||||
}).pipe(Scope.provide(scope)),
|
||||
);
|
||||
|
||||
await Effect.runPromise(
|
||||
Effect.gen(function* () {
|
||||
yield* pushBus.publishAll(WS_CHANNELS.serverConfigUpdated, {
|
||||
issues: [{ kind: "keybindings.malformed-config", message: "queued-before-connect" }],
|
||||
providers: [],
|
||||
});
|
||||
|
||||
const delivered = yield* pushBus.publishClient(
|
||||
client as unknown as WebSocket,
|
||||
WS_CHANNELS.serverWelcome,
|
||||
{
|
||||
cwd: "/tmp/project",
|
||||
projectName: "project",
|
||||
},
|
||||
);
|
||||
expect(delivered).toBe(true);
|
||||
|
||||
yield* Ref.update(clients, (current) => current.add(client as unknown as WebSocket));
|
||||
|
||||
yield* pushBus.publishAll(WS_CHANNELS.serverConfigUpdated, {
|
||||
issues: [],
|
||||
providers: [],
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
await client.waitForSentCount(2);
|
||||
|
||||
const messages = client.sent.map(
|
||||
(message) => JSON.parse(message) as { channel: string; data: unknown },
|
||||
);
|
||||
|
||||
expect(messages).toHaveLength(2);
|
||||
expect(messages[0]).toEqual({
|
||||
type: "push",
|
||||
sequence: 2,
|
||||
channel: WS_CHANNELS.serverWelcome,
|
||||
data: {
|
||||
cwd: "/tmp/project",
|
||||
projectName: "project",
|
||||
},
|
||||
});
|
||||
expect(messages[1]).toEqual({
|
||||
type: "push",
|
||||
sequence: 3,
|
||||
channel: WS_CHANNELS.serverConfigUpdated,
|
||||
data: {
|
||||
issues: [],
|
||||
providers: [],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,106 +0,0 @@
|
||||
import { type WsPushChannel, type WsPushData, type WsPush } from "@t3tools/contracts";
|
||||
import { Deferred, Effect, Queue, Ref } from "effect";
|
||||
import type { Scope } from "effect";
|
||||
import type { WebSocket } from "ws";
|
||||
|
||||
type PushTarget =
|
||||
| { readonly kind: "all" }
|
||||
| { readonly kind: "client"; readonly client: WebSocket };
|
||||
|
||||
interface PushJob<C extends WsPushChannel = WsPushChannel> {
|
||||
readonly channel: C;
|
||||
readonly data: WsPushData<C>;
|
||||
readonly target: PushTarget;
|
||||
readonly delivered: Deferred.Deferred<boolean> | null;
|
||||
}
|
||||
|
||||
export interface ServerPushBus {
|
||||
readonly publishAll: <C extends WsPushChannel>(
|
||||
channel: C,
|
||||
data: WsPushData<C>,
|
||||
) => Effect.Effect<void>;
|
||||
readonly publishClient: <C extends WsPushChannel>(
|
||||
client: WebSocket,
|
||||
channel: C,
|
||||
data: WsPushData<C>,
|
||||
) => Effect.Effect<boolean>;
|
||||
}
|
||||
|
||||
export const makeServerPushBus = (input: {
|
||||
readonly clients: Ref.Ref<Set<WebSocket>>;
|
||||
readonly logOutgoingPush: (push: WsPush, recipients: number) => void;
|
||||
}): Effect.Effect<ServerPushBus, never, Scope.Scope> =>
|
||||
Effect.gen(function* () {
|
||||
const nextSequence = yield* Ref.make(0);
|
||||
const queue = yield* Queue.unbounded<PushJob>();
|
||||
|
||||
const settleDelivery = (job: PushJob, delivered: boolean) =>
|
||||
job.delivered === null
|
||||
? Effect.void
|
||||
: Deferred.succeed(job.delivered, delivered).pipe(Effect.orDie);
|
||||
|
||||
const send = Effect.fnUntraced(function* (job: PushJob) {
|
||||
const sequence = yield* Ref.updateAndGet(nextSequence, (current) => current + 1);
|
||||
const push = {
|
||||
type: "push",
|
||||
sequence,
|
||||
channel: job.channel,
|
||||
data: job.data,
|
||||
} as WsPush;
|
||||
|
||||
const message = JSON.stringify(push);
|
||||
const recipients =
|
||||
job.target.kind === "all" ? yield* Ref.get(input.clients) : new Set([job.target.client]);
|
||||
|
||||
let recipientCount = 0;
|
||||
for (const client of recipients) {
|
||||
if (client.readyState !== client.OPEN) {
|
||||
continue;
|
||||
}
|
||||
client.send(message);
|
||||
recipientCount += 1;
|
||||
}
|
||||
|
||||
input.logOutgoingPush(push, recipientCount);
|
||||
return recipientCount > 0;
|
||||
});
|
||||
|
||||
yield* Effect.forkScoped(
|
||||
Effect.forever(
|
||||
Queue.take(queue).pipe(
|
||||
Effect.flatMap((job) =>
|
||||
send(job).pipe(
|
||||
Effect.tap((delivered) => settleDelivery(job, delivered)),
|
||||
Effect.tapCause(() => settleDelivery(job, false)),
|
||||
Effect.ignoreCause({ log: true }),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
const publish =
|
||||
(target: PushTarget) =>
|
||||
<C extends WsPushChannel>(channel: C, data: WsPushData<C>) =>
|
||||
Queue.offer(queue, {
|
||||
channel,
|
||||
data,
|
||||
target,
|
||||
delivered: null,
|
||||
}).pipe(Effect.asVoid);
|
||||
|
||||
return {
|
||||
publishAll: publish({ kind: "all" }),
|
||||
publishClient: (client, channel, data) =>
|
||||
Effect.gen(function* () {
|
||||
const delivered = yield* Deferred.make<boolean>();
|
||||
yield* Queue.offer(queue, {
|
||||
channel,
|
||||
data,
|
||||
target: { kind: "client", client },
|
||||
delivered,
|
||||
}).pipe(Effect.asVoid);
|
||||
return yield* Deferred.await(delivered);
|
||||
}),
|
||||
} satisfies ServerPushBus;
|
||||
});
|
||||
@@ -1,36 +0,0 @@
|
||||
import { Deferred, Effect } from "effect";
|
||||
|
||||
export interface ServerReadiness {
|
||||
readonly awaitServerReady: Effect.Effect<void>;
|
||||
readonly markHttpListening: Effect.Effect<void>;
|
||||
readonly markPushBusReady: Effect.Effect<void>;
|
||||
readonly markKeybindingsReady: Effect.Effect<void>;
|
||||
readonly markTerminalSubscriptionsReady: Effect.Effect<void>;
|
||||
readonly markOrchestrationSubscriptionsReady: Effect.Effect<void>;
|
||||
}
|
||||
|
||||
export const makeServerReadiness = Effect.gen(function* () {
|
||||
const httpListening = yield* Deferred.make<void>();
|
||||
const pushBusReady = yield* Deferred.make<void>();
|
||||
const keybindingsReady = yield* Deferred.make<void>();
|
||||
const terminalSubscriptionsReady = yield* Deferred.make<void>();
|
||||
const orchestrationSubscriptionsReady = yield* Deferred.make<void>();
|
||||
|
||||
const complete = (deferred: Deferred.Deferred<void>) =>
|
||||
Deferred.succeed(deferred, undefined).pipe(Effect.orDie);
|
||||
|
||||
return {
|
||||
awaitServerReady: Effect.all([
|
||||
Deferred.await(httpListening),
|
||||
Deferred.await(pushBusReady),
|
||||
Deferred.await(keybindingsReady),
|
||||
Deferred.await(terminalSubscriptionsReady),
|
||||
Deferred.await(orchestrationSubscriptionsReady),
|
||||
]).pipe(Effect.asVoid),
|
||||
markHttpListening: complete(httpListening),
|
||||
markPushBusReady: complete(pushBusReady),
|
||||
markKeybindingsReady: complete(keybindingsReady),
|
||||
markTerminalSubscriptionsReady: complete(terminalSubscriptionsReady),
|
||||
markOrchestrationSubscriptionsReady: complete(orchestrationSubscriptionsReady),
|
||||
} satisfies ServerReadiness;
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
import { defineConfig, mergeConfig } from "vitest/config";
|
||||
|
||||
import baseConfig from "../../vitest.config";
|
||||
|
||||
export default mergeConfig(
|
||||
baseConfig,
|
||||
defineConfig({
|
||||
test: {
|
||||
testTimeout: 15_000,
|
||||
hookTimeout: 15_000,
|
||||
},
|
||||
}),
|
||||
);
|
||||
@@ -15,6 +15,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@base-ui/react": "^1.2.0",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@lexical/react": "^0.41.0",
|
||||
"@pierre/diffs": "^1.1.0-beta.16",
|
||||
"@t3tools/contracts": "workspace:*",
|
||||
|
||||
@@ -256,6 +256,61 @@ function createDraftOnlySnapshot(): OrchestrationReadModel {
|
||||
};
|
||||
}
|
||||
|
||||
function createSnapshotWithLongProposedPlan(): OrchestrationReadModel {
|
||||
const snapshot = createSnapshotForTargetUser({
|
||||
targetMessageId: "msg-user-plan-target" as MessageId,
|
||||
targetText: "plan thread",
|
||||
});
|
||||
const planMarkdown = [
|
||||
"# Ship plan mode follow-up",
|
||||
"",
|
||||
"- Step 1: capture the thread-open trace",
|
||||
"- Step 2: identify the main-thread bottleneck",
|
||||
"- Step 3: keep collapsed cards cheap",
|
||||
"- Step 4: render the full markdown only on demand",
|
||||
"- Step 5: preserve export and save actions",
|
||||
"- Step 6: add regression coverage",
|
||||
"- Step 7: verify route transitions stay responsive",
|
||||
"- Step 8: confirm no server-side work changed",
|
||||
"- Step 9: confirm short plans still render normally",
|
||||
"- Step 10: confirm long plans stay collapsed by default",
|
||||
"- Step 11: confirm preview text is still useful",
|
||||
"- Step 12: confirm plan follow-up flow still works",
|
||||
"- Step 13: confirm timeline virtualization still behaves",
|
||||
"- Step 14: confirm theme styling still looks correct",
|
||||
"- Step 15: confirm save dialog behavior is unchanged",
|
||||
"- Step 16: confirm download behavior is unchanged",
|
||||
"- Step 17: confirm code fences do not parse until expand",
|
||||
"- Step 18: confirm preview truncation ends cleanly",
|
||||
"- Step 19: confirm markdown links still open in editor after expand",
|
||||
"- Step 20: confirm deep hidden detail only appears after expand",
|
||||
"",
|
||||
"```ts",
|
||||
"export const hiddenPlanImplementationDetail = 'deep hidden detail only after expand';",
|
||||
"```",
|
||||
].join("\n");
|
||||
|
||||
return {
|
||||
...snapshot,
|
||||
threads: snapshot.threads.map((thread) =>
|
||||
thread.id === THREAD_ID
|
||||
? Object.assign({}, thread, {
|
||||
proposedPlans: [
|
||||
{
|
||||
id: "plan-browser-test",
|
||||
turnId: null,
|
||||
planMarkdown,
|
||||
createdAt: isoAt(1_000),
|
||||
updatedAt: isoAt(1_001),
|
||||
},
|
||||
],
|
||||
updatedAt: isoAt(1_001),
|
||||
})
|
||||
: thread,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
function resolveWsRpc(tag: string): unknown {
|
||||
if (tag === ORCHESTRATION_WS_METHODS.getSnapshot) {
|
||||
return fixture.snapshot;
|
||||
@@ -305,7 +360,6 @@ const worker = setupWorker(
|
||||
client.send(
|
||||
JSON.stringify({
|
||||
type: "push",
|
||||
sequence: 1,
|
||||
channel: WS_CHANNELS.serverWelcome,
|
||||
data: fixture.welcome,
|
||||
}),
|
||||
@@ -868,4 +922,41 @@ describe("ChatView timeline estimator parity (full app)", () => {
|
||||
await mounted.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps long proposed plans lightweight until the user expands them", async () => {
|
||||
const mounted = await mountChatView({
|
||||
viewport: DEFAULT_VIEWPORT,
|
||||
snapshot: createSnapshotWithLongProposedPlan(),
|
||||
});
|
||||
|
||||
try {
|
||||
await waitForElement(
|
||||
() =>
|
||||
Array.from(document.querySelectorAll("button")).find(
|
||||
(button) => button.textContent?.trim() === "Expand plan",
|
||||
) as HTMLButtonElement | null,
|
||||
"Unable to find Expand plan button.",
|
||||
);
|
||||
|
||||
expect(document.body.textContent).not.toContain("deep hidden detail only after expand");
|
||||
|
||||
const expandButton = await waitForElement(
|
||||
() =>
|
||||
Array.from(document.querySelectorAll("button")).find(
|
||||
(button) => button.textContent?.trim() === "Expand plan",
|
||||
) as HTMLButtonElement | null,
|
||||
"Unable to find Expand plan button.",
|
||||
);
|
||||
expandButton.click();
|
||||
|
||||
await vi.waitFor(
|
||||
() => {
|
||||
expect(document.body.textContent).toContain("deep hidden detail only after expand");
|
||||
},
|
||||
{ timeout: 8_000, interval: 16 },
|
||||
);
|
||||
} finally {
|
||||
await mounted.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
@@ -20,6 +20,7 @@ import {
|
||||
buildProposedPlanMarkdownFilename,
|
||||
normalizePlanMarkdownForExport,
|
||||
downloadPlanAsTextFile,
|
||||
stripDisplayedPlanMarkdown,
|
||||
} from "../proposedPlan";
|
||||
import { Menu, MenuItem, MenuPopup, MenuTrigger } from "./ui/menu";
|
||||
import { readNativeApi } from "~/nativeApi";
|
||||
@@ -67,6 +68,7 @@ const PlanSidebar = memo(function PlanSidebar({
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
const planMarkdown = activeProposedPlan?.planMarkdown ?? null;
|
||||
const displayedPlanMarkdown = planMarkdown ? stripDisplayedPlanMarkdown(planMarkdown) : null;
|
||||
const planTitle = planMarkdown ? proposedPlanTitle(planMarkdown) : null;
|
||||
|
||||
const handleCopyPlan = useCallback(() => {
|
||||
@@ -237,7 +239,7 @@ const PlanSidebar = memo(function PlanSidebar({
|
||||
{proposedPlanExpanded ? (
|
||||
<div className="rounded-lg border border-border/50 bg-background/50 p-3">
|
||||
<ChatMarkdown
|
||||
text={planMarkdown}
|
||||
text={displayedPlanMarkdown ?? ""}
|
||||
cwd={markdownCwd}
|
||||
isStreaming={false}
|
||||
/>
|
||||
|
||||
+389
-278
@@ -11,6 +11,21 @@ import {
|
||||
TriangleAlertIcon,
|
||||
} from "lucide-react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import {
|
||||
DndContext,
|
||||
type DragCancelEvent,
|
||||
type CollisionDetection,
|
||||
PointerSensor,
|
||||
type DragStartEvent,
|
||||
closestCorners,
|
||||
pointerWithin,
|
||||
useSensor,
|
||||
useSensors,
|
||||
type DragEndEvent,
|
||||
} from "@dnd-kit/core";
|
||||
import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
||||
import { restrictToParentElement, restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
||||
import { CSS } from "@dnd-kit/utilities";
|
||||
import {
|
||||
DEFAULT_RUNTIME_MODE,
|
||||
DEFAULT_MODEL_BY_PROVIDER,
|
||||
@@ -32,6 +47,7 @@ import { derivePendingApprovals, derivePendingUserInputs } from "../session-logi
|
||||
import { gitRemoveWorktreeMutationOptions, gitStatusQueryOptions } from "../lib/gitReactQuery";
|
||||
import { serverConfigQueryOptions } from "../lib/serverReactQuery";
|
||||
import { readNativeApi } from "../nativeApi";
|
||||
import { resolveServerHttpOrigin } from "../serverConnection";
|
||||
import { type DraftThreadEnvMode, useComposerDraftStore } from "../composerDraftStore";
|
||||
import { selectThreadTerminalState, useTerminalStateStore } from "../terminalStateStore";
|
||||
import { toastManager } from "./ui/toast";
|
||||
@@ -48,7 +64,7 @@ import {
|
||||
} from "./desktopUpdate.logic";
|
||||
import { Alert, AlertAction, AlertDescription, AlertTitle } from "./ui/alert";
|
||||
import { Button } from "./ui/button";
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible";
|
||||
import { Collapsible, CollapsibleContent } from "./ui/collapsible";
|
||||
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
|
||||
import {
|
||||
SidebarContent,
|
||||
@@ -163,29 +179,7 @@ function T3Wordmark() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Derives the server's HTTP origin (scheme + host + port) from the same
|
||||
* sources WsTransport uses, converting ws(s) to http(s).
|
||||
*/
|
||||
function getServerHttpOrigin(): string {
|
||||
const bridgeUrl = window.desktopBridge?.getWsUrl();
|
||||
const envUrl = import.meta.env.VITE_WS_URL as string | undefined;
|
||||
const wsUrl =
|
||||
bridgeUrl && bridgeUrl.length > 0
|
||||
? bridgeUrl
|
||||
: envUrl && envUrl.length > 0
|
||||
? envUrl
|
||||
: `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`;
|
||||
// Parse to extract just the origin, dropping path/query (e.g. ?token=…)
|
||||
const httpUrl = wsUrl.replace(/^wss:/, "https:").replace(/^ws:/, "http:");
|
||||
try {
|
||||
return new URL(httpUrl).origin;
|
||||
} catch {
|
||||
return httpUrl;
|
||||
}
|
||||
}
|
||||
|
||||
const serverHttpOrigin = getServerHttpOrigin();
|
||||
const serverHttpOrigin = resolveServerHttpOrigin();
|
||||
|
||||
function ProjectFavicon({ cwd }: { cwd: string }) {
|
||||
const [status, setStatus] = useState<"loading" | "loaded" | "error">("loading");
|
||||
@@ -207,11 +201,41 @@ function ProjectFavicon({ cwd }: { cwd: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
type SortableProjectHandleProps = Pick<ReturnType<typeof useSortable>, "attributes" | "listeners">;
|
||||
|
||||
function SortableProjectItem({
|
||||
projectId,
|
||||
children,
|
||||
}: {
|
||||
projectId: ProjectId;
|
||||
children: (handleProps: SortableProjectHandleProps) => React.ReactNode;
|
||||
}) {
|
||||
const { attributes, listeners, setNodeRef, transform, transition, isDragging, isOver } =
|
||||
useSortable({ id: projectId });
|
||||
return (
|
||||
<li
|
||||
ref={setNodeRef}
|
||||
style={{
|
||||
transform: CSS.Translate.toString(transform),
|
||||
transition,
|
||||
}}
|
||||
className={`group/menu-item relative rounded-md ${
|
||||
isDragging ? "z-20 opacity-80" : ""
|
||||
} ${isOver && !isDragging ? "ring-1 ring-primary/40" : ""}`}
|
||||
data-sidebar="menu-item"
|
||||
data-slot="sidebar-menu-item"
|
||||
>
|
||||
{children({ attributes, listeners })}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Sidebar() {
|
||||
const projects = useStore((store) => store.projects);
|
||||
const threads = useStore((store) => store.threads);
|
||||
const markThreadUnread = useStore((store) => store.markThreadUnread);
|
||||
const toggleProject = useStore((store) => store.toggleProject);
|
||||
const reorderProjects = useStore((store) => store.reorderProjects);
|
||||
const clearComposerDraftForThread = useComposerDraftStore((store) => store.clearThreadDraft);
|
||||
const getDraftThreadByProjectId = useComposerDraftStore(
|
||||
(store) => store.getDraftThreadByProjectId,
|
||||
@@ -253,6 +277,8 @@ export default function Sidebar() {
|
||||
>(() => new Set());
|
||||
const renamingCommittedRef = useRef(false);
|
||||
const renamingInputRef = useRef<HTMLInputElement | null>(null);
|
||||
const dragInProgressRef = useRef(false);
|
||||
const suppressProjectClickAfterDragRef = useRef(false);
|
||||
const [desktopUpdateState, setDesktopUpdateState] = useState<DesktopUpdateState | null>(null);
|
||||
const shouldBrowseForProjectImmediately = isElectron;
|
||||
const shouldShowProjectPathEntry = addingProject && !shouldBrowseForProjectImmediately;
|
||||
@@ -503,6 +529,8 @@ export default function Sidebar() {
|
||||
void addProjectFromPath(newCwd);
|
||||
};
|
||||
|
||||
const canAddProject = newCwd.trim().length > 0 && !isAddingProject;
|
||||
|
||||
const handlePickFolder = async () => {
|
||||
const api = readNativeApi();
|
||||
if (!api || isPickingFolder) return;
|
||||
@@ -791,6 +819,77 @@ export default function Sidebar() {
|
||||
],
|
||||
);
|
||||
|
||||
const projectDnDSensors = useSensors(
|
||||
useSensor(PointerSensor, {
|
||||
activationConstraint: { distance: 6 },
|
||||
}),
|
||||
);
|
||||
const projectCollisionDetection = useCallback<CollisionDetection>((args) => {
|
||||
const pointerCollisions = pointerWithin(args);
|
||||
if (pointerCollisions.length > 0) {
|
||||
return pointerCollisions;
|
||||
}
|
||||
|
||||
return closestCorners(args);
|
||||
}, []);
|
||||
|
||||
const handleProjectDragEnd = useCallback(
|
||||
(event: DragEndEvent) => {
|
||||
dragInProgressRef.current = false;
|
||||
const { active, over } = event;
|
||||
if (!over || active.id === over.id) return;
|
||||
const activeProject = projects.find((project) => project.id === active.id);
|
||||
const overProject = projects.find((project) => project.id === over.id);
|
||||
if (!activeProject || !overProject) return;
|
||||
reorderProjects(activeProject.id, overProject.id);
|
||||
},
|
||||
[projects, reorderProjects],
|
||||
);
|
||||
|
||||
const handleProjectDragStart = useCallback((_event: DragStartEvent) => {
|
||||
dragInProgressRef.current = true;
|
||||
suppressProjectClickAfterDragRef.current = true;
|
||||
}, []);
|
||||
|
||||
const handleProjectDragCancel = useCallback((_event: DragCancelEvent) => {
|
||||
dragInProgressRef.current = false;
|
||||
}, []);
|
||||
|
||||
const handleProjectTitlePointerDownCapture = useCallback(() => {
|
||||
suppressProjectClickAfterDragRef.current = false;
|
||||
}, []);
|
||||
|
||||
const handleProjectTitleClick = useCallback(
|
||||
(event: React.MouseEvent<HTMLButtonElement>, projectId: ProjectId) => {
|
||||
if (dragInProgressRef.current) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
if (suppressProjectClickAfterDragRef.current) {
|
||||
// Consume the synthetic click emitted after a drag release.
|
||||
suppressProjectClickAfterDragRef.current = false;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
toggleProject(projectId);
|
||||
},
|
||||
[toggleProject],
|
||||
);
|
||||
|
||||
const handleProjectTitleKeyDown = useCallback(
|
||||
(event: React.KeyboardEvent<HTMLButtonElement>, projectId: ProjectId) => {
|
||||
if (event.key !== "Enter" && event.key !== " ") return;
|
||||
event.preventDefault();
|
||||
if (dragInProgressRef.current) {
|
||||
return;
|
||||
}
|
||||
toggleProject(projectId);
|
||||
},
|
||||
[toggleProject],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const onWindowKeyDown = (event: KeyboardEvent) => {
|
||||
const activeThread = routeThreadId
|
||||
@@ -1105,7 +1204,7 @@ export default function Sidebar() {
|
||||
type="button"
|
||||
className="shrink-0 rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground transition-colors duration-150 hover:bg-primary/90 disabled:opacity-60"
|
||||
onClick={handleAddProject}
|
||||
disabled={isAddingProject}
|
||||
disabled={!canAddProject}
|
||||
>
|
||||
{isAddingProject ? "Adding..." : "Add"}
|
||||
</button>
|
||||
@@ -1130,267 +1229,279 @@ export default function Sidebar() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<SidebarMenu>
|
||||
{projects.map((project) => {
|
||||
const projectThreads = threads
|
||||
.filter((thread) => thread.projectId === project.id)
|
||||
.toSorted((a, b) => {
|
||||
const byDate = new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
||||
if (byDate !== 0) return byDate;
|
||||
return b.id.localeCompare(a.id);
|
||||
});
|
||||
const isThreadListExpanded = expandedThreadListsByProject.has(project.id);
|
||||
const hasHiddenThreads = projectThreads.length > THREAD_PREVIEW_LIMIT;
|
||||
const visibleThreads =
|
||||
hasHiddenThreads && !isThreadListExpanded
|
||||
? projectThreads.slice(0, THREAD_PREVIEW_LIMIT)
|
||||
: projectThreads;
|
||||
<DndContext
|
||||
sensors={projectDnDSensors}
|
||||
collisionDetection={projectCollisionDetection}
|
||||
modifiers={[restrictToVerticalAxis, restrictToParentElement]}
|
||||
onDragStart={handleProjectDragStart}
|
||||
onDragEnd={handleProjectDragEnd}
|
||||
onDragCancel={handleProjectDragCancel}
|
||||
>
|
||||
<SidebarMenu>
|
||||
<SortableContext
|
||||
items={projects.map((project) => project.id)}
|
||||
strategy={verticalListSortingStrategy}
|
||||
>
|
||||
{projects.map((project) => {
|
||||
const projectThreads = threads
|
||||
.filter((thread) => thread.projectId === project.id)
|
||||
.toSorted((a, b) => {
|
||||
const byDate = new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
||||
if (byDate !== 0) return byDate;
|
||||
return b.id.localeCompare(a.id);
|
||||
});
|
||||
const isThreadListExpanded = expandedThreadListsByProject.has(project.id);
|
||||
const hasHiddenThreads = projectThreads.length > THREAD_PREVIEW_LIMIT;
|
||||
const visibleThreads =
|
||||
hasHiddenThreads && !isThreadListExpanded
|
||||
? projectThreads.slice(0, THREAD_PREVIEW_LIMIT)
|
||||
: projectThreads;
|
||||
|
||||
return (
|
||||
<Collapsible
|
||||
key={project.id}
|
||||
className="group/collapsible"
|
||||
open={project.expanded}
|
||||
onOpenChange={(open) => {
|
||||
if (open === project.expanded) return;
|
||||
toggleProject(project.id);
|
||||
}}
|
||||
>
|
||||
<SidebarMenuItem>
|
||||
<div className="group/project-header relative">
|
||||
<CollapsibleTrigger
|
||||
render={
|
||||
<SidebarMenuButton
|
||||
size="sm"
|
||||
className="gap-2 px-2 py-1.5 text-left hover:bg-accent group-hover/project-header:bg-accent group-hover/project-header:text-sidebar-accent-foreground"
|
||||
/>
|
||||
}
|
||||
onContextMenu={(event) => {
|
||||
event.preventDefault();
|
||||
void handleProjectContextMenu(project.id, {
|
||||
x: event.clientX,
|
||||
y: event.clientY,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<ChevronRightIcon
|
||||
className={`-ml-0.5 size-3.5 shrink-0 text-muted-foreground/70 transition-transform duration-150 ${
|
||||
project.expanded ? "rotate-90" : ""
|
||||
}`}
|
||||
/>
|
||||
<ProjectFavicon cwd={project.cwd} />
|
||||
<span className="flex-1 truncate text-xs font-medium text-foreground/90">
|
||||
{project.name}
|
||||
</span>
|
||||
</CollapsibleTrigger>
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<SidebarMenuAction
|
||||
render={
|
||||
<button
|
||||
type="button"
|
||||
aria-label={`Create new thread in ${project.name}`}
|
||||
/>
|
||||
}
|
||||
showOnHover
|
||||
className="top-1 right-1 size-5 rounded-md p-0 text-muted-foreground/70 hover:bg-secondary hover:text-foreground"
|
||||
onClick={(event) => {
|
||||
return (
|
||||
<SortableProjectItem key={project.id} projectId={project.id}>
|
||||
{(dragHandleProps) => (
|
||||
<Collapsible
|
||||
className="group/collapsible"
|
||||
open={project.expanded}
|
||||
>
|
||||
<div className="group/project-header relative">
|
||||
<SidebarMenuButton
|
||||
size="sm"
|
||||
className="gap-2 px-2 py-1.5 text-left cursor-grab active:cursor-grabbing hover:bg-accent group-hover/project-header:bg-accent group-hover/project-header:text-sidebar-accent-foreground"
|
||||
{...dragHandleProps.attributes}
|
||||
{...dragHandleProps.listeners}
|
||||
onPointerDownCapture={handleProjectTitlePointerDownCapture}
|
||||
onClick={(event) => handleProjectTitleClick(event, project.id)}
|
||||
onKeyDown={(event) => handleProjectTitleKeyDown(event, project.id)}
|
||||
onContextMenu={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
void handleNewThread(project.id);
|
||||
void handleProjectContextMenu(project.id, {
|
||||
x: event.clientX,
|
||||
y: event.clientY,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<SquarePenIcon className="size-3.5" />
|
||||
</SidebarMenuAction>
|
||||
}
|
||||
/>
|
||||
<TooltipPopup side="top">
|
||||
{newThreadShortcutLabel
|
||||
? `New thread (${newThreadShortcutLabel})`
|
||||
: "New thread"}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<CollapsibleContent>
|
||||
<SidebarMenuSub className="mx-1 my-0 w-full translate-x-0 gap-0 px-1.5 py-0">
|
||||
{visibleThreads.map((thread) => {
|
||||
const isActive = routeThreadId === thread.id;
|
||||
const threadStatus = resolveThreadStatusPill({
|
||||
thread,
|
||||
hasPendingApprovals: pendingApprovalByThreadId.get(thread.id) === true,
|
||||
hasPendingUserInput: pendingUserInputByThreadId.get(thread.id) === true,
|
||||
});
|
||||
const prStatus = prStatusIndicator(prByThreadId.get(thread.id) ?? null);
|
||||
const terminalStatus = terminalStatusFromRunningIds(
|
||||
selectThreadTerminalState(terminalStateByThreadId, thread.id)
|
||||
.runningTerminalIds,
|
||||
);
|
||||
|
||||
return (
|
||||
<SidebarMenuSubItem key={thread.id} className="w-full">
|
||||
<SidebarMenuSubButton
|
||||
render={<div role="button" tabIndex={0} />}
|
||||
size="sm"
|
||||
isActive={isActive}
|
||||
className={`h-7 w-full translate-x-0 cursor-default justify-start px-2 text-left hover:bg-accent hover:text-foreground ${
|
||||
isActive
|
||||
? "bg-accent/85 text-foreground font-medium ring-1 ring-border/70 dark:bg-accent/55 dark:ring-border/50"
|
||||
: "text-muted-foreground"
|
||||
<ChevronRightIcon
|
||||
className={`-ml-0.5 size-3.5 shrink-0 text-muted-foreground/70 transition-transform duration-150 ${
|
||||
project.expanded ? "rotate-90" : ""
|
||||
}`}
|
||||
onClick={() => {
|
||||
void navigate({
|
||||
to: "/$threadId",
|
||||
params: { threadId: thread.id },
|
||||
});
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key !== "Enter" && event.key !== " ") return;
|
||||
event.preventDefault();
|
||||
void navigate({
|
||||
to: "/$threadId",
|
||||
params: { threadId: thread.id },
|
||||
});
|
||||
}}
|
||||
onContextMenu={(event) => {
|
||||
event.preventDefault();
|
||||
void handleThreadContextMenu(thread.id, {
|
||||
x: event.clientX,
|
||||
y: event.clientY,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<div className="flex min-w-0 flex-1 items-center gap-1.5 text-left">
|
||||
{prStatus && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<button
|
||||
type="button"
|
||||
aria-label={prStatus.tooltip}
|
||||
className={`inline-flex items-center justify-center ${prStatus.colorClass} cursor-pointer rounded-sm outline-hidden focus-visible:ring-1 focus-visible:ring-ring`}
|
||||
onClick={(event) => {
|
||||
openPrLink(event, prStatus.url);
|
||||
}}
|
||||
>
|
||||
<GitPullRequestIcon className="size-3" />
|
||||
</button>
|
||||
}
|
||||
/>
|
||||
<ProjectFavicon cwd={project.cwd} />
|
||||
<span className="flex-1 truncate text-xs font-medium text-foreground/90">
|
||||
{project.name}
|
||||
</span>
|
||||
</SidebarMenuButton>
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<SidebarMenuAction
|
||||
render={
|
||||
<button
|
||||
type="button"
|
||||
aria-label={`Create new thread in ${project.name}`}
|
||||
/>
|
||||
<TooltipPopup side="top">{prStatus.tooltip}</TooltipPopup>
|
||||
</Tooltip>
|
||||
)}
|
||||
{threadStatus && (
|
||||
<span
|
||||
className={`inline-flex items-center gap-1 text-[10px] ${threadStatus.colorClass}`}
|
||||
>
|
||||
<span
|
||||
className={`h-1.5 w-1.5 rounded-full ${threadStatus.dotClass} ${
|
||||
threadStatus.pulse ? "animate-pulse" : ""
|
||||
}`}
|
||||
/>
|
||||
<span className="hidden md:inline">{threadStatus.label}</span>
|
||||
</span>
|
||||
)}
|
||||
{renamingThreadId === thread.id ? (
|
||||
<input
|
||||
ref={(el) => {
|
||||
if (el && renamingInputRef.current !== el) {
|
||||
renamingInputRef.current = el;
|
||||
el.focus();
|
||||
el.select();
|
||||
}
|
||||
}}
|
||||
className="min-w-0 flex-1 truncate text-xs bg-transparent outline-none border border-ring rounded px-0.5"
|
||||
value={renamingTitle}
|
||||
onChange={(e) => setRenamingTitle(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
e.stopPropagation();
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
renamingCommittedRef.current = true;
|
||||
void commitRename(thread.id, renamingTitle, thread.title);
|
||||
} else if (e.key === "Escape") {
|
||||
e.preventDefault();
|
||||
renamingCommittedRef.current = true;
|
||||
cancelRename();
|
||||
}
|
||||
}}
|
||||
onBlur={() => {
|
||||
if (!renamingCommittedRef.current) {
|
||||
void commitRename(thread.id, renamingTitle, thread.title);
|
||||
}
|
||||
}}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
/>
|
||||
) : (
|
||||
<span className="min-w-0 flex-1 truncate text-xs">
|
||||
{thread.title}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="ml-auto flex shrink-0 items-center gap-1.5">
|
||||
{terminalStatus && (
|
||||
<span
|
||||
role="img"
|
||||
aria-label={terminalStatus.label}
|
||||
title={terminalStatus.label}
|
||||
className={`inline-flex items-center justify-center ${terminalStatus.colorClass}`}
|
||||
>
|
||||
<TerminalIcon
|
||||
className={`size-3 ${terminalStatus.pulse ? "animate-pulse" : ""}`}
|
||||
/>
|
||||
</span>
|
||||
)}
|
||||
<span
|
||||
className={`text-[10px] ${
|
||||
isActive ? "text-foreground/65" : "text-muted-foreground/40"
|
||||
}`}
|
||||
}
|
||||
showOnHover
|
||||
className="top-1 right-1 size-5 rounded-md p-0 text-muted-foreground/70 hover:bg-secondary hover:text-foreground"
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
void handleNewThread(project.id);
|
||||
}}
|
||||
>
|
||||
{formatRelativeTime(thread.createdAt)}
|
||||
</span>
|
||||
</div>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
);
|
||||
})}
|
||||
<SquarePenIcon className="size-3.5" />
|
||||
</SidebarMenuAction>
|
||||
}
|
||||
/>
|
||||
<TooltipPopup side="top">
|
||||
{newThreadShortcutLabel
|
||||
? `New thread (${newThreadShortcutLabel})`
|
||||
: "New thread"}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
{hasHiddenThreads && !isThreadListExpanded && (
|
||||
<SidebarMenuSubItem className="w-full">
|
||||
<SidebarMenuSubButton
|
||||
render={<button type="button" />}
|
||||
size="sm"
|
||||
className="h-6 w-full translate-x-0 justify-start px-2 text-left text-[10px] text-muted-foreground/60 hover:bg-accent hover:text-muted-foreground/80"
|
||||
onClick={() => {
|
||||
expandThreadListForProject(project.id);
|
||||
}}
|
||||
>
|
||||
<span>Show more</span>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
)}
|
||||
{hasHiddenThreads && isThreadListExpanded && (
|
||||
<SidebarMenuSubItem className="w-full">
|
||||
<SidebarMenuSubButton
|
||||
render={<button type="button" />}
|
||||
size="sm"
|
||||
className="h-6 w-full translate-x-0 justify-start px-2 text-left text-[10px] text-muted-foreground/60 hover:bg-accent hover:text-muted-foreground/80"
|
||||
onClick={() => {
|
||||
collapseThreadListForProject(project.id);
|
||||
}}
|
||||
>
|
||||
<span>Show less</span>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
)}
|
||||
</SidebarMenuSub>
|
||||
</CollapsibleContent>
|
||||
</SidebarMenuItem>
|
||||
</Collapsible>
|
||||
);
|
||||
})}
|
||||
</SidebarMenu>
|
||||
<CollapsibleContent keepMounted>
|
||||
<SidebarMenuSub className="mx-1 my-0 w-full translate-x-0 gap-0 px-1.5 py-0">
|
||||
{visibleThreads.map((thread) => {
|
||||
const isActive = routeThreadId === thread.id;
|
||||
const threadStatus = resolveThreadStatusPill({
|
||||
thread,
|
||||
hasPendingApprovals: pendingApprovalByThreadId.get(thread.id) === true,
|
||||
hasPendingUserInput: pendingUserInputByThreadId.get(thread.id) === true,
|
||||
});
|
||||
const prStatus = prStatusIndicator(prByThreadId.get(thread.id) ?? null);
|
||||
const terminalStatus = terminalStatusFromRunningIds(
|
||||
selectThreadTerminalState(terminalStateByThreadId, thread.id)
|
||||
.runningTerminalIds,
|
||||
);
|
||||
|
||||
return (
|
||||
<SidebarMenuSubItem key={thread.id} className="w-full">
|
||||
<SidebarMenuSubButton
|
||||
render={<div role="button" tabIndex={0} />}
|
||||
size="sm"
|
||||
isActive={isActive}
|
||||
className={`h-7 w-full translate-x-0 cursor-default justify-start px-2 text-left hover:bg-accent hover:text-foreground ${
|
||||
isActive
|
||||
? "bg-accent/85 text-foreground font-medium ring-1 ring-border/70 dark:bg-accent/55 dark:ring-border/50"
|
||||
: "text-muted-foreground"
|
||||
}`}
|
||||
onClick={() => {
|
||||
void navigate({
|
||||
to: "/$threadId",
|
||||
params: { threadId: thread.id },
|
||||
});
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key !== "Enter" && event.key !== " ") return;
|
||||
event.preventDefault();
|
||||
void navigate({
|
||||
to: "/$threadId",
|
||||
params: { threadId: thread.id },
|
||||
});
|
||||
}}
|
||||
onContextMenu={(event) => {
|
||||
event.preventDefault();
|
||||
void handleThreadContextMenu(thread.id, {
|
||||
x: event.clientX,
|
||||
y: event.clientY,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<div className="flex min-w-0 flex-1 items-center gap-1.5 text-left">
|
||||
{prStatus && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<button
|
||||
type="button"
|
||||
aria-label={prStatus.tooltip}
|
||||
className={`inline-flex items-center justify-center ${prStatus.colorClass} cursor-pointer rounded-sm outline-hidden focus-visible:ring-1 focus-visible:ring-ring`}
|
||||
onClick={(event) => {
|
||||
openPrLink(event, prStatus.url);
|
||||
}}
|
||||
>
|
||||
<GitPullRequestIcon className="size-3" />
|
||||
</button>
|
||||
}
|
||||
/>
|
||||
<TooltipPopup side="top">{prStatus.tooltip}</TooltipPopup>
|
||||
</Tooltip>
|
||||
)}
|
||||
{threadStatus && (
|
||||
<span
|
||||
className={`inline-flex items-center gap-1 text-[10px] ${threadStatus.colorClass}`}
|
||||
>
|
||||
<span
|
||||
className={`h-1.5 w-1.5 rounded-full ${threadStatus.dotClass} ${
|
||||
threadStatus.pulse ? "animate-pulse" : ""
|
||||
}`}
|
||||
/>
|
||||
<span className="hidden md:inline">{threadStatus.label}</span>
|
||||
</span>
|
||||
)}
|
||||
{renamingThreadId === thread.id ? (
|
||||
<input
|
||||
ref={(el) => {
|
||||
if (el && renamingInputRef.current !== el) {
|
||||
renamingInputRef.current = el;
|
||||
el.focus();
|
||||
el.select();
|
||||
}
|
||||
}}
|
||||
className="min-w-0 flex-1 truncate text-xs bg-transparent outline-none border border-ring rounded px-0.5"
|
||||
value={renamingTitle}
|
||||
onChange={(e) => setRenamingTitle(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
e.stopPropagation();
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
renamingCommittedRef.current = true;
|
||||
void commitRename(thread.id, renamingTitle, thread.title);
|
||||
} else if (e.key === "Escape") {
|
||||
e.preventDefault();
|
||||
renamingCommittedRef.current = true;
|
||||
cancelRename();
|
||||
}
|
||||
}}
|
||||
onBlur={() => {
|
||||
if (!renamingCommittedRef.current) {
|
||||
void commitRename(thread.id, renamingTitle, thread.title);
|
||||
}
|
||||
}}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
/>
|
||||
) : (
|
||||
<span className="min-w-0 flex-1 truncate text-xs">
|
||||
{thread.title}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="ml-auto flex shrink-0 items-center gap-1.5">
|
||||
{terminalStatus && (
|
||||
<span
|
||||
role="img"
|
||||
aria-label={terminalStatus.label}
|
||||
title={terminalStatus.label}
|
||||
className={`inline-flex items-center justify-center ${terminalStatus.colorClass}`}
|
||||
>
|
||||
<TerminalIcon
|
||||
className={`size-3 ${terminalStatus.pulse ? "animate-pulse" : ""}`}
|
||||
/>
|
||||
</span>
|
||||
)}
|
||||
<span
|
||||
className={`text-[10px] ${
|
||||
isActive ? "text-foreground/65" : "text-muted-foreground/40"
|
||||
}`}
|
||||
>
|
||||
{formatRelativeTime(thread.createdAt)}
|
||||
</span>
|
||||
</div>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
);
|
||||
})}
|
||||
|
||||
{hasHiddenThreads && !isThreadListExpanded && (
|
||||
<SidebarMenuSubItem className="w-full">
|
||||
<SidebarMenuSubButton
|
||||
render={<button type="button" />}
|
||||
size="sm"
|
||||
className="h-6 w-full translate-x-0 justify-start px-2 text-left text-[10px] text-muted-foreground/60 hover:bg-accent hover:text-muted-foreground/80"
|
||||
onClick={() => {
|
||||
expandThreadListForProject(project.id);
|
||||
}}
|
||||
>
|
||||
<span>Show more</span>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
)}
|
||||
{hasHiddenThreads && isThreadListExpanded && (
|
||||
<SidebarMenuSubItem className="w-full">
|
||||
<SidebarMenuSubButton
|
||||
render={<button type="button" />}
|
||||
size="sm"
|
||||
className="h-6 w-full translate-x-0 justify-start px-2 text-left text-[10px] text-muted-foreground/60 hover:bg-accent hover:text-muted-foreground/80"
|
||||
onClick={() => {
|
||||
collapseThreadListForProject(project.id);
|
||||
}}
|
||||
>
|
||||
<span>Show less</span>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
)}
|
||||
</SidebarMenuSub>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
)}
|
||||
</SortableProjectItem>
|
||||
);
|
||||
})}
|
||||
</SortableContext>
|
||||
</SidebarMenu>
|
||||
</DndContext>
|
||||
|
||||
{projects.length === 0 && !shouldShowProjectPathEntry && (
|
||||
<div className="px-2 pt-4 text-center text-xs text-muted-foreground/60">
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX,
|
||||
COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX,
|
||||
shouldUseCompactComposerFooter,
|
||||
} from "./composerFooterLayout";
|
||||
|
||||
describe("shouldUseCompactComposerFooter", () => {
|
||||
it("stays expanded without a measured width", () => {
|
||||
expect(shouldUseCompactComposerFooter(null)).toBe(false);
|
||||
});
|
||||
|
||||
it("switches to compact mode below the breakpoint", () => {
|
||||
expect(shouldUseCompactComposerFooter(COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX - 1)).toBe(true);
|
||||
});
|
||||
|
||||
it("stays expanded at and above the breakpoint", () => {
|
||||
expect(shouldUseCompactComposerFooter(COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX)).toBe(false);
|
||||
expect(shouldUseCompactComposerFooter(COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX + 48)).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("uses a higher breakpoint for wide action states", () => {
|
||||
expect(
|
||||
shouldUseCompactComposerFooter(COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX - 1, {
|
||||
hasWideActions: true,
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
shouldUseCompactComposerFooter(COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX, {
|
||||
hasWideActions: true,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
export const COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX = 620;
|
||||
export const COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX = 720;
|
||||
|
||||
export function shouldUseCompactComposerFooter(
|
||||
width: number | null,
|
||||
options?: { hasWideActions?: boolean },
|
||||
): boolean {
|
||||
const breakpoint = options?.hasWideActions
|
||||
? COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX
|
||||
: COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX;
|
||||
return width !== null && width < breakpoint;
|
||||
}
|
||||
@@ -22,7 +22,7 @@ function CollapsiblePanel({ className, ...props }: CollapsiblePrimitive.Panel.Pr
|
||||
return (
|
||||
<CollapsiblePrimitive.Panel
|
||||
className={cn(
|
||||
"h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 data-ending-style:h-0 data-starting-style:h-0",
|
||||
"h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 data-ending-style:h-0 data-starting-style:h-0 data-open:data-ending-style:[height:var(--collapsible-panel-height)]",
|
||||
className,
|
||||
)}
|
||||
data-slot="collapsible-panel"
|
||||
|
||||
@@ -9,10 +9,12 @@ function ScrollArea({
|
||||
children,
|
||||
scrollFade = false,
|
||||
scrollbarGutter = false,
|
||||
hideScrollbars = false,
|
||||
...props
|
||||
}: ScrollAreaPrimitive.Root.Props & {
|
||||
scrollFade?: boolean;
|
||||
scrollbarGutter?: boolean;
|
||||
hideScrollbars?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<ScrollAreaPrimitive.Root className={cn("size-full min-h-0", className)} {...props}>
|
||||
@@ -22,14 +24,19 @@ function ScrollArea({
|
||||
scrollFade &&
|
||||
"mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]",
|
||||
scrollbarGutter && "data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5",
|
||||
hideScrollbars && "[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
||||
)}
|
||||
data-slot="scroll-area-viewport"
|
||||
>
|
||||
{children}
|
||||
</ScrollAreaPrimitive.Viewport>
|
||||
<ScrollBar orientation="vertical" />
|
||||
<ScrollBar orientation="horizontal" />
|
||||
<ScrollAreaPrimitive.Corner data-slot="scroll-area-corner" />
|
||||
{!hideScrollbars && (
|
||||
<>
|
||||
<ScrollBar orientation="vertical" />
|
||||
<ScrollBar orientation="horizontal" />
|
||||
<ScrollAreaPrimitive.Corner data-slot="scroll-area-corner" />
|
||||
</>
|
||||
)}
|
||||
</ScrollAreaPrimitive.Root>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
|
||||
return (
|
||||
<main
|
||||
className={cn(
|
||||
"relative flex w-full flex-1 flex-col bg-background",
|
||||
"relative flex min-w-0 w-full flex-1 flex-col bg-background",
|
||||
"md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm/5",
|
||||
className,
|
||||
)}
|
||||
@@ -651,10 +651,10 @@ function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof S
|
||||
|
||||
function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<ScrollArea className="**:data-[slot=scroll-area-scrollbar]:hidden" scrollFade>
|
||||
<ScrollArea hideScrollbars scrollFade className="h-auto min-h-0 flex-1">
|
||||
<div
|
||||
className={cn(
|
||||
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
||||
"flex w-full min-w-0 flex-col gap-2 group-data-[collapsible=icon]:overflow-hidden",
|
||||
className,
|
||||
)}
|
||||
data-sidebar="content"
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { ProjectId, ThreadId } from "@t3tools/contracts";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { type ComposerImageAttachment, useComposerDraftStore } from "./composerDraftStore";
|
||||
import {
|
||||
type ComposerImageAttachment,
|
||||
createDebouncedStorage,
|
||||
useComposerDraftStore,
|
||||
} from "./composerDraftStore";
|
||||
|
||||
function makeImage(input: {
|
||||
id: string;
|
||||
@@ -451,3 +455,125 @@ describe("composerDraftStore runtime and interaction settings", () => {
|
||||
expect(useComposerDraftStore.getState().draftsByThreadId[threadId]).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// createDebouncedStorage
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function createMockStorage() {
|
||||
const store = new Map<string, string>();
|
||||
return {
|
||||
getItem: vi.fn((name: string) => store.get(name) ?? null),
|
||||
setItem: vi.fn((name: string, value: string) => {
|
||||
store.set(name, value);
|
||||
}),
|
||||
removeItem: vi.fn((name: string) => {
|
||||
store.delete(name);
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
describe("createDebouncedStorage", () => {
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it("delegates getItem immediately", () => {
|
||||
const base = createMockStorage();
|
||||
base.getItem.mockReturnValueOnce("value");
|
||||
const storage = createDebouncedStorage(base);
|
||||
|
||||
expect(storage.getItem("key")).toBe("value");
|
||||
expect(base.getItem).toHaveBeenCalledWith("key");
|
||||
});
|
||||
|
||||
it("does not write to base storage until the debounce fires", () => {
|
||||
const base = createMockStorage();
|
||||
const storage = createDebouncedStorage(base);
|
||||
|
||||
storage.setItem("key", "v1");
|
||||
expect(base.setItem).not.toHaveBeenCalled();
|
||||
|
||||
vi.advanceTimersByTime(299);
|
||||
expect(base.setItem).not.toHaveBeenCalled();
|
||||
|
||||
vi.advanceTimersByTime(1);
|
||||
expect(base.setItem).toHaveBeenCalledWith("key", "v1");
|
||||
});
|
||||
|
||||
it("only writes the last value when setItem is called rapidly", () => {
|
||||
const base = createMockStorage();
|
||||
const storage = createDebouncedStorage(base);
|
||||
|
||||
storage.setItem("key", "v1");
|
||||
storage.setItem("key", "v2");
|
||||
storage.setItem("key", "v3");
|
||||
|
||||
vi.advanceTimersByTime(300);
|
||||
expect(base.setItem).toHaveBeenCalledTimes(1);
|
||||
expect(base.setItem).toHaveBeenCalledWith("key", "v3");
|
||||
});
|
||||
|
||||
it("removeItem cancels a pending setItem write", () => {
|
||||
const base = createMockStorage();
|
||||
const storage = createDebouncedStorage(base);
|
||||
|
||||
storage.setItem("key", "v1");
|
||||
storage.removeItem("key");
|
||||
|
||||
vi.advanceTimersByTime(300);
|
||||
expect(base.setItem).not.toHaveBeenCalled();
|
||||
expect(base.removeItem).toHaveBeenCalledWith("key");
|
||||
});
|
||||
|
||||
it("flush writes the pending value immediately", () => {
|
||||
const base = createMockStorage();
|
||||
const storage = createDebouncedStorage(base);
|
||||
|
||||
storage.setItem("key", "v1");
|
||||
expect(base.setItem).not.toHaveBeenCalled();
|
||||
|
||||
storage.flush();
|
||||
expect(base.setItem).toHaveBeenCalledWith("key", "v1");
|
||||
|
||||
// Timer should be cancelled; no duplicate write.
|
||||
vi.advanceTimersByTime(300);
|
||||
expect(base.setItem).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("flush is a no-op when nothing is pending", () => {
|
||||
const base = createMockStorage();
|
||||
const storage = createDebouncedStorage(base);
|
||||
|
||||
storage.flush();
|
||||
expect(base.setItem).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("flush after removeItem is a no-op", () => {
|
||||
const base = createMockStorage();
|
||||
const storage = createDebouncedStorage(base);
|
||||
|
||||
storage.setItem("key", "v1");
|
||||
storage.removeItem("key");
|
||||
storage.flush();
|
||||
|
||||
expect(base.setItem).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("setItem works normally after removeItem cancels a pending write", () => {
|
||||
const base = createMockStorage();
|
||||
const storage = createDebouncedStorage(base);
|
||||
|
||||
storage.setItem("key", "v1");
|
||||
storage.removeItem("key");
|
||||
storage.setItem("key", "v2");
|
||||
|
||||
vi.advanceTimersByTime(300);
|
||||
expect(base.setItem).toHaveBeenCalledTimes(1);
|
||||
expect(base.setItem).toHaveBeenCalledWith("key", "v2");
|
||||
});
|
||||
});
|
||||
@@ -14,12 +14,54 @@ import {
|
||||
DEFAULT_RUNTIME_MODE,
|
||||
type ChatImageAttachment,
|
||||
} from "./types";
|
||||
import { Debouncer } from "@tanstack/react-pacer";
|
||||
import { create } from "zustand";
|
||||
import { createJSONStorage, persist } from "zustand/middleware";
|
||||
import { createJSONStorage, persist, type StateStorage } from "zustand/middleware";
|
||||
|
||||
export const COMPOSER_DRAFT_STORAGE_KEY = "t3code:composer-drafts:v1";
|
||||
export type DraftThreadEnvMode = "local" | "worktree";
|
||||
|
||||
const COMPOSER_PERSIST_DEBOUNCE_MS = 300;
|
||||
|
||||
interface DebouncedStorage extends StateStorage {
|
||||
flush: () => void;
|
||||
}
|
||||
|
||||
export function createDebouncedStorage(baseStorage: StateStorage): DebouncedStorage {
|
||||
const debouncedSetItem = new Debouncer(
|
||||
(name: string, value: string) => {
|
||||
baseStorage.setItem(name, value);
|
||||
},
|
||||
{ wait: COMPOSER_PERSIST_DEBOUNCE_MS },
|
||||
);
|
||||
|
||||
return {
|
||||
getItem: (name) => baseStorage.getItem(name),
|
||||
setItem: (name, value) => {
|
||||
debouncedSetItem.maybeExecute(name, value);
|
||||
},
|
||||
removeItem: (name) => {
|
||||
debouncedSetItem.cancel();
|
||||
baseStorage.removeItem(name);
|
||||
},
|
||||
flush: () => {
|
||||
debouncedSetItem.flush();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const composerDebouncedStorage: DebouncedStorage =
|
||||
typeof localStorage !== "undefined"
|
||||
? createDebouncedStorage(localStorage)
|
||||
: { getItem: () => null, setItem: () => {}, removeItem: () => {}, flush: () => {} };
|
||||
|
||||
// Flush pending composer draft writes before page unload to prevent data loss.
|
||||
if (typeof window !== "undefined") {
|
||||
window.addEventListener("beforeunload", () => {
|
||||
composerDebouncedStorage.flush();
|
||||
});
|
||||
}
|
||||
|
||||
export interface PersistedComposerImageAttachment {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -1169,7 +1211,7 @@ export const useComposerDraftStore = create<ComposerDraftStoreState>()(
|
||||
{
|
||||
name: COMPOSER_DRAFT_STORAGE_KEY,
|
||||
version: 1,
|
||||
storage: createJSONStorage(() => localStorage),
|
||||
storage: createJSONStorage(() => composerDebouncedStorage),
|
||||
partialize: (state) => {
|
||||
const persistedDraftsByThreadId: PersistedComposerDraftStoreState["draftsByThreadId"] = {};
|
||||
for (const [threadId, draft] of Object.entries(state.draftsByThreadId)) {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
buildCollapsedProposedPlanPreviewMarkdown,
|
||||
buildPlanImplementationThreadTitle,
|
||||
buildPlanImplementationPrompt,
|
||||
buildProposedPlanMarkdownFilename,
|
||||
proposedPlanTitle,
|
||||
resolvePlanFollowUpSubmission,
|
||||
stripDisplayedPlanMarkdown,
|
||||
} from "./proposedPlan";
|
||||
|
||||
describe("proposedPlanTitle", () => {
|
||||
@@ -26,6 +28,38 @@ describe("buildPlanImplementationPrompt", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildCollapsedProposedPlanPreviewMarkdown", () => {
|
||||
it("drops the redundant title heading and preserves the following markdown lines", () => {
|
||||
expect(
|
||||
buildCollapsedProposedPlanPreviewMarkdown("# Integrate RPC\n\n## Summary\n\n- step 1\n- step 2", {
|
||||
maxLines: 4,
|
||||
}),
|
||||
).toBe("- step 1\n- step 2");
|
||||
});
|
||||
|
||||
it("appends an overflow marker when the preview truncates remaining content", () => {
|
||||
expect(
|
||||
buildCollapsedProposedPlanPreviewMarkdown("# Integrate RPC\n\n- step 1\n- step 2\n- step 3", {
|
||||
maxLines: 2,
|
||||
}),
|
||||
).toBe("- step 1\n- step 2\n\n...");
|
||||
});
|
||||
});
|
||||
|
||||
describe("stripDisplayedPlanMarkdown", () => {
|
||||
it("drops the leading title heading from displayed plan markdown", () => {
|
||||
expect(stripDisplayedPlanMarkdown("# Integrate RPC\n\n## Summary\n\n- step 1\n")).toBe(
|
||||
"- step 1",
|
||||
);
|
||||
});
|
||||
|
||||
it("preserves non-summary headings after dropping the title heading", () => {
|
||||
expect(stripDisplayedPlanMarkdown("# Integrate RPC\n\n## Scope\n\n- step 1\n")).toBe(
|
||||
"## Scope\n\n- step 1",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolvePlanFollowUpSubmission", () => {
|
||||
it("switches to default mode when implementing the ready plan without extra text", () => {
|
||||
expect(
|
||||
|
||||
@@ -3,6 +3,65 @@ export function proposedPlanTitle(planMarkdown: string): string | null {
|
||||
return heading && heading.length > 0 ? heading : null;
|
||||
}
|
||||
|
||||
export function stripDisplayedPlanMarkdown(planMarkdown: string): string {
|
||||
const lines = planMarkdown.trimEnd().split(/\r?\n/);
|
||||
const sourceLines =
|
||||
lines[0] && /^\s{0,3}#{1,6}\s+/.test(lines[0]) ? lines.slice(1) : [...lines];
|
||||
while (sourceLines[0]?.trim().length === 0) {
|
||||
sourceLines.shift();
|
||||
}
|
||||
const firstHeadingMatch = sourceLines[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/);
|
||||
if (firstHeadingMatch?.[1]?.trim().toLowerCase() === "summary") {
|
||||
sourceLines.shift();
|
||||
while (sourceLines[0]?.trim().length === 0) {
|
||||
sourceLines.shift();
|
||||
}
|
||||
}
|
||||
return sourceLines.join("\n");
|
||||
}
|
||||
|
||||
export function buildCollapsedProposedPlanPreviewMarkdown(
|
||||
planMarkdown: string,
|
||||
options?: {
|
||||
maxLines?: number;
|
||||
},
|
||||
): string {
|
||||
const maxLines = options?.maxLines ?? 8;
|
||||
const lines = stripDisplayedPlanMarkdown(planMarkdown)
|
||||
.trimEnd()
|
||||
.split(/\r?\n/)
|
||||
.map((line) => line.trimEnd());
|
||||
const previewLines: string[] = [];
|
||||
let visibleLineCount = 0;
|
||||
let hasMoreContent = false;
|
||||
|
||||
for (const line of lines) {
|
||||
const isVisibleLine = line.trim().length > 0;
|
||||
if (isVisibleLine && visibleLineCount >= maxLines) {
|
||||
hasMoreContent = true;
|
||||
break;
|
||||
}
|
||||
previewLines.push(line);
|
||||
if (isVisibleLine) {
|
||||
visibleLineCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
while (previewLines.length > 0 && previewLines.at(-1)?.trim().length === 0) {
|
||||
previewLines.pop();
|
||||
}
|
||||
|
||||
if (previewLines.length === 0) {
|
||||
return proposedPlanTitle(planMarkdown) ?? "Plan preview unavailable.";
|
||||
}
|
||||
|
||||
if (hasMoreContent) {
|
||||
previewLines.push("", "...");
|
||||
}
|
||||
|
||||
return previewLines.join("\n");
|
||||
}
|
||||
|
||||
function sanitizePlanFileSegment(input: string): string {
|
||||
const sanitized = input
|
||||
.toLowerCase()
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
} from "@tanstack/react-router";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { QueryClient, useQueryClient } from "@tanstack/react-query";
|
||||
import { Throttler } from "@tanstack/react-pacer";
|
||||
|
||||
import { APP_DISPLAY_NAME } from "../branding";
|
||||
import { Button } from "../components/ui/button";
|
||||
@@ -150,6 +151,7 @@ function EventRouter() {
|
||||
let latestSequence = 0;
|
||||
let syncing = false;
|
||||
let pending = false;
|
||||
let needsProviderInvalidation = false;
|
||||
|
||||
const flushSnapshotSync = async (): Promise<void> => {
|
||||
const snapshot = await api.orchestration.getSnapshot();
|
||||
@@ -185,7 +187,20 @@ function EventRouter() {
|
||||
syncing = false;
|
||||
};
|
||||
|
||||
void syncSnapshot().catch(() => undefined);
|
||||
const domainEventFlushThrottler = new Throttler(
|
||||
() => {
|
||||
if (needsProviderInvalidation) {
|
||||
needsProviderInvalidation = false;
|
||||
void queryClient.invalidateQueries({ queryKey: providerQueryKeys.all });
|
||||
}
|
||||
void syncSnapshot();
|
||||
},
|
||||
{
|
||||
wait: 100,
|
||||
leading: false,
|
||||
trailing: true,
|
||||
},
|
||||
);
|
||||
|
||||
const unsubDomainEvent = api.orchestration.onDomainEvent((event) => {
|
||||
if (event.sequence <= latestSequence) {
|
||||
@@ -193,9 +208,9 @@ function EventRouter() {
|
||||
}
|
||||
latestSequence = event.sequence;
|
||||
if (event.type === "thread.turn-diff-completed" || event.type === "thread.reverted") {
|
||||
void queryClient.invalidateQueries({ queryKey: providerQueryKeys.all });
|
||||
needsProviderInvalidation = true;
|
||||
}
|
||||
void syncSnapshot();
|
||||
domainEventFlushThrottler.maybeExecute();
|
||||
});
|
||||
const unsubTerminalEvent = api.terminal.onEvent((event) => {
|
||||
const hasRunningSubprocess = terminalRunningSubprocessFromEvent(event);
|
||||
@@ -280,6 +295,8 @@ function EventRouter() {
|
||||
});
|
||||
return () => {
|
||||
disposed = true;
|
||||
needsProviderInvalidation = false;
|
||||
domainEventFlushThrottler.cancel();
|
||||
unsubDomainEvent();
|
||||
unsubTerminalEvent();
|
||||
unsubWelcome();
|
||||
|
||||
@@ -15,6 +15,7 @@ const DIFF_INLINE_LAYOUT_MEDIA_QUERY = "(max-width: 1180px)";
|
||||
const DIFF_INLINE_SIDEBAR_WIDTH_STORAGE_KEY = "chat_diff_sidebar_width";
|
||||
const DIFF_INLINE_DEFAULT_WIDTH = "clamp(28rem,48vw,44rem)";
|
||||
const DIFF_INLINE_SIDEBAR_MIN_WIDTH = 26 * 16;
|
||||
const COMPOSER_COMPACT_MIN_LEFT_CONTROLS_WIDTH_PX = 208;
|
||||
|
||||
const DiffPanelSheet = (props: {
|
||||
children: ReactNode;
|
||||
@@ -91,8 +92,23 @@ const DiffPanelInlineSidebar = (props: {
|
||||
composerViewport.clientWidth - viewportPaddingLeft - viewportPaddingRight,
|
||||
);
|
||||
const formRect = composerForm.getBoundingClientRect();
|
||||
const composerFooter = composerForm.querySelector<HTMLElement>("[data-chat-composer-footer='true']");
|
||||
const composerRightActions = composerForm.querySelector<HTMLElement>(
|
||||
"[data-chat-composer-actions='right']",
|
||||
);
|
||||
const composerRightActionsWidth = composerRightActions?.getBoundingClientRect().width ?? 0;
|
||||
const composerFooterGap = composerFooter
|
||||
? Number.parseFloat(window.getComputedStyle(composerFooter).columnGap) ||
|
||||
Number.parseFloat(window.getComputedStyle(composerFooter).gap) ||
|
||||
0
|
||||
: 0;
|
||||
const minimumComposerWidth =
|
||||
COMPOSER_COMPACT_MIN_LEFT_CONTROLS_WIDTH_PX +
|
||||
composerRightActionsWidth +
|
||||
composerFooterGap;
|
||||
const hasComposerOverflow = composerForm.scrollWidth > composerForm.clientWidth + 0.5;
|
||||
const overflowsViewport = formRect.width > viewportContentWidth + 0.5;
|
||||
const violatesMinimumComposerWidth = composerForm.clientWidth + 0.5 < minimumComposerWidth;
|
||||
|
||||
if (previousSidebarWidth.length > 0) {
|
||||
wrapper.style.setProperty("--sidebar-width", previousSidebarWidth);
|
||||
@@ -100,7 +116,7 @@ const DiffPanelInlineSidebar = (props: {
|
||||
wrapper.style.removeProperty("--sidebar-width");
|
||||
}
|
||||
|
||||
return !hasComposerOverflow && !overflowsViewport;
|
||||
return !hasComposerOverflow && !overflowsViewport && !violatesMinimumComposerWidth;
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
resolveServerHttpOriginFromInput,
|
||||
resolveServerWsUrlFromInput,
|
||||
} from "./serverConnection";
|
||||
|
||||
const localhostLocation = {
|
||||
protocol: "http:",
|
||||
hostname: "localhost",
|
||||
port: "5733",
|
||||
origin: "http://localhost:5733",
|
||||
} as const;
|
||||
|
||||
describe("serverConnection", () => {
|
||||
it("prefers the desktop bridge websocket URL", () => {
|
||||
expect(
|
||||
resolveServerWsUrlFromInput({
|
||||
bridgeWsUrl: "ws://127.0.0.1:4444?token=abc",
|
||||
envWsUrl: "ws://localhost:3773",
|
||||
isDev: true,
|
||||
location: localhostLocation,
|
||||
}),
|
||||
).toBe("ws://127.0.0.1:4444?token=abc");
|
||||
});
|
||||
|
||||
it("uses the configured env websocket URL when available", () => {
|
||||
expect(
|
||||
resolveServerWsUrlFromInput({
|
||||
envWsUrl: "ws://localhost:3773",
|
||||
isDev: true,
|
||||
location: localhostLocation,
|
||||
}),
|
||||
).toBe("ws://localhost:3773");
|
||||
});
|
||||
|
||||
it("infers the paired dev server websocket port when env wiring is missing", () => {
|
||||
expect(
|
||||
resolveServerWsUrlFromInput({
|
||||
isDev: true,
|
||||
location: localhostLocation,
|
||||
}),
|
||||
).toBe("ws://localhost:3773");
|
||||
});
|
||||
|
||||
it("falls back to same-origin websocket outside paired localhost dev mode", () => {
|
||||
expect(
|
||||
resolveServerWsUrlFromInput({
|
||||
isDev: false,
|
||||
location: {
|
||||
protocol: "https:",
|
||||
hostname: "example.com",
|
||||
port: "443",
|
||||
origin: "https://example.com",
|
||||
},
|
||||
}),
|
||||
).toBe("wss://example.com:443");
|
||||
});
|
||||
|
||||
it("converts the resolved websocket URL into the matching http origin", () => {
|
||||
expect(
|
||||
resolveServerHttpOriginFromInput({
|
||||
isDev: true,
|
||||
location: localhostLocation,
|
||||
}),
|
||||
).toBe("http://localhost:3773");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,103 @@
|
||||
const DEFAULT_DEV_SERVER_PORT = 3773;
|
||||
const DEFAULT_DEV_WEB_PORT = 5733;
|
||||
const DEV_SERVER_PORT_GAP = DEFAULT_DEV_WEB_PORT - DEFAULT_DEV_SERVER_PORT;
|
||||
const LOOPBACK_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
|
||||
|
||||
interface BrowserLocationLike {
|
||||
readonly protocol: string;
|
||||
readonly hostname: string;
|
||||
readonly port: string;
|
||||
readonly origin?: string;
|
||||
}
|
||||
|
||||
interface ResolveServerConnectionInput {
|
||||
readonly bridgeWsUrl?: string;
|
||||
readonly envWsUrl?: string;
|
||||
readonly isDev: boolean;
|
||||
readonly location: BrowserLocationLike;
|
||||
}
|
||||
|
||||
function trimToUndefined(value: string | undefined): string | undefined {
|
||||
const trimmed = value?.trim();
|
||||
return trimmed && trimmed.length > 0 ? trimmed : undefined;
|
||||
}
|
||||
|
||||
function inferLoopbackDevServerWsUrl(input: ResolveServerConnectionInput): string | null {
|
||||
if (!input.isDev) return null;
|
||||
if (!LOOPBACK_HOSTS.has(input.location.hostname)) return null;
|
||||
|
||||
const currentPort = Number.parseInt(input.location.port, 10);
|
||||
if (!Number.isInteger(currentPort) || currentPort < DEFAULT_DEV_WEB_PORT) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const inferredServerPort = currentPort - DEV_SERVER_PORT_GAP;
|
||||
if (inferredServerPort < DEFAULT_DEV_SERVER_PORT) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const protocol = input.location.protocol === "https:" ? "wss:" : "ws:";
|
||||
return `${protocol}//${input.location.hostname}:${String(inferredServerPort)}`;
|
||||
}
|
||||
|
||||
export function resolveServerWsUrlFromInput(input: ResolveServerConnectionInput): string {
|
||||
const bridgeWsUrl = trimToUndefined(input.bridgeWsUrl);
|
||||
if (bridgeWsUrl) {
|
||||
return bridgeWsUrl;
|
||||
}
|
||||
|
||||
const envWsUrl = trimToUndefined(input.envWsUrl);
|
||||
if (envWsUrl) {
|
||||
return envWsUrl;
|
||||
}
|
||||
|
||||
const inferredDevServerWsUrl = inferLoopbackDevServerWsUrl(input);
|
||||
if (inferredDevServerWsUrl) {
|
||||
return inferredDevServerWsUrl;
|
||||
}
|
||||
|
||||
const protocol = input.location.protocol === "https:" ? "wss:" : "ws:";
|
||||
const port = input.location.port.length > 0 ? `:${input.location.port}` : "";
|
||||
return `${protocol}//${input.location.hostname}${port}`;
|
||||
}
|
||||
|
||||
export function resolveServerHttpOriginFromInput(input: ResolveServerConnectionInput): string {
|
||||
const fallbackOrigin =
|
||||
input.location.origin ??
|
||||
`${input.location.protocol}//${input.location.hostname}${input.location.port ? `:${input.location.port}` : ""}`;
|
||||
|
||||
try {
|
||||
const wsUrl = new URL(resolveServerWsUrlFromInput(input));
|
||||
const protocol =
|
||||
wsUrl.protocol === "wss:" ? "https:" : wsUrl.protocol === "ws:" ? "http:" : wsUrl.protocol;
|
||||
return `${protocol}//${wsUrl.host}`;
|
||||
} catch {
|
||||
return fallbackOrigin;
|
||||
}
|
||||
}
|
||||
|
||||
function getCurrentInput(): ResolveServerConnectionInput | null {
|
||||
if (typeof window === "undefined") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const bridgeWsUrl = window.desktopBridge?.getWsUrl?.() ?? undefined;
|
||||
const envWsUrl = (import.meta.env.VITE_WS_URL as string | undefined) ?? undefined;
|
||||
|
||||
return {
|
||||
...(bridgeWsUrl ? { bridgeWsUrl } : {}),
|
||||
...(envWsUrl ? { envWsUrl } : {}),
|
||||
isDev: import.meta.env.DEV,
|
||||
location: window.location,
|
||||
};
|
||||
}
|
||||
|
||||
export function resolveServerWsUrl(): string {
|
||||
const input = getCurrentInput();
|
||||
return input ? resolveServerWsUrlFromInput(input) : "";
|
||||
}
|
||||
|
||||
export function resolveServerHttpOrigin(): string {
|
||||
const input = getCurrentInput();
|
||||
return input ? resolveServerHttpOriginFromInput(input) : "";
|
||||
}
|
||||
+111
-1
@@ -7,7 +7,7 @@ import {
|
||||
} from "@t3tools/contracts";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { markThreadUnread, syncServerReadModel, type AppState } from "./store";
|
||||
import { markThreadUnread, reorderProjects, syncServerReadModel, type AppState } from "./store";
|
||||
import { DEFAULT_INTERACTION_MODE, DEFAULT_RUNTIME_MODE, type Thread } from "./types";
|
||||
|
||||
function makeThread(overrides: Partial<Thread> = {}): Thread {
|
||||
@@ -93,6 +93,22 @@ function makeReadModel(thread: OrchestrationReadModel["threads"][number]): Orche
|
||||
};
|
||||
}
|
||||
|
||||
function makeReadModelProject(
|
||||
overrides: Partial<OrchestrationReadModel["projects"][number]>,
|
||||
): OrchestrationReadModel["projects"][number] {
|
||||
return {
|
||||
id: ProjectId.makeUnsafe("project-1"),
|
||||
title: "Project",
|
||||
workspaceRoot: "/tmp/project",
|
||||
defaultModel: "gpt-5.3-codex",
|
||||
createdAt: "2026-02-27T00:00:00.000Z",
|
||||
updatedAt: "2026-02-27T00:00:00.000Z",
|
||||
deletedAt: null,
|
||||
scripts: [],
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe("store pure functions", () => {
|
||||
it("markThreadUnread moves lastVisitedAt before completion for a completed thread", () => {
|
||||
const latestTurnCompletedAt = "2026-02-25T12:30:00.000Z";
|
||||
@@ -132,6 +148,46 @@ describe("store pure functions", () => {
|
||||
|
||||
expect(next).toEqual(initialState);
|
||||
});
|
||||
|
||||
it("reorderProjects moves a project to a target index", () => {
|
||||
const project1 = ProjectId.makeUnsafe("project-1");
|
||||
const project2 = ProjectId.makeUnsafe("project-2");
|
||||
const project3 = ProjectId.makeUnsafe("project-3");
|
||||
const state: AppState = {
|
||||
projects: [
|
||||
{
|
||||
id: project1,
|
||||
name: "Project 1",
|
||||
cwd: "/tmp/project-1",
|
||||
model: DEFAULT_MODEL_BY_PROVIDER.codex,
|
||||
expanded: true,
|
||||
scripts: [],
|
||||
},
|
||||
{
|
||||
id: project2,
|
||||
name: "Project 2",
|
||||
cwd: "/tmp/project-2",
|
||||
model: DEFAULT_MODEL_BY_PROVIDER.codex,
|
||||
expanded: true,
|
||||
scripts: [],
|
||||
},
|
||||
{
|
||||
id: project3,
|
||||
name: "Project 3",
|
||||
cwd: "/tmp/project-3",
|
||||
model: DEFAULT_MODEL_BY_PROVIDER.codex,
|
||||
expanded: true,
|
||||
scripts: [],
|
||||
},
|
||||
],
|
||||
threads: [],
|
||||
threadsHydrated: true,
|
||||
};
|
||||
|
||||
const next = reorderProjects(state, project1, project3);
|
||||
|
||||
expect(next.projects.map((project) => project.id)).toEqual([project2, project3, project1]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("store read model sync", () => {
|
||||
@@ -147,4 +203,58 @@ describe("store read model sync", () => {
|
||||
|
||||
expect(next.threads[0]?.model).toBe(DEFAULT_MODEL_BY_PROVIDER.codex);
|
||||
});
|
||||
|
||||
it("preserves the current project order when syncing incoming read model updates", () => {
|
||||
const project1 = ProjectId.makeUnsafe("project-1");
|
||||
const project2 = ProjectId.makeUnsafe("project-2");
|
||||
const project3 = ProjectId.makeUnsafe("project-3");
|
||||
const initialState: AppState = {
|
||||
projects: [
|
||||
{
|
||||
id: project2,
|
||||
name: "Project 2",
|
||||
cwd: "/tmp/project-2",
|
||||
model: DEFAULT_MODEL_BY_PROVIDER.codex,
|
||||
expanded: true,
|
||||
scripts: [],
|
||||
},
|
||||
{
|
||||
id: project1,
|
||||
name: "Project 1",
|
||||
cwd: "/tmp/project-1",
|
||||
model: DEFAULT_MODEL_BY_PROVIDER.codex,
|
||||
expanded: true,
|
||||
scripts: [],
|
||||
},
|
||||
],
|
||||
threads: [],
|
||||
threadsHydrated: true,
|
||||
};
|
||||
const readModel: OrchestrationReadModel = {
|
||||
snapshotSequence: 2,
|
||||
updatedAt: "2026-02-27T00:00:00.000Z",
|
||||
projects: [
|
||||
makeReadModelProject({
|
||||
id: project1,
|
||||
title: "Project 1",
|
||||
workspaceRoot: "/tmp/project-1",
|
||||
}),
|
||||
makeReadModelProject({
|
||||
id: project2,
|
||||
title: "Project 2",
|
||||
workspaceRoot: "/tmp/project-2",
|
||||
}),
|
||||
makeReadModelProject({
|
||||
id: project3,
|
||||
title: "Project 3",
|
||||
workspaceRoot: "/tmp/project-3",
|
||||
}),
|
||||
],
|
||||
threads: [],
|
||||
};
|
||||
|
||||
const next = syncServerReadModel(initialState, readModel);
|
||||
|
||||
expect(next.projects.map((project) => project.id)).toEqual([project2, project1, project3]);
|
||||
});
|
||||
});
|
||||
+81
-32
@@ -14,6 +14,9 @@ import {
|
||||
} from "@t3tools/shared/model";
|
||||
import { create } from "zustand";
|
||||
import { type ChatMessage, type Project, type Thread } from "./types";
|
||||
import { Debouncer } from "@tanstack/react-pacer";
|
||||
|
||||
import { resolveServerHttpOrigin } from "./serverConnection";
|
||||
|
||||
// ── State ────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -42,6 +45,7 @@ const initialState: AppState = {
|
||||
threadsHydrated: false,
|
||||
};
|
||||
const persistedExpandedProjectCwds = new Set<string>();
|
||||
const persistedProjectOrderCwds: string[] = [];
|
||||
|
||||
// ── Persist helpers ──────────────────────────────────────────────────
|
||||
|
||||
@@ -50,19 +54,30 @@ function readPersistedState(): AppState {
|
||||
try {
|
||||
const raw = window.localStorage.getItem(PERSISTED_STATE_KEY);
|
||||
if (!raw) return initialState;
|
||||
const parsed = JSON.parse(raw) as { expandedProjectCwds?: string[] };
|
||||
const parsed = JSON.parse(raw) as {
|
||||
expandedProjectCwds?: string[];
|
||||
projectOrderCwds?: string[];
|
||||
};
|
||||
persistedExpandedProjectCwds.clear();
|
||||
persistedProjectOrderCwds.length = 0;
|
||||
for (const cwd of parsed.expandedProjectCwds ?? []) {
|
||||
if (typeof cwd === "string" && cwd.length > 0) {
|
||||
persistedExpandedProjectCwds.add(cwd);
|
||||
}
|
||||
}
|
||||
for (const cwd of parsed.projectOrderCwds ?? []) {
|
||||
if (typeof cwd === "string" && cwd.length > 0 && !persistedProjectOrderCwds.includes(cwd)) {
|
||||
persistedProjectOrderCwds.push(cwd);
|
||||
}
|
||||
}
|
||||
return { ...initialState };
|
||||
} catch {
|
||||
return initialState;
|
||||
}
|
||||
}
|
||||
|
||||
let legacyKeysCleanedUp = false;
|
||||
|
||||
function persistState(state: AppState): void {
|
||||
if (typeof window === "undefined") return;
|
||||
try {
|
||||
@@ -72,15 +87,20 @@ function persistState(state: AppState): void {
|
||||
expandedProjectCwds: state.projects
|
||||
.filter((project) => project.expanded)
|
||||
.map((project) => project.cwd),
|
||||
projectOrderCwds: state.projects.map((project) => project.cwd),
|
||||
}),
|
||||
);
|
||||
for (const legacyKey of LEGACY_PERSISTED_STATE_KEYS) {
|
||||
window.localStorage.removeItem(legacyKey);
|
||||
if (!legacyKeysCleanedUp) {
|
||||
legacyKeysCleanedUp = true;
|
||||
for (const legacyKey of LEGACY_PERSISTED_STATE_KEYS) {
|
||||
window.localStorage.removeItem(legacyKey);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Ignore quota/storage errors to avoid breaking chat UX.
|
||||
}
|
||||
}
|
||||
const debouncedPersistState = new Debouncer(persistState, { wait: 500 });
|
||||
|
||||
// ── Pure helpers ──────────────────────────────────────────────────────
|
||||
|
||||
@@ -103,10 +123,17 @@ function mapProjectsFromReadModel(
|
||||
incoming: OrchestrationReadModel["projects"],
|
||||
previous: Project[],
|
||||
): Project[] {
|
||||
return incoming.map((project) => {
|
||||
const existing =
|
||||
previous.find((entry) => entry.id === project.id) ??
|
||||
previous.find((entry) => entry.cwd === project.workspaceRoot);
|
||||
const previousById = new Map(previous.map((project) => [project.id, project] as const));
|
||||
const previousByCwd = new Map(previous.map((project) => [project.cwd, project] as const));
|
||||
const previousOrderById = new Map(previous.map((project, index) => [project.id, index] as const));
|
||||
const previousOrderByCwd = new Map(previous.map((project, index) => [project.cwd, index] as const));
|
||||
const persistedOrderByCwd = new Map(
|
||||
persistedProjectOrderCwds.map((cwd, index) => [cwd, index] as const),
|
||||
);
|
||||
const usePersistedOrder = previous.length === 0;
|
||||
|
||||
const mappedProjects = incoming.map((project) => {
|
||||
const existing = previousById.get(project.id) ?? previousByCwd.get(project.workspaceRoot);
|
||||
return {
|
||||
id: project.id,
|
||||
name: project.title,
|
||||
@@ -120,8 +147,25 @@ function mapProjectsFromReadModel(
|
||||
? persistedExpandedProjectCwds.has(project.workspaceRoot)
|
||||
: true),
|
||||
scripts: project.scripts.map((script) => ({ ...script })),
|
||||
};
|
||||
} satisfies Project;
|
||||
});
|
||||
|
||||
return mappedProjects
|
||||
.map((project, incomingIndex) => {
|
||||
const previousIndex = previousOrderById.get(project.id) ?? previousOrderByCwd.get(project.cwd);
|
||||
const persistedIndex = usePersistedOrder ? persistedOrderByCwd.get(project.cwd) : undefined;
|
||||
const orderIndex =
|
||||
previousIndex ??
|
||||
persistedIndex ??
|
||||
(usePersistedOrder ? persistedProjectOrderCwds.length : previous.length) + incomingIndex;
|
||||
return { project, incomingIndex, orderIndex };
|
||||
})
|
||||
.toSorted((a, b) => {
|
||||
const byOrder = a.orderIndex - b.orderIndex;
|
||||
if (byOrder !== 0) return byOrder;
|
||||
return a.incomingIndex - b.incomingIndex;
|
||||
})
|
||||
.map((entry) => entry.project);
|
||||
}
|
||||
|
||||
function toLegacySessionStatus(
|
||||
@@ -166,30 +210,9 @@ function inferProviderForThreadModel(input: {
|
||||
return "codex";
|
||||
}
|
||||
|
||||
function resolveWsHttpOrigin(): string {
|
||||
if (typeof window === "undefined") return "";
|
||||
const bridgeWsUrl = window.desktopBridge?.getWsUrl?.();
|
||||
const envWsUrl = import.meta.env.VITE_WS_URL as string | undefined;
|
||||
const wsCandidate =
|
||||
typeof bridgeWsUrl === "string" && bridgeWsUrl.length > 0
|
||||
? bridgeWsUrl
|
||||
: typeof envWsUrl === "string" && envWsUrl.length > 0
|
||||
? envWsUrl
|
||||
: null;
|
||||
if (!wsCandidate) return window.location.origin;
|
||||
try {
|
||||
const wsUrl = new URL(wsCandidate);
|
||||
const protocol =
|
||||
wsUrl.protocol === "wss:" ? "https:" : wsUrl.protocol === "ws:" ? "http:" : wsUrl.protocol;
|
||||
return `${protocol}//${wsUrl.host}`;
|
||||
} catch {
|
||||
return window.location.origin;
|
||||
}
|
||||
}
|
||||
|
||||
function toAttachmentPreviewUrl(rawUrl: string): string {
|
||||
if (rawUrl.startsWith("/")) {
|
||||
return `${resolveWsHttpOrigin()}${rawUrl}`;
|
||||
return `${resolveServerHttpOrigin()}${rawUrl}`;
|
||||
}
|
||||
return rawUrl;
|
||||
}
|
||||
@@ -342,6 +365,22 @@ export function setProjectExpanded(
|
||||
return changed ? { ...state, projects } : state;
|
||||
}
|
||||
|
||||
export function reorderProjects(
|
||||
state: AppState,
|
||||
draggedProjectId: Project["id"],
|
||||
targetProjectId: Project["id"],
|
||||
): AppState {
|
||||
if (draggedProjectId === targetProjectId) return state;
|
||||
const draggedIndex = state.projects.findIndex((project) => project.id === draggedProjectId);
|
||||
const targetIndex = state.projects.findIndex((project) => project.id === targetProjectId);
|
||||
if (draggedIndex < 0 || targetIndex < 0) return state;
|
||||
const projects = [...state.projects];
|
||||
const [draggedProject] = projects.splice(draggedIndex, 1);
|
||||
if (!draggedProject) return state;
|
||||
projects.splice(targetIndex, 0, draggedProject);
|
||||
return { ...state, projects };
|
||||
}
|
||||
|
||||
export function setError(state: AppState, threadId: ThreadId, error: string | null): AppState {
|
||||
const threads = updateThread(state.threads, threadId, (t) => {
|
||||
if (t.error === error) return t;
|
||||
@@ -377,6 +416,7 @@ interface AppStore extends AppState {
|
||||
markThreadUnread: (threadId: ThreadId) => void;
|
||||
toggleProject: (projectId: Project["id"]) => void;
|
||||
setProjectExpanded: (projectId: Project["id"], expanded: boolean) => void;
|
||||
reorderProjects: (draggedProjectId: Project["id"], targetProjectId: Project["id"]) => void;
|
||||
setError: (threadId: ThreadId, error: string | null) => void;
|
||||
setThreadBranch: (threadId: ThreadId, branch: string | null, worktreePath: string | null) => void;
|
||||
}
|
||||
@@ -390,13 +430,22 @@ export const useStore = create<AppStore>((set) => ({
|
||||
toggleProject: (projectId) => set((state) => toggleProject(state, projectId)),
|
||||
setProjectExpanded: (projectId, expanded) =>
|
||||
set((state) => setProjectExpanded(state, projectId, expanded)),
|
||||
reorderProjects: (draggedProjectId, targetProjectId) =>
|
||||
set((state) => reorderProjects(state, draggedProjectId, targetProjectId)),
|
||||
setError: (threadId, error) => set((state) => setError(state, threadId, error)),
|
||||
setThreadBranch: (threadId, branch, worktreePath) =>
|
||||
set((state) => setThreadBranch(state, threadId, branch, worktreePath)),
|
||||
}));
|
||||
|
||||
// Persist on every state change
|
||||
useStore.subscribe((state) => persistState(state));
|
||||
// Persist state changes with debouncing to avoid localStorage thrashing
|
||||
useStore.subscribe((state) => debouncedPersistState.maybeExecute(state));
|
||||
|
||||
// Flush pending writes synchronously before page unload to prevent data loss.
|
||||
if (typeof window !== "undefined") {
|
||||
window.addEventListener("beforeunload", () => {
|
||||
debouncedPersistState.flush();
|
||||
});
|
||||
}
|
||||
|
||||
export function StoreProvider({ children }: { children: ReactNode }) {
|
||||
useEffect(() => {
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
import {
|
||||
CommandId,
|
||||
type ContextMenuItem,
|
||||
EventId,
|
||||
ORCHESTRATION_WS_CHANNELS,
|
||||
ORCHESTRATION_WS_METHODS,
|
||||
type OrchestrationEvent,
|
||||
ProjectId,
|
||||
ThreadId,
|
||||
type WsPushChannel,
|
||||
type WsPushData,
|
||||
type WsPushMessage,
|
||||
WS_CHANNELS,
|
||||
WS_METHODS,
|
||||
type WsPush,
|
||||
type ServerProviderStatus,
|
||||
} from "@t3tools/contracts";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
@@ -24,19 +18,12 @@ const showContextMenuFallbackMock = vi.fn<
|
||||
position?: { x: number; y: number },
|
||||
) => Promise<T | null>
|
||||
>();
|
||||
const channelListeners = new Map<string, Set<(message: WsPush) => void>>();
|
||||
const latestPushByChannel = new Map<string, WsPush>();
|
||||
const subscribeMock = vi.fn<
|
||||
(channel: string, listener: (message: WsPush) => void, options?: { replayLatest?: boolean }) => () => void
|
||||
>(
|
||||
(channel, listener, options) => {
|
||||
const listeners = channelListeners.get(channel) ?? new Set<(message: WsPush) => void>();
|
||||
const channelListeners = new Map<string, Set<(data: unknown) => void>>();
|
||||
const subscribeMock = vi.fn<(channel: string, listener: (data: unknown) => void) => () => void>(
|
||||
(channel, listener) => {
|
||||
const listeners = channelListeners.get(channel) ?? new Set<(data: unknown) => void>();
|
||||
listeners.add(listener);
|
||||
channelListeners.set(channel, listeners);
|
||||
const latest = latestPushByChannel.get(channel);
|
||||
if (latest && options?.replayLatest) {
|
||||
listener(latest);
|
||||
}
|
||||
return () => {
|
||||
listeners.delete(listener);
|
||||
if (listeners.size === 0) {
|
||||
@@ -51,9 +38,6 @@ vi.mock("./wsTransport", () => {
|
||||
WsTransport: class MockWsTransport {
|
||||
request = requestMock;
|
||||
subscribe = subscribeMock;
|
||||
getLatestPush(channel: string) {
|
||||
return latestPushByChannel.get(channel) ?? null;
|
||||
}
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -62,20 +46,11 @@ vi.mock("./contextMenuFallback", () => ({
|
||||
showContextMenuFallback: showContextMenuFallbackMock,
|
||||
}));
|
||||
|
||||
let nextPushSequence = 1;
|
||||
|
||||
function emitPush<C extends WsPushChannel>(channel: C, data: WsPushData<C>): void {
|
||||
function emitPush(channel: string, data: unknown): void {
|
||||
const listeners = channelListeners.get(channel);
|
||||
const message = {
|
||||
type: "push" as const,
|
||||
sequence: nextPushSequence++,
|
||||
channel,
|
||||
data,
|
||||
} as WsPushMessage<C>;
|
||||
latestPushByChannel.set(channel, message);
|
||||
if (!listeners) return;
|
||||
for (const listener of listeners) {
|
||||
listener(message);
|
||||
listener(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,8 +80,6 @@ beforeEach(() => {
|
||||
showContextMenuFallbackMock.mockReset();
|
||||
subscribeMock.mockClear();
|
||||
channelListeners.clear();
|
||||
latestPushByChannel.clear();
|
||||
nextPushSequence = 1;
|
||||
Reflect.deleteProperty(getWindowForTest(), "desktopBridge");
|
||||
});
|
||||
|
||||
@@ -116,6 +89,7 @@ afterEach(() => {
|
||||
|
||||
describe("wsNativeApi", () => {
|
||||
it("delivers and caches valid server.welcome payloads", async () => {
|
||||
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
const { createWsNativeApi, onServerWelcome } = await import("./wsNativeApi");
|
||||
|
||||
createWsNativeApi();
|
||||
@@ -133,6 +107,7 @@ describe("wsNativeApi", () => {
|
||||
|
||||
expect(lateListener).toHaveBeenCalledTimes(1);
|
||||
expect(lateListener).toHaveBeenCalledWith(expect.objectContaining(payload));
|
||||
expect(warnSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("preserves bootstrap ids from server.welcome payloads", async () => {
|
||||
@@ -145,8 +120,8 @@ describe("wsNativeApi", () => {
|
||||
emitPush(WS_CHANNELS.serverWelcome, {
|
||||
cwd: "/tmp/workspace",
|
||||
projectName: "t3-code",
|
||||
bootstrapProjectId: ProjectId.makeUnsafe("project-1"),
|
||||
bootstrapThreadId: ThreadId.makeUnsafe("thread-1"),
|
||||
bootstrapProjectId: "project-1",
|
||||
bootstrapThreadId: "thread-1",
|
||||
});
|
||||
|
||||
expect(listener).toHaveBeenCalledTimes(1);
|
||||
@@ -160,26 +135,31 @@ describe("wsNativeApi", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("delivers successive server.welcome payloads to active listeners", async () => {
|
||||
it("ignores invalid server.welcome payloads and keeps subscription active", async () => {
|
||||
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
const { createWsNativeApi, onServerWelcome } = await import("./wsNativeApi");
|
||||
|
||||
createWsNativeApi();
|
||||
const listener = vi.fn();
|
||||
onServerWelcome(listener);
|
||||
|
||||
emitPush(WS_CHANNELS.serverWelcome, { cwd: "/tmp/one", projectName: "one" });
|
||||
emitPush(WS_CHANNELS.serverWelcome, { cwd: 42, projectName: "t3-code" });
|
||||
emitPush(WS_CHANNELS.serverWelcome, { cwd: "/tmp/workspace", projectName: "t3-code" });
|
||||
|
||||
expect(listener).toHaveBeenCalledTimes(2);
|
||||
expect(listener).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({
|
||||
cwd: "/tmp/workspace",
|
||||
projectName: "t3-code",
|
||||
}),
|
||||
expect(listener).toHaveBeenCalledTimes(1);
|
||||
expect(listener).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ cwd: "/tmp/workspace", projectName: "t3-code" }),
|
||||
);
|
||||
expect(warnSpy).toHaveBeenCalledTimes(1);
|
||||
expect(warnSpy).toHaveBeenCalledWith("Dropped inbound WebSocket push payload", {
|
||||
reason: "decode-failed",
|
||||
raw: { cwd: 42, projectName: "t3-code" },
|
||||
issue: expect.stringContaining("SchemaError"),
|
||||
});
|
||||
});
|
||||
|
||||
it("delivers and caches valid server.configUpdated payloads", async () => {
|
||||
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
const { createWsNativeApi, onServerConfigUpdated } = await import("./wsNativeApi");
|
||||
|
||||
createWsNativeApi();
|
||||
@@ -205,9 +185,11 @@ describe("wsNativeApi", () => {
|
||||
onServerConfigUpdated(lateListener);
|
||||
expect(lateListener).toHaveBeenCalledTimes(1);
|
||||
expect(lateListener).toHaveBeenCalledWith(payload);
|
||||
expect(warnSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("delivers successive server.configUpdated payloads to active listeners", async () => {
|
||||
it("drops malformed server.configUpdated payloads", async () => {
|
||||
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
const { createWsNativeApi, onServerConfigUpdated } = await import("./wsNativeApi");
|
||||
|
||||
createWsNativeApi();
|
||||
@@ -215,22 +197,24 @@ describe("wsNativeApi", () => {
|
||||
onServerConfigUpdated(listener);
|
||||
|
||||
emitPush(WS_CHANNELS.serverConfigUpdated, {
|
||||
issues: [{ kind: "keybindings.malformed-config", message: "bad json" }],
|
||||
issues: [{ kind: "keybindings.invalid-entry", message: "missing index" }],
|
||||
providers: defaultProviders,
|
||||
});
|
||||
emitPush(WS_CHANNELS.serverConfigUpdated, {
|
||||
issues: [],
|
||||
issues: [{ kind: "keybindings.malformed-config", message: "bad json" }],
|
||||
providers: defaultProviders,
|
||||
});
|
||||
|
||||
expect(listener).toHaveBeenCalledTimes(2);
|
||||
expect(listener).toHaveBeenLastCalledWith({
|
||||
issues: [],
|
||||
expect(listener).toHaveBeenCalledTimes(1);
|
||||
expect(listener).toHaveBeenCalledWith({
|
||||
issues: [{ kind: "keybindings.malformed-config", message: "bad json" }],
|
||||
providers: defaultProviders,
|
||||
});
|
||||
expect(warnSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("forwards valid terminal and orchestration events", async () => {
|
||||
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
const { createWsNativeApi } = await import("./wsNativeApi");
|
||||
|
||||
const api = createWsNativeApi();
|
||||
@@ -251,9 +235,9 @@ describe("wsNativeApi", () => {
|
||||
|
||||
const orchestrationEvent = {
|
||||
sequence: 1,
|
||||
eventId: EventId.makeUnsafe("event-1"),
|
||||
eventId: "event-1",
|
||||
aggregateKind: "project",
|
||||
aggregateId: ProjectId.makeUnsafe("project-1"),
|
||||
aggregateId: "project-1",
|
||||
occurredAt: "2026-02-24T00:00:00.000Z",
|
||||
commandId: null,
|
||||
causationEventId: null,
|
||||
@@ -261,7 +245,7 @@ describe("wsNativeApi", () => {
|
||||
metadata: {},
|
||||
type: "project.created",
|
||||
payload: {
|
||||
projectId: ProjectId.makeUnsafe("project-1"),
|
||||
projectId: "project-1",
|
||||
title: "Project",
|
||||
workspaceRoot: "/tmp/workspace",
|
||||
defaultModel: null,
|
||||
@@ -269,13 +253,61 @@ describe("wsNativeApi", () => {
|
||||
createdAt: "2026-02-24T00:00:00.000Z",
|
||||
updatedAt: "2026-02-24T00:00:00.000Z",
|
||||
},
|
||||
} satisfies Extract<OrchestrationEvent, { type: "project.created" }>;
|
||||
} as const;
|
||||
emitPush(ORCHESTRATION_WS_CHANNELS.domainEvent, orchestrationEvent);
|
||||
|
||||
expect(onTerminalEvent).toHaveBeenCalledTimes(1);
|
||||
expect(onTerminalEvent).toHaveBeenCalledWith(terminalEvent);
|
||||
expect(onDomainEvent).toHaveBeenCalledTimes(1);
|
||||
expect(onDomainEvent).toHaveBeenCalledWith(orchestrationEvent);
|
||||
expect(warnSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("drops malformed terminal and orchestration push payloads", async () => {
|
||||
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
const { createWsNativeApi } = await import("./wsNativeApi");
|
||||
|
||||
const api = createWsNativeApi();
|
||||
const onTerminalEvent = vi.fn();
|
||||
const onDomainEvent = vi.fn();
|
||||
|
||||
api.terminal.onEvent(onTerminalEvent);
|
||||
api.orchestration.onDomainEvent(onDomainEvent);
|
||||
|
||||
emitPush(WS_CHANNELS.terminalEvent, {
|
||||
threadId: "thread-1",
|
||||
terminalId: "",
|
||||
createdAt: "2026-02-24T00:00:00.000Z",
|
||||
type: "output",
|
||||
data: "hello",
|
||||
});
|
||||
emitPush(ORCHESTRATION_WS_CHANNELS.domainEvent, {
|
||||
sequence: -1,
|
||||
type: "project.created",
|
||||
});
|
||||
|
||||
expect(onTerminalEvent).not.toHaveBeenCalled();
|
||||
expect(onDomainEvent).not.toHaveBeenCalled();
|
||||
expect(warnSpy).toHaveBeenCalledTimes(2);
|
||||
expect(warnSpy).toHaveBeenNthCalledWith(1, "Dropped inbound WebSocket push payload", {
|
||||
reason: "decode-failed",
|
||||
raw: {
|
||||
threadId: "thread-1",
|
||||
terminalId: "",
|
||||
createdAt: "2026-02-24T00:00:00.000Z",
|
||||
type: "output",
|
||||
data: "hello",
|
||||
},
|
||||
issue: expect.stringContaining("SchemaError"),
|
||||
});
|
||||
expect(warnSpy).toHaveBeenNthCalledWith(2, "Dropped inbound WebSocket push payload", {
|
||||
reason: "decode-failed",
|
||||
raw: {
|
||||
sequence: -1,
|
||||
type: "project.created",
|
||||
},
|
||||
issue: expect.stringContaining("SchemaError"),
|
||||
});
|
||||
});
|
||||
|
||||
it("wraps orchestration dispatch commands in the command envelope", async () => {
|
||||
|
||||
+45
-15
@@ -1,13 +1,16 @@
|
||||
import {
|
||||
OrchestrationEvent,
|
||||
ORCHESTRATION_WS_CHANNELS,
|
||||
ORCHESTRATION_WS_METHODS,
|
||||
type ContextMenuItem,
|
||||
type NativeApi,
|
||||
ServerConfigUpdatedPayload,
|
||||
TerminalEvent,
|
||||
WS_CHANNELS,
|
||||
WS_METHODS,
|
||||
type WsWelcomePayload,
|
||||
WsWelcomePayload,
|
||||
} from "@t3tools/contracts";
|
||||
import { Cause, Schema } from "effect";
|
||||
|
||||
import { showContextMenuFallback } from "./contextMenuFallback";
|
||||
import { WsTransport } from "./wsTransport";
|
||||
@@ -15,6 +18,24 @@ import { WsTransport } from "./wsTransport";
|
||||
let instance: { api: NativeApi; transport: WsTransport } | null = null;
|
||||
const welcomeListeners = new Set<(payload: WsWelcomePayload) => void>();
|
||||
const serverConfigUpdatedListeners = new Set<(payload: ServerConfigUpdatedPayload) => void>();
|
||||
let lastWelcome: WsWelcomePayload | null = null;
|
||||
let lastServerConfigUpdated: ServerConfigUpdatedPayload | null = null;
|
||||
|
||||
const decodeAndWarnOnFailure = <T>(
|
||||
schema: Schema.Schema<T> & { readonly DecodingServices: never },
|
||||
raw: unknown,
|
||||
): T | null => {
|
||||
const decoded = Schema.decodeUnknownExit(schema)(raw);
|
||||
if (decoded._tag === "Failure") {
|
||||
console.warn("Dropped inbound WebSocket push payload", {
|
||||
reason: "decode-failed",
|
||||
raw,
|
||||
issue: Cause.pretty(decoded.cause),
|
||||
});
|
||||
return null;
|
||||
}
|
||||
return decoded.value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Subscribe to the server welcome message. If a welcome was already received
|
||||
@@ -24,10 +45,10 @@ const serverConfigUpdatedListeners = new Set<(payload: ServerConfigUpdatedPayloa
|
||||
export function onServerWelcome(listener: (payload: WsWelcomePayload) => void): () => void {
|
||||
welcomeListeners.add(listener);
|
||||
|
||||
const latestWelcome = instance?.transport.getLatestPush(WS_CHANNELS.serverWelcome)?.data ?? null;
|
||||
if (latestWelcome) {
|
||||
// Replay cached welcome for late subscribers
|
||||
if (lastWelcome) {
|
||||
try {
|
||||
listener(latestWelcome);
|
||||
listener(lastWelcome);
|
||||
} catch {
|
||||
// Swallow listener errors
|
||||
}
|
||||
@@ -47,10 +68,9 @@ export function onServerConfigUpdated(
|
||||
): () => void {
|
||||
serverConfigUpdatedListeners.add(listener);
|
||||
|
||||
const latestConfig = instance?.transport.getLatestPush(WS_CHANNELS.serverConfigUpdated)?.data ?? null;
|
||||
if (latestConfig) {
|
||||
if (lastServerConfigUpdated) {
|
||||
try {
|
||||
listener(latestConfig);
|
||||
listener(lastServerConfigUpdated);
|
||||
} catch {
|
||||
// Swallow listener errors
|
||||
}
|
||||
@@ -66,8 +86,12 @@ export function createWsNativeApi(): NativeApi {
|
||||
|
||||
const transport = new WsTransport();
|
||||
|
||||
transport.subscribe(WS_CHANNELS.serverWelcome, (message) => {
|
||||
const payload = message.data;
|
||||
// Listen for server welcome and forward to registered listeners.
|
||||
// Also cache it so late subscribers (React effects) get it immediately.
|
||||
transport.subscribe(WS_CHANNELS.serverWelcome, (data) => {
|
||||
const payload = decodeAndWarnOnFailure(WsWelcomePayload, data);
|
||||
if (!payload) return;
|
||||
lastWelcome = payload;
|
||||
for (const listener of welcomeListeners) {
|
||||
try {
|
||||
listener(payload);
|
||||
@@ -76,8 +100,10 @@ export function createWsNativeApi(): NativeApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
transport.subscribe(WS_CHANNELS.serverConfigUpdated, (message) => {
|
||||
const payload = message.data;
|
||||
transport.subscribe(WS_CHANNELS.serverConfigUpdated, (data) => {
|
||||
const payload = decodeAndWarnOnFailure(ServerConfigUpdatedPayload, data);
|
||||
if (!payload) return;
|
||||
lastServerConfigUpdated = payload;
|
||||
for (const listener of serverConfigUpdatedListeners) {
|
||||
try {
|
||||
listener(payload);
|
||||
@@ -108,7 +134,10 @@ export function createWsNativeApi(): NativeApi {
|
||||
restart: (input) => transport.request(WS_METHODS.terminalRestart, input),
|
||||
close: (input) => transport.request(WS_METHODS.terminalClose, input),
|
||||
onEvent: (callback) =>
|
||||
transport.subscribe(WS_CHANNELS.terminalEvent, (message) => callback(message.data)),
|
||||
transport.subscribe(WS_CHANNELS.terminalEvent, (data) => {
|
||||
const payload = decodeAndWarnOnFailure(TerminalEvent, data);
|
||||
if (payload) callback(payload);
|
||||
}),
|
||||
},
|
||||
projects: {
|
||||
searchEntries: (input) => transport.request(WS_METHODS.projectsSearchEntries, input),
|
||||
@@ -167,9 +196,10 @@ export function createWsNativeApi(): NativeApi {
|
||||
replayEvents: (fromSequenceExclusive) =>
|
||||
transport.request(ORCHESTRATION_WS_METHODS.replayEvents, { fromSequenceExclusive }),
|
||||
onDomainEvent: (callback) =>
|
||||
transport.subscribe(ORCHESTRATION_WS_CHANNELS.domainEvent, (message) =>
|
||||
callback(message.data),
|
||||
),
|
||||
transport.subscribe(ORCHESTRATION_WS_CHANNELS.domainEvent, (data) => {
|
||||
const payload = decodeAndWarnOnFailure(OrchestrationEvent, data);
|
||||
if (payload) callback(payload);
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { WS_CHANNELS } from "@t3tools/contracts";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { WsTransport } from "./wsTransport";
|
||||
@@ -91,24 +90,18 @@ describe("WsTransport", () => {
|
||||
socket.open();
|
||||
|
||||
const listener = vi.fn();
|
||||
transport.subscribe(WS_CHANNELS.serverConfigUpdated, listener);
|
||||
transport.subscribe("providers.event", listener);
|
||||
|
||||
socket.serverMessage(
|
||||
JSON.stringify({
|
||||
type: "push",
|
||||
sequence: 1,
|
||||
channel: WS_CHANNELS.serverConfigUpdated,
|
||||
data: { issues: [], providers: [] },
|
||||
channel: "providers.event",
|
||||
data: { status: "ok" },
|
||||
}),
|
||||
);
|
||||
|
||||
expect(listener).toHaveBeenCalledTimes(1);
|
||||
expect(listener).toHaveBeenCalledWith({
|
||||
type: "push",
|
||||
sequence: 1,
|
||||
channel: WS_CHANNELS.serverConfigUpdated,
|
||||
data: { issues: [], providers: [] },
|
||||
});
|
||||
expect(listener).toHaveBeenCalledWith({ status: "ok" });
|
||||
|
||||
transport.dispose();
|
||||
});
|
||||
@@ -144,13 +137,12 @@ describe("WsTransport", () => {
|
||||
socket.open();
|
||||
|
||||
const listener = vi.fn();
|
||||
transport.subscribe(WS_CHANNELS.serverConfigUpdated, listener);
|
||||
transport.subscribe("providers.event", listener);
|
||||
|
||||
socket.serverMessage("{ invalid-json");
|
||||
socket.serverMessage(
|
||||
JSON.stringify({
|
||||
type: "push",
|
||||
sequence: 2,
|
||||
channel: 42,
|
||||
data: { bad: true },
|
||||
}),
|
||||
@@ -158,58 +150,26 @@ describe("WsTransport", () => {
|
||||
socket.serverMessage(
|
||||
JSON.stringify({
|
||||
type: "push",
|
||||
sequence: 3,
|
||||
channel: WS_CHANNELS.serverConfigUpdated,
|
||||
data: { issues: [], providers: [] },
|
||||
channel: "providers.event",
|
||||
data: { ok: true },
|
||||
}),
|
||||
);
|
||||
|
||||
expect(listener).toHaveBeenCalledTimes(1);
|
||||
expect(listener).toHaveBeenCalledWith({
|
||||
type: "push",
|
||||
sequence: 3,
|
||||
channel: WS_CHANNELS.serverConfigUpdated,
|
||||
data: { issues: [], providers: [] },
|
||||
});
|
||||
expect(listener).toHaveBeenCalledWith({ ok: true });
|
||||
expect(warnSpy).toHaveBeenCalledTimes(2);
|
||||
expect(warnSpy).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
"Dropped inbound WebSocket envelope",
|
||||
expect.objectContaining({
|
||||
code: "invalid-json",
|
||||
reason: expect.stringContaining("Expected property name or '}'"),
|
||||
rawKind: "string",
|
||||
}),
|
||||
);
|
||||
expect(warnSpy).toHaveBeenNthCalledWith(1, "Dropped inbound WebSocket envelope", {
|
||||
reason: "decode-failed",
|
||||
issue:
|
||||
"SchemaError: SyntaxError: Expected property name or '}' in JSON at position 2 (line 1 column 3)",
|
||||
raw: "{ invalid-json",
|
||||
});
|
||||
expect(warnSpy).toHaveBeenNthCalledWith(2, "Dropped inbound WebSocket envelope", {
|
||||
code: "invalid-envelope",
|
||||
reason: expect.stringContaining("Expected"),
|
||||
rawKind: "object",
|
||||
expected: "WsResponse",
|
||||
actual: "object",
|
||||
reason: "decode-failed",
|
||||
issue: expect.stringContaining("SchemaError: Expected string, got 42"),
|
||||
raw: '{"type":"push","channel":42,"data":{"bad":true}}',
|
||||
});
|
||||
|
||||
transport.dispose();
|
||||
});
|
||||
|
||||
it("queues requests until the websocket opens", async () => {
|
||||
const transport = new WsTransport("ws://localhost:3020");
|
||||
const socket = getSocket();
|
||||
|
||||
const requestPromise = transport.request("projects.list");
|
||||
expect(socket.sent).toHaveLength(0);
|
||||
|
||||
socket.open();
|
||||
expect(socket.sent).toHaveLength(1);
|
||||
const requestEnvelope = JSON.parse(socket.sent[0] ?? "{}") as { id: string };
|
||||
socket.serverMessage(
|
||||
JSON.stringify({
|
||||
id: requestEnvelope.id,
|
||||
result: { projects: [] },
|
||||
}),
|
||||
);
|
||||
|
||||
await expect(requestPromise).resolves.toEqual({ projects: [] });
|
||||
transport.dispose();
|
||||
});
|
||||
});
|
||||
+58
-212
@@ -1,15 +1,9 @@
|
||||
import {
|
||||
type WsDecodeDiagnostic,
|
||||
type WsPush,
|
||||
type WsPushChannel,
|
||||
type WsPushMessage,
|
||||
WebSocketResponse,
|
||||
type WsResponse as WsResponseMessage,
|
||||
WsResponse as WsResponseSchema,
|
||||
} from "@t3tools/contracts";
|
||||
import { Schema, SchemaIssue } from "effect";
|
||||
import { WebSocketResponse, WsPush, WsResponse } from "@t3tools/contracts";
|
||||
import { Cause, Schema } from "effect";
|
||||
|
||||
type PushListener<C extends WsPushChannel> = (message: WsPushMessage<C>) => void;
|
||||
import { resolveServerWsUrl } from "./serverConnection";
|
||||
|
||||
type PushListener = (data: unknown) => void;
|
||||
|
||||
interface PendingRequest {
|
||||
resolve: (result: unknown) => void;
|
||||
@@ -17,20 +11,12 @@ interface PendingRequest {
|
||||
timeout: ReturnType<typeof setTimeout>;
|
||||
}
|
||||
|
||||
interface SubscribeOptions {
|
||||
readonly replayLatest?: boolean;
|
||||
}
|
||||
|
||||
type TransportState = "connecting" | "open" | "reconnecting" | "closed" | "disposed";
|
||||
|
||||
const REQUEST_TIMEOUT_MS = 60_000;
|
||||
const RECONNECT_DELAYS_MS = [500, 1_000, 2_000, 4_000, 8_000];
|
||||
const decodeWsResponse = Schema.decodeUnknownSync(WsResponseSchema);
|
||||
const decodeWsResponseFromJson = Schema.decodeUnknownExit(Schema.fromJsonString(WsResponse));
|
||||
const isWsPushEnvelope = Schema.is(WsPush);
|
||||
const isWebSocketResponseEnvelope = Schema.is(WebSocketResponse);
|
||||
|
||||
const isWsPushMessage = (value: WsResponseMessage): value is WsPush =>
|
||||
"type" in value && value.type === "push";
|
||||
|
||||
interface WsRequestEnvelope {
|
||||
id: string;
|
||||
body: {
|
||||
@@ -39,114 +25,21 @@ interface WsRequestEnvelope {
|
||||
};
|
||||
}
|
||||
|
||||
function describeValue(value: unknown): string {
|
||||
if (value === null) return "null";
|
||||
if (Array.isArray(value)) return "array";
|
||||
return typeof value;
|
||||
}
|
||||
|
||||
function parseJsonOffset(error: unknown): number | undefined {
|
||||
if (!(error instanceof Error)) {
|
||||
return undefined;
|
||||
}
|
||||
const match = /position\s+(\d+)/i.exec(error.message);
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
const parsed = Number(match[1]);
|
||||
return Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;
|
||||
}
|
||||
|
||||
function makeEnvelopeDiagnostic(raw: unknown, reason: string): WsDecodeDiagnostic {
|
||||
return {
|
||||
code: "invalid-envelope",
|
||||
reason,
|
||||
rawKind: describeValue(raw),
|
||||
expected: "WsResponse",
|
||||
actual: describeValue(raw),
|
||||
};
|
||||
}
|
||||
|
||||
function decodeInboundMessage(
|
||||
raw: unknown,
|
||||
): { readonly ok: true; readonly message: WsResponseMessage } | { readonly ok: false; readonly diagnostic: WsDecodeDiagnostic } {
|
||||
if (typeof raw !== "string") {
|
||||
return {
|
||||
ok: false,
|
||||
diagnostic: {
|
||||
code: "invalid-envelope",
|
||||
reason: "Expected a text WebSocket frame.",
|
||||
rawKind: describeValue(raw),
|
||||
expected: "string",
|
||||
actual: describeValue(raw),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
let parsed: unknown;
|
||||
try {
|
||||
parsed = JSON.parse(raw);
|
||||
} catch (error) {
|
||||
return {
|
||||
ok: false,
|
||||
diagnostic: {
|
||||
code: "invalid-json",
|
||||
reason: error instanceof Error ? error.message : "Failed to parse JSON.",
|
||||
rawKind: "string",
|
||||
expected: "valid JSON string",
|
||||
actual: raw,
|
||||
...(parseJsonOffset(error) !== undefined ? { jsonOffset: parseJsonOffset(error) } : {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
return { ok: true, message: decodeWsResponse(parsed) };
|
||||
} catch (error) {
|
||||
return {
|
||||
ok: false,
|
||||
diagnostic: makeEnvelopeDiagnostic(
|
||||
parsed,
|
||||
typeof error === "object" && error !== null && "issue" in error
|
||||
? SchemaIssue.makeFormatterDefault()((error as Schema.SchemaError).issue)
|
||||
: error instanceof Error
|
||||
? error.message
|
||||
: "Failed to decode WebSocket envelope.",
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function asError(value: unknown, fallback: string): Error {
|
||||
if (value instanceof Error) {
|
||||
return value;
|
||||
}
|
||||
return new Error(fallback);
|
||||
}
|
||||
|
||||
export class WsTransport {
|
||||
private ws: WebSocket | null = null;
|
||||
private nextId = 1;
|
||||
private readonly pending = new Map<string, PendingRequest>();
|
||||
private readonly listeners = new Map<string, Set<(message: WsPush) => void>>();
|
||||
private readonly latestPushByChannel = new Map<string, WsPush>();
|
||||
private readonly outboundQueue: string[] = [];
|
||||
private readonly listeners = new Map<string, Set<PushListener>>();
|
||||
private reconnectAttempt = 0;
|
||||
private reconnectTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
private disposed = false;
|
||||
private state: TransportState = "connecting";
|
||||
private readonly url: string;
|
||||
|
||||
constructor(url?: string) {
|
||||
const bridgeUrl = window.desktopBridge?.getWsUrl();
|
||||
const envUrl = import.meta.env.VITE_WS_URL as string | undefined;
|
||||
this.url =
|
||||
url ??
|
||||
(bridgeUrl && bridgeUrl.length > 0
|
||||
? bridgeUrl
|
||||
: envUrl && envUrl.length > 0
|
||||
? envUrl
|
||||
: `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`);
|
||||
this.url = url ?? resolveServerWsUrl();
|
||||
if (!this.url) {
|
||||
throw new Error("WebSocket URL is required");
|
||||
}
|
||||
this.connect();
|
||||
}
|
||||
|
||||
@@ -154,11 +47,9 @@ export class WsTransport {
|
||||
if (typeof method !== "string" || method.length === 0) {
|
||||
throw new Error("Request method is required");
|
||||
}
|
||||
|
||||
const id = String(this.nextId++);
|
||||
const body = params != null ? { ...params, _tag: method } : { _tag: method };
|
||||
const message: WsRequestEnvelope = { id, body };
|
||||
const encoded = JSON.stringify(message);
|
||||
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
const timeout = setTimeout(() => {
|
||||
@@ -172,53 +63,28 @@ export class WsTransport {
|
||||
timeout,
|
||||
});
|
||||
|
||||
this.send(encoded);
|
||||
this.send(message);
|
||||
});
|
||||
}
|
||||
|
||||
subscribe<C extends WsPushChannel>(
|
||||
channel: C,
|
||||
listener: PushListener<C>,
|
||||
options?: SubscribeOptions,
|
||||
): () => void {
|
||||
subscribe(channel: string, listener: PushListener): () => void {
|
||||
let channelListeners = this.listeners.get(channel);
|
||||
if (!channelListeners) {
|
||||
channelListeners = new Set<(message: WsPush) => void>();
|
||||
channelListeners = new Set();
|
||||
this.listeners.set(channel, channelListeners);
|
||||
}
|
||||
|
||||
const wrappedListener = (message: WsPush) => {
|
||||
listener(message as WsPushMessage<C>);
|
||||
};
|
||||
channelListeners.add(wrappedListener);
|
||||
|
||||
if (options?.replayLatest) {
|
||||
const latest = this.latestPushByChannel.get(channel);
|
||||
if (latest) {
|
||||
wrappedListener(latest);
|
||||
}
|
||||
}
|
||||
channelListeners.add(listener);
|
||||
|
||||
return () => {
|
||||
channelListeners?.delete(wrappedListener);
|
||||
if (channelListeners?.size === 0) {
|
||||
channelListeners!.delete(listener);
|
||||
if (channelListeners!.size === 0) {
|
||||
this.listeners.delete(channel);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
getLatestPush<C extends WsPushChannel>(channel: C): WsPushMessage<C> | null {
|
||||
const latest = this.latestPushByChannel.get(channel);
|
||||
return latest ? (latest as WsPushMessage<C>) : null;
|
||||
}
|
||||
|
||||
getState(): TransportState {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.disposed = true;
|
||||
this.state = "disposed";
|
||||
if (this.reconnectTimer !== null) {
|
||||
clearTimeout(this.reconnectTimer);
|
||||
this.reconnectTimer = null;
|
||||
@@ -228,24 +94,18 @@ export class WsTransport {
|
||||
pending.reject(new Error("Transport disposed"));
|
||||
}
|
||||
this.pending.clear();
|
||||
this.outboundQueue.length = 0;
|
||||
this.ws?.close();
|
||||
this.ws = null;
|
||||
}
|
||||
|
||||
private connect() {
|
||||
if (this.disposed) {
|
||||
return;
|
||||
}
|
||||
if (this.disposed) return;
|
||||
|
||||
this.state = this.reconnectAttempt > 0 ? "reconnecting" : "connecting";
|
||||
const ws = new WebSocket(this.url);
|
||||
|
||||
ws.addEventListener("open", () => {
|
||||
this.ws = ws;
|
||||
this.state = "open";
|
||||
this.reconnectAttempt = 0;
|
||||
this.flushQueue();
|
||||
});
|
||||
|
||||
ws.addEventListener("message", (event) => {
|
||||
@@ -253,37 +113,34 @@ export class WsTransport {
|
||||
});
|
||||
|
||||
ws.addEventListener("close", () => {
|
||||
if (this.ws === ws) {
|
||||
this.ws = null;
|
||||
}
|
||||
if (this.disposed) {
|
||||
this.state = "disposed";
|
||||
return;
|
||||
}
|
||||
this.state = "closed";
|
||||
this.ws = null;
|
||||
this.scheduleReconnect();
|
||||
});
|
||||
|
||||
ws.addEventListener("error", () => {
|
||||
// close will follow
|
||||
// close event will fire after error
|
||||
});
|
||||
}
|
||||
|
||||
private handleMessage(raw: unknown) {
|
||||
const decoded = decodeInboundMessage(raw);
|
||||
if (!decoded.ok) {
|
||||
console.warn("Dropped inbound WebSocket envelope", decoded.diagnostic);
|
||||
const exit = decodeWsResponseFromJson(raw);
|
||||
if (exit._tag === "Failure") {
|
||||
console.warn("Dropped inbound WebSocket envelope", {
|
||||
reason: "decode-failed",
|
||||
raw,
|
||||
issue: Cause.pretty(exit.cause),
|
||||
});
|
||||
return;
|
||||
}
|
||||
const message = exit.value;
|
||||
|
||||
const message = decoded.message;
|
||||
if (isWsPushMessage(message)) {
|
||||
this.latestPushByChannel.set(message.channel, message);
|
||||
// Push event
|
||||
if (isWsPushEnvelope(message)) {
|
||||
const channelListeners = this.listeners.get(message.channel);
|
||||
if (channelListeners) {
|
||||
for (const listener of channelListeners) {
|
||||
try {
|
||||
listener(message);
|
||||
listener(message.data);
|
||||
} catch {
|
||||
// Swallow listener errors
|
||||
}
|
||||
@@ -292,68 +149,57 @@ export class WsTransport {
|
||||
return;
|
||||
}
|
||||
|
||||
// Response to a request
|
||||
if (!isWebSocketResponseEnvelope(message)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pending = this.pending.get(message.id);
|
||||
if (!pending) {
|
||||
return;
|
||||
}
|
||||
if (!pending) return;
|
||||
|
||||
clearTimeout(pending.timeout);
|
||||
this.pending.delete(message.id);
|
||||
|
||||
if (message.error) {
|
||||
pending.reject(new Error(message.error.message));
|
||||
return;
|
||||
}
|
||||
|
||||
pending.resolve(message.result);
|
||||
}
|
||||
|
||||
private send(encodedMessage: string) {
|
||||
if (this.disposed) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.outboundQueue.push(encodedMessage);
|
||||
try {
|
||||
this.flushQueue();
|
||||
} catch {
|
||||
// Swallow: flushQueue has queued the message for retry on reconnect
|
||||
} else {
|
||||
pending.resolve(message.result);
|
||||
}
|
||||
}
|
||||
|
||||
private flushQueue() {
|
||||
if (this.ws?.readyState !== WebSocket.OPEN) {
|
||||
private send(message: WsRequestEnvelope) {
|
||||
if (this.ws?.readyState === WebSocket.OPEN) {
|
||||
this.ws.send(JSON.stringify(message));
|
||||
return;
|
||||
}
|
||||
|
||||
while (this.outboundQueue.length > 0) {
|
||||
const message = this.outboundQueue.shift();
|
||||
if (!message) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
this.ws.send(message);
|
||||
} catch (error) {
|
||||
this.outboundQueue.unshift(message);
|
||||
throw asError(error, "Failed to send WebSocket request.");
|
||||
}
|
||||
}
|
||||
// If not connected, wait for connection
|
||||
const waitForOpen = () => {
|
||||
const check = setInterval(() => {
|
||||
if (this.disposed) {
|
||||
clearInterval(check);
|
||||
return;
|
||||
}
|
||||
if (this.ws?.readyState === WebSocket.OPEN) {
|
||||
clearInterval(check);
|
||||
this.ws.send(JSON.stringify(message));
|
||||
}
|
||||
}, 50);
|
||||
|
||||
// Give up after timeout (the pending request will time out on its own)
|
||||
setTimeout(() => clearInterval(check), REQUEST_TIMEOUT_MS);
|
||||
};
|
||||
waitForOpen();
|
||||
}
|
||||
|
||||
private scheduleReconnect() {
|
||||
if (this.disposed || this.reconnectTimer !== null) {
|
||||
return;
|
||||
}
|
||||
if (this.disposed) return;
|
||||
|
||||
const delay =
|
||||
RECONNECT_DELAYS_MS[Math.min(this.reconnectAttempt, RECONNECT_DELAYS_MS.length - 1)] ??
|
||||
RECONNECT_DELAYS_MS[0]!;
|
||||
|
||||
this.reconnectAttempt += 1;
|
||||
this.reconnectAttempt++;
|
||||
this.reconnectTimer = setTimeout(() => {
|
||||
this.reconnectTimer = null;
|
||||
this.connect();
|
||||
|
||||
@@ -30,9 +30,6 @@ export default defineConfig({
|
||||
// In dev mode, tell the web app where the WebSocket server lives
|
||||
"import.meta.env.VITE_WS_URL": JSON.stringify(process.env.VITE_WS_URL ?? ""),
|
||||
},
|
||||
experimental: {
|
||||
enableNativePlugin: true,
|
||||
},
|
||||
resolve: {
|
||||
tsconfigPaths: true,
|
||||
},
|
||||
|
||||
@@ -75,6 +75,10 @@
|
||||
"version": "0.0.9",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "^1.2.0",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@lexical/react": "^0.41.0",
|
||||
"@pierre/diffs": "^1.1.0-beta.16",
|
||||
"@t3tools/contracts": "workspace:*",
|
||||
@@ -160,6 +164,9 @@
|
||||
},
|
||||
},
|
||||
},
|
||||
"overrides": {
|
||||
"vite": "^8.0.0-beta.12",
|
||||
},
|
||||
"catalog": {
|
||||
"@effect/language-service": "0.75.1",
|
||||
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@8881a9b",
|
||||
@@ -239,6 +246,16 @@
|
||||
|
||||
"@capsizecss/unpack": ["@capsizecss/[email protected]", "", { "dependencies": { "fontkitten": "^1.0.0" } }, "sha512-VERIM64vtTP1C4mxQ5thVT9fK0apjPFobqybMtA1UdUujWka24ERHbRHFGmpbbhp73MhV+KSsHQH9C6uOTdEQA=="],
|
||||
|
||||
"@dnd-kit/accessibility": ["@dnd-kit/[email protected]", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" } }, "sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw=="],
|
||||
|
||||
"@dnd-kit/core": ["@dnd-kit/[email protected]", "", { "dependencies": { "@dnd-kit/accessibility": "^3.1.1", "@dnd-kit/utilities": "^3.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ=="],
|
||||
|
||||
"@dnd-kit/modifiers": ["@dnd-kit/[email protected]", "", { "dependencies": { "@dnd-kit/utilities": "^3.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@dnd-kit/core": "^6.3.0", "react": ">=16.8.0" } }, "sha512-ybiLc66qRGuZoC20wdSSG6pDXFikui/dCNGthxv4Ndy8ylErY0N3KVxY2bgo7AWwIbxDmXDg3ylAFmnrjcbVvw=="],
|
||||
|
||||
"@dnd-kit/sortable": ["@dnd-kit/[email protected]", "", { "dependencies": { "@dnd-kit/utilities": "^3.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@dnd-kit/core": "^6.3.0", "react": ">=16.8.0" } }, "sha512-+xqhmIIzvAYMGfBYYnbKuNicfSsk4RksY2XdmJhT+HAC01nix6fHCztU68jooFiMUB01Ky3F0FyOvhG/BZrWkg=="],
|
||||
|
||||
"@dnd-kit/utilities": ["@dnd-kit/[email protected]", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" } }, "sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg=="],
|
||||
|
||||
"@effect/language-service": ["@effect/[email protected]", "", { "bin": { "effect-language-service": "cli.js" } }, "sha512-g9xD2tAQgRFpYC2YgpZq02VeSL5fBbFJ0B/g1o+14NuNmwtaYJc7SjiLWAA9eyhJHosNrn6h1Ye+Kx6j5mN0AA=="],
|
||||
|
||||
"@effect/platform-node": ["@effect/platform-node@https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@8881a9b", { "dependencies": { "@effect/platform-node-shared": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node-shared@8881a9b606d84a6f5eb6615279138322984f5368", "mime": "^4.1.0", "undici": "^7.20.0" }, "peerDependencies": { "effect": "^4.0.0-beta.25", "ioredis": "^5.7.0" } }],
|
||||
@@ -565,13 +582,13 @@
|
||||
|
||||
"@oxlint/binding-win32-x64-msvc": ["@oxlint/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-Q14+fOGb9T28nWF/0EUsYqERiRA7cl1oy4TJrGmLaqhm+aO2cV+JttboHI3CbdeMCAyDI1+NoSlrM7Melhp/cw=="],
|
||||
|
||||
"@pierre/diffs": ["@pierre/[email protected]8", "", { "dependencies": { "@pierre/theme": "0.0.22", "@shikijs/transformers": "^3.0.0", "diff": "8.0.3", "hast-util-to-html": "9.0.5", "lru_map": "0.4.1", "shiki": "^3.0.0" }, "peerDependencies": { "react": "^18.3.1 || ^19.0.0", "react-dom": "^18.3.1 || ^19.0.0" } }, "sha512-7ZF3YD9fxdbYsPnltz5cUqHacN7ztp8RX/fJLxwv8wIEORpP4+7dHz1h/qx3o4EW2xUrIhmbM8ImywLasB787Q=="],
|
||||
"@pierre/diffs": ["@pierre/[email protected]9", "", { "dependencies": { "@pierre/theme": "0.0.22", "@shikijs/transformers": "^3.0.0", "diff": "8.0.3", "hast-util-to-html": "9.0.5", "lru_map": "0.4.1", "shiki": "^3.0.0" }, "peerDependencies": { "react": "^18.3.1 || ^19.0.0", "react-dom": "^18.3.1 || ^19.0.0" } }, "sha512-XxGPKkVW+1t2KJQfgjmSnS+93nI9+ACJl1XjhF3Lo4BdQJOxV3pHeyix31ySn/m/1llq6O/7bXucE0OYCK6Kog=="],
|
||||
|
||||
"@pierre/theme": ["@pierre/[email protected]", "", {}, "sha512-ePUIdQRNGjrveELTU7fY89Xa7YGHHEy5Po5jQy/18lm32eRn96+tnYJEtFooGdffrx55KBUtOXfvVy/7LDFFhA=="],
|
||||
|
||||
"@polka/url": ["@polka/[email protected]", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="],
|
||||
|
||||
"@preact/signals-core": ["@preact/[email protected]3.0", "", {}, "sha512-slT6XeTCAbdql61GVLlGU4x7XHI7kCZV5Um5uhE4zLX4ApgiiXc0UYFvVOKq06xcovzp7p+61l68oPi563ARKg=="],
|
||||
"@preact/signals-core": ["@preact/[email protected]4.0", "", {}, "sha512-AowtCcCU/33lFlh1zRFf/u+12rfrhtNakj7UpaGEsmMwUKpKWMVvcktOGcwBBNiB4lWrZWc01LhiyyzVklJyaQ=="],
|
||||
|
||||
"@quansync/fs": ["@quansync/[email protected]", "", { "dependencies": { "quansync": "^1.0.0" } }, "sha512-4TJ3DFtlf1L5LDMaM6CanJ/0lckGNtJcMjQ1NAV6zDmA0tEHKZtxNKin8EgPaVX1YzljbxckyT2tJrpQKAtngQ=="],
|
||||
|
||||
@@ -589,9 +606,9 @@
|
||||
|
||||
"@rolldown/binding-linux-arm64-musl": ["@rolldown/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-Z03/wrqau9Bicfgb3Dbs6SYTHliELk2PM2LpG2nFd+cGupTMF5kanLEcj2vuuJLLhptNyS61rtk7SOZ+lPsTUA=="],
|
||||
|
||||
"@rolldown/binding-linux-ppc64-gnu": ["@rolldown/[email protected].7", "", { "os": "linux", "cpu": "ppc64" }, "sha512-Y48ShVxGE2zUTt0A0PR3grCLNxW4DWtAfe5lxf6L3uYEQujwo/LGuRogMsAtOJeYLCPTJo2i714LOdnK34cHpw=="],
|
||||
"@rolldown/binding-linux-ppc64-gnu": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "ppc64" }, "sha512-oaLRyUHw8kQE5M89RqrDJZ10GdmGJcMeCo8tvaE4ukOofqgjV84AbqBSH6tTPjeT2BHv+xlKj678GBuIb47lKA=="],
|
||||
|
||||
"@rolldown/binding-linux-s390x-gnu": ["@rolldown/[email protected].7", "", { "os": "linux", "cpu": "s390x" }, "sha512-KU5DUYvX3qI8/TX6D3RA4awXi4Ge/1+M6Jqv7kRiUndpqoVGgD765xhV3Q6QvtABnYjLJenrWDl3S1B5U56ixA=="],
|
||||
"@rolldown/binding-linux-s390x-gnu": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "s390x" }, "sha512-1hjSKFrod5MwBBdLOOA0zpUuSfSDkYIY+QqcMcIU1WOtswZtZdUkcFcZza9b2HcAb0bnpmmyo0LZcaxLb2ov1g=="],
|
||||
|
||||
"@rolldown/binding-linux-x64-gnu": ["@rolldown/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-iSXXZsQp08CSilff/DCTFZHSVEpEwdicV3W8idHyrByrcsRDVh9sGC3sev6d8BygSGj3vt8GvUKBPCoyMA4tgQ=="],
|
||||
|
||||
@@ -735,23 +752,23 @@
|
||||
|
||||
"@tanstack/react-query": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/query-core": "5.90.20" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-0Lu6y5t+tvlTJMTO7oh5NSpJfpg/5D41LlThfepTixPYkJ0sE2Jj0m0f6yYqujBwIXlId87e234+MxG3D3g7kg=="],
|
||||
|
||||
"@tanstack/react-router": ["@tanstack/[email protected].2", "", { "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-router": ["@tanstack/[email protected].4", "", { "dependencies": { "@tanstack/history": "1.161.4", "@tanstack/react-store": "^0.9.1", "@tanstack/router-core": "1.166.4", "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-kqTLQMW+tnomKYrdC4fGRu2RdU0pAiHgRL72T1O9gigdLbrYzM60LK2w+aRlwV2WC2CdieFluPxBtaWPUDxepQ=="],
|
||||
|
||||
"@tanstack/react-store": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/store": "0.8.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-XItJt+rG8c5Wn/2L/bnxys85rBpm0BfMbhb4zmPVLXAKY9POrp1xd6IbU4PKoOI+jSEGc3vntPRfLGSgXfE2Ig=="],
|
||||
|
||||
"@tanstack/react-virtual": ["@tanstack/[email protected]0", "", { "dependencies": { "@tanstack/virtual-core": "3.13.20" }, "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-LkFkwMMKKJ0zcbN4s37hTbj+22sHCXpaqV6+kh2x74aFg59kKCfdeeKtvCETVw8vP8oqtoWo+v+3JWkuGLqF/A=="],
|
||||
"@tanstack/react-virtual": ["@tanstack/[email protected]1", "", { "dependencies": { "@tanstack/virtual-core": "3.13.21" }, "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-SYXFrmrbPgXBvf+HsOsKhFgqSe4M6B29VHOsX9Jih9TlNkNkDWx0hWMiMLUghMEzyUz772ndzdEeCEBx+3GIZw=="],
|
||||
|
||||
"@tanstack/router-core": ["@tanstack/[email protected].2", "", { "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-core": ["@tanstack/[email protected].4", "", { "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-T/RrsAvznqNJqfT7nrj3S+/RiQmW4U/i4Vii8KdOQdhahPzAQnmRzZB+SUwR4quqRYql5o2zmCA6Brg1961hHg=="],
|
||||
|
||||
"@tanstack/router-generator": ["@tanstack/[email protected].2", "", { "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-generator": ["@tanstack/[email protected].4", "", { "dependencies": { "@tanstack/router-core": "1.166.4", "@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-/qqoTdFUaLKU42CVu/e+ghv/8TwcKtvCFD+f4qoRL1ol+k9z1sYpGqaMOgqBBUELCfc3p6FPxblPO/DB5ppkuQ=="],
|
||||
|
||||
"@tanstack/router-plugin": ["@tanstack/[email protected].2", "", { "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-plugin": ["@tanstack/[email protected].4", "", { "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.4", "@tanstack/router-generator": "1.166.4", "@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.4", "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-nNqJXMtPqURmtlg2Pz8Q51iKMPtZcBCMMQEV19tXzPuU6JvcyCIQOAFWul4rvdYe6Q3dx/Iy11JLmJGaQZOP8g=="],
|
||||
|
||||
"@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].1", "", {}, "sha512-+qcNkOy0N1qSGsP7omVCW0SDrXtaDcycPqBDE726yryiA5eTDFpjBReaYjghVJwNf1pcPMyzIwTGlYjCSQR0Fg=="],
|
||||
"@tanstack/store": ["@tanstack/[email protected].2", "", {}, "sha512-K013lUJEFJK2ofFQ/hZKJUmCnpcV00ebLyOyFOWQvyQHUOZp/iYO84BM6aOGiV81JzwbX0APTVmW8YI7yiG5oA=="],
|
||||
|
||||
"@tanstack/virtual-core": ["@tanstack/[email protected]0", "", {}, "sha512-Djnq7ujPWcRAKyDpwqL4JDe6ZTN9AWAqE2wLstBlsEu4OnO7Im0p8KsHzLU7TPIvLQgNKpkn9EmgBH6xs8yjfA=="],
|
||||
"@tanstack/virtual-core": ["@tanstack/[email protected]1", "", {}, "sha512-ww+fmLHyCbPSf7JNbWZP3g7wl6SdNo3ah5Aiw+0e9FDErkVHLKprYUrwTm7dF646FtEkN/KkAKPYezxpmvOjxw=="],
|
||||
|
||||
"@tanstack/virtual-file-routes": ["@tanstack/[email protected]", "", {}, "sha512-42WoRePf8v690qG8yGRe/YOh+oHni9vUaUUfoqlS91U2scd3a5rkLtVsc6b7z60w3RogH0I00vdrC5AaeiZ18w=="],
|
||||
|
||||
@@ -793,7 +810,7 @@
|
||||
|
||||
"@types/nlcst": ["@types/[email protected]", "", { "dependencies": { "@types/unist": "*" } }, "sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA=="],
|
||||
|
||||
"@types/node": ["@types/[email protected]1.2", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-HTsxyfkxTNxOXBsEdgIOzbMgBjDGPvkTfw0B1m09j1LFPk8u3tSL8SNBRTSc381wXXX/Wp93qPi1kQXwnWuHgA=="],
|
||||
"@types/node": ["@types/[email protected]2.0", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
|
||||
|
||||
"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w=="],
|
||||
|
||||
@@ -929,7 +946,7 @@
|
||||
|
||||
"camelcase": ["[email protected]", "", {}, "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA=="],
|
||||
|
||||
"caniuse-lite": ["[email protected]6", "", {}, "sha512-sg01JDPzZ9jGshqKSckOQthXnYwOEP50jeVFhaSFbZcOy05TiuuaffDOfcwtCisJ9kNQuLBFibYywv2Bgm9osw=="],
|
||||
"caniuse-lite": ["[email protected]7", "", {}, "sha512-tmN+fJxroPndC74efCdp12j+0rk0RHwV5Jwa1zWaFVyw2ZxAuPeG8ZgWC3Wz7uSjT3qMRQ5XHZ4COgQmsCMJAQ=="],
|
||||
|
||||
"ccount": ["[email protected]", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="],
|
||||
|
||||
@@ -1105,7 +1122,7 @@
|
||||
|
||||
"extract-zip": ["[email protected]", "", { "dependencies": { "debug": "^4.1.1", "get-stream": "^5.1.0", "yauzl": "^2.10.0" }, "optionalDependencies": { "@types/yauzl": "^2.9.1" }, "bin": { "extract-zip": "cli.js" } }, "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg=="],
|
||||
|
||||
"fast-check": ["fast-check@4.5.3", "", { "dependencies": { "pure-rand": "^7.0.0" } }, "sha512-IE9csY7lnhxBnA8g/WI5eg/hygA6MGWJMSNfFRrBlXUciADEhS1EDB0SIsMSvzubzIlOBbVITSsypCsW717poA=="],
|
||||
"fast-check": ["fast-check@4.6.0", "", { "dependencies": { "pure-rand": "^8.0.0" } }, "sha512-h7H6Dm0Fy+H4ciQYFxFjXnXkzR2kr9Fb22c0UBpHnm59K2zpr2t13aPTHlltFiNT6zuxp6HMPAVVvgur4BLdpA=="],
|
||||
|
||||
"fast-deep-equal": ["[email protected]", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],
|
||||
|
||||
@@ -1165,7 +1182,7 @@
|
||||
|
||||
"graphql": ["[email protected]", "", {}, "sha512-gGgrVCoDKlIZ8fIqXBBb0pPKqDgki0Z/FSKNiQzSGj2uEYHr1tq5wmBegGwJx6QB5S5cM0khSBpi/JFHMCvsmQ=="],
|
||||
|
||||
"h3": ["[email protected].5", "", { "dependencies": { "cookie-es": "^1.2.2", "crossws": "^0.3.5", "defu": "^6.1.4", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", "radix3": "^1.1.2", "ufo": "^1.6.3", "uncrypto": "^0.1.3" } }, "sha512-xEyq3rSl+dhGX2Lm0+eFQIAzlDN6Fs0EcC4f7BNUmzaRX/PTzeuM+Tr2lHB8FoXggsQIeXLj8EDVgs5ywxyxmg=="],
|
||||
"h3": ["[email protected].6", "", { "dependencies": { "cookie-es": "^1.2.2", "crossws": "^0.3.5", "defu": "^6.1.4", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", "radix3": "^1.1.2", "ufo": "^1.6.3", "uncrypto": "^0.1.3" } }, "sha512-oi15ESLW5LRthZ+qPCi5GNasY/gvynSKUQxgiovrY63bPAtG59wtM+LSrlcwvOHAXzGrXVLnI97brbkdPF9WoQ=="],
|
||||
|
||||
"has-property-descriptors": ["[email protected]", "", { "dependencies": { "es-define-property": "^1.0.0" } }, "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg=="],
|
||||
|
||||
@@ -1289,29 +1306,29 @@
|
||||
|
||||
"lib0": ["[email protected]", "", { "dependencies": { "isomorphic.js": "^0.2.4" }, "bin": { "0serve": "bin/0serve.js", "0gentesthtml": "bin/gentesthtml.js", "0ecdsa-generate-keypair": "bin/0ecdsa-generate-keypair.js" } }, "sha512-DeXj9X5xDCjgKLU/7RR+/HQEVzuuEUiwldwOGsHK/sfAfELGWEyTcf0x+uOvCvK3O2zPmZePXWL85vtia6GyZw=="],
|
||||
|
||||
"lightningcss": ["[email protected]1.1", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.31.1", "lightningcss-darwin-arm64": "1.31.1", "lightningcss-darwin-x64": "1.31.1", "lightningcss-freebsd-x64": "1.31.1", "lightningcss-linux-arm-gnueabihf": "1.31.1", "lightningcss-linux-arm64-gnu": "1.31.1", "lightningcss-linux-arm64-musl": "1.31.1", "lightningcss-linux-x64-gnu": "1.31.1", "lightningcss-linux-x64-musl": "1.31.1", "lightningcss-win32-arm64-msvc": "1.31.1", "lightningcss-win32-x64-msvc": "1.31.1" } }, "sha512-l51N2r93WmGUye3WuFoN5k10zyvrVs0qfKBhyC5ogUQ6Ew6JUSswh78mbSO+IU3nTWsyOArqPCcShdQSadghBQ=="],
|
||||
"lightningcss": ["[email protected]2.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="],
|
||||
|
||||
"lightningcss-android-arm64": ["[email protected]1.1", "", { "os": "android", "cpu": "arm64" }, "sha512-HXJF3x8w9nQ4jbXRiNppBCqeZPIAfUo8zE/kOEGbW5NZvGc/K7nMxbhIr+YlFlHW5mpbg/YFPdbnCh1wAXCKFg=="],
|
||||
"lightningcss-android-arm64": ["[email protected]2.0", "", { "os": "android", "cpu": "arm64" }, "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg=="],
|
||||
|
||||
"lightningcss-darwin-arm64": ["[email protected]1.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-02uTEqf3vIfNMq3h/z2cJfcOXnQ0GRwQrkmPafhueLb2h7mqEidiCzkE4gBMEH65abHRiQvhdcQ+aP0D0g67sg=="],
|
||||
"lightningcss-darwin-arm64": ["[email protected]2.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ=="],
|
||||
|
||||
"lightningcss-darwin-x64": ["[email protected]1.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-1ObhyoCY+tGxtsz1lSx5NXCj3nirk0Y0kB/g8B8DT+sSx4G9djitg9ejFnjb3gJNWo7qXH4DIy2SUHvpoFwfTA=="],
|
||||
"lightningcss-darwin-x64": ["[email protected]2.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w=="],
|
||||
|
||||
"lightningcss-freebsd-x64": ["[email protected]1.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-1RINmQKAItO6ISxYgPwszQE1BrsVU5aB45ho6O42mu96UiZBxEXsuQ7cJW4zs4CEodPUioj/QrXW1r9pLUM74A=="],
|
||||
"lightningcss-freebsd-x64": ["[email protected]2.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig=="],
|
||||
|
||||
"lightningcss-linux-arm-gnueabihf": ["[email protected]1.1", "", { "os": "linux", "cpu": "arm" }, "sha512-OOCm2//MZJ87CdDK62rZIu+aw9gBv4azMJuA8/KB74wmfS3lnC4yoPHm0uXZ/dvNNHmnZnB8XLAZzObeG0nS1g=="],
|
||||
"lightningcss-linux-arm-gnueabihf": ["[email protected]2.0", "", { "os": "linux", "cpu": "arm" }, "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw=="],
|
||||
|
||||
"lightningcss-linux-arm64-gnu": ["[email protected]1.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-WKyLWztD71rTnou4xAD5kQT+982wvca7E6QoLpoawZ1gP9JM0GJj4Tp5jMUh9B3AitHbRZ2/H3W5xQmdEOUlLg=="],
|
||||
"lightningcss-linux-arm64-gnu": ["[email protected]2.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ=="],
|
||||
|
||||
"lightningcss-linux-arm64-musl": ["[email protected]1.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-mVZ7Pg2zIbe3XlNbZJdjs86YViQFoJSpc41CbVmKBPiGmC4YrfeOyz65ms2qpAobVd7WQsbW4PdsSJEMymyIMg=="],
|
||||
"lightningcss-linux-arm64-musl": ["[email protected]2.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg=="],
|
||||
|
||||
"lightningcss-linux-x64-gnu": ["[email protected]1.1", "", { "os": "linux", "cpu": "x64" }, "sha512-xGlFWRMl+0KvUhgySdIaReQdB4FNudfUTARn7q0hh/V67PVGCs3ADFjw+6++kG1RNd0zdGRlEKa+T13/tQjPMA=="],
|
||||
"lightningcss-linux-x64-gnu": ["[email protected]2.0", "", { "os": "linux", "cpu": "x64" }, "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA=="],
|
||||
|
||||
"lightningcss-linux-x64-musl": ["[email protected]1.1", "", { "os": "linux", "cpu": "x64" }, "sha512-eowF8PrKHw9LpoZii5tdZwnBcYDxRw2rRCyvAXLi34iyeYfqCQNA9rmUM0ce62NlPhCvof1+9ivRaTY6pSKDaA=="],
|
||||
"lightningcss-linux-x64-musl": ["[email protected]2.0", "", { "os": "linux", "cpu": "x64" }, "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg=="],
|
||||
|
||||
"lightningcss-win32-arm64-msvc": ["[email protected]1.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-aJReEbSEQzx1uBlQizAOBSjcmr9dCdL3XuC/6HLXAxmtErsj2ICo5yYggg1qOODQMtnjNQv2UHb9NpOuFtYe4w=="],
|
||||
"lightningcss-win32-arm64-msvc": ["[email protected]2.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw=="],
|
||||
|
||||
"lightningcss-win32-x64-msvc": ["[email protected]1.1", "", { "os": "win32", "cpu": "x64" }, "sha512-I9aiFrbd7oYHwlnQDqr1Roz+fTz61oDDJX7n9tYF9FJymH1cIN1DtKw3iYt6b8WZgEjoNwVSncwF4wx/ZedMhw=="],
|
||||
"lightningcss-win32-x64-msvc": ["[email protected]2.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q=="],
|
||||
|
||||
"lodash": ["[email protected]", "", {}, "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w=="],
|
||||
|
||||
@@ -1559,7 +1576,7 @@
|
||||
|
||||
"pump": ["[email protected]", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA=="],
|
||||
|
||||
"pure-rand": ["pure-rand@7.0.1", "", {}, "sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ=="],
|
||||
"pure-rand": ["pure-rand@8.0.0", "", {}, "sha512-7rgWlxG2gAvFPIQfUreo1XYlNvrQ9VnQPFWdncPkdl3icucLK0InOxsaafbvxGTnI6Bk/Rxmslg0lQlRCuzOXw=="],
|
||||
|
||||
"quansync": ["[email protected]", "", {}, "sha512-5xZacEEufv3HSTPQuchrvV6soaiACMFnq1H8wkVioctoH3TRha9Sz66lOxRwPK/qZj7HPiSveih9yAyh98gvqA=="],
|
||||
|
||||
@@ -1637,7 +1654,7 @@
|
||||
|
||||
"rolldown": ["[email protected]", "", { "dependencies": { "@oxc-project/types": "=0.112.0", "@rolldown/pluginutils": "1.0.0-rc.3" }, "optionalDependencies": { "@rolldown/binding-android-arm64": "1.0.0-rc.3", "@rolldown/binding-darwin-arm64": "1.0.0-rc.3", "@rolldown/binding-darwin-x64": "1.0.0-rc.3", "@rolldown/binding-freebsd-x64": "1.0.0-rc.3", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.3", "@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.3", "@rolldown/binding-linux-arm64-musl": "1.0.0-rc.3", "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.3", "@rolldown/binding-linux-x64-musl": "1.0.0-rc.3", "@rolldown/binding-openharmony-arm64": "1.0.0-rc.3", "@rolldown/binding-wasm32-wasi": "1.0.0-rc.3", "@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.3", "@rolldown/binding-win32-x64-msvc": "1.0.0-rc.3" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-Po/YZECDOqVXjIXrtC5h++a5NLvKAQNrd9ggrIG3sbDfGO5BqTUsrI6l8zdniKRp3r5Tp/2JTrXqx4GIguFCMw=="],
|
||||
|
||||
"rolldown-plugin-dts": ["[email protected].3", "", { "dependencies": { "@babel/generator": "8.0.0-rc.2", "@babel/helper-validator-identifier": "8.0.0-rc.2", "@babel/parser": "8.0.0-rc.2", "@babel/types": "8.0.0-rc.2", "ast-kit": "^3.0.0-beta.1", "birpc": "^4.0.0", "dts-resolver": "^2.1.3", "get-tsconfig": "^4.13.6", "obug": "^2.1.1" }, "peerDependencies": { "@ts-macro/tsc": "^0.3.6", "@typescript/native-preview": ">=7.0.0-dev.20250601.1", "rolldown": "^1.0.0-rc.3", "typescript": "^5.0.0 || ^6.0.0-beta", "vue-tsc": "~3.2.0" }, "optionalPeers": ["@ts-macro/tsc", "@typescript/native-preview", "typescript", "vue-tsc"] }, "sha512-APIGZGChvLVu05f+7bMmgf+lpvhjIvELhkOsg7c/95IVdOgULVFOX9iciaHJLaBfZeTthIgp+gryGBjgyKNA1A=="],
|
||||
"rolldown-plugin-dts": ["[email protected].4", "", { "dependencies": { "@babel/generator": "8.0.0-rc.2", "@babel/helper-validator-identifier": "8.0.0-rc.2", "@babel/parser": "8.0.0-rc.2", "@babel/types": "8.0.0-rc.2", "ast-kit": "^3.0.0-beta.1", "birpc": "^4.0.0", "dts-resolver": "^2.1.3", "get-tsconfig": "^4.13.6", "obug": "^2.1.1" }, "peerDependencies": { "@ts-macro/tsc": "^0.3.6", "@typescript/native-preview": ">=7.0.0-dev.20250601.1", "rolldown": "^1.0.0-rc.3", "typescript": "^5.0.0 || ^6.0.0-beta", "vue-tsc": "~3.2.0" }, "optionalPeers": ["@ts-macro/tsc", "@typescript/native-preview", "typescript", "vue-tsc"] }, "sha512-pueqTPyN1N6lWYivyDGad+j+GO3DT67pzpct8s8e6KGVIezvnrDjejuw1AXFeyDRas3xTq4Ja6Lj5R5/04C5GQ=="],
|
||||
|
||||
"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": { "rollup": "dist/bin/rollup" } }, "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg=="],
|
||||
|
||||
@@ -1655,9 +1672,9 @@
|
||||
|
||||
"serialize-error": ["[email protected]", "", { "dependencies": { "type-fest": "^0.13.1" } }, "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw=="],
|
||||
|
||||
"seroval": ["[email protected].0", "", {}, "sha512-OE4cvmJ1uSPrKorFIH9/w/Qwuvi/IMcGbv5RKgcJ/zjA/IohDLU6SVaxFN9FwajbP7nsX0dQqMDes1whk3y+yw=="],
|
||||
"seroval": ["[email protected].1", "", {}, "sha512-OwrZRZAfhHww0WEnKHDY8OM0U/Qs8OTfIDWhUD4BLpNJUfXK4cGmjiagGze086m+mhI+V2nD0gfbHEnJjb9STA=="],
|
||||
|
||||
"seroval-plugins": ["[email protected].0", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-EAHqADIQondwRZIdeW2I636zgsODzoBDwb3PT/+7TLDWyw1Dy/Xv7iGUIEXXav7usHDE9HVhOU61irI3EnyyHA=="],
|
||||
"seroval-plugins": ["[email protected].1", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-4FbuZ/TMl02sqv0RTFexu0SP6V+ywaIe5bAWCCEik0fk17BhALgwvUDVF7e3Uvf9pxmwCEJsRPmlkUE6HdzLAw=="],
|
||||
|
||||
"sharp": ["[email protected]", "", { "dependencies": { "@img/colour": "^1.0.0", "detect-libc": "^2.1.2", "semver": "^7.7.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.34.5", "@img/sharp-darwin-x64": "0.34.5", "@img/sharp-libvips-darwin-arm64": "1.2.4", "@img/sharp-libvips-darwin-x64": "1.2.4", "@img/sharp-libvips-linux-arm": "1.2.4", "@img/sharp-libvips-linux-arm64": "1.2.4", "@img/sharp-libvips-linux-ppc64": "1.2.4", "@img/sharp-libvips-linux-riscv64": "1.2.4", "@img/sharp-libvips-linux-s390x": "1.2.4", "@img/sharp-libvips-linux-x64": "1.2.4", "@img/sharp-libvips-linuxmusl-arm64": "1.2.4", "@img/sharp-libvips-linuxmusl-x64": "1.2.4", "@img/sharp-linux-arm": "0.34.5", "@img/sharp-linux-arm64": "0.34.5", "@img/sharp-linux-ppc64": "0.34.5", "@img/sharp-linux-riscv64": "0.34.5", "@img/sharp-linux-s390x": "0.34.5", "@img/sharp-linux-x64": "0.34.5", "@img/sharp-linuxmusl-arm64": "0.34.5", "@img/sharp-linuxmusl-x64": "0.34.5", "@img/sharp-wasm32": "0.34.5", "@img/sharp-win32-arm64": "0.34.5", "@img/sharp-win32-ia32": "0.34.5", "@img/sharp-win32-x64": "0.34.5" } }, "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg=="],
|
||||
|
||||
@@ -1735,9 +1752,9 @@
|
||||
|
||||
"tinyrainbow": ["[email protected]", "", {}, "sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q=="],
|
||||
|
||||
"tldts": ["[email protected]4", "", { "dependencies": { "tldts-core": "^7.0.24" }, "bin": { "tldts": "bin/cli.js" } }, "sha512-1r6vQTTt1rUiJkI5vX7KG8PR342Ru/5Oh13kEQP2SMbRSZpOey9SrBe27IDxkoWulx8ShWu4K6C0BkctP8Z1bQ=="],
|
||||
"tldts": ["[email protected]5", "", { "dependencies": { "tldts-core": "^7.0.25" }, "bin": { "tldts": "bin/cli.js" } }, "sha512-keinCnPbwXEUG3ilrWQZU+CqcTTzHq9m2HhoUP2l7Xmi8l1LuijAXLpAJ5zRW+ifKTNscs4NdCkfkDCBYm352w=="],
|
||||
|
||||
"tldts-core": ["[email protected]4", "", {}, "sha512-pj7yygNMoMRqG7ML2SDQ0xNIOfN3IBDUcPVM2Sg6hP96oFNN2nqnzHreT3z9xLq85IWJyNTvD38O002DdOrPMw=="],
|
||||
"tldts-core": ["[email protected]5", "", {}, "sha512-ZjCZK0rppSBu7rjHYDYsEaMOIbbT+nWF57hKkv4IUmZWBNrBWBOjIElc0mKRgLM8bm7x/BBlof6t2gi/Oq/Asw=="],
|
||||
|
||||
"to-regex-range": ["[email protected]", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],
|
||||
|
||||
@@ -1761,19 +1778,19 @@
|
||||
|
||||
"tsx": ["[email protected]", "", { "dependencies": { "esbuild": "~0.27.0", "get-tsconfig": "^4.7.5" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "bin": { "tsx": "dist/cli.mjs" } }, "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw=="],
|
||||
|
||||
"turbo": ["[email protected]3", "", { "optionalDependencies": { "turbo-darwin-64": "2.8.13", "turbo-darwin-arm64": "2.8.13", "turbo-linux-64": "2.8.13", "turbo-linux-arm64": "2.8.13", "turbo-windows-64": "2.8.13", "turbo-windows-arm64": "2.8.13" }, "bin": { "turbo": "bin/turbo" } }, "sha512-nyM99hwFB9/DHaFyKEqatdayGjsMNYsQ/XBNO6MITc7roncZetKb97MpHxWf3uiU+LB9c9HUlU3Jp2Ixei2k1A=="],
|
||||
"turbo": ["[email protected]4", "", { "optionalDependencies": { "turbo-darwin-64": "2.8.14", "turbo-darwin-arm64": "2.8.14", "turbo-linux-64": "2.8.14", "turbo-linux-arm64": "2.8.14", "turbo-windows-64": "2.8.14", "turbo-windows-arm64": "2.8.14" }, "bin": { "turbo": "bin/turbo" } }, "sha512-UCTxeMNYT1cKaHiIFdLCQ7ulI+jw5i5uOnJOrRXsgUD7G3+OjlUjwVd7JfeVt2McWSVGjYA3EVW/v1FSsJ5DtA=="],
|
||||
|
||||
"turbo-darwin-64": ["[email protected]3", "", { "os": "darwin", "cpu": "x64" }, "sha512-PmOvodQNiOj77+Zwoqku70vwVjKzL34RTNxxoARjp5RU5FOj/CGiC6vcDQhNtFPUOWSAaogHF5qIka9TBhX4XA=="],
|
||||
"turbo-darwin-64": ["[email protected]4", "", { "os": "darwin", "cpu": "x64" }, "sha512-9sFi7n2lLfEsGWi5OEoA/eTtQU2BPKtzSYKqufMtDeRmqMT9vKjbv9gJCRkllSVE9BOXA0qXC3diyX8V8rKIKw=="],
|
||||
|
||||
"turbo-darwin-arm64": ["[email protected]3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-kI+anKcLIM4L8h+NsM7mtAUpElkCOxv5LgiQVQR8BASyDFfc8Efj5kCk3cqxuxOvIqx0sLfCX7atrHQ2kwuNJQ=="],
|
||||
"turbo-darwin-arm64": ["[email protected]4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-aS4yJuy6A1PCLws+PJpZP0qCURG8Y5iVx13z/WAbKyeDTY6W6PiGgcEllSaeLGxyn++382ztN/EZH85n2zZ6VQ=="],
|
||||
|
||||
"turbo-linux-64": ["[email protected]3", "", { "os": "linux", "cpu": "x64" }, "sha512-j29KnQhHyzdzgCykBFeBqUPS4Wj7lWMnZ8CHqytlYDap4Jy70l4RNG46pOL9+lGu6DepK2s1rE86zQfo0IOdPw=="],
|
||||
"turbo-linux-64": ["[email protected]4", "", { "os": "linux", "cpu": "x64" }, "sha512-XC6wPUDJkakjhNLaS0NrHDMiujRVjH+naEAwvKLArgqRaFkNxjmyNDRM4eu3soMMFmjym6NTxYaF74rvET+Orw=="],
|
||||
|
||||
"turbo-linux-arm64": ["[email protected]3", "", { "os": "linux", "cpu": "arm64" }, "sha512-OEl1YocXGZDRDh28doOUn49QwNe82kXljO1HXApjU0LapkDiGpfl3jkAlPKxEkGDSYWc8MH5Ll8S16Rf5tEBYg=="],
|
||||
"turbo-linux-arm64": ["[email protected]4", "", { "os": "linux", "cpu": "arm64" }, "sha512-ChfE7isyVNjZrVSPDwcfqcHLG/FuIBbOFxnt1FM8vSuBGzHAs8AlTdwFNIxlEMJfZ8Ad9mdMxdmsCUPIWiQ6cg=="],
|
||||
|
||||
"turbo-windows-64": ["[email protected]3", "", { "os": "win32", "cpu": "x64" }, "sha512-717bVk1+Pn2Jody7OmWludhEirEe0okoj1NpRbSm5kVZz/yNN/jfjbxWC6ilimXMz7xoMT3IDfQFJsFR3PMANA=="],
|
||||
"turbo-windows-64": ["[email protected]4", "", { "os": "win32", "cpu": "x64" }, "sha512-FTbIeQL1ycLFW2t9uQNMy+bRSzi3Xhwun/e7ZhFBdM+U0VZxxrtfYEBM9CHOejlfqomk6Jh7aRz0sJoqYn39Hg=="],
|
||||
|
||||
"turbo-windows-arm64": ["[email protected]3", "", { "os": "win32", "cpu": "arm64" }, "sha512-R819HShLIT0Wj6zWVnIsYvSNtRNj1q9VIyaUz0P24SMcLCbQZIm1sV09F4SDbg+KCCumqD2lcaR2UViQ8SnUJA=="],
|
||||
"turbo-windows-arm64": ["[email protected]4", "", { "os": "win32", "cpu": "arm64" }, "sha512-KgZX12cTyhY030qS7ieT8zRkhZZE2VWJasDFVUSVVn17nR7IShpv68/7j5UqJNeRLIGF1XPK0phsP5V5yw3how=="],
|
||||
|
||||
"type-fest": ["[email protected]", "", { "dependencies": { "tagged-tag": "^1.0.0" } }, "sha512-JnTrzGu+zPV3aXIUhnyWJj4z/wigMsdYajGLIYakqyOW1nPllzXEJee0QQbHj+CTIQtXGlAjuK0UY+2xTyjVAw=="],
|
||||
|
||||
@@ -1821,7 +1838,7 @@
|
||||
|
||||
"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=="],
|
||||
|
||||
"unrun": ["[email protected]0", "", { "dependencies": { "rolldown": "1.0.0-rc.7" }, "peerDependencies": { "synckit": "^0.11.11" }, "optionalPeers": ["synckit"], "bin": { "unrun": "dist/cli.mjs" } }, "sha512-a4W1wDADI0gvDDr14T0ho1FgMhmfjq6M8Iz8q234EnlxgH/9cMHDueUSLwTl1fwSBs5+mHrLFYH+7B8ao36EBA=="],
|
||||
"unrun": ["[email protected]1", "", { "dependencies": { "rolldown": "1.0.0-rc.8" }, "peerDependencies": { "synckit": "^0.11.11" }, "optionalPeers": ["synckit"], "bin": { "unrun": "dist/cli.mjs" } }, "sha512-qltXRUeKQSrIgVS4NbH6PXEFqq+dru2ivH9QINfB+TinSlslgQvursJEV56QzaX8VaDCV5KfbROwKTQf/APJFA=="],
|
||||
|
||||
"unstorage": ["[email protected]", "", { "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", "h3": "^1.15.5", "lru-cache": "^11.2.0", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" }, "peerDependencies": { "@azure/app-configuration": "^1.8.0", "@azure/cosmos": "^4.2.0", "@azure/data-tables": "^13.3.0", "@azure/identity": "^4.6.0", "@azure/keyvault-secrets": "^4.9.0", "@azure/storage-blob": "^12.26.0", "@capacitor/preferences": "^6 || ^7 || ^8", "@deno/kv": ">=0.9.0", "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0", "@planetscale/database": "^1.19.0", "@upstash/redis": "^1.34.3", "@vercel/blob": ">=0.27.1", "@vercel/functions": "^2.2.12 || ^3.0.0", "@vercel/kv": "^1 || ^2 || ^3", "aws4fetch": "^1.0.20", "db0": ">=0.2.1", "idb-keyval": "^6.2.1", "ioredis": "^5.4.2", "uploadthing": "^7.4.4" }, "optionalPeers": ["@azure/app-configuration", "@azure/cosmos", "@azure/data-tables", "@azure/identity", "@azure/keyvault-secrets", "@azure/storage-blob", "@capacitor/preferences", "@deno/kv", "@netlify/blobs", "@planetscale/database", "@upstash/redis", "@vercel/blob", "@vercel/functions", "@vercel/kv", "aws4fetch", "db0", "idb-keyval", "ioredis", "uploadthing"] }, "sha512-fHK0yNg38tBiJKp/Vgsq4j0JEsCmgqH58HAn707S7zGkArbZsVr/CwINoi+nh3h98BRCwKvx1K3Xg9u3VV83sw=="],
|
||||
|
||||
@@ -1839,7 +1856,7 @@
|
||||
|
||||
"vfile-message": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw=="],
|
||||
|
||||
"vite": ["[email protected]6", "", { "dependencies": { "@oxc-project/runtime": "0.115.0", "lightningcss": "^1.31.1", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rolldown": "1.0.0-rc.6", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.0.0-alpha.31", "esbuild": "^0.27.0", "jiti": ">=1.21.0", "less": "^4.0.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": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-c0t7hYkxsjws89HH+BUFh/sL3BpPNhNsL9CJrTpMxBmwKQBRSa5OJ5w4o9O0bQVI/H/vx7UpUUIevvXa37NS/Q=="],
|
||||
"vite": ["[email protected]8", "", { "dependencies": { "@oxc-project/runtime": "0.115.0", "lightningcss": "^1.31.1", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rolldown": "1.0.0-rc.8", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.0.0-alpha.31", "esbuild": "^0.27.0", "jiti": ">=1.21.0", "less": "^4.0.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": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-azgNbWdsO/WBqHQxwSCy+zd+Fq+37Fix2hn64cQuiUvaaGGSUac7f8RGQhI1aQl9OKbfWblrCFLWs+tln06c2A=="],
|
||||
|
||||
"vitefu": ["[email protected]", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-beta.0" }, "optionalPeers": ["vite"] }, "sha512-zpKATdUbzbsycPFBN71nS2uzBUQiVnFoOrr2rvqv34S1lcAgMKKkjWleLGeiJlZ8lwCXvtWaRn7R3ZC16SYRuw=="],
|
||||
|
||||
@@ -1963,13 +1980,13 @@
|
||||
|
||||
"@babel/types/@babel/helper-validator-identifier": ["@babel/[email protected]", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="],
|
||||
|
||||
"@effect/platform-node/effect": ["[email protected]7", "", { "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=="],
|
||||
"@effect/platform-node/effect": ["[email protected]9", "", { "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-7UoBAEiktoS81XLMX/39Mq/Ymq8whxmqFpsI0MEYdMlbDcbytzQlyuyhvrwEIdrd9qrqa8DZ5mKblWasamryqw=="],
|
||||
|
||||
"@effect/platform-node-shared/effect": ["[email protected]7", "", { "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=="],
|
||||
"@effect/platform-node-shared/effect": ["[email protected]9", "", { "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-7UoBAEiktoS81XLMX/39Mq/Ymq8whxmqFpsI0MEYdMlbDcbytzQlyuyhvrwEIdrd9qrqa8DZ5mKblWasamryqw=="],
|
||||
|
||||
"@effect/sql-sqlite-bun/effect": ["[email protected]7", "", { "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=="],
|
||||
"@effect/sql-sqlite-bun/effect": ["[email protected]9", "", { "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-7UoBAEiktoS81XLMX/39Mq/Ymq8whxmqFpsI0MEYdMlbDcbytzQlyuyhvrwEIdrd9qrqa8DZ5mKblWasamryqw=="],
|
||||
|
||||
"@effect/vitest/effect": ["[email protected]7", "", { "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=="],
|
||||
"@effect/vitest/effect": ["[email protected]9", "", { "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-7UoBAEiktoS81XLMX/39Mq/Ymq8whxmqFpsI0MEYdMlbDcbytzQlyuyhvrwEIdrd9qrqa8DZ5mKblWasamryqw=="],
|
||||
|
||||
"@electron/get/fs-extra": ["[email protected]", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="],
|
||||
|
||||
@@ -1979,6 +1996,8 @@
|
||||
|
||||
"@rollup/pluginutils/estree-walker": ["[email protected]", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss": ["[email protected]", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.31.1", "lightningcss-darwin-arm64": "1.31.1", "lightningcss-darwin-x64": "1.31.1", "lightningcss-freebsd-x64": "1.31.1", "lightningcss-linux-arm-gnueabihf": "1.31.1", "lightningcss-linux-arm64-gnu": "1.31.1", "lightningcss-linux-arm64-musl": "1.31.1", "lightningcss-linux-x64-gnu": "1.31.1", "lightningcss-linux-x64-musl": "1.31.1", "lightningcss-win32-arm64-msvc": "1.31.1", "lightningcss-win32-x64-msvc": "1.31.1" } }, "sha512-l51N2r93WmGUye3WuFoN5k10zyvrVs0qfKBhyC5ogUQ6Ew6JUSswh78mbSO+IU3nTWsyOArqPCcShdQSadghBQ=="],
|
||||
|
||||
"@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/[email protected]", "", { "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" }, "bundled": true }, "sha512-AvT9QFpxK0Zd8J0jopedNm+w/2fIzvtPKPjqyw9jwvBaReTTqPBk9Hixaz7KbjimP+QNz605/XnjFcDAL2pqBg=="],
|
||||
|
||||
"@tailwindcss/oxide-wasm32-wasi/@emnapi/runtime": ["@emnapi/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg=="],
|
||||
@@ -1991,11 +2010,9 @@
|
||||
|
||||
"@tailwindcss/oxide-wasm32-wasi/tslib": ["[email protected]", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@tailwindcss/vite/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": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA=="],
|
||||
|
||||
"@tanstack/pacer/@tanstack/store": ["@tanstack/[email protected]", "", {}, "sha512-PtOisLjUZPz5VyPRSCGjNOlwTvabdTBQ2K80DpVL1chGVr35WRxfeavAPdNq6pm/t7F8GhoR2qtmkkqtCEtHYw=="],
|
||||
|
||||
"@tanstack/react-router/@tanstack/react-store": ["@tanstack/[email protected].1", "", { "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/react-router/@tanstack/react-store": ["@tanstack/[email protected].2", "", { "dependencies": { "@tanstack/store": "0.9.2", "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-Vt5usJE5sHG/cMechQfmwvwne6ktGCELe89Lmvoxe3LKRoFrhPa8OCKWs0NliG8HTJElEIj7PLtaBQIcux5pAQ=="],
|
||||
|
||||
"@tanstack/react-store/@tanstack/store": ["@tanstack/[email protected]", "", {}, "sha512-PtOisLjUZPz5VyPRSCGjNOlwTvabdTBQ2K80DpVL1chGVr35WRxfeavAPdNq6pm/t7F8GhoR2qtmkkqtCEtHYw=="],
|
||||
|
||||
@@ -2009,12 +2026,8 @@
|
||||
|
||||
"@types/babel__template/@babel/parser": ["@babel/[email protected]", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="],
|
||||
|
||||
"@vitejs/plugin-react/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": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA=="],
|
||||
|
||||
"anymatch/picomatch": ["[email protected]", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
||||
|
||||
"astro/vite": ["[email protected]", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g=="],
|
||||
|
||||
"babel-dead-code-elimination/@babel/parser": ["@babel/[email protected]", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="],
|
||||
|
||||
"boxen/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="],
|
||||
@@ -2049,15 +2062,13 @@
|
||||
|
||||
"tsx/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"unrun/rolldown": ["[email protected].7", "", { "dependencies": { "@oxc-project/types": "=0.115.0", "@rolldown/pluginutils": "1.0.0-rc.7" }, "optionalDependencies": { "@rolldown/binding-android-arm64": "1.0.0-rc.7", "@rolldown/binding-darwin-arm64": "1.0.0-rc.7", "@rolldown/binding-darwin-x64": "1.0.0-rc.7", "@rolldown/binding-freebsd-x64": "1.0.0-rc.7", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.7", "@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.7", "@rolldown/binding-linux-arm64-musl": "1.0.0-rc.7", "@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.7", "@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.7", "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.7", "@rolldown/binding-linux-x64-musl": "1.0.0-rc.7", "@rolldown/binding-openharmony-arm64": "1.0.0-rc.7", "@rolldown/binding-wasm32-wasi": "1.0.0-rc.7", "@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.7", "@rolldown/binding-win32-x64-msvc": "1.0.0-rc.7" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-5X0zEeQFzDpB3MqUWQZyO2TUQqP9VnT7CqXHF2laTFRy487+b6QZyotCazOySAuZLAvplCaOVsg1tVn/Zlmwfg=="],
|
||||
"unrun/rolldown": ["[email protected].8", "", { "dependencies": { "@oxc-project/types": "=0.115.0", "@rolldown/pluginutils": "1.0.0-rc.8" }, "optionalDependencies": { "@rolldown/binding-android-arm64": "1.0.0-rc.8", "@rolldown/binding-darwin-arm64": "1.0.0-rc.8", "@rolldown/binding-darwin-x64": "1.0.0-rc.8", "@rolldown/binding-freebsd-x64": "1.0.0-rc.8", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.8", "@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.8", "@rolldown/binding-linux-arm64-musl": "1.0.0-rc.8", "@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.8", "@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.8", "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.8", "@rolldown/binding-linux-x64-musl": "1.0.0-rc.8", "@rolldown/binding-openharmony-arm64": "1.0.0-rc.8", "@rolldown/binding-wasm32-wasi": "1.0.0-rc.8", "@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.8", "@rolldown/binding-win32-x64-msvc": "1.0.0-rc.8" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-RGOL7mz/aoQpy/y+/XS9iePBfeNRDUdozrhCEJxdpJyimW8v6yp4c30q6OviUU5AnUJVLRL9GP//HUs6N3ALrQ=="],
|
||||
|
||||
"unstorage/chokidar": ["[email protected]", "", { "dependencies": { "readdirp": "^5.0.0" } }, "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw=="],
|
||||
|
||||
"vite/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"vite/rolldown": ["[email protected].6", "", { "dependencies": { "@oxc-project/types": "=0.115.0", "@rolldown/pluginutils": "1.0.0-rc.6" }, "optionalDependencies": { "@rolldown/binding-android-arm64": "1.0.0-rc.6", "@rolldown/binding-darwin-arm64": "1.0.0-rc.6", "@rolldown/binding-darwin-x64": "1.0.0-rc.6", "@rolldown/binding-freebsd-x64": "1.0.0-rc.6", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.6", "@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.6", "@rolldown/binding-linux-arm64-musl": "1.0.0-rc.6", "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.6", "@rolldown/binding-linux-x64-musl": "1.0.0-rc.6", "@rolldown/binding-openharmony-arm64": "1.0.0-rc.6", "@rolldown/binding-wasm32-wasi": "1.0.0-rc.6", "@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.6", "@rolldown/binding-win32-x64-msvc": "1.0.0-rc.6" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-B8vFPV1ADyegoYfhg+E7RAucYKv0xdVlwYYsIJgfPNeiSxZGWNxts9RqhyGzC11ULK/VaeXyKezGCwpMiH8Ktw=="],
|
||||
|
||||
"vitest/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": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA=="],
|
||||
"vite/rolldown": ["[email protected].8", "", { "dependencies": { "@oxc-project/types": "=0.115.0", "@rolldown/pluginutils": "1.0.0-rc.8" }, "optionalDependencies": { "@rolldown/binding-android-arm64": "1.0.0-rc.8", "@rolldown/binding-darwin-arm64": "1.0.0-rc.8", "@rolldown/binding-darwin-x64": "1.0.0-rc.8", "@rolldown/binding-freebsd-x64": "1.0.0-rc.8", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.8", "@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.8", "@rolldown/binding-linux-arm64-musl": "1.0.0-rc.8", "@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.8", "@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.8", "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.8", "@rolldown/binding-linux-x64-musl": "1.0.0-rc.8", "@rolldown/binding-openharmony-arm64": "1.0.0-rc.8", "@rolldown/binding-wasm32-wasi": "1.0.0-rc.8", "@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.8", "@rolldown/binding-win32-x64-msvc": "1.0.0-rc.8" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-RGOL7mz/aoQpy/y+/XS9iePBfeNRDUdozrhCEJxdpJyimW8v6yp4c30q6OviUU5AnUJVLRL9GP//HUs6N3ALrQ=="],
|
||||
|
||||
"vscode-json-languageservice/jsonc-parser": ["[email protected]", "", {}, "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ=="],
|
||||
|
||||
@@ -2083,18 +2094,32 @@
|
||||
|
||||
"@inquirer/core/wrap-ansi/ansi-styles": ["[email protected]", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"@tailwindcss/vite/vite/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
"@tailwindcss/node/lightningcss/lightningcss-android-arm64": ["[email protected]", "", { "os": "android", "cpu": "arm64" }, "sha512-HXJF3x8w9nQ4jbXRiNppBCqeZPIAfUo8zE/kOEGbW5NZvGc/K7nMxbhIr+YlFlHW5mpbg/YFPdbnCh1wAXCKFg=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss/lightningcss-darwin-arm64": ["[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-02uTEqf3vIfNMq3h/z2cJfcOXnQ0GRwQrkmPafhueLb2h7mqEidiCzkE4gBMEH65abHRiQvhdcQ+aP0D0g67sg=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss/lightningcss-darwin-x64": ["[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-1ObhyoCY+tGxtsz1lSx5NXCj3nirk0Y0kB/g8B8DT+sSx4G9djitg9ejFnjb3gJNWo7qXH4DIy2SUHvpoFwfTA=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss/lightningcss-freebsd-x64": ["[email protected]", "", { "os": "freebsd", "cpu": "x64" }, "sha512-1RINmQKAItO6ISxYgPwszQE1BrsVU5aB45ho6O42mu96UiZBxEXsuQ7cJW4zs4CEodPUioj/QrXW1r9pLUM74A=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss/lightningcss-linux-arm-gnueabihf": ["[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-OOCm2//MZJ87CdDK62rZIu+aw9gBv4azMJuA8/KB74wmfS3lnC4yoPHm0uXZ/dvNNHmnZnB8XLAZzObeG0nS1g=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss/lightningcss-linux-arm64-gnu": ["[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-WKyLWztD71rTnou4xAD5kQT+982wvca7E6QoLpoawZ1gP9JM0GJj4Tp5jMUh9B3AitHbRZ2/H3W5xQmdEOUlLg=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss/lightningcss-linux-arm64-musl": ["[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-mVZ7Pg2zIbe3XlNbZJdjs86YViQFoJSpc41CbVmKBPiGmC4YrfeOyz65ms2qpAobVd7WQsbW4PdsSJEMymyIMg=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss/lightningcss-linux-x64-gnu": ["[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-xGlFWRMl+0KvUhgySdIaReQdB4FNudfUTARn7q0hh/V67PVGCs3ADFjw+6++kG1RNd0zdGRlEKa+T13/tQjPMA=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss/lightningcss-linux-x64-musl": ["[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-eowF8PrKHw9LpoZii5tdZwnBcYDxRw2rRCyvAXLi34iyeYfqCQNA9rmUM0ce62NlPhCvof1+9ivRaTY6pSKDaA=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss/lightningcss-win32-arm64-msvc": ["[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-aJReEbSEQzx1uBlQizAOBSjcmr9dCdL3XuC/6HLXAxmtErsj2ICo5yYggg1qOODQMtnjNQv2UHb9NpOuFtYe4w=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss/lightningcss-win32-x64-msvc": ["[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-I9aiFrbd7oYHwlnQDqr1Roz+fTz61oDDJX7n9tYF9FJymH1cIN1DtKw3iYt6b8WZgEjoNwVSncwF4wx/ZedMhw=="],
|
||||
|
||||
"@tanstack/router-plugin/chokidar/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"@tanstack/router-plugin/chokidar/readdirp": ["[email protected]", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="],
|
||||
|
||||
"@vitejs/plugin-react/vite/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"astro/vite/esbuild": ["[email protected]", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.12", "@esbuild/android-arm": "0.25.12", "@esbuild/android-arm64": "0.25.12", "@esbuild/android-x64": "0.25.12", "@esbuild/darwin-arm64": "0.25.12", "@esbuild/darwin-x64": "0.25.12", "@esbuild/freebsd-arm64": "0.25.12", "@esbuild/freebsd-x64": "0.25.12", "@esbuild/linux-arm": "0.25.12", "@esbuild/linux-arm64": "0.25.12", "@esbuild/linux-ia32": "0.25.12", "@esbuild/linux-loong64": "0.25.12", "@esbuild/linux-mips64el": "0.25.12", "@esbuild/linux-ppc64": "0.25.12", "@esbuild/linux-riscv64": "0.25.12", "@esbuild/linux-s390x": "0.25.12", "@esbuild/linux-x64": "0.25.12", "@esbuild/netbsd-arm64": "0.25.12", "@esbuild/netbsd-x64": "0.25.12", "@esbuild/openbsd-arm64": "0.25.12", "@esbuild/openbsd-x64": "0.25.12", "@esbuild/openharmony-arm64": "0.25.12", "@esbuild/sunos-x64": "0.25.12", "@esbuild/win32-arm64": "0.25.12", "@esbuild/win32-ia32": "0.25.12", "@esbuild/win32-x64": "0.25.12" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg=="],
|
||||
|
||||
"astro/vite/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"boxen/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="],
|
||||
|
||||
"boxen/string-width/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="],
|
||||
@@ -2107,67 +2132,65 @@
|
||||
|
||||
"unrun/rolldown/@oxc-project/types": ["@oxc-project/[email protected]", "", {}, "sha512-4n91DKnebUS4yjUHl2g3/b2T+IUdCfmoZGhmwsovZCDaJSs+QkVAM+0AqqTxHSsHfeiMuueT75cZaZcT/m0pSw=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-android-arm64": ["@rolldown/[email protected].7", "", { "os": "android", "cpu": "arm64" }, "sha512-/uadfNUaMLFFBGvcIOiq8NnlhvTZTjOyybJaJnhGxD0n9k5vZRJfTaitH5GHnbwmc6T2PC+ZpS1FQH+vXyS/UA=="],
|
||||
"unrun/rolldown/@rolldown/binding-android-arm64": ["@rolldown/[email protected].8", "", { "os": "android", "cpu": "arm64" }, "sha512-5bcmMQDWEfWUq3m79Mcf/kbO6e5Jr6YjKSsA1RnpXR6k73hQ9z1B17+4h93jXpzHvS18p7bQHM1HN/fSd+9zog=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-darwin-arm64": ["@rolldown/[email protected].7", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zokYr1KgRn0hRA89dmgtPj/BmKp9DxgrfAJvOEFfXa8nfYWW2nmgiYIBGpSIAJrEg7Qc/Qznovy6xYwmKh0M8g=="],
|
||||
"unrun/rolldown/@rolldown/binding-darwin-arm64": ["@rolldown/[email protected].8", "", { "os": "darwin", "cpu": "arm64" }, "sha512-dcHPd5N4g9w2iiPRJmAvO0fsIWzF2JPr9oSuTjxLL56qu+oML5aMbBMNwWbk58Mt3pc7vYs9CCScwLxdXPdRsg=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-darwin-x64": ["@rolldown/[email protected].7", "", { "os": "darwin", "cpu": "x64" }, "sha512-eZFjbmrapCBVgMmuLALH3pmQQQStHFuRhsFceJHk6KISW8CkI2e9OPLp9V4qXksrySQcD8XM8fpvGLs5l5C7LQ=="],
|
||||
"unrun/rolldown/@rolldown/binding-darwin-x64": ["@rolldown/[email protected].8", "", { "os": "darwin", "cpu": "x64" }, "sha512-mw0VzDvoj8AuR761QwpdCFN0sc/jspuc7eRYJetpLWd+XyansUrH3C7IgNw6swBOgQT9zBHNKsVCjzpfGJlhUA=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-freebsd-x64": ["@rolldown/[email protected].7", "", { "os": "freebsd", "cpu": "x64" }, "sha512-xjMrh8Dmu2DNwdY6DZsrF6YPGeesc3PaTlkh8v9cqmkSCNeTxnhX3ErhVnuv1j3n8t2IuuhQIwM9eZDINNEt5Q=="],
|
||||
"unrun/rolldown/@rolldown/binding-freebsd-x64": ["@rolldown/[email protected].8", "", { "os": "freebsd", "cpu": "x64" }, "sha512-xNrRa6mQ9NmMIJBdJtPMPG8Mso0OhM526pDzc/EKnRrIrrkHD1E0Z6tONZRmUeJElfsQ6h44lQQCcDilSNIvSQ=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/[email protected].7", "", { "os": "linux", "cpu": "arm" }, "sha512-mOvftrHiXg4/xFdxJY3T9Wl1/zDAOSlMN8z9an2bXsCwuvv3RdyhYbSMZDuDO52S04w9z7+cBd90lvQSPTAQtw=="],
|
||||
"unrun/rolldown/@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "arm" }, "sha512-WgCKoO6O/rRUwimWfEJDeztwJJmuuX0N2bYLLRxmXDTtCwjToTOqk7Pashl/QpQn3H/jHjx0b5yCMbcTVYVpNg=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-linux-arm64-gnu": ["@rolldown/[email protected].7", "", { "os": "linux", "cpu": "arm64" }, "sha512-TuUkeuEEPRyXMBbJ86NRhAiPNezxHW8merl3Om2HASA9Pl1rI+VZcTtsVQ6v/P0MDIFpSl0k0+tUUze9HIXyEw=="],
|
||||
"unrun/rolldown/@rolldown/binding-linux-arm64-gnu": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "arm64" }, "sha512-tOHgTOQa8G4Z3ULj4G3NYOGGJEsqPHR91dT72u63OtVsZ7B6wFJKOx+ZKv+pvwzxWz92/I2ycaqi2/Ll4l+rlg=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-linux-arm64-musl": ["@rolldown/[email protected].7", "", { "os": "linux", "cpu": "arm64" }, "sha512-G43ZElEvaby+YSOgrXfBgpeQv42LdS0ivFFYQufk2tBDWeBfzE/+ob5DmO8Izbyn4Y8k6GgLF11jFDYNnmU/3w=="],
|
||||
"unrun/rolldown/@rolldown/binding-linux-arm64-musl": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "arm64" }, "sha512-oRbxcgDujCi2Yp1GTxoUFsIFlZsuPHU4OV4AzNc3/6aUmR4lfm9FK0uwQu82PJsuUwnF2jFdop3Ep5c1uK7Uxg=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-linux-x64-gnu": ["@rolldown/[email protected].7", "", { "os": "linux", "cpu": "x64" }, "sha512-1THb6FdBkAEL12zvUue2bmK4W1+P+tz8Pgu5uEzq+xrtYa3iBzmmKNlyfUzCFNCqsPd8WJEQrYdLcw4iMW4AVw=="],
|
||||
"unrun/rolldown/@rolldown/binding-linux-x64-gnu": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "x64" }, "sha512-a1+F0aV4Wy9tT3o+cHl3XhOy6aFV+B8Ll+/JFj98oGkb6lGk3BNgrxd+80RwYRVd23oLGvj3LwluKYzlv1PEuw=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-linux-x64-musl": ["@rolldown/[email protected].7", "", { "os": "linux", "cpu": "x64" }, "sha512-12o73atFNWDgYnLyA52QEUn9AH8pHIe12W28cmqjyHt4bIEYRzMICvYVCPa2IQm6DJBvCBrEhD9K+ct4wr2hwg=="],
|
||||
"unrun/rolldown/@rolldown/binding-linux-x64-musl": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "x64" }, "sha512-bGyXCFU11seFrf7z8PcHSwGEiFVkZ9vs+auLacVOQrVsI8PFHJzzJROF3P6b0ODDmXr0m6Tj5FlDhcXVk0Jp8w=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-openharmony-arm64": ["@rolldown/[email protected].7", "", { "os": "none", "cpu": "arm64" }, "sha512-+uUgGwvuUCXl894MTsmTS2J0BnCZccFsmzV7y1jFxW5pTSxkuwL5agyPuDvDOztPeS6RrdqWkn7sT0jRd0ECkg=="],
|
||||
"unrun/rolldown/@rolldown/binding-openharmony-arm64": ["@rolldown/[email protected].8", "", { "os": "none", "cpu": "arm64" }, "sha512-n8d+L2bKgf9G3+AM0bhHFWdlz9vYKNim39ujRTieukdRek0RAo2TfG2uEnV9spa4r4oHUfL9IjcY3M9SlqN1gw=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-wasm32-wasi": ["@rolldown/[email protected].7", "", { "dependencies": { "@napi-rs/wasm-runtime": "^1.1.1" }, "cpu": "none" }, "sha512-53p2L/NSy21UiFOqUGlC11kJDZS2Nx2GJRz1QvbkXovypA3cOHbsyZHLkV72JsLSbiEQe+kg4tndUhSiC31UEA=="],
|
||||
"unrun/rolldown/@rolldown/binding-wasm32-wasi": ["@rolldown/[email protected].8", "", { "dependencies": { "@napi-rs/wasm-runtime": "^1.1.1" }, "cpu": "none" }, "sha512-4R4iJDIk7BrJdteAbEAICXPoA7vZoY/M0OBfcRlQxzQvUYMcEp2GbC/C8UOgQJhu2TjGTpX1H8vVO1xHWcRqQA=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-win32-arm64-msvc": ["@rolldown/[email protected].7", "", { "os": "win32", "cpu": "arm64" }, "sha512-K6svNRljO6QrL6VTKxwh4yThhlR9DT/tK0XpaFQMnJwwQKng+NYcVEtUkAM0WsoiZHw+Hnh3DGnn3taf/pNYGg=="],
|
||||
"unrun/rolldown/@rolldown/binding-win32-arm64-msvc": ["@rolldown/[email protected].8", "", { "os": "win32", "cpu": "arm64" }, "sha512-3lwnklba9qQOpFnQ7EW+A1m4bZTWXZE4jtehsZ0YOl2ivW1FQqp5gY7X2DLuKITggesyuLwcmqS11fA7NtrmrA=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/binding-win32-x64-msvc": ["@rolldown/[email protected].7", "", { "os": "win32", "cpu": "x64" }, "sha512-3ZJBT47VWLKVKIyvHhUSUgVwHzzZW761YAIkM3tOT+8ZTjFVp0acCM0Y2Z2j3jCl+XYi2d9y2uEWQ8H0PvvpPw=="],
|
||||
"unrun/rolldown/@rolldown/binding-win32-x64-msvc": ["@rolldown/[email protected].8", "", { "os": "win32", "cpu": "x64" }, "sha512-VGjCx9Ha1P/r3tXGDZyG0Fcq7Q0Afnk64aaKzr1m40vbn1FL8R3W0V1ELDvPgzLXaaqK/9PnsqSaLWXfn6JtGQ=="],
|
||||
|
||||
"unrun/rolldown/@rolldown/pluginutils": ["@rolldown/[email protected].7", "", {}, "sha512-qujRfC8sFVInYSPPMLQByRh7zhwkGFS4+tyMQ83srV1qrxL4g8E2tyxVVyxd0+8QeBM1mIk9KbWxkegRr76XzA=="],
|
||||
"unrun/rolldown/@rolldown/pluginutils": ["@rolldown/[email protected].8", "", {}, "sha512-wzJwL82/arVfeSP3BLr1oTy40XddjtEdrdgtJ4lLRBu06mP3q/8HGM6K0JRlQuTA3XB0pNJx2so/nmpY4xyOew=="],
|
||||
|
||||
"unstorage/chokidar/readdirp": ["[email protected]", "", {}, "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ=="],
|
||||
|
||||
"vite/rolldown/@oxc-project/types": ["@oxc-project/[email protected]", "", {}, "sha512-4n91DKnebUS4yjUHl2g3/b2T+IUdCfmoZGhmwsovZCDaJSs+QkVAM+0AqqTxHSsHfeiMuueT75cZaZcT/m0pSw=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-android-arm64": ["@rolldown/[email protected].6", "", { "os": "android", "cpu": "arm64" }, "sha512-kvjTSWGcrv+BaR2vge57rsKiYdVR8V8CoS0vgKrc570qRBfty4bT+1X0z3j2TaVV+kAYzA0PjeB9+mdZyqUZlg=="],
|
||||
"vite/rolldown/@rolldown/binding-android-arm64": ["@rolldown/[email protected].8", "", { "os": "android", "cpu": "arm64" }, "sha512-5bcmMQDWEfWUq3m79Mcf/kbO6e5Jr6YjKSsA1RnpXR6k73hQ9z1B17+4h93jXpzHvS18p7bQHM1HN/fSd+9zog=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-darwin-arm64": ["@rolldown/[email protected].6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-+tJhD21KvGNtUrpLXrZQlT+j5HZKiEwR2qtcZb3vNOUpvoT9QjEykr75ZW/Kr0W89gose/HVXU6351uVZD8Qvw=="],
|
||||
"vite/rolldown/@rolldown/binding-darwin-arm64": ["@rolldown/[email protected].8", "", { "os": "darwin", "cpu": "arm64" }, "sha512-dcHPd5N4g9w2iiPRJmAvO0fsIWzF2JPr9oSuTjxLL56qu+oML5aMbBMNwWbk58Mt3pc7vYs9CCScwLxdXPdRsg=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-darwin-x64": ["@rolldown/[email protected].6", "", { "os": "darwin", "cpu": "x64" }, "sha512-DKNhjMk38FAWaHwUt1dFR3rA/qRAvn2NUvSG2UGvxvlMxSmN/qqww/j4ABAbXhNRXtGQNmrAINMXRuwHl16ZHg=="],
|
||||
"vite/rolldown/@rolldown/binding-darwin-x64": ["@rolldown/[email protected].8", "", { "os": "darwin", "cpu": "x64" }, "sha512-mw0VzDvoj8AuR761QwpdCFN0sc/jspuc7eRYJetpLWd+XyansUrH3C7IgNw6swBOgQT9zBHNKsVCjzpfGJlhUA=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-freebsd-x64": ["@rolldown/[email protected].6", "", { "os": "freebsd", "cpu": "x64" }, "sha512-8TThsRkCPAnfyMBShxrGdtoOE6h36QepqRQI97iFaQSCRbHFWHcDHppcojZnzXoruuhPnjMEygzaykvPVJsMRg=="],
|
||||
"vite/rolldown/@rolldown/binding-freebsd-x64": ["@rolldown/[email protected].8", "", { "os": "freebsd", "cpu": "x64" }, "sha512-xNrRa6mQ9NmMIJBdJtPMPG8Mso0OhM526pDzc/EKnRrIrrkHD1E0Z6tONZRmUeJElfsQ6h44lQQCcDilSNIvSQ=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/[email protected].6", "", { "os": "linux", "cpu": "arm" }, "sha512-ZfmFoOwPUZCWtGOVC9/qbQzfc0249FrRUOzV2XabSMUV60Crp211OWLQN1zmQAsRIVWRcEwhJ46Z1mXGo/L/nQ=="],
|
||||
"vite/rolldown/@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "arm" }, "sha512-WgCKoO6O/rRUwimWfEJDeztwJJmuuX0N2bYLLRxmXDTtCwjToTOqk7Pashl/QpQn3H/jHjx0b5yCMbcTVYVpNg=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-linux-arm64-gnu": ["@rolldown/[email protected].6", "", { "os": "linux", "cpu": "arm64" }, "sha512-ZsGzbNETxPodGlLTYHaCSGVhNN/rvkMDCJYHdT7PZr5jFJRmBfmDi2awhF64Dt2vxrJqY6VeeYSgOzEbHRsb7Q=="],
|
||||
"vite/rolldown/@rolldown/binding-linux-arm64-gnu": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "arm64" }, "sha512-tOHgTOQa8G4Z3ULj4G3NYOGGJEsqPHR91dT72u63OtVsZ7B6wFJKOx+ZKv+pvwzxWz92/I2ycaqi2/Ll4l+rlg=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-linux-arm64-musl": ["@rolldown/[email protected].6", "", { "os": "linux", "cpu": "arm64" }, "sha512-elPpdevtCdUOqziemR86C4CSCr/5sUxalzDrf/CJdMT+kZt2C556as++qHikNOz0vuFf52h+GJNXZM08eWgGPQ=="],
|
||||
"vite/rolldown/@rolldown/binding-linux-arm64-musl": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "arm64" }, "sha512-oRbxcgDujCi2Yp1GTxoUFsIFlZsuPHU4OV4AzNc3/6aUmR4lfm9FK0uwQu82PJsuUwnF2jFdop3Ep5c1uK7Uxg=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-linux-x64-gnu": ["@rolldown/[email protected].6", "", { "os": "linux", "cpu": "x64" }, "sha512-IBwXsf56o3xhzAyaZxdM1CX8UFiBEUFCjiVUgny67Q8vPIqkjzJj0YKhd3TbBHanuxThgBa59f6Pgutg2OGk5A=="],
|
||||
"vite/rolldown/@rolldown/binding-linux-x64-gnu": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "x64" }, "sha512-a1+F0aV4Wy9tT3o+cHl3XhOy6aFV+B8Ll+/JFj98oGkb6lGk3BNgrxd+80RwYRVd23oLGvj3LwluKYzlv1PEuw=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-linux-x64-musl": ["@rolldown/[email protected].6", "", { "os": "linux", "cpu": "x64" }, "sha512-vOk7G8V9Zm+8a6PL6JTpCea61q491oYlGtO6CvnsbhNLlKdf0bbCPytFzGQhYmCKZDKkEbmnkcIprTEGCURnwg=="],
|
||||
"vite/rolldown/@rolldown/binding-linux-x64-musl": ["@rolldown/[email protected].8", "", { "os": "linux", "cpu": "x64" }, "sha512-bGyXCFU11seFrf7z8PcHSwGEiFVkZ9vs+auLacVOQrVsI8PFHJzzJROF3P6b0ODDmXr0m6Tj5FlDhcXVk0Jp8w=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-openharmony-arm64": ["@rolldown/[email protected].6", "", { "os": "none", "cpu": "arm64" }, "sha512-ASjEDI4MRv7XCQb2JVaBzfEYO98JKCGrAgoW6M03fJzH/ilCnC43Mb3ptB9q/lzsaahoJyIBoAGKAYEjUvpyvQ=="],
|
||||
"vite/rolldown/@rolldown/binding-openharmony-arm64": ["@rolldown/[email protected].8", "", { "os": "none", "cpu": "arm64" }, "sha512-n8d+L2bKgf9G3+AM0bhHFWdlz9vYKNim39ujRTieukdRek0RAo2TfG2uEnV9spa4r4oHUfL9IjcY3M9SlqN1gw=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-wasm32-wasi": ["@rolldown/[email protected].6", "", { "dependencies": { "@napi-rs/wasm-runtime": "^1.1.1" }, "cpu": "none" }, "sha512-mYa1+h2l6Zc0LvmwUh0oXKKYihnw/1WC73vTqw+IgtfEtv47A+rWzzcWwVDkW73+UDr0d/Ie/HRXoaOY22pQDw=="],
|
||||
"vite/rolldown/@rolldown/binding-wasm32-wasi": ["@rolldown/[email protected].8", "", { "dependencies": { "@napi-rs/wasm-runtime": "^1.1.1" }, "cpu": "none" }, "sha512-4R4iJDIk7BrJdteAbEAICXPoA7vZoY/M0OBfcRlQxzQvUYMcEp2GbC/C8UOgQJhu2TjGTpX1H8vVO1xHWcRqQA=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-win32-arm64-msvc": ["@rolldown/[email protected].6", "", { "os": "win32", "cpu": "arm64" }, "sha512-e2ABskbNH3MRUBMjgxaMjYIw11DSwjLJxBII3UgpF6WClGLIh8A20kamc+FKH5vIaFVnYQInmcLYSUVpqMPLow=="],
|
||||
"vite/rolldown/@rolldown/binding-win32-arm64-msvc": ["@rolldown/[email protected].8", "", { "os": "win32", "cpu": "arm64" }, "sha512-3lwnklba9qQOpFnQ7EW+A1m4bZTWXZE4jtehsZ0YOl2ivW1FQqp5gY7X2DLuKITggesyuLwcmqS11fA7NtrmrA=="],
|
||||
|
||||
"vite/rolldown/@rolldown/binding-win32-x64-msvc": ["@rolldown/[email protected].6", "", { "os": "win32", "cpu": "x64" }, "sha512-dJVc3ifhaRXxIEh1xowLohzFrlQXkJ66LepHm+CmSprTWgVrPa8Fx3OL57xwIqDEH9hufcKkDX2v65rS3NZyRA=="],
|
||||
"vite/rolldown/@rolldown/binding-win32-x64-msvc": ["@rolldown/[email protected].8", "", { "os": "win32", "cpu": "x64" }, "sha512-VGjCx9Ha1P/r3tXGDZyG0Fcq7Q0Afnk64aaKzr1m40vbn1FL8R3W0V1ELDvPgzLXaaqK/9PnsqSaLWXfn6JtGQ=="],
|
||||
|
||||
"vite/rolldown/@rolldown/pluginutils": ["@rolldown/[email protected].6", "", {}, "sha512-Y0+JT8Mi1mmW08K6HieG315XNRu4L0rkfCpA364HtytjgiqYnMYRdFPcxRl+BQQqNXzecL2S9nii+RUpO93XIA=="],
|
||||
|
||||
"vitest/vite/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
"vite/rolldown/@rolldown/pluginutils": ["@rolldown/[email protected].8", "", {}, "sha512-wzJwL82/arVfeSP3BLr1oTy40XddjtEdrdgtJ4lLRBu06mP3q/8HGM6K0JRlQuTA3XB0pNJx2so/nmpY4xyOew=="],
|
||||
|
||||
"widest-line/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="],
|
||||
|
||||
@@ -2179,58 +2202,6 @@
|
||||
|
||||
"@tanstack/router-plugin/chokidar/readdirp/picomatch": ["[email protected]", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/aix-ppc64": ["@esbuild/[email protected]", "", { "os": "aix", "cpu": "ppc64" }, "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/android-arm": ["@esbuild/[email protected]", "", { "os": "android", "cpu": "arm" }, "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/android-arm64": ["@esbuild/[email protected]", "", { "os": "android", "cpu": "arm64" }, "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/android-x64": ["@esbuild/[email protected]", "", { "os": "android", "cpu": "x64" }, "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/darwin-arm64": ["@esbuild/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/darwin-x64": ["@esbuild/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/freebsd-arm64": ["@esbuild/[email protected]", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/freebsd-x64": ["@esbuild/[email protected]", "", { "os": "freebsd", "cpu": "x64" }, "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/linux-arm": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/linux-arm64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/linux-ia32": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "ia32" }, "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/linux-loong64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/linux-mips64el": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/linux-ppc64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/linux-riscv64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/linux-s390x": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "s390x" }, "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/linux-x64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/netbsd-arm64": ["@esbuild/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/netbsd-x64": ["@esbuild/[email protected]", "", { "os": "none", "cpu": "x64" }, "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/openbsd-arm64": ["@esbuild/[email protected]", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/openbsd-x64": ["@esbuild/[email protected]", "", { "os": "openbsd", "cpu": "x64" }, "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/openharmony-arm64": ["@esbuild/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/sunos-x64": ["@esbuild/[email protected]", "", { "os": "sunos", "cpu": "x64" }, "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/win32-arm64": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/win32-ia32": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ=="],
|
||||
|
||||
"astro/vite/esbuild/@esbuild/win32-x64": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA=="],
|
||||
|
||||
"boxen/string-width/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
|
||||
|
||||
"widest-line/string-width/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
"turbo": "^2.3.3",
|
||||
"vitest": "catalog:"
|
||||
},
|
||||
"overrides": {
|
||||
"vite": "^8.0.0-beta.12"
|
||||
},
|
||||
"engines": {
|
||||
"bun": "^1.3.9",
|
||||
"node": "^24.13.1"
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { Effect, Schema } from "effect";
|
||||
|
||||
import { ORCHESTRATION_WS_CHANNELS, ORCHESTRATION_WS_METHODS } from "./orchestration";
|
||||
import { WebSocketRequest, WsResponse, WS_CHANNELS } from "./ws";
|
||||
import { ORCHESTRATION_WS_METHODS } from "./orchestration";
|
||||
import { WebSocketRequest } from "./ws";
|
||||
|
||||
const decodeWebSocketRequest = Schema.decodeUnknownEffect(WebSocketRequest);
|
||||
const decodeWsResponse = Schema.decodeUnknownEffect(WsResponse);
|
||||
|
||||
it.effect("accepts getTurnDiff requests when fromTurnCount <= toTurnCount", () =>
|
||||
Effect.gen(function* () {
|
||||
@@ -57,43 +56,3 @@ it.effect("trims websocket request id and nested orchestration ids", () =>
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("accepts typed websocket push envelopes with sequence", () =>
|
||||
Effect.gen(function* () {
|
||||
const parsed = yield* decodeWsResponse({
|
||||
type: "push",
|
||||
sequence: 1,
|
||||
channel: WS_CHANNELS.serverWelcome,
|
||||
data: {
|
||||
cwd: "/tmp/workspace",
|
||||
projectName: "workspace",
|
||||
},
|
||||
});
|
||||
|
||||
if (!("type" in parsed) || parsed.type !== "push") {
|
||||
assert.fail("expected websocket response to decode as a push envelope");
|
||||
}
|
||||
|
||||
assert.strictEqual(parsed.type, "push");
|
||||
assert.strictEqual(parsed.sequence, 1);
|
||||
assert.strictEqual(parsed.channel, WS_CHANNELS.serverWelcome);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("rejects push envelopes when channel payload does not match the channel schema", () =>
|
||||
Effect.gen(function* () {
|
||||
const result = yield* Effect.exit(
|
||||
decodeWsResponse({
|
||||
type: "push",
|
||||
sequence: 2,
|
||||
channel: ORCHESTRATION_WS_CHANNELS.domainEvent,
|
||||
data: {
|
||||
cwd: "/tmp/workspace",
|
||||
projectName: "workspace",
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
assert.strictEqual(result._tag, "Failure");
|
||||
}),
|
||||
);
|
||||
@@ -1,10 +1,8 @@
|
||||
import { Schema, Struct } from "effect";
|
||||
import { NonNegativeInt, ProjectId, ThreadId, TrimmedNonEmptyString } from "./baseSchemas";
|
||||
import { ProjectId, ThreadId, TrimmedNonEmptyString } from "./baseSchemas";
|
||||
|
||||
import {
|
||||
ClientOrchestrationCommand,
|
||||
OrchestrationEvent,
|
||||
ORCHESTRATION_WS_CHANNELS,
|
||||
OrchestrationGetFullThreadDiffInput,
|
||||
ORCHESTRATION_WS_METHODS,
|
||||
OrchestrationGetSnapshotInput,
|
||||
@@ -25,7 +23,6 @@ import {
|
||||
import {
|
||||
TerminalClearInput,
|
||||
TerminalCloseInput,
|
||||
TerminalEvent,
|
||||
TerminalOpenInput,
|
||||
TerminalResizeInput,
|
||||
TerminalRestartInput,
|
||||
@@ -34,7 +31,6 @@ import {
|
||||
import { KeybindingRule } from "./keybindings";
|
||||
import { ProjectSearchEntriesInput, ProjectWriteFileInput } from "./project";
|
||||
import { OpenInEditorInput } from "./editor";
|
||||
import { ServerConfigUpdatedPayload } from "./server";
|
||||
|
||||
// ── WebSocket RPC Method Names ───────────────────────────────────────
|
||||
|
||||
@@ -152,8 +148,19 @@ export const WebSocketResponse = Schema.Struct({
|
||||
});
|
||||
export type WebSocketResponse = typeof WebSocketResponse.Type;
|
||||
|
||||
export const WsPushSequence = NonNegativeInt;
|
||||
export type WsPushSequence = typeof WsPushSequence.Type;
|
||||
export const WsPush = Schema.Struct({
|
||||
type: Schema.Literal("push"),
|
||||
channel: TrimmedNonEmptyString,
|
||||
data: Schema.Unknown,
|
||||
});
|
||||
export type WsPush = typeof WsPush.Type;
|
||||
|
||||
// ── Union of all server → client messages ─────────────────────────────
|
||||
|
||||
export const WsResponse = Schema.Union([WebSocketResponse, WsPush]);
|
||||
export type WsResponse = typeof WsResponse.Type;
|
||||
|
||||
// ── Server welcome payload ───────────────────────────────────────────
|
||||
|
||||
export const WsWelcomePayload = Schema.Struct({
|
||||
cwd: TrimmedNonEmptyString,
|
||||
@@ -162,85 +169,3 @@ export const WsWelcomePayload = Schema.Struct({
|
||||
bootstrapThreadId: Schema.optional(ThreadId),
|
||||
});
|
||||
export type WsWelcomePayload = typeof WsWelcomePayload.Type;
|
||||
|
||||
export const WsDecodeDiagnosticCode = Schema.Literals([
|
||||
"invalid-json",
|
||||
"invalid-envelope",
|
||||
"invalid-request",
|
||||
"invalid-response",
|
||||
]);
|
||||
export type WsDecodeDiagnosticCode = typeof WsDecodeDiagnosticCode.Type;
|
||||
|
||||
export const WsDecodeDiagnostic = Schema.Struct({
|
||||
code: WsDecodeDiagnosticCode,
|
||||
reason: TrimmedNonEmptyString,
|
||||
rawKind: Schema.optional(TrimmedNonEmptyString),
|
||||
expected: Schema.optional(TrimmedNonEmptyString),
|
||||
actual: Schema.optional(TrimmedNonEmptyString),
|
||||
path: Schema.optional(Schema.Array(TrimmedNonEmptyString)),
|
||||
jsonOffset: Schema.optional(NonNegativeInt),
|
||||
});
|
||||
export type WsDecodeDiagnostic = typeof WsDecodeDiagnostic.Type;
|
||||
|
||||
export interface WsPushPayloadByChannel {
|
||||
readonly [WS_CHANNELS.serverWelcome]: WsWelcomePayload;
|
||||
readonly [WS_CHANNELS.serverConfigUpdated]: typeof ServerConfigUpdatedPayload.Type;
|
||||
readonly [WS_CHANNELS.terminalEvent]: typeof TerminalEvent.Type;
|
||||
readonly [ORCHESTRATION_WS_CHANNELS.domainEvent]: OrchestrationEvent;
|
||||
}
|
||||
|
||||
export type WsPushChannel = keyof WsPushPayloadByChannel;
|
||||
export type WsPushData<C extends WsPushChannel> = WsPushPayloadByChannel[C];
|
||||
|
||||
const makeWsPushSchema = <const Channel extends string, Payload extends Schema.Schema<any>>(
|
||||
channel: Channel,
|
||||
payload: Payload,
|
||||
) =>
|
||||
Schema.Struct({
|
||||
type: Schema.Literal("push"),
|
||||
sequence: WsPushSequence,
|
||||
channel: Schema.Literal(channel),
|
||||
data: payload,
|
||||
});
|
||||
|
||||
export const WsPushServerWelcome = makeWsPushSchema(WS_CHANNELS.serverWelcome, WsWelcomePayload);
|
||||
export const WsPushServerConfigUpdated = makeWsPushSchema(
|
||||
WS_CHANNELS.serverConfigUpdated,
|
||||
ServerConfigUpdatedPayload,
|
||||
);
|
||||
export const WsPushTerminalEvent = makeWsPushSchema(WS_CHANNELS.terminalEvent, TerminalEvent);
|
||||
export const WsPushOrchestrationDomainEvent = makeWsPushSchema(
|
||||
ORCHESTRATION_WS_CHANNELS.domainEvent,
|
||||
OrchestrationEvent,
|
||||
);
|
||||
|
||||
export const WsPushChannelSchema = Schema.Literals([
|
||||
WS_CHANNELS.serverWelcome,
|
||||
WS_CHANNELS.serverConfigUpdated,
|
||||
WS_CHANNELS.terminalEvent,
|
||||
ORCHESTRATION_WS_CHANNELS.domainEvent,
|
||||
]);
|
||||
export type WsPushChannelSchema = typeof WsPushChannelSchema.Type;
|
||||
|
||||
export const WsPush = Schema.Union([
|
||||
WsPushServerWelcome,
|
||||
WsPushServerConfigUpdated,
|
||||
WsPushTerminalEvent,
|
||||
WsPushOrchestrationDomainEvent,
|
||||
]);
|
||||
export type WsPush = typeof WsPush.Type;
|
||||
|
||||
export type WsPushMessage<C extends WsPushChannel> = Extract<WsPush, { channel: C }>;
|
||||
|
||||
export const WsPushEnvelopeBase = Schema.Struct({
|
||||
type: Schema.Literal("push"),
|
||||
sequence: WsPushSequence,
|
||||
channel: WsPushChannelSchema,
|
||||
data: Schema.Unknown,
|
||||
});
|
||||
export type WsPushEnvelopeBase = typeof WsPushEnvelopeBase.Type;
|
||||
|
||||
// ── Union of all server → client messages ─────────────────────────────
|
||||
|
||||
export const WsResponse = Schema.Union([WebSocketResponse, WsPush]);
|
||||
export type WsResponse = typeof WsResponse.Type;
|
||||
@@ -23,10 +23,6 @@
|
||||
"./Net": {
|
||||
"types": "./src/Net.ts",
|
||||
"import": "./src/Net.ts"
|
||||
},
|
||||
"./DrainableWorker": {
|
||||
"types": "./src/DrainableWorker.ts",
|
||||
"import": "./src/DrainableWorker.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { Deferred, Effect, Exit, Scope } from "effect";
|
||||
|
||||
import { makeDrainableWorker } from "./DrainableWorker";
|
||||
|
||||
describe("makeDrainableWorker", () => {
|
||||
let scope: Scope.Closeable | null = null;
|
||||
|
||||
afterEach(async () => {
|
||||
if (scope) {
|
||||
await Effect.runPromise(Scope.close(scope, Exit.void));
|
||||
}
|
||||
scope = null;
|
||||
});
|
||||
|
||||
it("waits for work enqueued during active processing before draining", async () => {
|
||||
scope = await Effect.runPromise(Scope.make("sequential"));
|
||||
|
||||
const processed: string[] = [];
|
||||
const { worker, firstStarted, releaseFirst, secondStarted, releaseSecond } =
|
||||
await Effect.runPromise(
|
||||
Effect.gen(function* () {
|
||||
const firstStarted = yield* Deferred.make<void>();
|
||||
const releaseFirst = yield* Deferred.make<void>();
|
||||
const secondStarted = yield* Deferred.make<void>();
|
||||
const releaseSecond = yield* Deferred.make<void>();
|
||||
|
||||
const worker = yield* makeDrainableWorker((item: string) =>
|
||||
Effect.gen(function* () {
|
||||
if (item === "first") {
|
||||
yield* Deferred.succeed(firstStarted, undefined).pipe(Effect.orDie);
|
||||
yield* Deferred.await(releaseFirst);
|
||||
}
|
||||
|
||||
if (item === "second") {
|
||||
yield* Deferred.succeed(secondStarted, undefined).pipe(Effect.orDie);
|
||||
yield* Deferred.await(releaseSecond);
|
||||
}
|
||||
|
||||
processed.push(item);
|
||||
}),
|
||||
);
|
||||
|
||||
return {
|
||||
worker,
|
||||
firstStarted,
|
||||
releaseFirst,
|
||||
secondStarted,
|
||||
releaseSecond,
|
||||
};
|
||||
}).pipe(Scope.provide(scope)),
|
||||
);
|
||||
|
||||
await Effect.runPromise(worker.enqueue("first"));
|
||||
await Effect.runPromise(Deferred.await(firstStarted));
|
||||
|
||||
const drainPromise = Effect.runPromise(worker.drain);
|
||||
|
||||
await Effect.runPromise(worker.enqueue("second"));
|
||||
await Effect.runPromise(Deferred.succeed(releaseFirst, undefined));
|
||||
await Effect.runPromise(Deferred.await(secondStarted));
|
||||
|
||||
const earlyResult = await Promise.race([
|
||||
drainPromise.then(() => "resolved" as const),
|
||||
new Promise<"pending">((resolve) => {
|
||||
setTimeout(() => resolve("pending"), 20);
|
||||
}),
|
||||
]);
|
||||
expect(earlyResult).toBe("pending");
|
||||
|
||||
await Effect.runPromise(Deferred.succeed(releaseSecond, undefined));
|
||||
await drainPromise;
|
||||
|
||||
expect(processed).toEqual(["first", "second"]);
|
||||
});
|
||||
});
|
||||
@@ -1,82 +0,0 @@
|
||||
/**
|
||||
* DrainableWorker - A queue-based worker that exposes a `drain()` effect.
|
||||
*
|
||||
* Wraps the common `Queue.unbounded` + `Effect.forever` pattern and adds
|
||||
* a signal that resolves when the queue is empty **and** the current item
|
||||
* has finished processing. This lets tests replace timing-sensitive
|
||||
* `Effect.sleep` calls with deterministic `drain()`.
|
||||
*
|
||||
* @module DrainableWorker
|
||||
*/
|
||||
import { Effect, Queue, Ref, Schedule } from "effect";
|
||||
import type { Scope } from "effect";
|
||||
|
||||
export interface DrainableWorker<A> {
|
||||
/**
|
||||
* Enqueue a work item and track it for `drain()`.
|
||||
*
|
||||
* This wraps `Queue.offer` so drain state is updated atomically with the
|
||||
* enqueue path instead of inferring it from queue internals.
|
||||
*/
|
||||
readonly enqueue: (item: A) => Effect.Effect<void>;
|
||||
|
||||
/**
|
||||
* Resolves when the queue is empty and the worker is idle (not processing).
|
||||
*
|
||||
* Uses a tight `Schedule.spaced("1 millis")` poll which resolves in
|
||||
* microseconds in practice — intended for test use only.
|
||||
*/
|
||||
readonly drain: Effect.Effect<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a drainable worker that processes items from an unbounded queue.
|
||||
*
|
||||
* The worker is forked into the current scope and will be interrupted when
|
||||
* the scope closes. A finalizer shuts down the queue.
|
||||
*
|
||||
* @param process - The effect to run for each queued item.
|
||||
* @returns A `DrainableWorker` with `queue` and `drain`.
|
||||
*/
|
||||
export const makeDrainableWorker = <A, E, R>(
|
||||
process: (item: A) => Effect.Effect<void, E, R>,
|
||||
): Effect.Effect<DrainableWorker<A>, never, Scope.Scope | R> =>
|
||||
Effect.gen(function* () {
|
||||
const queue = yield* Queue.unbounded<A>();
|
||||
const outstanding = yield* Ref.make(0);
|
||||
|
||||
yield* Effect.addFinalizer(() => Queue.shutdown(queue).pipe(Effect.asVoid));
|
||||
|
||||
yield* Effect.forkScoped(
|
||||
Effect.forever(
|
||||
Queue.take(queue).pipe(
|
||||
Effect.flatMap((item) =>
|
||||
process(item).pipe(
|
||||
Effect.ensuring(Ref.update(outstanding, (count) => Math.max(0, count - 1))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
const enqueue: DrainableWorker<A>["enqueue"] = (item) =>
|
||||
Ref.update(outstanding, (count) => count + 1).pipe(
|
||||
Effect.flatMap(() => Queue.offer(queue, item)),
|
||||
Effect.flatMap((accepted) =>
|
||||
accepted === false
|
||||
? Ref.update(outstanding, (count) => Math.max(0, count - 1))
|
||||
: Effect.void,
|
||||
),
|
||||
Effect.asVoid,
|
||||
);
|
||||
|
||||
const drain: DrainableWorker<A>["drain"] = Ref.get(outstanding).pipe(
|
||||
Effect.repeat({
|
||||
while: (count) => count > 0,
|
||||
schedule: Schedule.spaced("1 millis"),
|
||||
}),
|
||||
Effect.asVoid,
|
||||
);
|
||||
|
||||
return { enqueue, drain } satisfies DrainableWorker<A>;
|
||||
});
|
||||
Reference in new issue
Block a user