chore: remove unused code and brittle tests (#9150)
This commit is contained in:
1 parent
b8262b4122
commit
db4bf9497b
41 files changed
+17
-744
No files matched your search
@@ -851,35 +851,6 @@ jobs:
|
||||
fi
|
||||
done
|
||||
|
||||
# - name: Merge Windows updater manifests
|
||||
# run: |
|
||||
# shopt -s nullglob
|
||||
# found_windows_manifest=false
|
||||
# for x64_manifest in release-assets/*-win-x64.yml; do
|
||||
# if [[ "$(basename "$x64_manifest")" == builder-debug-* ]]; then
|
||||
# continue
|
||||
# fi
|
||||
|
||||
# arm64_manifest="${x64_manifest/-x64.yml/-arm64.yml}"
|
||||
# output_manifest="${x64_manifest/-win-x64.yml/.yml}"
|
||||
# if [[ ! -f "$arm64_manifest" ]]; then
|
||||
# echo "Missing matching arm64 Windows manifest for $x64_manifest" >&2
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
# found_windows_manifest=true
|
||||
# node scripts/merge-update-manifests.ts --platform win \
|
||||
# "$arm64_manifest" \
|
||||
# "$x64_manifest" \
|
||||
# "$output_manifest"
|
||||
# rm -f "$arm64_manifest" "$x64_manifest"
|
||||
# done
|
||||
|
||||
# if [[ "$found_windows_manifest" != true ]]; then
|
||||
# echo "No Windows updater manifests found to merge." >&2
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
- name: Publish release
|
||||
if: needs.preflight.outputs.previous_tag != ''
|
||||
uses: softprops/action-gh-release@v3
|
||||
|
||||
@@ -198,13 +198,10 @@ describe("WSL runtime cache", () => {
|
||||
expect(script).toContain(' [ -f "$runtime_root/apps/server/dist/bin.mjs" ] &&');
|
||||
expect(script).toContain(' [ -f "$runtime_root/node_modules/node-pty/package.json" ] &&');
|
||||
expect(script).toContain(' node_pty_payload_present "$runtime_root"');
|
||||
expect(script).not.toContain("node_modules/effect/package.json");
|
||||
expect(script).toContain("if runtime_is_ready; then");
|
||||
expect(script).toContain("trap 'exit 1' HUP INT TERM");
|
||||
expect(script).toContain('exec 9> "$runtime_lock"');
|
||||
expect(script).toContain("flock -x 9");
|
||||
expect(script).not.toContain("runtime_lock_pid");
|
||||
expect(script).not.toContain("sleep 0.1");
|
||||
expect(script).not.toContain('rm -rf "$runtime_lock"');
|
||||
expect(script).toContain('mv -T "$runtime_root" "$runtime_stale"');
|
||||
expect(script).toContain('mktemp -d "$runtime_parent/.1.2.3-x64.tmp.XXXXXX"');
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 244 B |
Binary file not shown.
|
Before Width: | Height: | Size: 358 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 123 KiB |
@@ -1,19 +0,0 @@
|
||||
https://x.com/Shay_Benshabtay/status/2054668503857156326
|
||||
https://x.com/teja2495/status/2052420254991581623
|
||||
https://x.com/developedbyed/status/2030627970532921605
|
||||
https://x.com/tannerlinsley/status/2031102771529920966
|
||||
https://x.com/aronprins/status/2045102518196183109
|
||||
https://x.com/BennettBuhner/status/2054667115697754387
|
||||
https://x.com/ex0t1clol/status/2054666870008021197
|
||||
https://x.com/Josikinz/status/2030367951694745870
|
||||
https://x.com/jetpackjoe_/status/2054666792933404959
|
||||
https://x.com/mil000/status/2030120041451246071
|
||||
https://x.com/_winter_wonders/status/2052350198764970434
|
||||
https://x.com/kostyniuk00/status/2052041388179468521
|
||||
https://x.com/gnukeith/status/2054670073579630730
|
||||
https://x.com/peculiarnewbie/status/2054671685027233827
|
||||
https://x.com/leodev/status/2054679746353537042
|
||||
https://x.com/pocarles/status/2054673964274758046
|
||||
https://x.com/DavidKPiano/status/2054682983504719930
|
||||
https://x.com/iamkaffe/status/2054675539311411280
|
||||
https://x.com/uwunetes/status/2054683356022120640
|
||||
@@ -52,7 +52,6 @@
|
||||
"@expo/ui": "~57.0.14",
|
||||
"@legendapp/list": "catalog:",
|
||||
"@noble/curves": "catalog:",
|
||||
"@noble/hashes": "catalog:",
|
||||
"@pierre/diffs": "catalog:",
|
||||
"@react-native-ai/apple": "0.12.0",
|
||||
"@react-native-menu/menu": "^2.0.0",
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { resolveTerminalRouteBootstrap } from "./terminalRouteBootstrap";
|
||||
|
||||
describe("resolveTerminalRouteBootstrap", () => {
|
||||
it("redirects bare terminal routes to another already-running terminal for the thread", () => {
|
||||
expect(
|
||||
resolveTerminalRouteBootstrap({
|
||||
hasThread: true,
|
||||
hasWorkspaceRoot: true,
|
||||
hasOpened: false,
|
||||
requestedTerminalId: null,
|
||||
currentTerminalId: "default",
|
||||
runningTerminalId: "term-2",
|
||||
currentTerminalStatus: "closed",
|
||||
hasCurrentTerminalHydration: false,
|
||||
}),
|
||||
).toEqual({
|
||||
kind: "redirect",
|
||||
terminalId: "term-2",
|
||||
});
|
||||
});
|
||||
|
||||
it("hydrates the current running terminal when client state is not hydrated yet", () => {
|
||||
expect(
|
||||
resolveTerminalRouteBootstrap({
|
||||
hasThread: true,
|
||||
hasWorkspaceRoot: true,
|
||||
hasOpened: false,
|
||||
requestedTerminalId: null,
|
||||
currentTerminalId: "default",
|
||||
runningTerminalId: "default",
|
||||
currentTerminalStatus: "running",
|
||||
hasCurrentTerminalHydration: false,
|
||||
}),
|
||||
).toEqual({
|
||||
kind: "open",
|
||||
});
|
||||
});
|
||||
|
||||
it("opens explicit terminal routes when the session still needs hydration", () => {
|
||||
expect(
|
||||
resolveTerminalRouteBootstrap({
|
||||
hasThread: true,
|
||||
hasWorkspaceRoot: true,
|
||||
hasOpened: false,
|
||||
requestedTerminalId: "term-2",
|
||||
currentTerminalId: "term-2",
|
||||
runningTerminalId: "term-2",
|
||||
currentTerminalStatus: "running",
|
||||
hasCurrentTerminalHydration: false,
|
||||
}),
|
||||
).toEqual({
|
||||
kind: "open",
|
||||
});
|
||||
});
|
||||
|
||||
it("stays idle after the route already bootstrapped once", () => {
|
||||
expect(
|
||||
resolveTerminalRouteBootstrap({
|
||||
hasThread: true,
|
||||
hasWorkspaceRoot: true,
|
||||
hasOpened: true,
|
||||
requestedTerminalId: null,
|
||||
currentTerminalId: "default",
|
||||
runningTerminalId: "default",
|
||||
currentTerminalStatus: "running",
|
||||
hasCurrentTerminalHydration: true,
|
||||
}),
|
||||
).toEqual({
|
||||
kind: "idle",
|
||||
});
|
||||
});
|
||||
|
||||
it("stays idle when the current running terminal is already hydrated in client state", () => {
|
||||
expect(
|
||||
resolveTerminalRouteBootstrap({
|
||||
hasThread: true,
|
||||
hasWorkspaceRoot: true,
|
||||
hasOpened: false,
|
||||
requestedTerminalId: null,
|
||||
currentTerminalId: "default",
|
||||
runningTerminalId: "default",
|
||||
currentTerminalStatus: "running",
|
||||
hasCurrentTerminalHydration: true,
|
||||
}),
|
||||
).toEqual({
|
||||
kind: "idle",
|
||||
});
|
||||
});
|
||||
|
||||
it("stays idle for explicit running terminal routes that already have hydrated output", () => {
|
||||
expect(
|
||||
resolveTerminalRouteBootstrap({
|
||||
hasThread: true,
|
||||
hasWorkspaceRoot: true,
|
||||
hasOpened: false,
|
||||
requestedTerminalId: "term-2",
|
||||
currentTerminalId: "term-2",
|
||||
runningTerminalId: "term-2",
|
||||
currentTerminalStatus: "running",
|
||||
hasCurrentTerminalHydration: true,
|
||||
}),
|
||||
).toEqual({
|
||||
kind: "idle",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,35 +0,0 @@
|
||||
export function resolveTerminalRouteBootstrap(input: {
|
||||
readonly hasThread: boolean;
|
||||
readonly hasWorkspaceRoot: boolean;
|
||||
readonly hasOpened: boolean;
|
||||
readonly requestedTerminalId: string | null;
|
||||
readonly currentTerminalId: string;
|
||||
readonly runningTerminalId: string | null;
|
||||
readonly currentTerminalStatus: "starting" | "running" | "exited" | "error" | "closed";
|
||||
/** True once the attach stream has populated scrollback (`buffer` non-empty), not merely metadata. */
|
||||
readonly hasCurrentTerminalHydration: boolean;
|
||||
}):
|
||||
| { readonly kind: "idle" }
|
||||
| { readonly kind: "redirect"; readonly terminalId: string }
|
||||
| { readonly kind: "open" } {
|
||||
if (!input.hasThread || !input.hasWorkspaceRoot || input.hasOpened) {
|
||||
return { kind: "idle" };
|
||||
}
|
||||
|
||||
if (
|
||||
input.requestedTerminalId === null &&
|
||||
input.runningTerminalId !== null &&
|
||||
input.runningTerminalId !== input.currentTerminalId
|
||||
) {
|
||||
return { kind: "redirect", terminalId: input.runningTerminalId };
|
||||
}
|
||||
|
||||
if (
|
||||
(input.currentTerminalStatus === "running" || input.currentTerminalStatus === "starting") &&
|
||||
input.hasCurrentTerminalHydration
|
||||
) {
|
||||
return { kind: "idle" };
|
||||
}
|
||||
|
||||
return { kind: "open" };
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import * as Stream from "effect/Stream";
|
||||
import * as Tracer from "effect/Tracer";
|
||||
|
||||
import * as CheckpointStore from "../src/checkpointing/CheckpointStore.ts";
|
||||
import { TextGeneration, type TextGenerationShape } from "../src/textGeneration/TextGeneration.ts";
|
||||
import { TextGeneration } from "../src/textGeneration/TextGeneration.ts";
|
||||
import { OrchestrationCommandReceiptRepositoryLive } from "../src/persistence/Layers/OrchestrationCommandReceipts.ts";
|
||||
import { OrchestrationEventStoreLive } from "../src/persistence/Layers/OrchestrationEventStore.ts";
|
||||
import { ProjectionCheckpointRepositoryLive } from "../src/persistence/Layers/ProjectionCheckpoints.ts";
|
||||
@@ -335,7 +335,7 @@ export const makeOrchestrationIntegrationHarness = (
|
||||
const textGenerationLayer = Layer.succeed(TextGeneration, {
|
||||
generateBranchName: () => Effect.succeed({ branch: "update" }),
|
||||
generateThreadTitle: () => Effect.succeed({ title: "New thread" }),
|
||||
} as unknown as TextGenerationShape);
|
||||
} as unknown as TextGeneration["Service"]);
|
||||
const providerCommandReactorLayer = ProviderCommandReactorLive.pipe(
|
||||
Layer.provideMerge(runtimeServicesLayer),
|
||||
Layer.provideMerge(gitWorkflowLayer),
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
"@anthropic-ai/claude-agent-sdk": "^0.3.170",
|
||||
"@effect/platform-bun": "catalog:",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/platform-node-shared": "catalog:",
|
||||
"@effect/sql-sqlite-bun": "catalog:",
|
||||
"@ff-labs/fff-node": "0.9.4",
|
||||
"@opencode-ai/sdk": "^1.3.15",
|
||||
|
||||
@@ -45,7 +45,7 @@ import {
|
||||
type ProviderServiceShape,
|
||||
} from "../../provider/Services/ProviderService.ts";
|
||||
import { makeProviderRegistryLayer } from "../../provider/testUtils/providerRegistryMock.ts";
|
||||
import { TextGeneration, type TextGenerationShape } from "../../textGeneration/TextGeneration.ts";
|
||||
import { TextGeneration } from "../../textGeneration/TextGeneration.ts";
|
||||
import * as RepositoryIdentityResolver from "../../project/RepositoryIdentityResolver.ts";
|
||||
import { OrchestrationEngineLive } from "./OrchestrationEngine.ts";
|
||||
import { OrchestrationProjectionPipelineLive } from "./ProjectionPipeline.ts";
|
||||
@@ -310,7 +310,7 @@ describe("ProviderCommandReactor", () => {
|
||||
pr: null,
|
||||
}),
|
||||
);
|
||||
const generateBranchName = vi.fn<TextGenerationShape["generateBranchName"]>((_) =>
|
||||
const generateBranchName = vi.fn<TextGeneration["Service"]["generateBranchName"]>((_) =>
|
||||
Effect.fail(
|
||||
new TextGenerationError({
|
||||
operation: "generateBranchName",
|
||||
@@ -318,7 +318,7 @@ describe("ProviderCommandReactor", () => {
|
||||
}),
|
||||
),
|
||||
);
|
||||
const generateThreadTitle = vi.fn<TextGenerationShape["generateThreadTitle"]>((_) =>
|
||||
const generateThreadTitle = vi.fn<TextGeneration["Service"]["generateThreadTitle"]>((_) =>
|
||||
Effect.fail(
|
||||
new TextGenerationError({
|
||||
operation: "generateThreadTitle",
|
||||
|
||||
@@ -96,11 +96,6 @@ const fakeCursorAdapter: CursorAdapter.CursorAdapterShape = {
|
||||
streamEvents: Stream.empty,
|
||||
};
|
||||
|
||||
// ProviderAdapterRegistryLive is now a facade over ProviderInstanceRegistry —
|
||||
// it walks `listInstances` once at boot and surfaces the default-instance
|
||||
// adapter keyed by its driver kind. To test the facade we supply four fake
|
||||
// instances whose `instanceId === defaultInstanceIdForDriver(driverKind)` so
|
||||
// they pass the default-instance filter.
|
||||
const makeFakeInstance = (
|
||||
driverKindString: "codex" | "claudeAgent" | "cursor" | "opencode",
|
||||
adapter: ProviderInstance["adapter"],
|
||||
@@ -184,13 +179,5 @@ it.layer(layer)("ProviderAdapterRegistryLive", (it) => {
|
||||
defaultInstanceIdForDriver(OPENCODE_DRIVER),
|
||||
defaultInstanceIdForDriver(CURSOR_DRIVER),
|
||||
]);
|
||||
|
||||
const providers = yield* registry.listProviders();
|
||||
assert.deepStrictEqual(providers, [
|
||||
CODEX_DRIVER,
|
||||
CLAUDE_AGENT_DRIVER,
|
||||
OPENCODE_DRIVER,
|
||||
CURSOR_DRIVER,
|
||||
]);
|
||||
}));
|
||||
});
|
||||
@@ -15,11 +15,7 @@
|
||||
*
|
||||
* @module ProviderAdapterRegistryLive
|
||||
*/
|
||||
import {
|
||||
defaultInstanceIdForDriver,
|
||||
ProviderInstanceId,
|
||||
type ProviderDriverKind,
|
||||
} from "@t3tools/contracts";
|
||||
import { ProviderInstanceId } from "@t3tools/contracts";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
|
||||
@@ -71,31 +67,10 @@ const makeProviderAdapterRegistry = Effect.fn("makeProviderAdapterRegistry")(fun
|
||||
Effect.map((instances) => instances.map((instance) => instance.instanceId)),
|
||||
);
|
||||
|
||||
const listProviders: ProviderAdapterRegistryShape["listProviders"] = () =>
|
||||
registry.listInstances.pipe(
|
||||
Effect.map((instances) => {
|
||||
const kinds = new Set<ProviderDriverKind>();
|
||||
for (const instance of instances) {
|
||||
const defaultId = defaultInstanceIdForDriver(instance.driverKind);
|
||||
if (instance.instanceId === defaultId) {
|
||||
// Only the default-instance rows show up through the legacy
|
||||
// shim — custom instances like `codex_personal` have no
|
||||
// `ProviderDriverKind` equivalent.
|
||||
kinds.add(instance.driverKind);
|
||||
}
|
||||
}
|
||||
return Array.from(kinds);
|
||||
}),
|
||||
);
|
||||
|
||||
return {
|
||||
getByInstance,
|
||||
getInstanceInfo,
|
||||
listInstances,
|
||||
listProviders,
|
||||
// Proxy directly — the facade has no state of its own; the instance
|
||||
// registry already coalesces adds/removes/rebuilds into one emission.
|
||||
streamChanges: registry.streamChanges,
|
||||
subscribeChanges: registry.subscribeChanges,
|
||||
} satisfies ProviderAdapterRegistryShape;
|
||||
});
|
||||
|
||||
@@ -514,8 +514,6 @@ it.effect(
|
||||
})
|
||||
: Effect.fail(unsupported()),
|
||||
listInstances: () => Effect.succeed([instanceId]),
|
||||
listProviders: () => Effect.succeed([driverKind] as const),
|
||||
streamChanges: Stream.empty,
|
||||
subscribeChanges: Effect.flatMap(PubSub.unbounded<void>(), (pubsub) =>
|
||||
PubSub.subscribe(pubsub),
|
||||
),
|
||||
@@ -594,8 +592,6 @@ it.effect("ProviderServiceLive rejects new sessions for disabled custom instance
|
||||
})
|
||||
: Effect.fail(unsupported()),
|
||||
listInstances: () => Effect.succeed([instanceId]),
|
||||
listProviders: () => Effect.succeed([CODEX_DRIVER] as const),
|
||||
streamChanges: Stream.empty,
|
||||
subscribeChanges: Effect.flatMap(PubSub.unbounded<void>(), (pubsub) =>
|
||||
PubSub.subscribe(pubsub),
|
||||
),
|
||||
|
||||
@@ -1,21 +1,9 @@
|
||||
/**
|
||||
* ProviderAdapterRegistry - Lookup boundary for provider adapter implementations.
|
||||
*
|
||||
* Maps a `ProviderInstanceId` (the new per-instance routing key) or a
|
||||
* `ProviderDriverKind` (legacy single-instance-per-driver key) to the concrete
|
||||
* adapter service (Codex, Claude, etc). It does not own session lifecycle
|
||||
* or routing rules; `ProviderService` uses this registry together with
|
||||
* `ProviderSessionDirectory`.
|
||||
*
|
||||
* During the driver/instance migration this tag exposes both flavours:
|
||||
*
|
||||
* - `getByInstance` / `listInstances` — new per-instance routing. Callers
|
||||
* that already know an `instanceId` (threads, sessions, events)
|
||||
* should prefer these.
|
||||
* (`defaultInstanceIdForDriver(kind) === kind`), matching the pre-Slice-D
|
||||
* behaviour. New code should not grow additional callers of the kind-keyed
|
||||
* methods; they exist so the settings UI, WS refresh RPC, and a handful
|
||||
* of legacy persisted rows can still be routed during the rollout.
|
||||
* Maps a `ProviderInstanceId` to its provider adapter. `ProviderService` uses
|
||||
* this registry with `ProviderSessionDirectory`. The registry does not own
|
||||
* session lifecycle or routing rules.
|
||||
*
|
||||
* @module ProviderAdapterRegistry
|
||||
*/
|
||||
@@ -24,7 +12,6 @@ import * as Context from "effect/Context";
|
||||
import type * as Effect from "effect/Effect";
|
||||
import type * as PubSub from "effect/PubSub";
|
||||
import type * as Scope from "effect/Scope";
|
||||
import type * as Stream from "effect/Stream";
|
||||
|
||||
import type { ProviderAdapterError, ProviderUnsupportedError } from "../Errors.ts";
|
||||
import type { ProviderAdapterShape } from "./ProviderAdapter.ts";
|
||||
@@ -64,25 +51,6 @@ export interface ProviderAdapterRegistryShape {
|
||||
*/
|
||||
readonly listInstances: () => Effect.Effect<ReadonlyArray<ProviderInstanceId>>;
|
||||
|
||||
/**
|
||||
* Legacy: list provider kinds whose default instance is currently
|
||||
* registered.
|
||||
*
|
||||
* @deprecated Prefer `listInstances`. Retained for migration-era call
|
||||
* sites that iterate providers to build UI/metrics.
|
||||
*/
|
||||
readonly listProviders: () => Effect.Effect<ReadonlyArray<ProviderDriverKind>>;
|
||||
|
||||
/**
|
||||
* Change notification stream mirroring `ProviderInstanceRegistry.streamChanges`.
|
||||
* Emits one `void` tick whenever the set of live instances changes
|
||||
* (instance added, removed, or rebuilt after a settings edit). Consumers
|
||||
* that fan out `adapter.streamEvents` per instance — e.g. `ProviderService`'s
|
||||
* runtime event bus — re-pull `listInstances` on each tick and fork new
|
||||
* subscriptions for instances they haven't seen yet.
|
||||
*/
|
||||
readonly streamChanges: Stream.Stream<void>;
|
||||
|
||||
/**
|
||||
* Acquire a change subscription synchronously in the caller's current fiber.
|
||||
* Consumers that must avoid missing a publish between initial reconciliation
|
||||
|
||||
@@ -2,15 +2,6 @@
|
||||
* Test helpers for constructing a `ProviderAdapterRegistryShape` mock from a
|
||||
* kind-keyed adapter map.
|
||||
*
|
||||
* Tests historically assembled a `registry` object with only `getByProvider`
|
||||
* + `listProviders` populated. Slice D grew the shape with `getByInstance`
|
||||
* and `listInstances`; this helper fills both in from a single kind-keyed
|
||||
* input so individual fixtures can stay concise.
|
||||
*
|
||||
* Non-default instance ids (e.g. `codex_personal`) are not addressable via
|
||||
* the shim returned here — the legacy test fixtures only ever had
|
||||
* single-instance-per-driver data anyway.
|
||||
*
|
||||
* @module provider/testUtils/providerAdapterRegistryMock
|
||||
*/
|
||||
import {
|
||||
@@ -20,9 +11,6 @@ import {
|
||||
} from "@t3tools/contracts";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as PubSub from "effect/PubSub";
|
||||
import * as Record from "effect/Record";
|
||||
import * as Result from "effect/Result";
|
||||
import * as Stream from "effect/Stream";
|
||||
|
||||
import { ProviderUnsupportedError, type ProviderAdapterError } from "../Errors.ts";
|
||||
import type { ProviderAdapterShape } from "../Services/ProviderAdapter.ts";
|
||||
@@ -34,9 +22,8 @@ export type KindAdapterMap = Partial<
|
||||
|
||||
/**
|
||||
* Build a `ProviderAdapterRegistryShape` from a kind-keyed adapter map.
|
||||
* Every adapter present in the map is addressable via both the legacy
|
||||
* `getByProvider(kind)` path and the new `getByInstance(id)` path (where
|
||||
* `id = defaultInstanceIdForDriver(kind)`).
|
||||
* Every adapter present in the map is addressable through its default
|
||||
* provider instance id.
|
||||
*/
|
||||
export const makeAdapterRegistryMock = (adapters: KindAdapterMap): ProviderAdapterRegistryShape => {
|
||||
const byInstanceId = new Map<ProviderInstanceId, ProviderAdapterShape<ProviderAdapterError>>();
|
||||
@@ -80,18 +67,6 @@ export const makeAdapterRegistryMock = (adapters: KindAdapterMap): ProviderAdapt
|
||||
});
|
||||
},
|
||||
listInstances: () => Effect.succeed(Array.from(byInstanceId.keys())),
|
||||
listProviders: () =>
|
||||
Effect.succeed(
|
||||
Record.keys(
|
||||
Record.filterMap(adapters, (adapter, kind) =>
|
||||
adapter !== undefined ? Result.succeed(kind) : Result.failVoid,
|
||||
),
|
||||
),
|
||||
),
|
||||
// Static test fixtures don't reload; an empty stream is enough to
|
||||
// satisfy the shape. Tests exercising hot-reload build their own
|
||||
// stream via the real `ProviderInstanceRegistry`.
|
||||
streamChanges: Stream.empty,
|
||||
subscribeChanges: Effect.flatMap(PubSub.unbounded<void>(), (pubsub) =>
|
||||
PubSub.subscribe(pubsub),
|
||||
),
|
||||
|
||||
@@ -73,15 +73,6 @@ export interface ThreadTitleGenerationResult {
|
||||
title: string;
|
||||
}
|
||||
|
||||
export interface TextGenerationService {
|
||||
generateCommitMessage(
|
||||
input: CommitMessageGenerationInput,
|
||||
): Promise<CommitMessageGenerationResult>;
|
||||
generatePrContent(input: PrContentGenerationInput): Promise<PrContentGenerationResult>;
|
||||
generateBranchName(input: BranchNameGenerationInput): Promise<BranchNameGenerationResult>;
|
||||
generateThreadTitle(input: ThreadTitleGenerationInput): Promise<ThreadTitleGenerationResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* TextGeneration - Service tag for commit and change request text generation.
|
||||
*/
|
||||
@@ -116,9 +107,6 @@ export class TextGeneration extends Context.Service<
|
||||
}
|
||||
>()("t3/textGeneration/TextGeneration") {}
|
||||
|
||||
/** @deprecated Use `TextGeneration["Service"]`. */
|
||||
export type TextGenerationShape = TextGeneration["Service"];
|
||||
|
||||
type TextGenerationOp =
|
||||
| "generateCommitMessage"
|
||||
| "generatePrContent"
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
WS_METHODS,
|
||||
} from "@t3tools/contracts";
|
||||
import {
|
||||
type RelayClientDeviceRecord,
|
||||
type RelayClientEnvironmentRecord,
|
||||
type RelayEnvironmentLinkResponse,
|
||||
type RelayManagedEndpointProviderKind,
|
||||
@@ -26,10 +25,6 @@ import { request, runStream } from "@t3tools/client-runtime/rpc";
|
||||
import { makeEnvironmentHttpApiClient } from "@t3tools/client-runtime/rpc";
|
||||
import { ManagedRelay, relayProtectedErrorMessage } from "@t3tools/client-runtime/relay";
|
||||
|
||||
import {
|
||||
readPrimaryEnvironmentDescriptor,
|
||||
readPrimaryEnvironmentTarget,
|
||||
} from "../environments/primary";
|
||||
import { primaryEnvironmentHttpLayer } from "../environments/primary/httpLayer";
|
||||
import { resolveCloudPublicConfig } from "./publicConfig";
|
||||
import {
|
||||
@@ -215,20 +210,6 @@ export function collectCloudLinkTargets(input: {
|
||||
return [...byId.values()];
|
||||
}
|
||||
|
||||
export function readPrimaryCloudLinkTarget(): CloudLinkTarget | null {
|
||||
const descriptor = readPrimaryEnvironmentDescriptor();
|
||||
const target = readPrimaryEnvironmentTarget();
|
||||
if (!descriptor || !target) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
environmentId: descriptor.environmentId,
|
||||
label: descriptor.label,
|
||||
httpBaseUrl: target.target.httpBaseUrl,
|
||||
wsBaseUrl: target.target.wsBaseUrl,
|
||||
};
|
||||
}
|
||||
|
||||
export function listManagedCloudEnvironments(input: {
|
||||
readonly clerkToken: string;
|
||||
}): Effect.Effect<
|
||||
@@ -260,32 +241,6 @@ export function listManagedCloudEnvironments(input: {
|
||||
});
|
||||
}
|
||||
|
||||
export function listCloudDevices(input: {
|
||||
readonly clerkToken: string;
|
||||
}): Effect.Effect<
|
||||
ReadonlyArray<RelayClientDeviceRecord>,
|
||||
CloudEnvironmentLinkError,
|
||||
ManagedRelay.ManagedRelayClient
|
||||
> {
|
||||
return Effect.gen(function* () {
|
||||
if (!relayUrl()) {
|
||||
return yield* new CloudEnvironmentLinkError({
|
||||
message: "T3CODE_RELAY_URL is not configured.",
|
||||
});
|
||||
}
|
||||
const relayClient = yield* ManagedRelay.ManagedRelayClient;
|
||||
return yield* relayClient.listDevices({ clerkToken: input.clerkToken }).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new CloudEnvironmentLinkError({
|
||||
message: "Could not list cloud devices.",
|
||||
cause,
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function readPrimaryCloudLinkState(input: {
|
||||
readonly target: CloudLinkTarget;
|
||||
}): Effect.Effect<CloudLinkState | null, CloudEnvironmentLinkError, HttpClient.HttpClient> {
|
||||
|
||||
@@ -46,20 +46,6 @@ export function DiffPanelShell(props: {
|
||||
);
|
||||
}
|
||||
|
||||
export function DiffPanelHeaderSkeleton() {
|
||||
return (
|
||||
<>
|
||||
<div className="min-w-0 flex-1">
|
||||
<Skeleton className="h-8 w-32 rounded-lg" />
|
||||
</div>
|
||||
<div className="flex shrink-0 gap-1">
|
||||
<Skeleton className="size-7 rounded-md" />
|
||||
<Skeleton className="size-7 rounded-md" />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function DiffFileHeaderSkeleton({ titleClassName }: { titleClassName: string }) {
|
||||
return (
|
||||
<div className="flex h-8 items-center gap-2 px-2 pr-3">
|
||||
|
||||
@@ -202,10 +202,6 @@ export function providerUpdateNotificationKey(
|
||||
return parts.length > 0 ? parts.join("|") : null;
|
||||
}
|
||||
|
||||
export function providerUpdateCandidateKey(provider: ProviderUpdateCandidate): string {
|
||||
return providerUpdateNotificationKey([provider])!;
|
||||
}
|
||||
|
||||
export function formatProviderList(providers: ReadonlyArray<Pick<ServerProvider, "driver">>) {
|
||||
const names = providers.map(
|
||||
(provider) => PROVIDER_DISPLAY_NAMES[provider.driver] ?? provider.driver,
|
||||
|
||||
@@ -22,17 +22,6 @@ describe("ChangedFilesCard", () => {
|
||||
|
||||
expect(markup).toContain('data-changed-files-state="expanded"');
|
||||
expect(markup).toContain('aria-expanded="true"');
|
||||
expect(markup).toContain("whitespace-nowrap");
|
||||
expect(markup).toContain('class="group flex min-w-0 flex-1 items-center rounded-xl');
|
||||
expect(markup).not.toMatch(/class="group flex min-w-0 flex-1 items-center[^"]*overflow-hidden/);
|
||||
expect(markup).toContain('class="flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden"');
|
||||
expect(markup).toContain('class="flex shrink-0 items-center gap-1 whitespace-nowrap');
|
||||
expect(markup).toContain('class="ml-1 hidden min-w-0 flex-1 truncate');
|
||||
expect(markup).toContain("@[24rem]/changed-files:inline");
|
||||
expect(markup).not.toContain("sm:inline");
|
||||
expect(markup).toContain('class="flex shrink-0 items-center gap-1.5 pr-1"');
|
||||
expect(markup).toContain("!size-[22px]");
|
||||
expect(markup).toContain("size-3");
|
||||
expect(markup).toContain('aria-label="Collapse all folders"');
|
||||
expect(markup).toContain('aria-label="Open diff"');
|
||||
expect(markup).toContain('role="group" aria-label="2 additions, 1 deletions"');
|
||||
|
||||
@@ -5,24 +5,7 @@ import { describe, expect, it } from "vite-plus/test";
|
||||
import { ComposerCommandMenu } from "./ComposerCommandMenu";
|
||||
|
||||
describe("ComposerCommandMenu", () => {
|
||||
it("renders slash-command results as an attached composer drawer", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<ComposerCommandMenu
|
||||
items={[]}
|
||||
resolvedTheme="dark"
|
||||
isLoading={false}
|
||||
triggerKind="slash-command"
|
||||
activeItemId={null}
|
||||
onHighlightedItemChange={() => {}}
|
||||
onSelect={() => {}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(markup).toContain('data-composer-command-drawer="true"');
|
||||
expect(markup).not.toContain("dropdown-glass");
|
||||
});
|
||||
|
||||
it("renders commands without a category heading or invented icons", () => {
|
||||
it("renders slash commands with their descriptions", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<ComposerCommandMenu
|
||||
items={[
|
||||
@@ -45,16 +28,9 @@ describe("ComposerCommandMenu", () => {
|
||||
|
||||
expect(markup).toContain("/model");
|
||||
expect(markup).toContain("Switch response model for this thread");
|
||||
expect(markup).not.toContain("Built-in");
|
||||
expect(markup).not.toContain("<svg");
|
||||
expect(markup).toContain("font-sans text-xs font-medium");
|
||||
expect(markup).not.toContain("font-mono");
|
||||
expect(markup).not.toContain("grid-cols-");
|
||||
expect(markup).toContain("max-w-[45%]");
|
||||
expect(markup).toContain("text-left");
|
||||
});
|
||||
|
||||
it("renders the skill source icon inside its badge", () => {
|
||||
it("shows the app source for an app skill", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<ComposerCommandMenu
|
||||
items={[
|
||||
@@ -85,18 +61,10 @@ describe("ComposerCommandMenu", () => {
|
||||
expect(markup).toContain('data-slot="badge"');
|
||||
expect(markup).toContain(">App Skill</span>");
|
||||
expect(markup).toContain("Open and control the in-app browser");
|
||||
expect(markup).toContain("max-w-[48ch]");
|
||||
expect(markup).toContain("text-secondary-label text-xs");
|
||||
expect(markup).toContain("ms-auto");
|
||||
expect(markup).toContain("text-current");
|
||||
expect(markup.indexOf("Open and control the in-app browser")).toBeLessThan(
|
||||
markup.indexOf(">App Skill</span>"),
|
||||
);
|
||||
expect(markup).toContain("<svg");
|
||||
expect(markup.indexOf('data-slot="badge"')).toBeLessThan(markup.indexOf("<svg"));
|
||||
});
|
||||
|
||||
it("keeps slash skills aligned with the source icon inside the badge", () => {
|
||||
it("shows the repo source for a slash skill", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<ComposerCommandMenu
|
||||
items={[
|
||||
@@ -129,6 +97,5 @@ describe("ComposerCommandMenu", () => {
|
||||
expect(markup).toContain("lucide-folder");
|
||||
expect(markup).toContain(">Repo</span>");
|
||||
expect(markup).toContain("Find the right skill or workflow");
|
||||
expect(markup).not.toContain("font-medium text-secondary-label");
|
||||
});
|
||||
});
|
||||
@@ -44,27 +44,6 @@ function renderPendingActions(isRunning: boolean) {
|
||||
);
|
||||
}
|
||||
|
||||
function renderStandaloneStop() {
|
||||
return renderToStaticMarkup(
|
||||
createElement(ComposerPrimaryActions, {
|
||||
compact: true,
|
||||
pendingAction: null,
|
||||
isRunning: true,
|
||||
showPlanFollowUpPrompt: false,
|
||||
promptHasText: false,
|
||||
isSendBusy: false,
|
||||
sendDisabledReason: null,
|
||||
isConnecting: false,
|
||||
isEnvironmentUnavailable: false,
|
||||
isPreparingWorktree: false,
|
||||
hasSendableContent: false,
|
||||
onPreviousPendingQuestion: () => {},
|
||||
onInterrupt: () => {},
|
||||
onImplementPlanInNewThread: () => {},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
function renderRunningActions(showSendWhileRunning: boolean, hasSendableContent: boolean) {
|
||||
return renderToStaticMarkup(
|
||||
createElement(ComposerPrimaryActions, {
|
||||
@@ -219,12 +198,6 @@ describe("ComposerPrimaryActions", () => {
|
||||
expect(renderPendingActions(false)).not.toContain('aria-label="Stop generation"');
|
||||
});
|
||||
|
||||
it("matches the small pending action size without changing the standalone size", () => {
|
||||
expect(renderPendingActions(true)).toContain("size-8 sm:size-7");
|
||||
expect(renderStandaloneStop()).toContain("size-8 sm:h-8 sm:w-8");
|
||||
expect(renderStandaloneStop()).not.toContain("sm:size-7");
|
||||
});
|
||||
|
||||
it("renders stage artwork inside the send button when artwork identification is active", () => {
|
||||
stageArtworkState.mode = "artwork";
|
||||
stageArtworkState.variant = "nightly";
|
||||
@@ -232,17 +205,14 @@ describe("ComposerPrimaryActions", () => {
|
||||
const markup = renderSendButton();
|
||||
|
||||
expect(markup).toContain("stage-nightly");
|
||||
expect(markup).toContain("bg-transparent text-white");
|
||||
expect(markup).not.toContain("bg-message-action text-message-action-foreground");
|
||||
});
|
||||
|
||||
it("keeps the normal send-button fill when artwork identification is inactive", () => {
|
||||
it("hides stage artwork when artwork identification is inactive", () => {
|
||||
stageArtworkState.variant = "nightly";
|
||||
|
||||
const markup = renderSendButton();
|
||||
|
||||
expect(markup).not.toContain("stage-nightly");
|
||||
expect(markup).toContain("bg-message-action text-message-action-foreground");
|
||||
});
|
||||
|
||||
it("only renders stop while running when Enter-to-send is available", () => {
|
||||
@@ -258,7 +228,6 @@ describe("ComposerPrimaryActions", () => {
|
||||
expect(markup).toContain('aria-label="Stop generation"');
|
||||
expect(markup).toContain('aria-label="Send message"');
|
||||
expect(markup).toContain('type="submit"');
|
||||
expect(markup).toContain("size-9 sm:size-8");
|
||||
});
|
||||
|
||||
it("keeps stop as the only action while running with an empty composer", () => {
|
||||
|
||||
@@ -16,12 +16,7 @@ vi.mock("@legendapp/list/react", async () => {
|
||||
ListFooterComponent?: ReactNode;
|
||||
anchoredEndSpace?: {
|
||||
anchorIndex: number;
|
||||
anchorMaxSize?: number;
|
||||
anchorOffset?: number;
|
||||
onReady?: (info: { anchorIndex: number }) => void;
|
||||
};
|
||||
contentInsetEndAdjustment?: number;
|
||||
className?: string;
|
||||
maintainScrollAtEnd?:
|
||||
| boolean
|
||||
| {
|
||||
@@ -32,27 +27,12 @@ vi.mock("@legendapp/list/react", async () => {
|
||||
layout?: boolean;
|
||||
};
|
||||
};
|
||||
maintainVisibleContentPosition?:
|
||||
| boolean
|
||||
| {
|
||||
data?: boolean;
|
||||
size?: boolean;
|
||||
shouldRestorePosition?: (item: { id: string }) => boolean;
|
||||
};
|
||||
ref?: Ref<LegendListRef>;
|
||||
}) => {
|
||||
if (props.anchoredEndSpace) {
|
||||
props.anchoredEndSpace.onReady?.({ anchorIndex: props.anchoredEndSpace.anchorIndex });
|
||||
}
|
||||
return (
|
||||
<div
|
||||
data-testid={legendListTestId}
|
||||
data-anchor-index={props.anchoredEndSpace?.anchorIndex}
|
||||
data-anchor-max-size={props.anchoredEndSpace?.anchorMaxSize}
|
||||
data-anchor-offset={props.anchoredEndSpace?.anchorOffset}
|
||||
data-anchor-on-ready={Boolean(props.anchoredEndSpace?.onReady)}
|
||||
data-content-inset-end={props.contentInsetEndAdjustment}
|
||||
data-class-name={props.className}
|
||||
data-maintain-scroll-at-end={props.maintainScrollAtEnd ? "enabled" : undefined}
|
||||
data-maintain-scroll-at-end-animated={
|
||||
typeof props.maintainScrollAtEnd === "object"
|
||||
@@ -74,26 +54,6 @@ vi.mock("@legendapp/list/react", async () => {
|
||||
? props.maintainScrollAtEnd.on?.layout
|
||||
: undefined
|
||||
}
|
||||
data-maintain-visible-content-position={
|
||||
typeof props.maintainVisibleContentPosition === "object"
|
||||
? "object"
|
||||
: props.maintainVisibleContentPosition
|
||||
}
|
||||
data-maintain-visible-content-position-data={
|
||||
typeof props.maintainVisibleContentPosition === "object"
|
||||
? props.maintainVisibleContentPosition.data
|
||||
: undefined
|
||||
}
|
||||
data-maintain-visible-content-position-size={
|
||||
typeof props.maintainVisibleContentPosition === "object"
|
||||
? props.maintainVisibleContentPosition.size
|
||||
: undefined
|
||||
}
|
||||
data-maintain-visible-content-position-restore={
|
||||
typeof props.maintainVisibleContentPosition === "object"
|
||||
? Boolean(props.maintainVisibleContentPosition.shouldRestorePosition)
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{props.ListHeaderComponent}
|
||||
{props.data.map((item) => (
|
||||
@@ -293,7 +253,7 @@ describe("MessagesTimeline", () => {
|
||||
expect(markup).toContain("codex-thread-1");
|
||||
});
|
||||
|
||||
it("renders the worked-for row at assistant response text size", () => {
|
||||
it("renders elapsed time for a completed turn", () => {
|
||||
const turnId = TurnId.make("turn-with-fold");
|
||||
const assistantEntry = buildAssistantTimelineEntry("Done.");
|
||||
const markup = renderToStaticMarkup(
|
||||
@@ -328,23 +288,6 @@ describe("MessagesTimeline", () => {
|
||||
);
|
||||
|
||||
expect(markup).toContain("Worked for 8.0s");
|
||||
expect(markup).toContain("px-1 text-sm leading-relaxed text-muted-foreground");
|
||||
});
|
||||
|
||||
it("uses the larger leading inset only when the top fade is enabled", () => {
|
||||
const timelineEntries = [buildUserTimelineEntry("Hello")];
|
||||
|
||||
const compactMarkup = renderToStaticMarkup(
|
||||
<MessagesTimeline {...buildProps()} timelineEntries={timelineEntries} />,
|
||||
);
|
||||
const fadedMarkup = renderToStaticMarkup(
|
||||
<MessagesTimeline {...buildProps()} timelineEntries={timelineEntries} topFadeEnabled />,
|
||||
);
|
||||
|
||||
expect(compactMarkup).toContain('class="h-3 sm:h-4"');
|
||||
expect(compactMarkup).not.toContain("topbar-scroll-fade");
|
||||
expect(fadedMarkup).toContain('class="h-[var(--workspace-titlebar-scroll-fade-height)]"');
|
||||
expect(fadedMarkup).toContain("topbar-scroll-fade");
|
||||
});
|
||||
|
||||
it("keeps assistant changed-files headers sticky below the thread header", () => {
|
||||
@@ -491,74 +434,6 @@ describe("MessagesTimeline", () => {
|
||||
expect(resolveTimelineMinimapInteractiveWidth(40, true)).toBe("22rem");
|
||||
});
|
||||
|
||||
it("anchors the first user message using its measured height", () => {
|
||||
const onAnchorReady = vi.fn();
|
||||
const firstEntry = {
|
||||
...buildUserTimelineEntry("First prompt."),
|
||||
message: {
|
||||
...buildUserTimelineEntry("First prompt.").message,
|
||||
attachments: [
|
||||
{
|
||||
type: "image" as const,
|
||||
id: "attachment-1",
|
||||
name: "screenshot.png",
|
||||
mimeType: "image/png",
|
||||
sizeBytes: 1,
|
||||
previewUrl: "data:image/png;base64,iVBORw0KGgo=",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
const markup = renderToStaticMarkup(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
anchorMessageId={firstEntry.message.id}
|
||||
onAnchorReady={onAnchorReady}
|
||||
contentInsetEndAdjustment={144}
|
||||
timelineEntries={[firstEntry]}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(markup).toContain('data-anchor-index="0"');
|
||||
expect(markup).toContain('data-anchor-offset="24"');
|
||||
expect(markup).toContain('data-anchor-on-ready="true"');
|
||||
expect(markup).not.toContain("data-anchor-max-size=");
|
||||
expect(markup).toContain('data-content-inset-end="144"');
|
||||
expect(markup).toContain("[overflow-anchor:none]");
|
||||
expect(markup).not.toContain('data-maintain-scroll-at-end="enabled"');
|
||||
expect(markup).toContain('data-maintain-visible-content-position="object"');
|
||||
expect(markup).toContain('data-maintain-visible-content-position-data="true"');
|
||||
expect(markup).toContain('data-maintain-visible-content-position-size="true"');
|
||||
expect(markup).toContain('data-maintain-visible-content-position-restore="true"');
|
||||
expect(onAnchorReady).toHaveBeenCalledOnce();
|
||||
expect(onAnchorReady).toHaveBeenCalledWith(firstEntry.message.id, 0);
|
||||
});
|
||||
|
||||
it("does not reserve end space for a follow-up user message", () => {
|
||||
const onAnchorReady = vi.fn();
|
||||
const firstEntry = buildUserTimelineEntry("First prompt.");
|
||||
const secondEntry = {
|
||||
...buildUserTimelineEntry("Newest prompt."),
|
||||
id: "entry-2",
|
||||
message: {
|
||||
...buildUserTimelineEntry("Newest prompt.").message,
|
||||
id: MessageId.make("message-2"),
|
||||
},
|
||||
};
|
||||
const markup = renderToStaticMarkup(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
anchorMessageId={secondEntry.message.id}
|
||||
onAnchorReady={onAnchorReady}
|
||||
timelineEntries={[firstEntry, secondEntry]}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(markup).not.toContain("data-anchor-index=");
|
||||
expect(markup).toContain('data-maintain-scroll-at-end="enabled"');
|
||||
expect(onAnchorReady).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("renders generic attachments as download links instead of image previews", () => {
|
||||
const entry = {
|
||||
...buildUserTimelineEntry("Read the report."),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { ProviderDriverKind } from "@t3tools/contracts";
|
||||
import { ClaudeAI, CursorIcon, GrokIcon, Icon, OpenAI, OpenCodeIcon } from "../Icons";
|
||||
import { PROVIDER_OPTIONS } from "../../session-logic";
|
||||
|
||||
export const PROVIDER_ICON_BY_PROVIDER: Partial<Record<ProviderDriverKind, Icon>> = {
|
||||
[ProviderDriverKind.make("codex")]: OpenAI,
|
||||
@@ -10,17 +9,6 @@ export const PROVIDER_ICON_BY_PROVIDER: Partial<Record<ProviderDriverKind, Icon>
|
||||
[ProviderDriverKind.make("grok")]: GrokIcon,
|
||||
};
|
||||
|
||||
function isAvailableProviderOption(option: (typeof PROVIDER_OPTIONS)[number]): option is {
|
||||
value: ProviderDriverKind;
|
||||
label: string;
|
||||
available: true;
|
||||
pickerSidebarBadge?: "new" | "soon";
|
||||
} {
|
||||
return option.available;
|
||||
}
|
||||
|
||||
export const AVAILABLE_PROVIDER_OPTIONS = PROVIDER_OPTIONS.filter(isAvailableProviderOption);
|
||||
|
||||
export type ModelEsque = {
|
||||
slug: string;
|
||||
name: string;
|
||||
|
||||
@@ -125,11 +125,6 @@ export function shouldToastDesktopUpdateActionResult(result: DesktopUpdateAction
|
||||
return getDesktopUpdateActionError(result) !== null;
|
||||
}
|
||||
|
||||
export function shouldHighlightDesktopUpdateError(state: DesktopUpdateState | null): boolean {
|
||||
if (!state || state.status !== "error") return false;
|
||||
return state.errorContext === "download" || state.errorContext === "install";
|
||||
}
|
||||
|
||||
export function canCheckForUpdate(state: DesktopUpdateState | null): boolean {
|
||||
if (!state || !state.enabled) return false;
|
||||
return (
|
||||
|
||||
@@ -221,8 +221,6 @@ export function isCollapsedCursorAdjacentToInlineToken(
|
||||
return false;
|
||||
}
|
||||
|
||||
export const isCollapsedCursorAdjacentToMention = isCollapsedCursorAdjacentToInlineToken;
|
||||
|
||||
export function detectComposerTrigger(text: string, cursorInput: number): ComposerTrigger | null {
|
||||
const cursor = clampCursor(text, cursorInput);
|
||||
const lineStart = text.lastIndexOf("\n", Math.max(0, cursor - 1)) + 1;
|
||||
|
||||
@@ -4117,11 +4117,3 @@ export function finalizePromotedDraftThreadByRef(threadRef: ScopedThreadRef): vo
|
||||
}
|
||||
clearBackgroundDraftSubmissionByRef(threadRef);
|
||||
}
|
||||
|
||||
export function finalizePromotedDraftThreadsByRef(
|
||||
serverThreadRefs: Iterable<ScopedThreadRef>,
|
||||
): void {
|
||||
for (const threadRef of serverThreadRefs) {
|
||||
finalizePromotedDraftThreadByRef(threadRef);
|
||||
}
|
||||
}
|
||||
@@ -411,14 +411,6 @@ export function isDiffToggleShortcut(
|
||||
return matchesCommandShortcut(event, keybindings, "diff.toggle", options);
|
||||
}
|
||||
|
||||
export function isPreviewToggleShortcut(
|
||||
event: ShortcutEventLike,
|
||||
keybindings: ResolvedKeybindingsConfig,
|
||||
options?: ShortcutMatchOptions,
|
||||
): boolean {
|
||||
return matchesCommandShortcut(event, keybindings, "preview.toggle", options);
|
||||
}
|
||||
|
||||
export function isPreviewRefreshShortcut(
|
||||
event: ShortcutEventLike,
|
||||
keybindings: ResolvedKeybindingsConfig,
|
||||
@@ -427,14 +419,6 @@ export function isPreviewRefreshShortcut(
|
||||
return matchesCommandShortcut(event, keybindings, "preview.refresh", options);
|
||||
}
|
||||
|
||||
export function isPreviewFocusUrlShortcut(
|
||||
event: ShortcutEventLike,
|
||||
keybindings: ResolvedKeybindingsConfig,
|
||||
options?: ShortcutMatchOptions,
|
||||
): boolean {
|
||||
return matchesCommandShortcut(event, keybindings, "preview.focusUrl", options);
|
||||
}
|
||||
|
||||
export function isChatNewShortcut(
|
||||
event: ShortcutEventLike,
|
||||
keybindings: ResolvedKeybindingsConfig,
|
||||
|
||||
@@ -25,28 +25,6 @@ export type ContextWindowSnapshot = NullableContextWindowUsage & {
|
||||
readonly updatedAt: string;
|
||||
};
|
||||
|
||||
/** Map a provider driver kind to a user-facing display name. */
|
||||
export function formatProviderDisplayName(provider: string | null | undefined): string {
|
||||
if (!provider) return "This agent";
|
||||
switch (provider) {
|
||||
case "claudeAgent":
|
||||
case "claude":
|
||||
return "Claude";
|
||||
case "codex":
|
||||
return "Codex";
|
||||
case "cursor":
|
||||
return "Cursor";
|
||||
case "opencode":
|
||||
return "OpenCode";
|
||||
default: {
|
||||
// Title-case unknown driver kinds so they read reasonably.
|
||||
const trimmed = provider.replace(/Agent$/i, "").trim();
|
||||
if (trimmed.length === 0) return provider;
|
||||
return trimmed.charAt(0).toUpperCase() + trimmed.slice(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function deriveLatestContextWindowSnapshot(
|
||||
activities: ReadonlyArray<OrchestrationThreadActivity>,
|
||||
): ContextWindowSnapshot | null {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CommandId, MessageId, ProjectId, ThreadId } from "@t3tools/contracts";
|
||||
import { MessageId, ProjectId, ThreadId } from "@t3tools/contracts";
|
||||
import { type CxOptions, cx } from "class-variance-authority";
|
||||
import * as Encoding from "effect/Encoding";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
@@ -16,10 +16,6 @@ export function isWindowsPlatform(platform: string): boolean {
|
||||
return /^win(dows)?/i.test(platform);
|
||||
}
|
||||
|
||||
export function isLinuxPlatform(platform: string): boolean {
|
||||
return /linux/i.test(platform);
|
||||
}
|
||||
|
||||
export function normalizeSearchText(value: string): string {
|
||||
return value.normalize("NFKD").replace(/\p{M}/gu, "").toLowerCase().replace(/\s+/g, " ").trim();
|
||||
}
|
||||
@@ -46,8 +42,6 @@ export function randomUUID(): string {
|
||||
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
||||
}
|
||||
|
||||
export const newCommandId = (): CommandId => CommandId.make(randomUUID());
|
||||
|
||||
export const newProjectId = (): ProjectId => ProjectId.make(randomUUID());
|
||||
|
||||
export const newThreadId = (): ThreadId => ThreadId.make(randomUUID());
|
||||
|
||||
@@ -85,22 +85,3 @@ export function useThreadDiscoveredPorts(input: {
|
||||
[input.threadId, ports],
|
||||
);
|
||||
}
|
||||
|
||||
export function useTerminalDiscoveredPorts(input: {
|
||||
readonly environmentId: EnvironmentId | null;
|
||||
readonly threadId: ThreadId | null;
|
||||
readonly terminalId: string | null;
|
||||
}): ReadonlyArray<DiscoveredLocalServer> {
|
||||
const ports = useDiscoveredPorts(input.environmentId);
|
||||
return useMemo(
|
||||
() =>
|
||||
input.threadId && input.terminalId
|
||||
? ports.filter(
|
||||
(port) =>
|
||||
port.terminal?.threadId === input.threadId &&
|
||||
port.terminal.terminalId === input.terminalId,
|
||||
)
|
||||
: EMPTY_PORTS,
|
||||
[input.terminalId, input.threadId, ports],
|
||||
);
|
||||
}
|
||||
@@ -299,17 +299,6 @@ export function getProviderInstanceEntry(
|
||||
return deriveProviderInstanceEntries(providers).find((entry) => entry.instanceId === instanceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model list for a specific instance. Returns `[]` when the instance isn't
|
||||
* present so callers don't have to thread optionality through render code.
|
||||
*/
|
||||
export function getProviderInstanceModels(
|
||||
providers: ReadonlyArray<ServerProvider>,
|
||||
instanceId: ProviderInstanceId,
|
||||
): ReadonlyArray<ServerProviderModel> {
|
||||
return getProviderInstanceEntry(providers, instanceId)?.models ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Default model slug for a specific instance: its declared built-in default,
|
||||
* then its first built-in model, then any model it reports, then the driver-level default. Custom
|
||||
|
||||
@@ -38,14 +38,6 @@ export function getProviderSnapshot(
|
||||
return providers.find((candidate) => candidate.instanceId === defaultInstanceId);
|
||||
}
|
||||
|
||||
export function getProviderDisplayName(
|
||||
providers: ReadonlyArray<ServerProvider>,
|
||||
provider: ProviderDriverKind,
|
||||
): string {
|
||||
const snapshot = getProviderSnapshot(providers, provider);
|
||||
return snapshot?.displayName?.trim() || formatProviderDriverKindLabel(provider);
|
||||
}
|
||||
|
||||
export function getProviderInteractionModeToggle(
|
||||
providers: ReadonlyArray<ServerProvider>,
|
||||
provider: ProviderDriverKind,
|
||||
@@ -53,16 +45,6 @@ export function getProviderInteractionModeToggle(
|
||||
return getProviderSnapshot(providers, provider)?.showInteractionModeToggle ?? true;
|
||||
}
|
||||
|
||||
export function isProviderEnabled(
|
||||
providers: ReadonlyArray<ServerProvider>,
|
||||
provider: ProviderDriverKind,
|
||||
): boolean {
|
||||
if (providers.length === 0) {
|
||||
return true;
|
||||
}
|
||||
return getProviderSnapshot(providers, provider)?.enabled ?? false;
|
||||
}
|
||||
|
||||
// Resolve an instance selection to the correlated live driver. If the
|
||||
// instance is absent, fall back to a live enabled provider instead of
|
||||
// inferring a driver from the missing instance id.
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
// @effect-diagnostics nodeBuiltinImport:off
|
||||
// Regression coverage compares the onboarding header with the shared titlebar contract.
|
||||
import * as NodeFS from "node:fs";
|
||||
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
describe("hosted static onboarding header", () => {
|
||||
it("uses the shared workspace topbar geometry", () => {
|
||||
const routeSource = NodeFS.readFileSync(new URL("./_chat.index.tsx", import.meta.url), "utf8");
|
||||
const onboardingStart = routeSource.indexOf("function HostedStaticOnboardingState()");
|
||||
const onboardingEnd = routeSource.indexOf('<Empty className="flex-1">', onboardingStart);
|
||||
|
||||
expect(onboardingStart).toBeGreaterThanOrEqual(0);
|
||||
expect(onboardingEnd).toBeGreaterThan(onboardingStart);
|
||||
|
||||
const onboardingHeader = routeSource.slice(onboardingStart, onboardingEnd);
|
||||
|
||||
expect(onboardingHeader).toContain("<WorkspacePageHeader");
|
||||
expect(onboardingHeader).not.toMatch(/(?:^|\s)(?:[\w-]+:)*py-/);
|
||||
|
||||
const headerSource = NodeFS.readFileSync(
|
||||
new URL("../components/WorkspacePageHeader.tsx", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
expect(headerSource).toContain("h-[var(--workspace-topbar-height)]");
|
||||
expect(headerSource).toContain("min-h-[var(--workspace-topbar-height)]");
|
||||
expect(headerSource).toContain("COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS");
|
||||
});
|
||||
});
|
||||
@@ -1521,8 +1521,6 @@ export class ThemeLibraryStorageError extends Schema.TaggedErrorClass<ThemeLibra
|
||||
}
|
||||
}
|
||||
|
||||
export const isThemeLibraryStorageError = Schema.is(ThemeLibraryStorageError);
|
||||
|
||||
function saveCustomThemes(
|
||||
storedThemes: ReadonlyArray<unknown>,
|
||||
themes: ReadonlyArray<ThemeDefinition>,
|
||||
|
||||
Generated
-6
@@ -232,9 +232,6 @@ importers:
|
||||
'@noble/curves':
|
||||
specifier: 'catalog:'
|
||||
version: 1.9.1
|
||||
'@noble/hashes':
|
||||
specifier: 'catalog:'
|
||||
version: 1.8.0
|
||||
'@pierre/diffs':
|
||||
specifier: 'catalog:'
|
||||
version: 1.3.0-beta.10(patch_hash=7ef7cb0cbabb17c15cdb137554068b36f15f6f5265e73fb51452aa3380db91aa)(@shikijs/[email protected])([email protected]([email protected]))([email protected])
|
||||
@@ -479,9 +476,6 @@ importers:
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.103
|
||||
version: 4.0.0-beta.103([email protected])([email protected](patch_hash=af36b7948b6f9c56623074662b51dade5699880c1a7c71245de73e13c3185fb6))([email protected])([email protected])
|
||||
'@effect/platform-node-shared':
|
||||
specifier: 4.0.0-beta.103
|
||||
version: 4.0.0-beta.103([email protected])([email protected](patch_hash=af36b7948b6f9c56623074662b51dade5699880c1a7c71245de73e13c3185fb6))([email protected])
|
||||
'@effect/sql-sqlite-bun':
|
||||
specifier: 4.0.0-beta.103
|
||||
version: 4.0.0-beta.103([email protected](patch_hash=af36b7948b6f9c56623074662b51dade5699880c1a7c71245de73e13c3185fb6))
|
||||
|
||||
@@ -37,7 +37,6 @@ export default defineConfig({
|
||||
"**/routeTree.gen.ts",
|
||||
"apps/mobile/android/**",
|
||||
"apps/mobile/ios/**",
|
||||
"apps/web/public/mockServiceWorker.js",
|
||||
"apps/web/src/lib/vendor/qrcodegen.ts",
|
||||
"apps/mobile/uniwind-types.d.ts",
|
||||
"*.icon/**",
|
||||
|
||||
Reference in new issue
Block a user