Skip to content

refactor(shared): move the CLIProxy types into their own file - #1699

Merged
devswha merged 1 commit into
mainfrom
refactor/types-cliproxy
Oct 23, 2026
Merged

devswha merged 1 commit into
mainfrom
refactor/types-cliproxy

Conversation

@devswha

@devswha devswha commented Oct 23, 2026

Copy link
Copy Markdown
Owner

The first type-only slice of phase 2 (plan .omo/plans/feature-slices-plan.md, section 7, item 1): the CLIProxy types move out of shared/protocol.ts into shared/cliproxy.ts. Their routes were already split out (server/cliproxy-routes.ts, server/cliproxy.ts), so only the contract types were left in protocol.ts.

What changes

  • Moved: CLIProxyStatus, CLIProxyProvider, CLIProxyLogin and CLIProxyLoginStatus, verbatim with their doc comment, into the new shared/cliproxy.ts. The file holds types only, with no imports and no values.
  • Stays in protocol.ts: export type { CLIProxyStatus, CLIProxyProvider, CLIProxyLogin, CLIProxyLoginStatus } from "./cliproxy.ts"; at the old place, so every importer compiles unchanged: server/cliproxy.ts, server/cliproxy-routes.ts, server/cliproxy.test.ts, CLIProxyLogin.tsx, UsageAccountDialog.tsx, UsageHubConnect.tsx and UsageSettings.tsx.
  • No other protocol.ts declaration uses these four names, so nothing else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the route and its tests are untouched. A type-only re-export also adds no runtime import.

Checks

  • --color-moved: git diff --color-moved=plain origin/main...HEAD -- shared shows the four declarations and their comment as moved (32 lines). The only other line is the re-export in protocol.ts.
  • Client imports: bun run typecheck passes on both tsconfigs, so every importer still compiles through the re-export. No file in src/ or site/ imports shared/cliproxy.ts.
  • HERDR_TEST_MODE=unit bun test server/cliproxy.test.ts: 18 pass, 0 fail.
  • bun run check fast: passes (unit 6161 pass, 0 fail, 12 skip in 440 files, 8 at a time, 57.5s).

Overlapping open PRs

