Skip to content

Commit 0105816

Browse files
committed
fix(ui): split view type seams
1 parent 3323ec8 commit 0105816

10 files changed

Lines changed: 60 additions & 59 deletions

ui/src/ui/chat-model-ref.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1+
import type { ChatModelOverride } from "./chat-model-ref.types.ts";
12
import type { ModelCatalogEntry } from "./types.ts";
2-
3-
export type ChatModelOverride =
4-
| {
5-
kind: "qualified";
6-
value: string;
7-
}
8-
| {
9-
kind: "raw";
10-
value: string;
11-
};
3+
export type { ChatModelOverride } from "./chat-model-ref.types.ts";
124

135
export function buildQualifiedChatModelValue(model: string, provider?: string | null): string {
146
const trimmedModel = model.trim();

ui/src/ui/chat-model-ref.types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export type ChatModelOverride =
2+
| {
3+
kind: "qualified";
4+
value: string;
5+
}
6+
| {
7+
kind: "raw";
8+
value: string;
9+
};

ui/src/ui/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export type GatewaySessionsDefaults = {
321321
contextTokens: number | null;
322322
};
323323

324-
export type ChatModelOverride = import("./chat-model-ref.ts").ChatModelOverride;
324+
export type ChatModelOverride = import("./chat-model-ref.types.ts").ChatModelOverride;
325325

326326
export type GatewayAgentRow = SharedGatewayAgentRow;
327327

ui/src/ui/views/agents-panels-overview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
resolveModelLabel,
1616
resolveModelPrimary,
1717
} from "./agents-utils.ts";
18-
import type { AgentsPanel } from "./agents.ts";
18+
import type { AgentsPanel } from "./agents.types.ts";
1919

2020
export function renderAgentOverview(params: {
2121
agent: AgentsListResult["agents"][number];

ui/src/ui/views/agents-panels-status-files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import type {
2020
CronStatus,
2121
} from "../types.ts";
2222
import { type AgentContext } from "./agents-utils.ts";
23-
import type { AgentsPanel } from "./agents.ts";
23+
import type { AgentsPanel } from "./agents.types.ts";
2424
import { resolveChannelExtras as resolveChannelExtrasFromConfig } from "./channel-config-extras.ts";
2525

2626
function renderAgentContextCard(

ui/src/ui/views/agents.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ import {
1818
renderAgentChannels,
1919
renderAgentCron,
2020
} from "./agents-panels-status-files.ts";
21+
export type { AgentsPanel } from "./agents.types.ts";
2122
import { renderAgentTools, renderAgentSkills } from "./agents-panels-tools-skills.ts";
2223
import { agentBadgeText, buildAgentContext, normalizeAgentLabel } from "./agents-utils.ts";
23-
24-
export type AgentsPanel = "overview" | "files" | "tools" | "skills" | "channels" | "cron";
24+
import type { AgentsPanel } from "./agents.types.ts";
2525

2626
export type ConfigState = {
2727
form: Record<string, unknown> | null;

ui/src/ui/views/agents.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type AgentsPanel = "overview" | "files" | "tools" | "skills" | "channels" | "cron";

ui/src/ui/views/nodes-exec-approvals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
resolveNodeTargets,
1111
type NodeTargetOption,
1212
} from "./nodes-shared.ts";
13-
import type { NodesProps } from "./nodes.ts";
13+
import type { NodesProps } from "./nodes.types.ts";
1414

1515
type ExecSecurity = "deny" | "allowlist" | "full";
1616
type ExecAsk = "off" | "on-miss" | "always";

ui/src/ui/views/nodes.ts

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,12 @@
11
import { html, nothing } from "lit";
22
import { t } from "../../i18n/index.ts";
3-
import type {
4-
DevicePairingList,
5-
DeviceTokenSummary,
6-
PairedDevice,
7-
PendingDevice,
8-
} from "../controllers/devices.ts";
9-
import type { ExecApprovalsFile, ExecApprovalsSnapshot } from "../controllers/exec-approvals.ts";
3+
import type { DeviceTokenSummary, PairedDevice, PendingDevice } from "../controllers/devices.ts";
104
import { formatRelativeTimestamp, formatList } from "../format.ts";
115
import { normalizeOptionalString } from "../string-coerce.ts";
126
import { renderExecApprovals, resolveExecApprovalsState } from "./nodes-exec-approvals.ts";
137
import { resolveConfigAgents, resolveNodeTargets, type NodeTargetOption } from "./nodes-shared.ts";
14-
export type NodesProps = {
15-
loading: boolean;
16-
nodes: Array<Record<string, unknown>>;
17-
devicesLoading: boolean;
18-
devicesError: string | null;
19-
devicesList: DevicePairingList | null;
20-
configForm: Record<string, unknown> | null;
21-
configLoading: boolean;
22-
configSaving: boolean;
23-
configDirty: boolean;
24-
configFormMode: "form" | "raw";
25-
execApprovalsLoading: boolean;
26-
execApprovalsSaving: boolean;
27-
execApprovalsDirty: boolean;
28-
execApprovalsSnapshot: ExecApprovalsSnapshot | null;
29-
execApprovalsForm: ExecApprovalsFile | null;
30-
execApprovalsSelectedAgent: string | null;
31-
execApprovalsTarget: "gateway" | "node";
32-
execApprovalsTargetNodeId: string | null;
33-
onRefresh: () => void;
34-
onDevicesRefresh: () => void;
35-
onDeviceApprove: (requestId: string) => void;
36-
onDeviceReject: (requestId: string) => void;
37-
onDeviceRotate: (deviceId: string, role: string, scopes?: string[]) => void;
38-
onDeviceRevoke: (deviceId: string, role: string) => void;
39-
onLoadConfig: () => void;
40-
onLoadExecApprovals: () => void;
41-
onBindDefault: (nodeId: string | null) => void;
42-
onBindAgent: (agentIndex: number, nodeId: string | null) => void;
43-
onSaveBindings: () => void;
44-
onExecApprovalsTargetChange: (kind: "gateway" | "node", nodeId: string | null) => void;
45-
onExecApprovalsSelectAgent: (agentId: string) => void;
46-
onExecApprovalsPatch: (path: Array<string | number>, value: unknown) => void;
47-
onExecApprovalsRemove: (path: Array<string | number>) => void;
48-
onSaveExecApprovals: () => void;
49-
};
8+
export type { NodesProps } from "./nodes.types.ts";
9+
import type { NodesProps } from "./nodes.types.ts";
5010

5111
export function renderNodes(props: NodesProps) {
5212
const bindingState = resolveBindingsState(props);

ui/src/ui/views/nodes.types.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import type { DevicePairingList } from "../controllers/devices.ts";
2+
import type { ExecApprovalsFile, ExecApprovalsSnapshot } from "../controllers/exec-approvals.ts";
3+
4+
export type NodesProps = {
5+
loading: boolean;
6+
nodes: Array<Record<string, unknown>>;
7+
devicesLoading: boolean;
8+
devicesError: string | null;
9+
devicesList: DevicePairingList | null;
10+
configForm: Record<string, unknown> | null;
11+
configLoading: boolean;
12+
configSaving: boolean;
13+
configDirty: boolean;
14+
configFormMode: "form" | "raw";
15+
execApprovalsLoading: boolean;
16+
execApprovalsSaving: boolean;
17+
execApprovalsDirty: boolean;
18+
execApprovalsSnapshot: ExecApprovalsSnapshot | null;
19+
execApprovalsForm: ExecApprovalsFile | null;
20+
execApprovalsSelectedAgent: string | null;
21+
execApprovalsTarget: "gateway" | "node";
22+
execApprovalsTargetNodeId: string | null;
23+
onRefresh: () => void;
24+
onDevicesRefresh: () => void;
25+
onDeviceApprove: (requestId: string) => void;
26+
onDeviceReject: (requestId: string) => void;
27+
onDeviceRotate: (deviceId: string, role: string, scopes?: string[]) => void;
28+
onDeviceRevoke: (deviceId: string, role: string) => void;
29+
onLoadConfig: () => void;
30+
onLoadExecApprovals: () => void;
31+
onBindDefault: (nodeId: string | null) => void;
32+
onBindAgent: (agentIndex: number, nodeId: string | null) => void;
33+
onSaveBindings: () => void;
34+
onExecApprovalsTargetChange: (kind: "gateway" | "node", nodeId: string | null) => void;
35+
onExecApprovalsSelectAgent: (agentId: string) => void;
36+
onExecApprovalsPatch: (path: Array<string | number>, value: unknown) => void;
37+
onExecApprovalsRemove: (path: Array<string | number>) => void;
38+
onSaveExecApprovals: () => void;
39+
};

0 commit comments

Comments
 (0)