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
121 changes: 120 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,126 @@ This file is the canonical source for unreleased changes and published release n

## Format

- Add in-progress work under `## [Unreleased]
- Add in-progress work under `## [Unreleased]`.

## [Unreleased]

### @codeworksh/desktop

#### Added

- Accounts and workspaces through Clerk and Relay: the app requires sign-in (staying usable locally if Clerk cannot be reached), creates a personal workspace named after your account, lets you switch or create workspaces, and adds Profile under Personal settings.
- Machine pairing and workspace linking: one Machines page for This Machine, Paired Machines, Waiting to Connect (approve or decline pending codes) and Workspace Machines, plus a dedicated This Machine page for installing, starting, stopping and restarting the local server and editing its executable, home directory, arguments and environment variables.
- Guided machine setup when the local CLI is missing, stopped or not linked to the active workspace, with server settings inline and a "Set Up Later" option per workspace.
- A machine picker on the start page to start sessions on any connected local or paired machine, remembering the last machine and scoping folders, models, clones and notices to it.
- Connectors settings (`Providers`, `MCP Connectors`, `Integrations`) backed by the host's connector catalog and local connection vault: browse and filter connectors, sign in with OAuth (through the shared `http://127.0.0.1/oauth/callback` loopback listener), device code or API key, inspect auto-detected host env credentials, pick a default connection, switch connections on or off, reconnect expired ones or remove them, scoped to the selected machine.
- MCP Connectors in Project Settings and This Session: see user `mcp.json`, project `mcp.json` and layer-added connectors, switch servers off or on, attach or detach catalog connectors without editing `mcp.json`, and pick which stored account each connector runs on.
- Fault pages (`Page Not Found` and `Page Crashed`) with error details, copy, Try Again and Go Home actions so a broken route does not take down the window.

#### Changed

- The old Servers and Providers settings pages are replaced by Machines (with its own This Machine page) and the Connectors pages (`Providers`, `MCP Connectors`, `Integrations`). Settings opens on Providers by default.
- `app.db` drops the local `organization` table and stores the app's pairing key (`device`) along with remote machine metadata (`label`, `version`, `seen_at`, `identity`, `workspaces`, `device`, `machine_key`).

#### Removed

- Removed the Settings › Tabs page and the `tabs.reorder` RPC; tab shortcuts (`⌘1`–`9` / `Ctrl+1`–`9`) stay unchanged.

#### Fixed

- In the Git Changes widget, the Retry button stays hidden when a space has no git daemon (`unavailable`) or is detached (`detached`), showing only for a git failure or unreachable server.
- Polished Machines settings layouts, status checks, notices and reconnect states.

#### Breaking Changes

- An `app.db` from 0.5.0 is not upgraded; delete it before starting the new build.
- Builds require `CLERK_PUBLISHABLE_KEY` at build time.

### @codeworksh/cli

#### Added

- Machine identity and Relay workspace linking: `codework serve` creates `<home>/machine.json` with a per-home identity key at startup and sends heartbeats to linked workspaces. `codework connect [--workspace <id>] [--machine-id <id>]` links a machine through an approval code, and `codework disconnect [--workspace <id>]` revokes a link (retrying on heartbeats if Relay is unreachable).
- Authenticated RPC server door and SSH-style device pairing: local callers authenticate from loopback only using a fresh per-start token written to `<home>/service.json` (mode `0600`), and browser requests carrying an `Origin` header are refused. Remote computers pair via `codework service pair` (10-minute one-time code), `codework service devices` and `codework service revoke <id>`, exchanging signed proofs for single-use WebSocket tickets.
- `--trusted-proxy` on `codework serve` (alongside `CODEWORK_TRUSTED_PROXY` and the `server.trustedProxy` user setting) to trust `X-Forwarded-Proto` from specific IPs or CIDR ranges.
- Connectors and local connection vault (`<home>/connections.db`): `codework connect discover`, `categories`, `create`, `login`, `list`, `status`, `disconnect` and `remove` manage provider, MCP and integration connections (OAuth, device code, API key and auto-detected host env) against the connector catalog at `catalog.codework.sh` (cached locally with ETag).
- MCP connector scoping commands: `codework mcp add --connector <id>`, `codework mcp view`, `off`, `on`, `attach`, `detach`, `account` and `reset` (targeting Project Settings by default, or This Session with `--session`).
- Host RPC endpoints: `machine.info`, `machine.rename`, `machine.connect`, `machine.disconnect`, `device.pair`, `device.list`, `device.revoke`, `device.leave`, `connectors.catalog`, `connections.*` (`list`, `get`, `create`, `update`, `remove`, `setApiKey`, `disconnect`, `oauth.start`, `oauth.finish`, `oauth.deviceStart`, `oauth.devicePoll`), `mcp.view` and `mcp.edit`.

#### Changed

- Commands that talk to a running server (`mcp reconnect`, `mcp disconnect`, `plugin reload`, etc.) default `--server` to this home's server from `service.json` instead of hardcoding `ws://127.0.0.1:7433/rpc/v1`.
- Plain CLI errors for invalid ids, flag errors and refused server connections.
- `<home>/token` files left by earlier builds are deleted when `codework serve` starts.
- The host RPC contract moves to `@codeworksh/schema/host`; the CLI server and desktop app import the same declaration.
- OAuth sign-in identifies CodeWork with its Client ID Metadata Document (`https://codework.sh/oauth/client.json` or a per-resource document) and shared `/oauth/callback` loopback path when the authorization server supports it, falling back to Dynamic Client Registration.

#### Breaking Changes

- The RPC WebSocket listener requires authentication (loopback token for local callers, paired-device ticket for remote callers); unauthenticated connections and non-loopback token connections are refused.
- `codework mcp add` no longer accepts `auth` options in `mcp.json`; use `--connector <id>` instead.

### @codeworksh/harness

#### Added

- Connector broker integration (`@codeworksh/plugin/connector`): `ModelCatalog` and the LLM runner resolve provider credentials and available models through the host-supplied `Connector.Broker` when provided, alongside existing credentials.
- MCP soft layers (`Project Settings` and `This Session`) stored in `codework.db` (`project_mcp`, `session_mcp` and `mcp_account` tables): each layer can switch off servers enabled below it, attach or detach catalog connectors not named in `mcp.json`, and pick which stored account a connector runs on. Accounts are pinned per run so mid-run default changes take effect on the next run, and turning a connection off mid-turn fails further calls as disabled rather than asking to sign in.
- `{ "connector": "<id>" }` entries in `mcp.json`, backed by stored, enabled vault connections validated against `allowedHosts` with single-flight token refresh locking.
- OAuth Client ID Metadata Document (CIMD) support and shared `/oauth/callback` loopback matching (`mcp/cimd.ts`), using `https://codework.sh/oauth/client.json` when the server advertises RFC 9207 `iss` support or a per-resource document and callback path otherwise, without storing CIMD client ids as DCR registrations in `mcpauth.json`.
- Persistent `space_state` table in `codework.db`: space daemons store their latest event per space and type so clients subscribing after a server restart receive the last state before the space mounts again.
- Runtime `Actor.Current` propagation from `@codeworksh/schema/actor` across `Control`, sessions, threads and OpenTelemetry span attributes (`codework.actor.id`, `codework.actor.scope`).
- User-only `server.trustedProxy` setting (`Settings.proxyNetwork`), ignored in project settings files.
- `@codeworksh/harness/effect` exports `Actor`, `Connector`, `McpLayers`, `McpStore`, `OAuthCimd` and `Settings.proxyNetwork`.

#### Changed

- `mcp.json` entries are whole and no longer merge partial project overrides into user entries: a project entry replaces the user entry with the same name or connector.
- Shared domain schemas and error classes (`PromptConflictError`, `SettingsError`, `Session.Failure`, ids, projects, spaces, locations, events, sandbox instances) live in `@codeworksh/schema` and are re-exported from the harness where exposed.

#### Removed

- `auth: { provider }` on HTTP entries in `mcp.json`, replaced by `{ "connector": "<id>" }`.

#### Breaking Changes

- `mcp.json` entries using `auth: { provider }` or partial project overrides (entries without `command`, `url` or `connector`) are rejected during validation.

### @codeworksh/plugin

#### Added

- `@codeworksh/plugin/connector`: `Connector.Broker` service contract, `ResolvedCredential`, `McpConnection`, `ProviderConnectionState`, and `AuthRequiredError`, `ConnectorAuthError`, `HostNotAllowedError`.
- `ConnectorServer` in `@codeworksh/plugin/plugin/mcp`, added to `ServerConfig`.
- `Settings.Server`, `Settings.TrustedProxy` and `Settings.proxyNetwork` in `@codeworksh/plugin/settings`; `Settings.McpServer` gains `from: "user" | "project"` and `Settings.Info` gains `server.trustedProxy`.

#### Removed

- `HttpServer.auth` from `@codeworksh/plugin/plugin/mcp`.
- `Settings.McpServer.override` from `@codeworksh/plugin/settings`.

#### Breaking Changes

- Shared schemas moved to `@codeworksh/schema`, which is now a peer dependency of `@codeworksh/plugin`. Removed the `./ids`, `./project`, `./repo`, `./space` and `./sandbox/instance` subpath exports from `@codeworksh/plugin`; import those from `@codeworksh/schema/*` instead.

### @codeworksh/schema

#### Added

- New published, browser-safe contract package holding schemas shared across the harness, plugin SDK, CLI server, desktop app, widgets and Relay, one module per subpath: `./actor`, `./common`, `./connector`, `./daemon`, `./door`, `./event`, `./forwarded`, `./host` (with `./host/envelope`, `./host/part`, `./host/principal`, `./host/records`), `./ids`, `./jws`, `./location`, `./machine`, `./mcp`, `./model`, `./pairing`, `./project`, `./records`, `./relay`, `./repo`, `./sandbox/driver`, `./sandbox/errors`, `./sandbox/instance`, `./session`, `./settings`, `./shell`, `./space`, `./thread` and `./usage`.

### @codeworksh/aikit

#### Changed

- Refreshed the OAuth callback HTML pages (`oauthSuccessHtml`, `oauthErrorHtml`): "Connected to CodeWork" title and heading, light/dark color scheme support and status icons.

### Relay & Site

#### Added

- `infra/relay`: Effect `HttpApi` service over Postgres with Clerk authentication for accounts, personal and team workspaces, machine pairing, approval and decline, signed heartbeats, role-based removal and revocation.
- `sites/www`: hosts CodeWork's OAuth Client ID Metadata Documents at `https://codework.sh/oauth/client.json` and `https://codework.sh/oauth/<id>/client.json`.

## [@codeworksh/[email protected]] - 2026-11-15

Expand Down
8 changes: 0 additions & 8 deletions apps/contract/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,10 @@ export const TabCreate = Schema.Struct({
});
export const TabUpdate = Schema.Struct({
id: Schema.String,
name: Schema.optional(Schema.String),
layout: Schema.optional(Layout),
mfact: Schema.optional(Schema.Number),
label: Schema.optional(Schema.String),
});
export const TabOrder = Schema.Struct({ ids: Schema.Array(Schema.String) });
export const TabId = Schema.Struct({ id: Schema.String });

export class TabError extends Schema.TaggedError<TabError>()("Server.TabError", {
Expand Down Expand Up @@ -1068,12 +1066,6 @@ export const Api = RpcGroup.make(
success: Schema.Void,
error: TabError,
}),
/** Puts the tabs in this order; `ids` must name every tab once. */
Rpc.make("tabs.reorder", {
payload: TabOrder,
success: Schema.Void,
error: TabError,
}),
Rpc.make("tabs.delete", {
payload: TabId,
success: Schema.Void,
Expand Down
20 changes: 1 addition & 19 deletions apps/server/src/tabs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Clock, Effect } from "effect";
import { SqlClient } from "effect/sql";
import { Contract, type Tab, type TabCreate, type TabId, type TabOrder, type TabUpdate } from "@codeworksh/contract";
import { Contract, type Tab, type TabCreate, type TabId, type TabUpdate } from "@codeworksh/contract";

// webwm tag bits a tab may hold; also the Cmd+1–9 keys.
const MAX = 9;
Expand Down Expand Up @@ -80,24 +80,6 @@ export const handlers = Effect.gen(function* () {
if (updated.length === 0) return yield* fail(`No tab ${id}`);
}),

"tabs.reorder": Effect.fn("tabs.reorder")(function* ({ ids }: typeof TabOrder.Type) {
yield* sql
.withTransaction(
Effect.gen(function* () {
const current = yield* list;
const known = new Set(current.map((tab) => tab.id));
if (
ids.length !== known.size ||
new Set(ids).size !== ids.length ||
!ids.every((id) => known.has(id))
)
return yield* fail("The order must name every tab once");
yield* renumber(ids);
}),
)
.pipe(Effect.catchTag("SqlError", Effect.die));
}),

// The deleted bit leaves every widget's mask with it; a widget left on no tab goes too.
"tabs.delete": Effect.fn("tabs.delete")(function* ({ id }: typeof TabId.Type) {
yield* sql
Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/landing/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
FolderIcon,
FolderOpenIcon,
MagnifyingGlassIcon,
NotePencilIcon,
PlusIcon,
SquaresFourIcon,
XIcon,
Expand Down Expand Up @@ -167,7 +166,7 @@ export function SessionsSidebar() {
<SidebarHeader className="gap-1 px-2 pt-2 pb-3">
<WorkspaceSwitcher />
<button type="button" onClick={startNew} className={`${NAV_ROW} text-ink`}>
<NotePencilIcon size={15} className="shrink-0" aria-hidden />
<PlusIcon size={15} className="shrink-0" aria-hidden />
<span>New</span>
</button>
<div className="relative">
Expand Down
21 changes: 0 additions & 21 deletions apps/web/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { Route as ShellSettingsIndexRouteImport } from './routes/_shell.settings
import { Route as ShellSettingsIntegrationsRouteImport } from './routes/_shell.settings.integrations'
import { Route as ShellSettingsMcpRouteImport } from './routes/_shell.settings.mcp'
import { Route as ShellSettingsProvidersRouteImport } from './routes/_shell.settings.providers'
import { Route as ShellSettingsTabsRouteImport } from './routes/_shell.settings.tabs'
import { Route as ShellSettingsThemesRouteImport } from './routes/_shell.settings.themes'
import { Route as ShellTabsTabIdRouteImport } from './routes/_shell.tabs.$tabId'
import { Route as SettingsMachinesSetupRouteImport } from './routes/settings.machines.setup'
Expand Down Expand Up @@ -85,11 +84,6 @@ const ShellSettingsProvidersRoute = ShellSettingsProvidersRouteImport.update({
path: '/providers',
getParentRoute: () => ShellSettingsRoute,
} as any)
const ShellSettingsTabsRoute = ShellSettingsTabsRouteImport.update({
id: '/tabs',
path: '/tabs',
getParentRoute: () => ShellSettingsRoute,
} as any)
const ShellSettingsThemesRoute = ShellSettingsThemesRouteImport.update({
id: '/themes',
path: '/themes',
Expand Down Expand Up @@ -145,7 +139,6 @@ export interface FileRoutesByFullPath {
'/settings/integrations': typeof ShellSettingsIntegrationsRoute
'/settings/mcp': typeof ShellSettingsMcpRoute
'/settings/providers': typeof ShellSettingsProvidersRoute
'/settings/tabs': typeof ShellSettingsTabsRoute
'/settings/themes': typeof ShellSettingsThemesRoute
'/tabs/$tabId': typeof ShellTabsTabIdRoute
'/settings/machines/setup': typeof SettingsMachinesSetupRoute
Expand All @@ -165,7 +158,6 @@ export interface FileRoutesByTo {
'/settings/integrations': typeof ShellSettingsIntegrationsRoute
'/settings/mcp': typeof ShellSettingsMcpRoute
'/settings/providers': typeof ShellSettingsProvidersRoute
'/settings/tabs': typeof ShellSettingsTabsRoute
'/settings/themes': typeof ShellSettingsThemesRoute
'/tabs/$tabId': typeof ShellTabsTabIdRoute
'/settings/machines/setup': typeof SettingsMachinesSetupRoute
Expand All @@ -188,7 +180,6 @@ export interface FileRoutesById {
'/_shell/settings/integrations': typeof ShellSettingsIntegrationsRoute
'/_shell/settings/mcp': typeof ShellSettingsMcpRoute
'/_shell/settings/providers': typeof ShellSettingsProvidersRoute
'/_shell/settings/tabs': typeof ShellSettingsTabsRoute
'/_shell/settings/themes': typeof ShellSettingsThemesRoute
'/_shell/tabs/$tabId': typeof ShellTabsTabIdRoute
'/settings/machines/setup': typeof SettingsMachinesSetupRoute
Expand All @@ -211,7 +202,6 @@ export interface FileRouteTypes {
| '/settings/integrations'
| '/settings/mcp'
| '/settings/providers'
| '/settings/tabs'
| '/settings/themes'
| '/tabs/$tabId'
| '/settings/machines/setup'
Expand All @@ -231,7 +221,6 @@ export interface FileRouteTypes {
| '/settings/integrations'
| '/settings/mcp'
| '/settings/providers'
| '/settings/tabs'
| '/settings/themes'
| '/tabs/$tabId'
| '/settings/machines/setup'
Expand All @@ -253,7 +242,6 @@ export interface FileRouteTypes {
| '/_shell/settings/integrations'
| '/_shell/settings/mcp'
| '/_shell/settings/providers'
| '/_shell/settings/tabs'
| '/_shell/settings/themes'
| '/_shell/tabs/$tabId'
| '/settings/machines/setup'
Expand Down Expand Up @@ -351,13 +339,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ShellSettingsProvidersRouteImport
parentRoute: typeof ShellSettingsRoute
}
'/_shell/settings/tabs': {
id: '/_shell/settings/tabs'
path: '/tabs'
fullPath: '/settings/tabs'
preLoaderRoute: typeof ShellSettingsTabsRouteImport
parentRoute: typeof ShellSettingsRoute
}
'/_shell/settings/themes': {
id: '/_shell/settings/themes'
path: '/themes'
Expand Down Expand Up @@ -421,7 +402,6 @@ interface ShellSettingsRouteChildren {
ShellSettingsIntegrationsRoute: typeof ShellSettingsIntegrationsRoute
ShellSettingsMcpRoute: typeof ShellSettingsMcpRoute
ShellSettingsProvidersRoute: typeof ShellSettingsProvidersRoute
ShellSettingsTabsRoute: typeof ShellSettingsTabsRoute
ShellSettingsThemesRoute: typeof ShellSettingsThemesRoute
ShellSettingsIndexRoute: typeof ShellSettingsIndexRoute
ShellSettingsMachinesIdRoute: typeof ShellSettingsMachinesIdRoute
Expand All @@ -433,7 +413,6 @@ const ShellSettingsRouteChildren: ShellSettingsRouteChildren = {
ShellSettingsIntegrationsRoute: ShellSettingsIntegrationsRoute,
ShellSettingsMcpRoute: ShellSettingsMcpRoute,
ShellSettingsProvidersRoute: ShellSettingsProvidersRoute,
ShellSettingsTabsRoute: ShellSettingsTabsRoute,
ShellSettingsThemesRoute: ShellSettingsThemesRoute,
ShellSettingsIndexRoute: ShellSettingsIndexRoute,
ShellSettingsMachinesIdRoute: ShellSettingsMachinesIdRoute,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/routes/_shell.settings.index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { createFileRoute, redirect } from "@tanstack/react-router";

export const Route = createFileRoute("/_shell/settings/")({
beforeLoad: () => {
throw redirect({ to: "/settings/tabs" });
throw redirect({ to: "/settings/providers" });
},
});
5 changes: 0 additions & 5 deletions apps/web/src/routes/_shell.settings.tabs.tsx

This file was deleted.

Loading