The open PRs that touch shared/protocol.ts (#1652, #1598, #1442, #1427) change none of these four types.

Move-only: moved declarations plus one re-export line. No changelog fragment: users see no change.

The first type-only slice (plan: .omo/plans/feature-slices-plan.md, section 7):
CLIProxyStatus, CLIProxyProvider, CLIProxyLogin and CLIProxyLoginStatus move
verbatim from shared/protocol.ts into shared/cliproxy.ts (types only). Their
routes were already split out; protocol.ts re-exports the four names, so every
importer compiles unchanged.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 50041fd and 8c03538.

📒 Files selected for processing: 2
  • shared/cliproxy.ts
  • shared/protocol.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

Merging without a CodeRabbit review, as a move-only PR (AGENTS.md). The merge pass checked head 8c03538 with git diff --color-moved=plain origin/main...HEAD -- shared: every changed line is moved code, except the one type re-export in shared/protocol.ts. The new shared/cliproxy.ts holds only the four types, with no imports or values. None of the four open PRs that touch shared/protocol.ts (#1427, #1442, #1598, #1652) mentions a CLIProxy type. All required checks are green.

@devswha
devswha merged commit 9759d62 into main Oct 23, 2026
17 checks passed
@devswha
devswha deleted the refactor/types-cliproxy branch October 23, 2026 03:27
devswha added a commit that referenced this pull request Oct 23, 2026
A type-only slice of phase 2 (plan `.omo/plans/feature-slices-plan.md`,
section 7, item 2), after CLIProxy (#1699): `PortalStatus` moves out of
`shared/protocol.ts` into `shared/portal.ts`. Its routes were already
split out (`server/portal.ts`), so only the contract type was left in
`protocol.ts`.

## What changes

- **Moved:** `PortalStatus`, verbatim with its doc comment, into the new
`shared/portal.ts`. The file holds types only, with no imports and no
values.
- **Stays in `protocol.ts`:**
- `export type { PortalStatus } from "./portal.ts";` at the old place,
so every importer compiles unchanged. They are `server/portal.ts`,
`server/portal.test.ts`, `server/api.contract.test.ts`,
`scripts/portal-regression.ts`, `src/lib/api.ts`, `src/lib/portal.ts`
and `site/demo/transport.ts`.
  - The HTTP API doc comment that names `PortalStatus` (line 105).
- **No other `protocol.ts` declaration uses `PortalStatus`.**

There is no behaviour to pin: types are erased at runtime, and the
routes and their tests are untouched.

## Checks

- **`--color-moved`:** `git diff --color-moved=plain origin/main...HEAD
-- shared` shows the declaration and its comment as moved (54 lines).
The only other line is the re-export in `protocol.ts`.
- **Client imports:** `bun run typecheck` passes on both tsconfigs. No
file in `src/` or `site/` imports `shared/portal.ts`.
- `HERDR_TEST_MODE=unit bun test server/portal.test.ts
src/lib/portal.test.ts`: **38 pass, 0 fail**.
- `bun run check fast`: passes (unit 6161 pass, 0 fail, 12 skip in 440
files, 8 at a time, 57.4s).

## Overlapping open PRs

Open PRs that touch `shared/protocol.ts`: #1652, #1598, #1442 and #1427.
I checked each diff for `PortalStatus`:
- #1652, #1598 and #1442 do not change it.
- #1427 edits import lines in `server/api.contract.test.ts` and
`site/demo/transport.ts` that name `PortalStatus`. Both import it from
`protocol.ts`, so they still resolve through the re-export.

Move-only: one moved declaration plus one re-export line. No changelog
fragment: users see no change.
devswha added a commit that referenced this pull request Oct 23, 2026
#1701)

A type-only slice of phase 2 (plan `.omo/plans/feature-slices-plan.md`,
section 7, item 3), after CLIProxy (#1699) and Portal (#1700): the
directory browser types move out of `shared/protocol.ts` into
`shared/directories.ts`. Their routes were already split out
(`server/workspace-routes.ts` and `server/directories.ts`), so only the
contract types were left in `protocol.ts`.

## What changes

- **Moved:** `DirectoryListing`, `CreateDirectoryRequest`,
`DirectoryCreated`, verbatim with their doc comments, into the new
`shared/directories.ts`. The file holds types only, with no values.
- **Stays in `protocol.ts`:** `export type { DirectoryListing,
CreateDirectoryRequest, DirectoryCreated } from "./directories.ts";` at
the old place, so every importer compiles unchanged.
- **No other `protocol.ts` declaration uses these names**, so nothing
else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the
routes and their tests are untouched.

## Checks

- **`--color-moved`:** `git diff --color-moved=plain origin/main...HEAD
-- shared` shows the declarations and their comments as moved (64
lines). The only other line is the re-export in `protocol.ts`.
- **Client imports:** `bun run typecheck` passes on both tsconfigs, so
every importer still compiles through the re-export. No file in `src/`
or `site/` imports `shared/directories.ts`.
- `HERDR_TEST_MODE=unit bun test server/directories.test.ts`: **6 pass,
0 fail**.
- `bun run check fast`: passes (unit 6161 pass, 0 fail, 12 skip in 440
files, 8 at a time, 57.3s).

## Overlapping open PRs

Open PRs that touch `shared/protocol.ts`: #1652, #1598, #1442, #1427. I
checked each diff for `DirectoryListing`, `CreateDirectoryRequest` and
`DirectoryCreated`:
- #1652, #1598, #1442 do not change them.
- #1427 edits `server/workspace-routes.ts`, which imports them from
`protocol.ts`. That import still resolves through the re-export.

Move-only: moved declarations plus one re-export line. No changelog
fragment: users see no change.
devswha added a commit that referenced this pull request Oct 23, 2026
…1703)

A type-only slice of phase 2 (plan `.omo/plans/feature-slices-plan.md`,
section 7, item 4), after CLIProxy (#1699), Portal (#1700) and
directories (#1701): the terminal find types move out of
`shared/protocol.ts` into `shared/find.ts`. Their routes were already
split out (`server/pane-routes.ts`), so only the contract types were
left in `protocol.ts`.

## What changes

- **Moved:** `PaneFindMatch`, `PaneFindRequest`, `PaneFindResponse`,
verbatim with their doc comments, into the new `shared/find.ts`. The
file holds types only, with no values; it imports `PaneScrollInfo` from
`./herdr-api.generated.ts`, as `protocol.ts` did.
- **Stays in `protocol.ts`:** `export type { PaneFindMatch,
PaneFindRequest, PaneFindResponse } from "./find.ts";` at the old place,
so every importer compiles unchanged.
- **No other `protocol.ts` declaration uses these names**, so nothing
else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the
routes and their tests are untouched.

## Checks

- **`--color-moved`:** `git diff --color-moved=plain origin/main...HEAD
-- shared` shows the declarations and their comments as moved (56
lines). The other lines are the re-export in `protocol.ts`, the
`PaneScrollInfo` type import at the top of `shared/find.ts`, and
`protocol.ts`'s own local type import from the generated file without
`PaneScrollInfo`, which only these types used there. `PaneScrollInfo`
stays re-exported from `protocol.ts` as before.
- **Client imports:** `bun run typecheck` passes on both tsconfigs, so
every importer still compiles through the re-export. No file in `src/`
or `site/` imports `shared/find.ts`.
- `HERDR_TEST_MODE=unit bun test src/lib/paneFind.test.ts
scripts/demo-history.test.ts`: **6 pass, 0 fail**.
- `bun run check fast`: passes (unit 6161 pass, 0 fail, 12 skip in 440
files, 8 at a time, 57.7s).

## Overlapping open PRs

Open PRs that touch `shared/protocol.ts`: #1652, #1598, #1442, #1427. I
checked each diff for `PaneFindMatch`, `PaneFindRequest` and
`PaneFindResponse`:
- #1652, #1598, #1442 do not change them.
- #1427 edits `server/api.contract.test.ts` and
`site/demo/transport.ts`, which import them from `protocol.ts`. Those
imports still resolve through the re-export.

Move-only apart from imports: moved declarations, one re-export line,
and the two type-import lines above. No changelog fragment: users see no
change.
devswha added a commit that referenced this pull request Oct 23, 2026
A type-only slice of phase 2 (plan `.omo/plans/feature-slices-plan.md`,
section 7, item 5), after CLIProxy (#1699), Portal (#1700), directories
(#1701) and terminal find (#1703): the web push types move out of
`shared/protocol.ts` into `shared/push.ts`. Their routes were already
split out (`server/push.ts`), so only the contract types were left in
`protocol.ts`.

## What changes

- **Moved:** `PushKey`, `PushPayload`, verbatim with their doc comments,
into the new `shared/push.ts`. The file holds types only, with no
values.
- **Stays in `protocol.ts`:** `export type { PushKey, PushPayload } from
"./push.ts";` at the old place, so every importer compiles unchanged.
The two types sat in two places in `protocol.ts` (`PushKey` near the
top, `PushPayload` beside the WebSocket messages); both now come from
this one line at `PushKey`'s old place.
- **No other `protocol.ts` declaration uses these names**, so nothing
else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the
routes and their tests are untouched.

## Checks

- **`--color-moved`:** `git diff --color-moved=plain origin/main...HEAD
-- shared` shows the declarations and their comments as moved (43
lines). The only other line is the re-export in `protocol.ts`.
- **Client imports:** `bun run typecheck` passes on both tsconfigs, so
every importer still compiles through the re-export. No file in `src/`
or `site/` imports `shared/push.ts`.
- `HERDR_TEST_MODE=unit bun test server/push.test.ts
src/lib/notifications.test.ts`: **50 pass, 0 fail**.
- `bun run check fast`: passes (unit 6161 pass, 0 fail, 12 skip in 440
files, 8 at a time, 57.3s).

## Overlapping open PRs

Open PRs that touch `shared/protocol.ts`: #1706, #1652, #1598, #1442,
#1427. I checked each diff for `PushKey` and `PushPayload`:
- #1706, #1652, #1598, #1442 do not change them.
- #1427 edits `server/api.contract.test.ts`, which imports them from
`protocol.ts`. That import still resolves through the re-export.

Move-only: moved declarations plus one re-export line. No changelog
fragment: users see no change.
devswha added a commit that referenced this pull request Oct 23, 2026
A type-only slice of phase 2 (plan `.omo/plans/feature-slices-plan.md`,
section 7, item 6), after CLIProxy (#1699), Portal (#1700), directories
(#1701), terminal find (#1703) and web push (#1707): the usage types
move out of `shared/protocol.ts` into `shared/usage.ts`. Their routes
were already split out (`server/usage.ts`), so only the contract types
were left in `protocol.ts`.

## What changes

- **Moved:** `UsageProviderId`, `UsageWindow`, `UsageProblem`,
`ProviderUsage`, `UsageReport`, verbatim with their doc comments, into
the new `shared/usage.ts`. The file holds types only, with no values.
- **Stays in `protocol.ts`:** `export type { UsageProviderId,
UsageWindow, UsageProblem, ProviderUsage, UsageReport } from
"./usage.ts";` at the old place, so every importer compiles unchanged.
- **No other `protocol.ts` declaration uses these names**, so nothing
else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the
routes and their tests are untouched.

## Checks

- **`--color-moved`:** `git diff --color-moved=plain origin/main...HEAD
-- shared` shows the declarations and their comments as moved (96
lines). The only other line is the re-export in `protocol.ts`.
- **Client imports:** `bun run typecheck` passes on both tsconfigs, so
every importer still compiles through the re-export. No file in `src/`
or `site/` imports `shared/usage.ts`.
- `HERDR_TEST_MODE=unit bun test server/usage.test.ts
src/lib/usage.test.ts`: **68 pass, 0 fail**.
- `bun run check fast`: passes (unit 6161 pass, 0 fail, 12 skip in 440
files, 8 at a time, 57.4s).

## Overlapping open PRs

Open PRs that touch `shared/protocol.ts`: #1706, #1652, #1598, #1442,
#1427. I checked each diff for `UsageProviderId`, `UsageWindow`,
`UsageProblem`, `ProviderUsage`, `UsageReport`:
- #1706, #1652, #1598, #1442 do not change them.
- #1427 edits `server/api.contract.test.ts` and
`site/demo/transport.ts`, which import them from `protocol.ts`. Those
imports still resolve through the re-export.

Move-only: moved declarations plus one re-export line. No changelog
fragment: users see no change.
devswha added a commit that referenced this pull request Oct 23, 2026
…1710)

A type-only slice of phase 2 (plan `.omo/plans/feature-slices-plan.md`,
section 7, item 8), after CLIProxy (#1699), Portal (#1700), directories
(#1701), terminal find (#1703), web push (#1707) and usage (#1708);
session history (item 7) waits while the open PR #1598 rewrites those
types: the repository diff types move out of `shared/protocol.ts` into
`shared/repo-diff.ts`. Their routes were already split out
(`server/workspace-routes.ts` and `server/repo-diff.ts`), so only the
contract types were left in `protocol.ts`.

## What changes

- **Moved:** `RepoDiffScope`, `RepoDiffStatus`, `RepoDiffRepository`,
`RepoDiffFile`, `RepoDiffFileList`, `RepoDiffFilePatch`, verbatim with
their doc comments, into the new `shared/repo-diff.ts`. The file holds
types only, with no values.
- **Stays in `protocol.ts`:** `export type { RepoDiffScope,
RepoDiffStatus, RepoDiffRepository, RepoDiffFile, RepoDiffFileList,
RepoDiffFilePatch } from "./repo-diff.ts";` at the old place, so every
importer compiles unchanged.
- **No other `protocol.ts` declaration uses these names**, so nothing
else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the
routes and their tests are untouched.

## Checks

- **`--color-moved`:** `git diff --color-moved=plain origin/main...HEAD
-- shared` shows the declarations and their comments as moved (140
lines). The only other line is the re-export in `protocol.ts`.
- **Client imports:** `bun run typecheck` passes on both tsconfigs, so
every importer still compiles through the re-export. No file in `src/`
or `site/` imports `shared/repo-diff.ts`.
- `HERDR_TEST_MODE=unit bun test server/repo-diff.test.ts
src/lib/repoDiff.test.ts src/lib/diff.test.ts`: **36 pass, 0 fail**.
- `bun run check fast`: passes (unit 6161 pass, 0 fail, 12 skip in 440
files, 8 at a time, 57.3s).

## Overlapping open PRs

Open PRs that touch `shared/protocol.ts`: #1706, #1652, #1598, #1442,
#1427. I checked each diff for `RepoDiffScope`, `RepoDiffStatus`,
`RepoDiffRepository`, `RepoDiffFile`, `RepoDiffFileList`,
`RepoDiffFilePatch`:
- #1706, #1652, #1442, #1427 do not change them.
- #1598 edits `server/api.contract.test.ts` and
`site/demo/transport.ts`, which import them from `protocol.ts`. Those
imports still resolve through the re-export.

Move-only: moved declarations plus one re-export line. No changelog
fragment: users see no change.
devswha added a commit that referenced this pull request Oct 23, 2026
#1711)

A type-only slice of phase 2 (plan `.omo/plans/feature-slices-plan.md`,
section 7, item 9), after CLIProxy (#1699), Portal (#1700), directories
(#1701), terminal find (#1703), web push (#1707), usage (#1708) and
repository diff (#1710); session history (item 7) waits while the open
PR #1598 rewrites those types: the access and device types move out of
`shared/protocol.ts` into `shared/access.ts`. Their routes were already
split out (`server/access.ts`, `server/devices.ts` and
`server/tailscale.ts`), so only the contract types were left in
`protocol.ts`.

## What changes

- **Moved:** `AccessVia`, `AccessRefusal`, `DeviceRole`, `HealthAuth`,
`LanExposure`, `PairedDevice`, `PairingCode`, `RemoteAccess`,
`TailscaleAccess`, verbatim with their doc comments, into the new
`shared/access.ts`. The file holds types only, with no values.
- **Stays in `protocol.ts`:** `export type { AccessVia, AccessRefusal,
DeviceRole, HealthAuth, LanExposure, PairedDevice, PairingCode,
RemoteAccess, TailscaleAccess } from "./access.ts";` at the old place,
so every importer compiles unchanged, including `shared/machines.ts`,
which imports `HealthAuth` from `protocol.ts` (the plan's check for this
family).
- **No other `protocol.ts` declaration uses these names**, so nothing
else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the
routes and their tests are untouched.

## Checks

- **`--color-moved`:** `git diff --color-moved=plain origin/main...HEAD
-- shared` shows the declarations and their comments as moved (138
lines). The only other line is the re-export in `protocol.ts`.
- **Client imports:** `bun run typecheck` passes on both tsconfigs, so
every importer still compiles through the re-export. No file in `src/`
or `site/` imports `shared/access.ts`.
- `HERDR_TEST_MODE=unit bun test server/access.test.ts
server/devices.test.ts server/pairing.test.ts server/tailscale.test.ts`:
**80 pass, 0 fail**.
- `bun run check fast`: passes (unit 6161 pass, 0 fail, 12 skip in 440
files, 8 at a time, 57.6s).

## Overlapping open PRs

Open PRs that touch `shared/protocol.ts`: #1706, #1652, #1598, #1442,
#1427. I checked each diff for `AccessVia`, `AccessRefusal`,
`DeviceRole`, `HealthAuth`, `LanExposure`, `PairedDevice`,
`PairingCode`, `RemoteAccess`, `TailscaleAccess`:
- #1706, #1652, #1598, #1442 do not change them.
- #1427 edits `server/api.contract.test.ts`, which imports them from
`protocol.ts`. That import still resolves through the re-export.

Move-only: moved declarations plus one re-export line. No changelog
fragment: users see no change.
devswha added a commit that referenced this pull request Oct 23, 2026
A type-only slice of phase 2 (plan `.omo/plans/feature-slices-plan.md`,
section 7, item 10), after CLIProxy (#1699), Portal (#1700), directories
(#1701), terminal find (#1703), web push (#1707), usage (#1708),
repository diff (#1710) and access (#1711); session history (item 7)
waits while the open PR #1598 rewrites those types: the pane layout
types move out of `shared/protocol.ts` into `shared/pane-layout.ts`.
Their routes were already split out (`server/pane-routes.ts`), so only
the contract types were left in `protocol.ts`.

## What changes

- **Moved:** `SplitPaneDirection`, `PaneDirection`, `SplitPaneRequest`,
`PaneSplit`, `ZoomPaneRequest`, `PaneZoomed`, `FocusPaneRequest`,
`SwapPaneRequest`, `PaneSwapped`, `ResizePaneRequest`, `PaneResized`,
`SetSplitRatioRequest`, verbatim with their doc comments, into the new
`shared/pane-layout.ts`. The file holds types only, with no values; it
imports `PaneInfo` (for `PaneSplit`) from `./herdr-api.generated.ts`, as
`protocol.ts` does.
- **Stays in `protocol.ts`:** `export type { SplitPaneDirection,
PaneDirection, SplitPaneRequest, PaneSplit, ZoomPaneRequest, PaneZoomed,
FocusPaneRequest, SwapPaneRequest, PaneSwapped, ResizePaneRequest,
PaneResized, SetSplitRatioRequest } from "./pane-layout.ts";` at the old
place, so every importer compiles unchanged.
- **No other `protocol.ts` declaration uses these names**, so nothing
else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the
routes and their tests are untouched.

## Checks

- **`--color-moved`:** `git diff --color-moved=plain origin/main...HEAD
-- shared` shows the declarations and their comments as moved (159
lines). The other lines are the re-export in `protocol.ts` and the
`PaneInfo` type import at the top of `shared/pane-layout.ts`.
`protocol.ts` keeps its own `PaneInfo` import, which its other
declarations still use.
- **Client imports:** `bun run typecheck` passes on both tsconfigs, so
every importer still compiles through the re-export. No file in `src/`
or `site/` imports `shared/pane-layout.ts`.
- These routes are covered by contract tests against an isolated live
herdr (`server/pane-layout.contract.test.ts`,
`server/api.contract.test.ts`,
`server/route-envelope.contract.test.ts`), which CI's integration lane
runs; the unit lane has none to run here.
- `bun run check fast`: passes (unit 6161 pass, 0 fail, 12 skip in 440
files, 8 at a time, 57.4s).

## Overlapping open PRs

Open PRs that touch `shared/protocol.ts`: #1706, #1652, #1598, #1442,
#1427. I checked each diff for the twelve names:
- #1706, #1652, #1442 do not change them.
- #1598 edits `src/lib/machineContext.tsx`, which imports them from
`protocol.ts`. That import still resolves through the re-export.
- #1427 edits `site/demo/transport.ts`, which imports them from
`protocol.ts`. That import still resolves through the re-export.

Move-only apart from imports: moved declarations, one re-export line and
one type import. No changelog fragment: users see no change.
devswha added a commit that referenced this pull request Oct 23, 2026
…s into their own file (#1713)

The last type-only slice of phase 2 that can go now (plan
`.omo/plans/feature-slices-plan.md`, section 7, item 11). It follows:
- CLIProxy (#1699)
- Portal (#1700)
- directories (#1701)
- terminal find (#1703)
- web push (#1707)
- usage (#1708)
- repository diff (#1710)
- access (#1711)
- pane layout (#1712)

This slice moves the workspace, tab and worktree lifecycle types out of
`shared/protocol.ts` into `shared/workspace-lifecycle.ts`. Their routes
were already split out (`server/workspace-routes.ts`). Session history
(item 7) waits while the open PR #1598 rewrites those types.

## What changes

- **Moved, verbatim with their doc comments,** into the new
`shared/workspace-lifecycle.ts`:
  - `WorkspaceMoved`;
- `CreateWorkspaceRequest`, `CreateTabRequest`, `CreateWorktreeRequest`;
  - `MoveTabRequest`, `TabMoved`;
  - `OpenWorktreeRequest`, `WorktreeOpened`;
  - `RemoveWorktreeRequest`, `WorktreeRemoved`;
  - `WorktreeEntry`, `WorktreeListing`;
  - `WorkspaceCreated`, `TabCreated`.

  The file holds types only, with no values.
- **One import in the new file:** `TabMoved` uses `HerdrTab`, which
`protocol.ts` defines as an alias of the generated `TabInfo`. The new
file imports `TabInfo as HerdrTab` from `./herdr-api.generated.ts`, so
the moved lines stay unchanged. It does not import back from
`protocol.ts`.
- **Three places in `protocol.ts`:** the types sat in three places
there. `WorkspaceMoved` sat by the snapshot types, and the others sat in
two blocks on either side of `AgentRenameRequest`.
- `AgentRenameRequest` stays, because it belongs to the agent rename
route, not to this family.
- `WorkspaceMoved`'s old place keeps `export type { WorkspaceMoved }
from "./workspace-lifecycle.ts";`.
- The first block's old place keeps one `export type { … } from
"./workspace-lifecycle.ts";` for the other thirteen names.

  Every importer compiles unchanged.
- **No other `protocol.ts` declaration uses these names,** so nothing
else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the
routes and their tests are untouched.

## Checks

- **`--color-moved`:** `git diff --color-moved=plain origin/main...HEAD
-- shared` shows 252 lines as moved. The other lines are the two
re-export lines in `protocol.ts` and the `TabInfo as HerdrTab` type
import at the top of the new file.
- **Client imports:** `bun run typecheck` passes on both tsconfigs. No
file in `src/` or `site/` imports `shared/workspace-lifecycle.ts`.
- `HERDR_TEST_MODE=unit bun test server/order-sequence.test.ts
scripts/demo-tabs.test.ts scripts/demo-first-message.test.ts
src/lib/workspaceOrder.test.ts`: **42 pass, 0 fail**. The routes
themselves are covered by contract tests against an isolated live herdr
(`server/api.contract.test.ts`,
`server/route-envelope.contract.test.ts`,
`server/pending-input.contract.test.ts`), which CI's integration lane
runs.
- `bun run check fast`: passes (unit 6161 pass, 0 fail, 12 skip in 440
files, 8 at a time, 57.5s).

## Overlapping open PRs

Open PRs that touch `shared/protocol.ts`: #1706, #1652, #1598, #1442,
#1427. I checked each diff for the fourteen names:
- #1706, #1652, #1442 do not change them.
- #1598 edits `scripts/session-history-browser-qa.ts`,
`src/components/SessionHistory.tsx`, `src/lib/machineContext.tsx` and
`src/lib/sessionHistory.ts`, which import them from `protocol.ts`. Those
imports still resolve through the re-export.
- #1427 edits `server/api.contract.test.ts`,
`server/workspace-routes.ts` and `site/demo/transport.ts`, which import
them from `protocol.ts`. Those imports still resolve through the
re-export.

Move-only apart from imports: moved declarations, two re-export lines
and one type import. No changelog fragment: users see no change.
devswha added a commit that referenced this pull request Oct 23, 2026
…1753)

The last type-only slice of phase 2 (plan
`.omo/plans/feature-slices-plan.md`, section 7, item 7). It follows the
other type-only slices (#1699 to #1713) and waited for the session
resume PR (#1598), which added `SessionResumeSource`,
`SessionResumeRequest` and `SessionResumeResponse` beside the history
types. The session history types move out of `shared/protocol.ts` into
`shared/session-history.ts`. Their routes were already split out
(`server/session-history-routes.ts`), so only the contract types were
left in `protocol.ts`.

## What changes

- **Moved:** `SessionHistoryAgent`, `SessionResumeSource`,
`SessionHistoryRow`, `SessionResumeRequest`, `SessionResumeResponse`,
`SessionHistoryResponse`, verbatim with their doc comments, into the new
`shared/session-history.ts`. The file holds types only, with no imports
and no values.
- **Stays in `protocol.ts`:** `export type { SessionHistoryAgent,
SessionResumeSource, SessionHistoryRow, SessionResumeRequest,
SessionResumeResponse, SessionHistoryResponse } from
"./session-history.ts";` at the old place, so every importer compiles
unchanged.
- **No other `protocol.ts` declaration uses these names**, so nothing
else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the
routes and their tests are untouched.

## Checks

- **`--color-moved`:** `git diff --color-moved=plain origin/main...HEAD
-- shared` shows the declarations and their comments as moved (96
lines). The only other line is the re-export in `protocol.ts`.
- **Client imports:** `bun run typecheck` passes on both tsconfigs, so
every importer still compiles through the re-export. No file in `src/`
or `site/` imports `shared/session-history.ts`.
- `HERDR_TEST_MODE=unit bun test server/session-history.test.ts
server/machine-proxy.test.ts src/lib/sessionHistory.test.ts
server/claude-store.test.ts`: **190 pass, 0 fail**. The routes' contract
tests (`server/api.contract.test.ts`,
`server/device-access.contract.test.ts`) run in CI's integration lane.
- `bun run check fast`: passes (unit 6244 pass, 0 fail, 13 skip in 442
files, 8 at a time, 57.6s)

## Outside PRs that touch the same files

No other maintainer PR touches these files. Outside contributors' PRs
that touch `shared/protocol.ts`: #1714, #1706, #1652, #1442 and #1427.
- None of them changes the moved types, so none needs code changes, at
most a rebase.
- I tested each against this branch with `git merge-tree`:
  - #1714, #1706 and #1652 still merge cleanly in `shared/`.
- #1442 and #1427 already conflict with main in `shared/protocol.ts`.
This move adds no new conflict there.
- Their imports from `protocol.ts` keep resolving through the re-export.

Move-only: moved declarations plus one re-export line. No changelog
fragment: users see no change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant