Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ npm start
`npm start` prints a local URL such as `http://127.0.0.1:PORT` and opens it in your default browser.
Then:

1. Open **Settings → Connections** and add your Coder domain.
1. Open **Settings → Environments** and add your Coder domain.
2. Choose **Sign in**. Coder prints its login URL and a hidden token prompt in the terminal running
`npm start`; the token is handled there, never in the browser.
3. Choose **Add project** in the sidebar, pick your domain and workspace, and select a folder in
Expand Down
2 changes: 1 addition & 1 deletion apps/coder-helper/src/bin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { describe, it } from "node:test";
import { fileURLToPath } from "node:url";

import { CODER_HELPER_INFO_METHOD, CODER_HELPER_PROTOCOL_VERSION } from "@t3tools/coder-cli/rpc";
import { ORCHESTRATION_V2_WS_METHODS, ProviderInstanceId, WS_METHODS } from "@t3tools/contracts";
import { ORCHESTRATION_V2_WS_METHODS, WS_METHODS } from "@t3tools/contracts";

function makeNdjsonReader(stream: NodeJS.ReadableStream): () => Promise<unknown> {
const queued: Array<unknown> = [];
Expand Down
87 changes: 8 additions & 79 deletions apps/coder-helper/src/bin.ts
Original file line number Diff line number Diff line change
@@ -1,83 +1,7 @@
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
import * as NodeServices from "@effect/platform-node/NodeServices";
import * as NodeStdio from "@effect/platform-node/NodeStdio";
import { CoderWsRpcGroup } from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Logger from "effect/Logger";
import * as Path from "effect/Path";
import * as RpcSerialization from "effect/rpc/RpcSerialization";
import * as RpcServer from "effect/rpc/RpcServer";

import {
CODER_HELPER_INFO_METHOD,
CODER_HELPER_PROTOCOL_VERSION,
CoderHelperProtocolError,
CoderHelperRpcGroup,
} from "@t3tools/coder-cli/rpc";
import * as ServerConfig from "t3/src/config.ts";
import * as DefectReporter from "t3/src/observability/DefectReporter.ts";
import { withTerminalOutputWindow } from "t3/src/terminal/OutputProtocol.ts";
import { makeCoderRuntimeLayer } from "t3/src/coderServer.ts";
import { WS_RPC_SERVER_OPTIONS } from "t3/src/ws.ts";

export const coderHelperHandlers = CoderHelperRpcGroup.toLayer({
[CODER_HELPER_INFO_METHOD]: ({ protocolVersion }) =>
protocolVersion === CODER_HELPER_PROTOCOL_VERSION
? Effect.succeed({
protocolVersion: CODER_HELPER_PROTOCOL_VERSION,
platform: process.platform,
architecture: process.arch,
})
: Effect.fail(
new CoderHelperProtocolError({
message: `Unsupported protocol version ${protocolVersion}.`,
supportedVersion: CODER_HELPER_PROTOCOL_VERSION,
}),
),
});

const coderServerConfigLayer = Layer.effect(
ServerConfig.ServerConfig,
Effect.gen(function* () {
const path = yield* Path.Path;
const baseDir =
process.env.T3_CODER_HOME?.trim() || path.join(process.env.HOME ?? ".", ".t3-coder");
const cwd = process.env.T3_CODER_CWD?.trim() || process.env.HOME?.trim() || process.cwd();
const derivedPaths = yield* ServerConfig.deriveServerPaths(baseDir);
yield* ServerConfig.ensureServerDirectories(derivedPaths);
return ServerConfig.ServerConfig.of({
...derivedPaths,
cwd,
baseDir,
});
}),
);

export const CoderWorkspaceRpcGroup = CoderHelperRpcGroup.merge(CoderWsRpcGroup);

export const coderHelperStdioLayer = RpcServer.layer(
CoderWorkspaceRpcGroup,
WS_RPC_SERVER_OPTIONS,
).pipe(
Layer.provide(Layer.mergeAll(coderHelperHandlers, makeCoderRuntimeLayer(), DefectReporter.layer)),
Layer.provide(
Layer.effect(RpcServer.Protocol, Effect.map(RpcServer.Protocol, withTerminalOutputWindow)).pipe(
Layer.provide(RpcServer.layerProtocolStdio),
),
),
Layer.provide(RpcSerialization.layerNdjson),
Layer.provide(NodeStdio.layer),
Layer.provide(coderServerConfigLayer),
Layer.provide(NodeServices.layer),
// Keep Effect logs, including DefectReporter's, off stdout, which carries the NDJSON RPC
// transport. The helper launch discards stderr, so these logs are not kept anywhere.
Layer.provide(Layer.succeed(Logger.LogToStderr)(true)),
);

// Coder: upstream's `bin.ts` dispatch for `DocumentText.ts`, which runs office document text
// extraction in a child process of the server's own entry point; here that is the helper bundle.
if (import.meta.main && process.argv[2] === "__document-text") {
// Both branches import lazily so the extraction child loads only its worker, as upstream's does.
if (process.argv[2] === "__document-text") {
const { extractDocumentText } = await import("t3/src/provider/documentTextWorker.ts");
try {
process.stdout.write(await extractDocumentText(process.argv[3]!, process.argv[4]!));
Expand All @@ -88,6 +12,11 @@ if (import.meta.main && process.argv[2] === "__document-text") {
// Exit 2 identifies document rejections; OS and process failures remain retryable.
process.exitCode = 2;
}
} else if (import.meta.main) {
} else {
const [{ coderHelperStdioLayer }, Layer, NodeRuntime] = await Promise.all([
import("./helper.ts"),
import("effect/Layer"),
import("@effect/platform-node/NodeRuntime"),
]);
Layer.launch(coderHelperStdioLayer).pipe(NodeRuntime.runMain);
}
75 changes: 75 additions & 0 deletions apps/coder-helper/src/helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
import * as NodeStdio from "@effect/platform-node/NodeStdio";
import { CoderWsRpcGroup } from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Logger from "effect/Logger";
import * as Path from "effect/Path";
import * as RpcSerialization from "effect/rpc/RpcSerialization";
import * as RpcServer from "effect/rpc/RpcServer";

import {
CODER_HELPER_INFO_METHOD,
CODER_HELPER_PROTOCOL_VERSION,
CoderHelperProtocolError,
CoderHelperRpcGroup,
} from "@t3tools/coder-cli/rpc";
import * as ServerConfig from "t3/src/config.ts";
import * as DefectReporter from "t3/src/observability/DefectReporter.ts";
import { withTerminalOutputWindow } from "t3/src/terminal/OutputProtocol.ts";
import { makeCoderRuntimeLayer } from "t3/src/coderServer.ts";
import { WS_RPC_SERVER_OPTIONS } from "t3/src/ws.ts";

export const coderHelperHandlers = CoderHelperRpcGroup.toLayer({
[CODER_HELPER_INFO_METHOD]: ({ protocolVersion }) =>
protocolVersion === CODER_HELPER_PROTOCOL_VERSION
? Effect.succeed({
protocolVersion: CODER_HELPER_PROTOCOL_VERSION,
platform: process.platform,
architecture: process.arch,
})
: Effect.fail(
new CoderHelperProtocolError({
message: `Unsupported protocol version ${protocolVersion}.`,
supportedVersion: CODER_HELPER_PROTOCOL_VERSION,
}),
),
});

const coderServerConfigLayer = Layer.effect(
ServerConfig.ServerConfig,
Effect.gen(function* () {
const path = yield* Path.Path;
const baseDir =
process.env.T3_CODER_HOME?.trim() || path.join(process.env.HOME ?? ".", ".t3-coder");
const cwd = process.env.T3_CODER_CWD?.trim() || process.env.HOME?.trim() || process.cwd();
const derivedPaths = yield* ServerConfig.deriveServerPaths(baseDir);
yield* ServerConfig.ensureServerDirectories(derivedPaths);
return ServerConfig.ServerConfig.of({
...derivedPaths,
cwd,
baseDir,
});
}),
);

export const CoderWorkspaceRpcGroup = CoderHelperRpcGroup.merge(CoderWsRpcGroup);

export const coderHelperStdioLayer = RpcServer.layer(
CoderWorkspaceRpcGroup,
WS_RPC_SERVER_OPTIONS,
).pipe(
Layer.provide(Layer.mergeAll(coderHelperHandlers, makeCoderRuntimeLayer(), DefectReporter.layer)),
Layer.provide(
Layer.effect(RpcServer.Protocol, Effect.map(RpcServer.Protocol, withTerminalOutputWindow)).pipe(
Layer.provide(RpcServer.layerProtocolStdio),
),
),
Layer.provide(RpcSerialization.layerNdjson),
Layer.provide(NodeStdio.layer),
Layer.provide(coderServerConfigLayer),
Layer.provide(NodeServices.layer),
// Keep Effect logs, including DefectReporter's, off stdout, which carries the NDJSON RPC
// transport. The helper launch discards stderr, so these logs are not kept anywhere.
Layer.provide(Layer.succeed(Logger.LogToStderr)(true)),
);
1 change: 0 additions & 1 deletion apps/web/src/branding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ export const APP_DISPLAY_NAME = APP_STAGE_LABEL
? `${APP_BASE_NAME} ${APP_STAGE_LABEL}`
: APP_BASE_NAME;
export const APP_VERSION = import.meta.env.APP_VERSION || "0.0.0";
export const DESKTOP_DOWNLOAD_URL = "https://t3.codes/download";
3 changes: 2 additions & 1 deletion apps/web/src/components/chat/ChatHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ export const ChatHeader = memo(function ChatHeader({
if (isTrailingDoubleClick(event.detail)) return;
const clickedChevron =
(event.target as HTMLElement).closest("[data-thread-title-chevron]") !== null;
if (event.detail === 0 || clickedChevron) {
// Coder: the fork's Window type has no `desktopBridge`; the browser opens at once, as upstream's web build does.
if (event.detail === 0 || clickedChevron || !("desktopBridge" in window)) {
openTitleMenuNow();
return;
}
Expand Down
4 changes: 0 additions & 4 deletions apps/web/src/components/chat/ThreadDetailsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ export function ThreadDetailsPanel(props: ThreadDetailsPanelProps) {
/>
) : null}

{density === "full" ? (
<BranchToolbar layout="panel" panelSection="workspace" {...branchToolbarProps} />
) : null}

{props.activeProjectScripts ? (
<ProjectScriptsControl
environmentId={props.environmentId}
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/chat/TimelineUserMessageRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
className="me-1 text-2xs text-muted-foreground/70"
data-user-message-attribution="t3code"
>
Sent by T3 Code
{/* Coder: messages T3 sent are attributed under the T3 Coder name. */}
Sent by T3 Coder
</p>
) : null}
{row.message.inputIntent === "steer" ||
Expand Down
110 changes: 0 additions & 110 deletions apps/web/src/components/chat/claudeCompaction.test.ts

This file was deleted.

45 changes: 0 additions & 45 deletions apps/web/src/components/chat/claudeCompaction.ts

This file was deleted.

Loading