Compare commits

..

8 Commits

Author SHA1 Message Date
Claude 077748e5a4 feat(timer): allow swapping the secondary source into the main timer slot
The timer view lets operators show an aux timer or the secondary message
as a smaller secondary timer under the main event timer. This adds a
placement control so that selected source can be promoted into the main
slot, swapping positions with the event timer.

The swap is deliberate: the event timer is demoted to the secondary slot
rather than removed, so the show-critical countdown (and its phase colour)
is never lost from screen.

- add `SecondaryPlacement` ('below' | 'main') to the timer message, with
  server validation and a store default
- expose the aux timer direction to the timer view and honour it when
  formatting a promoted aux (previously hard-coded to count-down)
- add a `getTimerSlots` helper that assigns the event timer and secondary
  content to the main/secondary slots, routing phase colour, paused/finished
  styling and font sizing to whichever slot holds the event timer
- add a Placement radio control to the timer view panel (disabled until a
  secondary source is active) and reflect the swap in the control preview

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MbgWVAXTJUX7E5pAmv6Rs7
2026-07-18 07:27:32 +00:00
Carlos Valente daa032e92c ux(finder): add navigation shortcuts 2026-07-14 12:04:44 +02:00
Carlos Valente ae65ec97d6 fix(shortcut): correct shortcut to delete 2026-07-14 12:04:44 +02:00
Carlos Valente e7e4302100 refactor(shortcuts): improve readability of info element 2026-07-14 12:04:44 +02:00
Carlos Valente 7e7d35980a refactor(op): improve status recognition 2026-07-14 11:58:59 +02:00
Carlos Valente 5001dda284 feat(op): add group visual relation 2026-07-14 11:58:59 +02:00
Carlos Valente a75d35bdc0 refactor(op): improve delay indicator styles 2026-07-14 11:58:59 +02:00
Claude 2e631194e1 fix(ui): improve progress bar with local interpolation
Co-authored-by: Carlos Valente <34649812+cpvalente@users.noreply.github.com>
2026-07-14 11:25:22 +02:00
53 changed files with 1275 additions and 1153 deletions
+1 -1
View File
@@ -23,7 +23,7 @@
"no-restricted-imports": [
"error",
{
"patterns": ["ontime-types/src/*", "ontime-utils/src/*", "zod"]
"patterns": ["ontime-types/src/*", "ontime-utils/src/*"]
}
]
},
@@ -0,0 +1,14 @@
.kbd {
display: inline-block;
min-width: 1.5rem;
padding: 0.0625rem 0.375rem;
border-radius: 2px;
background-color: $gray-1100;
color: $ui-white;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
font-family: monospace;
font-size: calc(1rem - 4px);
line-height: 1.5;
text-align: center;
white-space: nowrap;
}
@@ -0,0 +1,7 @@
import { PropsWithChildren } from 'react';
import style from './Kbd.module.scss';
export default function Kbd({ children }: PropsWithChildren) {
return <kbd className={style.kbd}>{children}</kbd>;
}
@@ -38,8 +38,6 @@ $progress-bar-br: 3px;
.multiprogress-bar__indicator-bar {
background-color: var(--background-color-override, $ui-black);
opacity: 0.8;
transition: 1s linear;
transition-property: width;
.multiprogress-bar--ignore-css-override & {
background-color: $ui-black;
@@ -1,5 +1,6 @@
import { MaybeNumber } from 'ontime-types';
import { useAnimatedProgress } from '../../hooks/useAnimatedProgress';
import { getProgress } from '../../utils/getProgress';
import { cx } from '../../utils/styleUtils';
@@ -34,7 +35,7 @@ export default function MultiPartProgressBar(props: MultiPartProgressBar) {
className = '',
} = props;
const percentRemaining = 100 - getProgress(now, complete);
const percentRemaining = 100 - useAnimatedProgress(now, complete);
const dangerWidth = danger ? 100 - getProgress(danger, complete) : 0;
const warningWidth = warning ? 100 - dangerWidth - getProgress(warning, complete) : 0;
const isOvertime = now !== null && now < 0;
@@ -14,6 +14,4 @@ $progress-bar-br: 3px;
.progress-bar__indicator {
height: $progress-bar-size;
background-color: var(--timer-progress-override, $accent-color);
transition: 1s linear;
transition-property: width;
}
@@ -1,6 +1,6 @@
import { MaybeNumber } from 'ontime-types';
import { getProgress } from '../../utils/getProgress';
import { useAnimatedProgress } from '../../hooks/useAnimatedProgress';
import './ProgressBar.scss';
@@ -12,7 +12,7 @@ interface ProgressBarProps {
export default function ProgressBar(props: ProgressBarProps) {
const { current, duration, className } = props;
const progress = getProgress(current, duration);
const progress = useAnimatedProgress(current, duration);
return (
<div className={`progress-bar__bg ${className}`}>
@@ -0,0 +1,41 @@
import { MaybeNumber, Playback } from 'ontime-types';
import { useEffect, useRef, useState } from 'react';
import { getProgress } from '../utils/getProgress';
import { usePlayback } from './useSocket';
/**
* Returns the live completion percentage (0100) of a countdown, interpolated locally.
*/
export function useAnimatedProgress(current: MaybeNumber, duration: MaybeNumber): number {
const playback = usePlayback();
const isRunning = playback === Playback.Play || playback === Playback.Roll;
const baseline = useRef({ current, at: performance.now() });
const [, setTick] = useState(0);
// there is only something to animate while a running timer is counting down towards 0
const shouldAnimate = isRunning && current !== null && current > 0 && duration !== null;
// re-anchor to the authoritative value whenever the server pushes a new timer update
useEffect(() => {
baseline.current = { current, at: performance.now() };
}, [current, duration, playback]);
// while counting down, re-render every animation frame so the derived progress stays smooth
useEffect(() => {
if (!shouldAnimate) {
return;
}
let frame = requestAnimationFrame(function tick() {
setTick((value) => value + 1);
frame = requestAnimationFrame(tick);
});
return () => cancelAnimationFrame(frame);
}, [shouldAnimate]);
// derive from the anchor plus elapsed time at render; frozen to the anchor when not running
const anchored = baseline.current.current;
const value = isRunning && anchored !== null ? anchored - (performance.now() - baseline.current.at) : anchored;
return getProgress(value, duration);
}
+7 -3
View File
@@ -26,6 +26,7 @@ export const useTimerViewControl = createSelector((state: RuntimeStore) => ({
blackout: state.message.timer.blackout,
blink: state.message.timer.blink,
secondarySource: state.message.timer.secondarySource,
secondaryPlacement: state.message.timer.secondaryPlacement,
}));
export const useTimerMessageInput = createSelector((state: RuntimeStore) => ({
@@ -43,6 +44,7 @@ export const useMessagePreview = createSelector((state: RuntimeStore) => ({
blackout: state.message.timer.blackout,
phase: state.timer.phase,
secondarySource: state.message.timer.secondarySource,
secondaryPlacement: state.message.timer.secondaryPlacement,
showTimerMessage: state.message.timer.visible && Boolean(state.message.timer.text),
timerType: state.eventNow?.timerType ?? null,
countToEnd: state.eventNow?.countToEnd ?? false,
@@ -56,6 +58,8 @@ export const setMessage = {
timerBlackout: (payload: boolean) => sendSocket('message', { timer: { blackout: payload } }),
timerSecondarySource: (payload: TimerMessage['secondarySource']) =>
sendSocket('message', { timer: { secondarySource: payload } }),
timerSecondaryPlacement: (payload: TimerMessage['secondaryPlacement']) =>
sendSocket('message', { timer: { secondaryPlacement: payload } }),
};
export const usePlaybackControl = createSelector((state: RuntimeStore) => ({
@@ -227,9 +231,9 @@ export const useTimerSocket = createSelector((state: RuntimeStore) => ({
timerTypeNow: state.eventNow?.timerType ?? TimerType.CountDown,
countToEndNow: state.eventNow?.countToEnd ?? false,
auxTimer: {
aux1: state.auxtimer1.current,
aux2: state.auxtimer2.current,
aux3: state.auxtimer3.current,
aux1: { current: state.auxtimer1.current, direction: state.auxtimer1.direction },
aux2: { current: state.auxtimer2.current, direction: state.auxtimer2.direction },
aux3: { current: state.auxtimer3.current, direction: state.auxtimer3.direction },
},
}));
@@ -25,6 +25,15 @@
.secondaryContent {
border-top: 1px solid $white-7;
// when the event timer is demoted here (secondary swapped to main) it keeps its colour treatment
color: var(--override-colour, inherit);
&[data-phase='pending'] {
color: $ontime-roll;
}
&[data-phase='overtime'] {
color: $playback-negative;
}
}
.blackout {
@@ -1,5 +1,5 @@
import { TimerPhase, TimerType } from 'ontime-types';
import { IoArrowDown, IoArrowUp, IoBan, IoTime } from 'react-icons/io5';
import { IoArrowDown, IoArrowUp, IoBan, IoSwapVertical, IoTime } from 'react-icons/io5';
import { LuArrowDownToLine } from 'react-icons/lu';
import { CornerWithPip } from '../../../common/components/editor-utils/EditorUtils';
@@ -20,10 +20,11 @@ const secondarySourceLabels: Record<string, string> = {
};
export default function TimerPreview() {
const { blink, blackout, countToEnd, phase, secondarySource, showTimerMessage, timerType } = useMessagePreview();
const { blink, blackout, countToEnd, phase, secondarySource, secondaryPlacement, showTimerMessage, timerType } =
useMessagePreview();
const { data } = useViewSettings();
const main = (() => {
const eventLabel = (() => {
if (showTimerMessage) return 'Message';
if (timerType === TimerType.None) return timerPlaceholder;
if (phase === TimerPhase.Pending) return 'Standby to start';
@@ -33,7 +34,7 @@ export default function TimerPreview() {
return 'Timer';
})();
const secondary = (() => {
const secondaryLabel = (() => {
// message is a fullscreen overlay or secondary is not active
if (showTimerMessage || !secondarySource) return null;
@@ -41,6 +42,11 @@ export default function TimerPreview() {
return secondarySourceLabels[secondarySource];
})();
// when the secondary is promoted to the main slot the two labels swap; the event timer is demoted
const isSwapped = secondaryPlacement === 'main' && secondaryLabel !== null && !showTimerMessage;
const mainDisplay = isSwapped ? secondaryLabel : eventLabel;
const secondaryDisplay = isSwapped ? eventLabel : secondaryLabel;
const overrideColour = (() => {
// override fallback colours from starter project
if (phase === TimerPhase.Warning) return data.warningColor ?? '#ffa528';
@@ -48,7 +54,9 @@ export default function TimerPreview() {
return data.normalColor ?? '#FFFC';
})();
const showColourOverride = main == 'Timer';
// the event timer keeps its colour treatment in whichever slot it now occupies
const eventInMain = !isSwapped;
const showColourOverride = eventLabel == 'Timer';
const contentClasses = cx([blink && style.blink, blackout && style.blackout]);
return (
@@ -57,12 +65,20 @@ export default function TimerPreview() {
<div className={contentClasses}>
<div
className={style.mainContent}
data-phase={showColourOverride && phase}
style={showColourOverride ? { '--override-colour': overrideColour } : {}}
data-phase={eventInMain && showColourOverride && phase}
style={eventInMain && showColourOverride ? { '--override-colour': overrideColour } : {}}
>
{main}
{mainDisplay}
</div>
{secondary !== null && <div className={style.secondaryContent}>{secondary}</div>}
{secondaryDisplay !== null && (
<div
className={style.secondaryContent}
data-phase={!eventInMain && showColourOverride && phase}
style={!eventInMain && showColourOverride ? { '--override-colour': overrideColour } : {}}
>
{secondaryDisplay}
</div>
)}
</div>
<div className={style.eventStatus}>
<Tooltip
@@ -105,6 +121,14 @@ export default function TimerPreview() {
>
<LuArrowDownToLine />
</Tooltip>
<Tooltip
text='Secondary swapped into main slot'
render={<span />}
className={style.statusIcon}
data-active={isSwapped}
>
<IoSwapVertical />
</Tooltip>
</div>
</div>
);
@@ -1,8 +1,9 @@
import { SecondarySource } from 'ontime-types';
import { SecondaryPlacement, SecondarySource } from 'ontime-types';
import { useEffect, useState } from 'react';
import Button from '../../../common/components/buttons/Button';
import * as Editor from '../../../common/components/editor-utils/EditorUtils';
import RadioGroup from '../../../common/components/radio-group/RadioGroup';
import Select from '../../../common/components/select/Select';
import { setMessage, useTimerViewControl } from '../../../common/hooks/useSocket';
import TimerPreview from './TimerPreview';
@@ -42,7 +43,7 @@ export default function TimerControlsPreview() {
}
function SecondarySourceControl() {
const { secondarySource } = useTimerViewControl();
const { secondarySource, secondaryPlacement } = useTimerViewControl();
const [value, setValue] = useState<SecondarySource>('aux1');
// sync secondary source with external changes
@@ -52,6 +53,8 @@ function SecondarySourceControl() {
}
}, [secondarySource]);
const isActive = secondarySource !== null;
const toggleSecondary = () => {
if (secondarySource === value) {
setMessage.timerSecondarySource(null);
@@ -79,12 +82,19 @@ function SecondarySourceControl() {
setValue(value);
}}
/>
<Button
variant={secondarySource !== null ? 'primary' : 'subtle'}
fluid
onClick={toggleSecondary}
data-testid='toggle secondary'
>
<Editor.Label htmlFor='secondary-placement'>Placement</Editor.Label>
<RadioGroup<SecondaryPlacement>
id='secondary-placement'
orientation='horizontal'
value={secondaryPlacement}
disabled={!isActive}
onValueChange={(placement) => setMessage.timerSecondaryPlacement(placement)}
items={[
{ value: 'below', label: 'Below timer' },
{ value: 'main', label: 'Swap with timer' },
]}
/>
<Button variant={isActive ? 'primary' : 'subtle'} fluid onClick={toggleSecondary} data-testid='toggle secondary'>
Show secondary
</Button>
</>
@@ -180,7 +180,13 @@ function Operator({ rundown, rundownMetadata, customFields, settings }: Operator
return (
<Fragment key={entry.id}>
<OperatorGroup key={entry.id} title={entry.title} />
<OperatorGroup
key={entry.id}
title={entry.title}
colour={entry.colour}
count={entry.entries.length}
duration={entry.duration}
/>
{entry.entries.map((nestedEntryId) => {
const nestedEntry = rundown.entries[nestedEntryId];
if (!isOntimeEvent(nestedEntry)) {
@@ -217,6 +223,7 @@ function Operator({ rundown, rundownMetadata, customFields, settings }: Operator
isLinkedToLoaded={isLinkedToLoaded}
isSelected={isLoaded}
isPast={isPast}
groupColour={entry.colour}
selectedRef={isLoaded ? selectedRef : undefined}
showStart={showStart}
subscribed={subscribedData}
@@ -22,17 +22,39 @@
background-color: $gray-1250;
}
&.grouped {
position: relative;
padding-left: 0.35rem;
background:
linear-gradient(90deg, color-mix(in srgb, transparent 88%, var(--group-colour, $gray-500) 12%), transparent 8rem),
$viewer-card-bg-color;
}
&.running {
border-top: 1px solid $gray-1300;
background-color: var(--operator-running-bg-override, $active-green);
}
&.grouped.running {
background:
linear-gradient(90deg, color-mix(in srgb, transparent 82%, var(--group-colour, $gray-500) 18%), transparent 8rem),
var(--operator-running-bg-override, $active-green);
}
&.past {
border-top: 1px solid transparent;
opacity: 0.2;
}
}
.groupRail {
position: absolute;
inset-block: 0;
left: 0;
width: 0.35rem;
background-color: var(--group-colour, $gray-500);
}
.binder {
grid-area: binder;
color: $section-white;
@@ -74,6 +96,9 @@
.plannedStart,
.timeUntil,
.runningTime {
display: flex;
align-items: center;
gap: 0.25rem;
border-radius: $component-border-radius-md;
padding: 0.25rem 0.5rem;
line-height: 1;
@@ -95,6 +120,21 @@
letter-spacing: 1px;
}
.live {
color: $ui-black;
background-color: $ui-white;
}
.due {
color: $ui-black;
background-color: $orange-500;
}
.done {
color: $white-60;
background-color: $white-7;
}
.runningTime {
grid-area: running;
font-size: 1.25rem;
@@ -25,6 +25,7 @@ interface OperatorEventProps {
isLinkedToLoaded: boolean;
isSelected: boolean;
isPast: boolean;
groupColour?: string;
selectedRef?: RefObject<HTMLDivElement | null>;
showStart: boolean;
subscribed: Subscribed;
@@ -46,6 +47,7 @@ function OperatorEvent({
isLinkedToLoaded,
isSelected,
isPast,
groupColour,
selectedRef,
showStart,
subscribed,
@@ -68,7 +70,12 @@ function OperatorEvent({
const mouseHandlers = useLongPress(handleLongPress);
const cueColours = colour && getAccessibleColour(colour);
const operatorClasses = cx([style.event, isSelected && style.running, isPast && style.past]);
const operatorClasses = cx([
style.event,
groupColour && style.grouped,
isSelected && style.running,
isPast && style.past,
]);
const hasFields = subscribed.some((field) => field.value);
const columnCount = subscribed.length ? Math.min(subscribed.length, 4) : 0;
@@ -85,8 +92,10 @@ function OperatorEvent({
data-testid={cue}
ref={selectedRef}
onContextMenu={handleLongPress}
style={groupColour ? ({ '--group-colour': groupColour } as CSSProperties) : undefined}
{...mouseHandlers}
>
{groupColour && <div className={style.groupRail} />}
<div className={style.binder} style={{ ...cueColours }}>
<span className={style.cue}>{cue}</span>
</div>
@@ -153,11 +162,11 @@ function OperatorEventSchedule({
isLinkedToLoaded,
}: OperatorEventScheduleProps) {
if (isPast) {
return <span className={style.timeUntil}>DONE</span>;
return <span className={cx([style.timeUntil, style.done])}>DONE</span>;
}
if (isSelected) {
return <span className={style.timeUntil}>LIVE</span>;
return <span className={cx([style.timeUntil, style.live])}>LIVE</span>;
}
return (
@@ -186,7 +195,7 @@ function TimeUntil({ timeStart, delay, dayOffset, totalGap, isLinkedToLoaded }:
const timeUntilString = isDue ? 'DUE' : `${formatDuration(Math.abs(timeUntil), timeUntil > 2 * MILLIS_PER_MINUTE)}`;
return (
<span className={style.timeUntil} data-testid='time-until'>
<span className={cx([style.timeUntil, isDue && style.due])} data-testid='time-until'>
{timeUntilString}
</span>
);
@@ -1,13 +1,33 @@
.group {
width: 100%;
padding: 0.25rem 0.5rem;
min-height: 2.5rem;
padding: 0.4rem 0.75rem;
border-left: 0.35rem solid var(--group-colour, $gray-500);
background-color: $gray-1350;
background: color-mix(in srgb, transparent 88%, var(--group-colour, $gray-500) 12%);
font-size: 1.25rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 1rem;
letter-spacing: 0;
}
// tablet
@media (min-width: $min-tablet) {
.group {
padding: 0.25rem 1rem;
}
.title {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.meta {
display: flex;
flex: 0 0 auto;
align-items: center;
gap: 0.5rem;
color: color-mix(in srgb, currentColor 60%, transparent);
font-size: 0.875rem;
font-weight: 500;
}
@@ -1,12 +1,29 @@
import { memo } from 'react';
import { CSSProperties, memo } from 'react';
import { getAccessibleColour } from '../../../common/utils/styleUtils';
import { formatDuration } from '../../../common/utils/time';
import style from './OperatorGroup.module.scss';
interface OperatorGroup {
title: string;
colour: string;
count: number;
duration: number;
}
export default memo(OperatorGroup);
function OperatorGroup({ title }: OperatorGroup) {
return <div className={style.group}>{title}</div>;
function OperatorGroup({ title, colour, count, duration }: OperatorGroup) {
const groupColour = colour || '#929292';
const groupColours = getAccessibleColour(groupColour);
return (
<div className={style.group} style={{ ...groupColours, '--group-colour': groupColour } as CSSProperties}>
<span className={style.title}>{title}</span>
<span className={style.meta}>
<span>{`${count} ${count === 1 ? 'event' : 'events'}`}</span>
<span>{formatDuration(duration)}</span>
</span>
</div>
);
}
@@ -3,58 +3,94 @@
height: 100%;
max-height: 100%;
overflow-y: auto;
padding: 0.5rem;
padding: 1rem 1.5rem;
display: flex;
flex-direction: column;
overflow-x: auto;
}
.shortcutSection {
flex: 1;
margin-top: 15vh;
width: min(100%, 48rem);
margin-top: clamp(1.5rem, 8vh, 5rem);
margin-inline: auto;
gap: 1rem;
}
.shortcuts {
font-size: calc(1rem - 3px);
border-collapse: separate;
border-spacing: 4rem 0;
display: grid;
gap: 0.875rem;
margin-top: 0.875rem;
}
tr {
white-space: nowrap;
td:nth-child(odd) {
text-align: left;
}
td:nth-child(even) {
text-align: right;
}
.shortcutGroup {
h3 {
margin: 0 0 0.375rem;
color: $ui-white;
font-size: calc(1rem - 3px);
font-weight: 600;
text-transform: uppercase;
}
}
.spacer {
height: 1rem;
.shortcutList {
display: grid;
gap: 0.25rem;
}
.shortcutRow {
min-height: 1.625rem;
display: grid;
grid-template-columns: minmax(10rem, 1fr) minmax(0, auto);
align-items: center;
gap: 0.75rem;
font-size: calc(1rem - 3px);
}
.shortcutLabel {
min-width: 0;
line-height: 1.2;
}
.shortcutKeys {
display: inline-flex;
align-items: center;
flex-wrap: wrap;
justify-content: flex-end;
gap: 0.25rem 0.5rem;
min-width: 0;
}
.keyCombo {
display: inline-flex;
align-items: center;
flex-wrap: nowrap;
gap: 0.25rem 0;
}
.separator {
color: $gray-500;
font-size: calc(1rem - 5px);
}
.prompt {
margin-left: 4rem;
}
.divider {
display: inline-block;
text-align: center;
width: 1em;
}
.kbd {
font-family: monospace;
white-space: nowrap;
font-size: calc(1rem - 2px);
padding: 0.125rem 0.5rem;
background-color: $gray-1200;
color: $ui-white;
border-radius: 2px;
font-weight: 400;
box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.4);
}
@media (max-width: 680px) {
.entryEditor {
padding: 0.75rem 1rem;
}
.shortcutSection {
margin-top: 1rem;
}
.shortcutRow {
grid-template-columns: 1fr;
gap: 0.25rem;
}
.shortcutKeys {
justify-content: flex-start;
}
}
@@ -1,6 +1,7 @@
import { PropsWithChildren, memo } from 'react';
import * as Editor from '../../../common/components/editor-utils/EditorUtils';
import Kbd from '../../../common/components/kbd/Kbd';
import { deviceAlt, deviceMod } from '../../../common/utils/deviceUtils';
import style from './EventEditorEmpty.module.scss';
@@ -12,216 +13,124 @@ function EventEditorEmpty() {
<div className={style.entryEditor} data-testid='editor-container'>
<div className={style.shortcutSection}>
<Editor.Title className={style.prompt}>Rundown shortcuts</Editor.Title>
<table className={style.shortcuts}>
<tbody>
<tr>
<td>Find in rundown</td>
<td>
<Kbd>{deviceMod}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>F</Kbd>
</td>
</tr>
<tr>
<td>Open Settings</td>
<td>
<Kbd>{deviceMod}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>,</Kbd>
</td>
</tr>
<tr className={style.spacer} />
<tr>
<td>Select entry</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd></Kbd>
<AuxKey>/</AuxKey>
<Kbd></Kbd>
</td>
</tr>
<tr>
<td>Select group</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>Shift</Kbd>
<AuxKey>+</AuxKey>
<Kbd></Kbd>
<AuxKey>/</AuxKey>
<Kbd></Kbd>
</td>
</tr>
<tr>
<td>Jump to top / bottom</td>
<td>
<Kbd>Home</Kbd>
<AuxKey>/</AuxKey>
<Kbd>End</Kbd>
</td>
</tr>
<tr>
<td>Page up / down</td>
<td>
<Kbd>PgUp</Kbd>
<AuxKey>/</AuxKey>
<Kbd>PgDn</Kbd>
</td>
</tr>
<tr>
<td>Deselect entry</td>
<td>
<Kbd>Esc</Kbd>
</td>
</tr>
<tr className={style.spacer} />
<tr>
<td>Reorder selected entry</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>{deviceMod}</Kbd>
<AuxKey>+</AuxKey>
<Kbd></Kbd>
<AuxKey>/</AuxKey>
<Kbd></Kbd>
</td>
</tr>
<tr>
<td>Copy selected entry</td>
<td>
<Kbd>{deviceMod}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>C</Kbd>
</td>
</tr>
<tr>
<td>Cut selected entry</td>
<td>
<Kbd>{deviceMod}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>X</Kbd>
</td>
</tr>
<tr>
<td>Paste above</td>
<td>
<Kbd>{deviceMod}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>Shift</Kbd>
<AuxKey>+</AuxKey>
<Kbd>V</Kbd>
</td>
</tr>
<tr>
<td>Paste below</td>
<td>
<Kbd>{deviceMod}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>V</Kbd>
</td>
</tr>
<tr>
<td>Clone selected entry</td>
<td>
<Kbd>{deviceMod}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>D</Kbd>
</td>
</tr>
<tr>
<td>Delete selected entry</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>Backspace</Kbd>
</td>
</tr>
<tr className={style.spacer} />
<tr>
<td>Add event below</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>E</Kbd>
</td>
</tr>
<tr>
<td>Add event above</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>Shift</Kbd>
<AuxKey>+</AuxKey>
<Kbd>E</Kbd>
</td>
</tr>
<tr>
<td>Add group below</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>G</Kbd>
</td>
</tr>
<tr>
<td>Add group above</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>Shift</Kbd>
<AuxKey>+</AuxKey>
<Kbd>G</Kbd>
</td>
</tr>
<tr>
<td>Add milestone below</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>M</Kbd>
</td>
</tr>
<tr>
<td>Add milestone above</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>Shift</Kbd>
<AuxKey>+</AuxKey>
<Kbd>M</Kbd>
</td>
</tr>
<tr>
<td>Add delay below</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>D</Kbd>
</td>
</tr>
<tr>
<td>Add delay above</td>
<td>
<Kbd>{deviceAlt}</Kbd>
<AuxKey>+</AuxKey>
<Kbd>Shift</Kbd>
<AuxKey>+</AuxKey>
<Kbd>D</Kbd>
</td>
</tr>
</tbody>
</table>
<div className={style.shortcuts}>
<ShortcutGroup title='Search'>
<Shortcut label='Find in rundown'>
<Combo keys={[deviceMod, 'F']} />
</Shortcut>
<Shortcut label='Open settings'>
<Combo keys={[deviceMod, ',']} />
</Shortcut>
</ShortcutGroup>
<ShortcutGroup title='Navigation'>
<Shortcut label='Select entry'>
<Combo keys={[deviceAlt, '↑']} />
<Separator />
<Combo keys={[deviceAlt, '↓']} />
</Shortcut>
<Shortcut label='Select group'>
<Combo keys={[deviceAlt, 'Shift', '↑']} />
<Separator />
<Combo keys={[deviceAlt, 'Shift', '↓']} />
</Shortcut>
<Shortcut label='Jump to top / bottom'>
<Combo keys={['Home']} />
<Separator />
<Combo keys={['End']} />
</Shortcut>
<Shortcut label='Page up / down'>
<Combo keys={['PgUp']} />
<Separator />
<Combo keys={['PgDn']} />
</Shortcut>
<Shortcut label='Deselect entry'>
<Combo keys={['Esc']} />
</Shortcut>
</ShortcutGroup>
<ShortcutGroup title='Editing'>
<Shortcut label='Reorder selected entry'>
<Combo keys={[deviceAlt, deviceMod, '↑']} />
<Separator />
<Combo keys={[deviceAlt, deviceMod, '↓']} />
</Shortcut>
<Shortcut label='Copy selected entry'>
<Combo keys={[deviceMod, 'C']} />
</Shortcut>
<Shortcut label='Cut selected entry'>
<Combo keys={[deviceMod, 'X']} />
</Shortcut>
<Shortcut label='Paste below'>
<Combo keys={[deviceMod, 'V']} />
</Shortcut>
<Shortcut label='Paste above'>
<Combo keys={[deviceMod, 'Shift', 'V']} />
</Shortcut>
<Shortcut label='Clone selected entry'>
<Combo keys={[deviceMod, 'D']} />
</Shortcut>
<Shortcut label='Delete selected entry'>
<Combo keys={[deviceAlt, 'Backspace']} />
</Shortcut>
</ShortcutGroup>
<ShortcutGroup title='Insert'>
<Shortcut label='Add event below / above'>
<Combo keys={[deviceAlt, 'E']} />
<Separator />
<Combo keys={[deviceAlt, 'Shift', 'E']} />
</Shortcut>
<Shortcut label='Add group below / above'>
<Combo keys={[deviceAlt, 'G']} />
<Separator />
<Combo keys={[deviceAlt, 'Shift', 'G']} />
</Shortcut>
<Shortcut label='Add milestone below / above'>
<Combo keys={[deviceAlt, 'M']} />
<Separator />
<Combo keys={[deviceAlt, 'Shift', 'M']} />
</Shortcut>
<Shortcut label='Add delay below / above'>
<Combo keys={[deviceAlt, 'D']} />
<Separator />
<Combo keys={[deviceAlt, 'Shift', 'D']} />
</Shortcut>
</ShortcutGroup>
</div>
</div>
</div>
);
}
function AuxKey({ children }: PropsWithChildren) {
return <span className={style.divider}>{children}</span>;
function ShortcutGroup({ title, children }: PropsWithChildren<{ title: string }>) {
return (
<section className={style.shortcutGroup}>
<h3>{title}</h3>
<div className={style.shortcutList}>{children}</div>
</section>
);
}
function Kbd({ children }: PropsWithChildren) {
return <span className={style.kbd}>{children}</span>;
function Shortcut({ label, children }: PropsWithChildren<{ label: string }>) {
return (
<div className={style.shortcutRow}>
<span className={style.shortcutLabel}>{label}</span>
<span className={style.shortcutKeys}>{children}</span>
</div>
);
}
function Combo({ keys }: { keys: string[] }) {
return (
<span className={style.keyCombo}>
{keys.map((key) => (
<Kbd key={key}>{key}</Kbd>
))}
</span>
);
}
function Separator() {
return <span className={style.separator}>/</span>;
}
@@ -18,7 +18,7 @@ import { TbFlagFilled, TbListNumbers } from 'react-icons/tb';
import { useEntryActionsContext } from '../../../common/context/EntryActionsContext';
import { useContextMenu } from '../../../common/hooks/useContextMenu';
import { useEntryCopy } from '../../../common/stores/entryCopyStore';
import { deviceMod } from '../../../common/utils/deviceUtils';
import { deviceAlt, deviceMod } from '../../../common/utils/deviceUtils';
import { cx, getAccessibleColour } from '../../../common/utils/styleUtils';
import { useRenumberCuesDialogStore } from '../renumber-cues-dialog/RenumberCuesDialog';
import { useEventIdSwapping } from '../useEventIdSwapping';
@@ -156,7 +156,7 @@ export default function RundownEvent({
type: 'item',
label: 'Delete',
icon: IoTrash,
shortcut: `${deviceMod}+Del`,
shortcut: `${deviceAlt}+Backspace`,
onClick: () => {
clearSelectedEvents();
deleteEntry(Array.from(selectedEvents));
@@ -202,7 +202,7 @@ export default function RundownEvent({
type: 'item',
label: 'Delete',
icon: IoTrash,
shortcut: `${deviceMod}+Del`,
shortcut: `${deviceAlt}+Backspace`,
onClick: () => {
deleteEntry([eventId]);
unselect(eventId);
@@ -3,7 +3,5 @@
width: 0;
border-radius: 1px 0 0 1px;
transition: 1s linear;
transition-property: width;
background-color: $gray-200;
}
@@ -1,12 +1,12 @@
import { useAnimatedProgress } from '../../../../common/hooks/useAnimatedProgress';
import { useTimer } from '../../../../common/hooks/useSocket';
import { getProgress } from '../../../../common/utils/getProgress';
import style from './RundownEventProgressBar.module.scss';
export default function RundownEventProgressBar() {
const timer = useTimer();
const progress = getProgress(timer.current, timer.duration);
const progress = useAnimatedProgress(timer.current, timer.duration);
return <div className={style.progressBar} style={{ width: `${progress}%` }} />;
}
@@ -18,7 +18,7 @@ import Tag from '../../../common/components/tag/Tag';
import { useEntryActionsContext } from '../../../common/context/EntryActionsContext';
import { useContextMenu } from '../../../common/hooks/useContextMenu';
import { useEntryCopy } from '../../../common/stores/entryCopyStore';
import { deviceMod } from '../../../common/utils/deviceUtils';
import { deviceAlt, deviceMod } from '../../../common/utils/deviceUtils';
import { getOffsetState } from '../../../common/utils/offset';
import { cx, getAccessibleColour } from '../../../common/utils/styleUtils';
import { formatDuration, formatTime } from '../../../common/utils/time';
@@ -66,7 +66,7 @@ export default function RundownGroup({ data, hasCursor, collapsed, onCollapse }:
type: 'item',
label: 'Delete Group',
icon: IoTrash,
shortcut: `${deviceMod}+Del`,
shortcut: `${deviceAlt}+Backspace`,
onClick: () => deleteEntry([data.id]),
},
]);
@@ -9,7 +9,7 @@ import useReactiveTextInput from '../../../common/components/input/text-input/us
import { useEntryActionsContext } from '../../../common/context/EntryActionsContext';
import { useContextMenu } from '../../../common/hooks/useContextMenu';
import { useEntryCopy } from '../../../common/stores/entryCopyStore';
import { deviceMod } from '../../../common/utils/deviceUtils';
import { deviceAlt } from '../../../common/utils/deviceUtils';
import { cx, getAccessibleColour } from '../../../common/utils/styleUtils';
import { useEventSelection } from '../useEventSelection';
@@ -38,7 +38,7 @@ export default function RundownMilestone({ colour, cue, entryId, hasCursor, titl
type: 'item',
label: 'Delete',
icon: IoTrash,
shortcut: `${deviceMod}+Del`,
shortcut: `${deviceAlt}+Backspace`,
onClick: () => deleteEntry([entryId]),
},
]);
@@ -54,17 +54,51 @@
}
.footer {
width: 100%;
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 1rem;
font-size: calc(1rem - 2px);
color: $label-gray;
}
.filterHint {
text-align: right;
}
.em {
color: $ui-white;
margin-inline: 0.25rem;
}
.hints {
display: flex;
flex-wrap: wrap;
gap: 0.5rem 1rem;
color: $label-gray;
font-size: calc(1rem - 3px);
}
.hintItem {
display: inline-flex;
align-items: center;
gap: 0.25rem;
}
.scrollContainer {
max-height: 70vh;
overflow: auto;
padding-top: 1rem;
}
@media (max-width: 680px) {
.footer {
align-items: flex-start;
flex-direction: column;
}
.filterHint {
text-align: left;
}
}
+20 -2
View File
@@ -3,6 +3,7 @@ import { SupportedEntry } from 'ontime-types';
import { KeyboardEvent, useState } from 'react';
import Input from '../../../common/components/input/input/Input';
import Kbd from '../../../common/components/kbd/Kbd';
import Modal from '../../../common/components/modal/Modal';
import useFinder from './useFinder';
@@ -96,8 +97,25 @@ export default function Finder({ isOpen, onClose }: FinderProps) {
}
footerElements={
<div className={style.footer}>
Use the keywords <span className={style.em}>cue</span>, <span className={style.em}>index</span> or
<span className={style.em}>title</span> to filter search.
<div className={style.hints}>
<span className={style.hintItem}>
<Kbd></Kbd>
<Kbd></Kbd>
Navigate
</span>
<span className={style.hintItem}>
<Kbd>Enter</Kbd>
Go
</span>
<span className={style.hintItem}>
<Kbd>Esc</Kbd>
Close
</span>
</div>
<div className={style.filterHint}>
Filter by <span className={style.em}>cue</span>, <span className={style.em}>index</span>, or
<span className={style.em}>title</span>
</div>
</div>
}
/>
@@ -1,8 +1,8 @@
import { Day } from 'ontime-types';
import { CSSProperties, RefObject } from 'react';
import { useAnimatedProgress } from '../../common/hooks/useAnimatedProgress';
import { useExpectedStartData, useTimer } from '../../common/hooks/useSocket';
import { getProgress } from '../../common/utils/getProgress';
import { alpha, cx } from '../../common/utils/styleUtils';
import { formatDuration, formatTime, getExpectedTimesFromExtendedEvent } from '../../common/utils/time';
import { useTranslation } from '../../translation/TranslationProvider';
@@ -169,7 +169,7 @@ function TimelineEntryStatus({
/** Generates a block level progress bar */
function ActiveBlock() {
const { current, duration } = useTimer();
const progress = getProgress(current, duration);
const progress = useAnimatedProgress(current, duration);
return (
<div data-status='live' className={style.timelineBlock} style={{ '--progress': `${progress}%` } as CSSProperties} />
);
+22
View File
@@ -154,6 +154,28 @@
opacity: 0;
height: 0;
}
// when the event timer is demoted into the secondary slot it keeps its (phase-aware) colour
&--as-timer {
color: var(--timer-colour, var(--timer-color-override, $ui-white));
border-top-color: color-mix(in srgb, var(--timer-colour, $external-color) 10%, transparent);
&.secondary--paused {
opacity: $viewer-opacity-disabled;
transition: $viewer-transition-time;
}
&.secondary--finished {
color: var(--timer-overtime-color-override, $timer-finished-color);
}
&[data-phase='warning'] {
color: var(--timer-colour, var(--timer-warning-color-override));
}
&[data-phase='danger'] {
color: var(--timer-colour, var(--timer-danger-color-override));
}
}
}
.progress-container {
+35 -9
View File
@@ -27,6 +27,7 @@ import {
getShowMessage,
getShowModifiers,
getShowProgressBar,
getTimerSlots,
getTotalTime,
} from './timer.utils';
import { TimerData, useTimerData } from './useTimerData';
@@ -132,15 +133,25 @@ function Timer({ customFields, projectData, isMirrored, settings, viewSettings,
hideSecondary,
);
// when the operator promotes the secondary source to the main slot, swap the two so the event
// timer is demoted (never removed). Frozen overtime end-messages keep the event timer prominent.
const isSwapped = message.timer.secondaryPlacement === 'main' && Boolean(secondaryContent) && !showEndMessage;
const { main: mainSlot, secondary: secondarySlot } = getTimerSlots(
isSwapped,
{ content: display, timerType: viewTimerType, phase: time.phase },
secondaryContent,
);
// gather presentation styles
const resolvedTimerColour = getTimerColour(viewSettings, timerColour, showWarning, showDanger);
const timerFontSize = getEstimatedFontSize(display, secondaryContent);
const timerFontSize = getEstimatedFontSize(mainSlot.content ?? display, secondarySlot.content);
const subduePaused = !isPlaying && viewTimerType !== TimerType.Clock;
const userStyles = {
...(keyColour && { '--timer-bg': keyColour }),
...(resolvedTimerColour && { '--timer-colour': resolvedTimerColour }),
...(font && { '--timer-font': font }),
};
// the event timer keeps its (phase-aware) colour in whichever slot it occupies
const eventTimerColour = resolvedTimerColour ? { '--timer-colour': resolvedTimerColour } : undefined;
// gather option data
const defaultFormat = getDefaultFormat(settings?.timeFormat);
@@ -175,17 +186,32 @@ function Timer({ customFields, projectData, isMirrored, settings, viewSettings,
</FitText>
) : (
<div
className={cx(['timer', subduePaused && 'timer--paused', showFinished && 'timer--finished'])}
style={{ fontSize: `${timerFontSize}vw` }}
data-type={viewTimerType}
data-phase={time.phase}
className={cx([
'timer',
mainSlot.isEventTimer && subduePaused && 'timer--paused',
mainSlot.isEventTimer && showFinished && 'timer--finished',
])}
style={{ fontSize: `${timerFontSize}vw`, ...(mainSlot.isEventTimer ? eventTimerColour : {}) }}
data-type={mainSlot.timerType}
data-phase={mainSlot.phase}
>
{display}
{mainSlot.content}
</div>
)}
<div className={cx(['secondary', !secondaryContent && 'secondary--hidden'])}>
<div
className={cx([
'secondary',
!secondarySlot.content && 'secondary--hidden',
secondarySlot.isEventTimer && 'secondary--as-timer',
secondarySlot.isEventTimer && subduePaused && 'secondary--paused',
secondarySlot.isEventTimer && showFinished && 'secondary--finished',
])}
style={secondarySlot.isEventTimer ? eventTimerColour : undefined}
data-type={secondarySlot.timerType}
data-phase={secondarySlot.phase}
>
<FitText mode='multi' min={64} max={256}>
{secondaryContent}
{secondarySlot.content}
</FitText>
</div>
</div>
@@ -0,0 +1,89 @@
import { MessageState, SimpleDirection, TimerPhase, TimerType } from 'ontime-types';
import { getSecondaryDisplay, getTimerSlots } from './timer.utils';
function makeMessage(partial: Partial<MessageState['timer']> = {}, secondary = ''): MessageState {
return {
timer: {
text: '',
visible: false,
blink: false,
blackout: false,
secondarySource: null,
secondaryPlacement: 'below',
...partial,
},
secondary,
};
}
const eventTimer = { content: '00:10:00', timerType: TimerType.CountDown, phase: TimerPhase.Warning };
describe('getTimerSlots()', () => {
it('keeps the event timer in the main slot when not swapped', () => {
const { main, secondary } = getTimerSlots(false, eventTimer, 'AUX');
expect(main).toMatchObject({ content: '00:10:00', phase: TimerPhase.Warning, isEventTimer: true });
expect(secondary).toMatchObject({ content: 'AUX', phase: undefined, isEventTimer: false });
});
it('swaps the secondary into the main slot and demotes the event timer', () => {
const { main, secondary } = getTimerSlots(true, eventTimer, 'AUX');
expect(main).toMatchObject({ content: 'AUX', isEventTimer: false, phase: undefined });
// the event timer is never removed, only demoted, and keeps its phase
expect(secondary).toMatchObject({ content: '00:10:00', isEventTimer: true, phase: TimerPhase.Warning });
});
it('does not swap when there is no secondary content to promote', () => {
const { main, secondary } = getTimerSlots(true, eventTimer, undefined);
expect(main.isEventTimer).toBe(true);
expect(secondary.isEventTimer).toBe(false);
});
});
describe('getSecondaryDisplay()', () => {
it('returns nothing when the secondary is hidden', () => {
const message = makeMessage({ secondarySource: 'aux1' });
expect(
getSecondaryDisplay(message, { current: 5000, direction: SimpleDirection.CountDown }, 'min', false, false, true),
).toBeUndefined();
});
it('returns the secondary message text for the secondary source', () => {
const message = makeMessage({ secondarySource: 'secondary' }, 'hello');
expect(getSecondaryDisplay(message, null, 'min', false, false, false)).toBe('hello');
});
it('formats an aux source as a timer honouring its direction', () => {
const message = makeMessage({ secondarySource: 'aux1' });
// a running count-up aux shows elapsed time without a negative sign
const countUp = getSecondaryDisplay(
message,
{ current: 5000, direction: SimpleDirection.CountUp },
'min',
false,
false,
false,
);
expect(countUp).toBe('00:00:05');
// a count-down aux past zero shows overtime as a negative value
const countDown = getSecondaryDisplay(
message,
{ current: -5000, direction: SimpleDirection.CountDown },
'min',
false,
false,
false,
);
expect(countDown).toBe('-00:00:05');
});
it('returns nothing when no secondary source is selected', () => {
const message = makeMessage({ secondarySource: null });
expect(getSecondaryDisplay(message, null, 'min', false, false, false)).toBeUndefined();
});
});
+49 -2
View File
@@ -4,6 +4,7 @@ import {
OntimeEvent,
Playback,
RundownEntries,
SimpleDirection,
TimerMessage,
TimerPhase,
TimerType,
@@ -12,6 +13,11 @@ import { isPlaybackActive } from 'ontime-utils';
import { getFormattedTimer, getPropertyValue } from '../common/viewUtils';
/**
* The current value and direction of the aux timer feeding the secondary slot
*/
export type AuxTimerValue = { current: MaybeNumber; direction: SimpleDirection };
/**
* Whether a message should be shown
*/
@@ -119,7 +125,7 @@ export function getShowModifiers(
*/
export function getSecondaryDisplay(
message: MessageState,
currentAux: MaybeNumber,
currentAux: AuxTimerValue | null,
localisedMinutes: string,
removeSeconds: boolean,
removeLeadingZero: boolean,
@@ -133,7 +139,9 @@ export function getSecondaryDisplay(
message.timer.secondarySource === 'aux2' ||
message.timer.secondarySource === 'aux3'
) {
return getFormattedTimer(currentAux, TimerType.CountDown, localisedMinutes, {
// honour the aux timer's own direction so a promoted aux reads correctly
const timerType = currentAux?.direction === SimpleDirection.CountUp ? TimerType.CountUp : TimerType.CountDown;
return getFormattedTimer(currentAux?.current ?? null, timerType, localisedMinutes, {
removeSeconds,
removeLeadingZero,
});
@@ -144,6 +152,45 @@ export function getSecondaryDisplay(
return;
}
/**
* Describes what a timer slot (main or secondary) renders and how it should be styled
*/
export type TimerSlot = {
content: string | undefined;
timerType: TimerType | undefined;
phase: TimerPhase | undefined;
isEventTimer: boolean;
};
/**
* Assigns the event timer and the secondary content to the main (large) and secondary (small) slots.
* When the operator promotes the secondary source to the main slot, the two are swapped so the event
* timer is never removed from screen — it is only demoted to the smaller slot.
*/
export function getTimerSlots(
isSwapped: boolean,
eventTimer: { content: string; timerType: TimerType; phase: TimerPhase },
secondaryContent: string | undefined,
): { main: TimerSlot; secondary: TimerSlot } {
const eventSlot: TimerSlot = {
content: eventTimer.content,
timerType: eventTimer.timerType,
phase: eventTimer.phase,
isEventTimer: true,
};
const secondarySlot: TimerSlot = {
content: secondaryContent,
timerType: undefined,
phase: undefined,
isEventTimer: false,
};
if (isSwapped && secondaryContent) {
return { main: secondarySlot, secondary: eventSlot };
}
return { main: eventSlot, secondary: secondarySlot };
}
/**
* What should we be showing in the cards?
*/
+1 -9
View File
@@ -1,13 +1,5 @@
{
"$schema": "../../node_modules/oxlint/configuration_schema.json",
"extends": ["../../.oxlintrc.json"],
"plugins": ["unicorn", "typescript", "oxc", "vitest", "node", "promise"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": ["ontime-types/src/*", "ontime-utils/src/*"]
}
]
}
"plugins": ["unicorn", "typescript", "oxc", "vitest", "node", "promise"]
}
+1 -2
View File
@@ -22,8 +22,7 @@
"osc-min": "2.1.2",
"sanitize-filename": "^1.6.3",
"ws": "^8.18.0",
"xlsx": "^0.18.5",
"zod": "catalog:"
"xlsx": "^0.18.5"
},
"devDependencies": {
"@types/cookie-parser": "1.4.10",
@@ -1,57 +0,0 @@
import { describe, expect, it } from 'vitest';
import { runMiddleware } from '../../validation-utils/__tests__/testMiddleware.js';
import { validateGenerateUrl } from '../session.validation.js';
describe('validateGenerateUrl', () => {
it('accepts a valid payload and normalises req.body', () => {
const { nextCalled, req } = runMiddleware(validateGenerateUrl, {
body: {
baseUrl: 'https://ontime.example',
path: '/timer',
authenticate: true,
lockConfig: false,
lockNav: false,
},
});
expect(nextCalled).toBe(true);
expect(req.body).toMatchObject({ baseUrl: 'https://ontime.example', path: '/timer' });
});
it('accepts an optional preset field', () => {
const { nextCalled, req } = runMiddleware(validateGenerateUrl, {
body: {
baseUrl: 'https://ontime.example',
path: '/timer',
authenticate: true,
lockConfig: false,
lockNav: false,
preset: 'my-preset',
},
});
expect(nextCalled).toBe(true);
expect(req.body.preset).toBe('my-preset');
});
it('rejects a missing required field with a 422', () => {
const { nextCalled, statusCode } = runMiddleware(validateGenerateUrl, {
body: { path: '/timer', authenticate: true, lockConfig: false, lockNav: false },
});
expect(nextCalled).toBe(false);
expect(statusCode).toBe(422);
});
it('rejects a wrong-typed field', () => {
const { nextCalled, statusCode } = runMiddleware(validateGenerateUrl, {
body: {
baseUrl: 'https://ontime.example',
path: '/timer',
authenticate: 'yes', // should be boolean
lockConfig: false,
lockNav: false,
},
});
expect(nextCalled).toBe(false);
expect(statusCode).toBe(422);
});
});
@@ -4,7 +4,6 @@ import type { ErrorResponse, GetInfo, GetUrl, SessionStats } from 'ontime-types'
import { getErrorMessage } from 'ontime-utils';
import * as sessionService from './session.service.js';
import type { GenerateUrlInput } from './session.validation.js';
import { validateGenerateUrl } from './session.validation.js';
export const router: Router = express.Router();
@@ -29,21 +28,17 @@ router.get('/info', (_req: Request, res: Response<GetInfo | ErrorResponse>) => {
}
});
router.post(
'/url',
validateGenerateUrl,
(req: Request<unknown, GetUrl | ErrorResponse, GenerateUrlInput>, res: Response<GetUrl | ErrorResponse>) => {
try {
const url = sessionService.generateShareUrl(req.body.baseUrl, req.body.path, {
authenticate: req.body.authenticate,
lockConfig: req.body.lockConfig,
lockNav: req.body.lockNav,
preset: req.body.preset,
});
res.status(200).send({ url: url.toString() });
} catch (error) {
const message = getErrorMessage(error);
res.status(500).send({ message });
}
},
);
router.post('/url', validateGenerateUrl, (req: Request, res: Response<GetUrl | ErrorResponse>) => {
try {
const url = sessionService.generateShareUrl(req.body.baseUrl, req.body.path, {
authenticate: req.body.authenticate,
lockConfig: req.body.lockConfig,
lockNav: req.body.lockNav,
preset: req.body.preset,
});
res.status(200).send({ url: url.toString() });
} catch (error) {
const message = getErrorMessage(error);
res.status(500).send({ message });
}
});
@@ -1,14 +1,15 @@
import { z } from 'zod';
import { body } from 'express-validator';
import { validateBody } from '../validation-utils/validate.js';
import { requestValidationFunction } from '../validation-utils/validationFunction.js';
const generateUrlSchema = z.object({
baseUrl: z.string().trim().min(1),
path: z.string().trim().min(1),
authenticate: z.boolean(),
lockConfig: z.boolean(),
lockNav: z.boolean(),
preset: z.string().trim().min(1).optional(),
});
export type GenerateUrlInput = z.infer<typeof generateUrlSchema>;
export const validateGenerateUrl = validateBody(generateUrlSchema);
export const validateGenerateUrl = [
body('baseUrl').isString().trim().notEmpty(),
body('path').isString().trim().notEmpty(),
body('authenticate').isBoolean(),
body('lockConfig').isBoolean(),
body('lockNav').isBoolean(),
body('preset').optional().isString().trim().notEmpty(),
requestValidationFunction,
];
@@ -1,64 +0,0 @@
import { OntimeView } from 'ontime-types';
import { describe, expect, it } from 'vitest';
import { runMiddleware } from '../../validation-utils/__tests__/testMiddleware.js';
import { validateNewPreset, validatePresetParam } from '../urlPresets.validation.js';
const validPreset = {
enabled: true,
alias: 'my-preset',
target: OntimeView.Cuesheet,
search: '',
displayInNav: true,
};
describe('validateNewPreset', () => {
it('accepts a valid preset', () => {
const { nextCalled } = runMiddleware(validateNewPreset, { body: validPreset });
expect(nextCalled).toBe(true);
});
it('accepts optional cuesheet options', () => {
const { nextCalled, req } = runMiddleware(validateNewPreset, {
body: { ...validPreset, options: { read: 'a', write: 'b' } },
});
expect(nextCalled).toBe(true);
expect(req.body.options).toEqual({ read: 'a', write: 'b' });
});
it('rejects a missing required field', () => {
const { alias: _alias, ...withoutAlias } = validPreset;
const { nextCalled, statusCode } = runMiddleware(validateNewPreset, { body: withoutAlias });
expect(nextCalled).toBe(false);
expect(statusCode).toBe(422);
});
it('rejects "editor" as a target — URL presets cannot point at the editor view', () => {
const { nextCalled, statusCode } = runMiddleware(validateNewPreset, {
body: { ...validPreset, target: OntimeView.Editor },
});
expect(nextCalled).toBe(false);
expect(statusCode).toBe(422);
});
it('rejects an unknown target value', () => {
const { nextCalled, statusCode } = runMiddleware(validateNewPreset, {
body: { ...validPreset, target: 'not-a-real-view' },
});
expect(nextCalled).toBe(false);
expect(statusCode).toBe(422);
});
});
describe('validatePresetParam', () => {
it('accepts a non-empty alias param', () => {
const { nextCalled } = runMiddleware(validatePresetParam, { params: { alias: 'my-preset' } });
expect(nextCalled).toBe(true);
});
it('rejects an empty alias param', () => {
const { nextCalled, statusCode } = runMiddleware(validatePresetParam, { params: { alias: '' } });
expect(nextCalled).toBe(false);
expect(statusCode).toBe(422);
});
});
@@ -5,7 +5,6 @@ import { getErrorMessage } from 'ontime-utils';
import { sendRefetch } from '../../adapters/WebsocketAdapter.js';
import { getDataProvider } from '../../classes/data-provider/DataProvider.js';
import type { NewPresetInput, PresetAliasParam, UpdatePresetInput } from './urlPresets.validation.js';
import { validateNewPreset, validatePresetParam, validateUpdatePreset } from './urlPresets.validation.js';
export const router: Router = express.Router();
@@ -15,98 +14,80 @@ router.get('/', (_req: Request, res: Response<URLPreset[]>) => {
res.status(200).send(presets as URLPreset[]);
});
router.post(
'/',
validateNewPreset,
async (
req: Request<unknown, URLPreset[] | ErrorResponse, NewPresetInput>,
res: Response<URLPreset[] | ErrorResponse>,
) => {
try {
const newPreset: URLPreset = {
enabled: req.body.enabled,
alias: req.body.alias,
target: req.body.target,
search: req.body.search,
displayInNav: req.body.displayInNav,
options: req.body.options,
};
router.post('/', validateNewPreset, async (req: Request, res: Response<URLPreset[] | ErrorResponse>) => {
try {
const newPreset: URLPreset = {
enabled: req.body.enabled,
alias: req.body.alias,
target: req.body.target,
search: req.body.search,
displayInNav: req.body.displayInNav,
options: req.body.options,
};
const currentPresets = getDataProvider().getUrlPresets();
if (currentPresets.some((preset) => preset.alias === newPreset.alias)) {
throw new Error(`Preset with alias ${newPreset.alias} already exists.`);
}
const newPresets = [...currentPresets, newPreset];
// Update the URL presets in the data provider
await getDataProvider().setUrlPresets(newPresets);
sendRefetch(RefetchKey.UrlPresets);
res.status(201).send(newPresets);
} catch (error) {
const message = getErrorMessage(error);
res.status(400).send({ message });
const currentPresets = getDataProvider().getUrlPresets();
if (currentPresets.some((preset) => preset.alias === newPreset.alias)) {
throw new Error(`Preset with alias ${newPreset.alias} already exists.`);
}
},
);
router.put(
'/:alias',
validateUpdatePreset,
async (
req: Request<PresetAliasParam, URLPreset[] | ErrorResponse, UpdatePresetInput>,
res: Response<URLPreset[] | ErrorResponse>,
) => {
try {
const alias = req.params.alias;
const currentPresets = getDataProvider().getUrlPresets();
const existingPreset = currentPresets.find((preset) => preset.alias === alias);
if (!existingPreset) {
throw new Error(`Preset with alias ${alias} does not exist.`);
}
const newPresets = [...currentPresets, newPreset];
const updatedPreset: URLPreset = {
enabled: req.body.enabled,
alias: req.body.alias,
target: req.body.target,
search: req.body.search,
displayInNav: req.body.displayInNav,
options: req.body.options ?? existingPreset.options,
};
// Update the URL presets in the data provider
await getDataProvider().setUrlPresets(newPresets);
sendRefetch(RefetchKey.UrlPresets);
res.status(201).send(newPresets);
} catch (error) {
const message = getErrorMessage(error);
res.status(400).send({ message });
}
});
if (alias !== updatedPreset.alias) {
throw new Error('Changing alias is not permitted');
}
const newPresets = currentPresets.map((preset) => (preset.alias === alias ? updatedPreset : preset));
// Update the URL presets in the data provider
await getDataProvider().setUrlPresets(newPresets);
sendRefetch(RefetchKey.UrlPresets);
res.status(200).send(newPresets);
} catch (error) {
const message = getErrorMessage(error);
res.status(400).send({ message });
router.put('/:alias', validateUpdatePreset, async (req: Request, res: Response<URLPreset[] | ErrorResponse>) => {
try {
const alias = req.params.alias;
const currentPresets = getDataProvider().getUrlPresets();
const existingPreset = currentPresets.find((preset) => preset.alias === alias);
if (!existingPreset) {
throw new Error(`Preset with alias ${alias} does not exist.`);
}
},
);
router.delete(
'/:alias',
validatePresetParam,
async (req: Request<PresetAliasParam>, res: Response<URLPreset[] | ErrorResponse>) => {
try {
const alias = req.params.alias;
const currentPresets = getDataProvider().getUrlPresets();
const newPresets = currentPresets.filter((preset) => preset.alias !== alias);
const updatedPreset: URLPreset = {
enabled: req.body.enabled,
alias: req.body.alias,
target: req.body.target,
search: req.body.search,
displayInNav: req.body.displayInNav,
options: req.body.options ?? existingPreset.options,
};
// Update the URL presets in the data provider
await getDataProvider().setUrlPresets(newPresets);
sendRefetch(RefetchKey.UrlPresets);
res.status(200).send(newPresets);
} catch (error) {
const message = getErrorMessage(error);
res.status(400).send({ message });
if (alias !== updatedPreset.alias) {
throw new Error('Changing alias is not permitted');
}
},
);
const newPresets = currentPresets.map((preset) => (preset.alias === alias ? updatedPreset : preset));
// Update the URL presets in the data provider
await getDataProvider().setUrlPresets(newPresets);
sendRefetch(RefetchKey.UrlPresets);
res.status(200).send(newPresets);
} catch (error) {
const message = getErrorMessage(error);
res.status(400).send({ message });
}
});
router.delete('/:alias', validatePresetParam, async (req: Request, res: Response<URLPreset[] | ErrorResponse>) => {
try {
const alias = req.params.alias;
const currentPresets = getDataProvider().getUrlPresets();
const newPresets = currentPresets.filter((preset) => preset.alias !== alias);
// Update the URL presets in the data provider
await getDataProvider().setUrlPresets(newPresets);
sendRefetch(RefetchKey.UrlPresets);
res.status(200).send(newPresets);
} catch (error) {
const message = getErrorMessage(error);
res.status(400).send({ message });
}
});
@@ -1,36 +1,40 @@
import { OntimeView, type OntimeViewPresettable } from 'ontime-types';
import { z } from 'zod';
import { body, param } from 'express-validator';
import { OntimeView } from 'ontime-types';
import { validateBody, validateParams } from '../validation-utils/validate.js';
// URL presets cannot target the editor (see OntimeViewPresettable) — the previous
// express-validator check allowed any OntimeView value including 'editor', which URLPreset's
// own type never permitted; narrowed here now that the field is properly typed end to end.
const presettableViews = Object.values(OntimeView).filter(
(view): view is OntimeViewPresettable => view !== OntimeView.Editor,
);
const presetOptionsSchema = z.record(z.string(), z.string()).optional();
import { requestValidationFunction } from '../validation-utils/validationFunction.js';
/**
* validate array of URL preset objects
*/
const newPresetSchema = z.object({
enabled: z.boolean(),
alias: z.string().trim().min(1),
target: z.enum(presettableViews),
search: z.string().trim(),
displayInNav: z.boolean(),
export const validateNewPreset = [
body().isObject().withMessage('No data found in request'),
body('enabled').isBoolean(),
body('alias').isString().trim().notEmpty(),
body('target').isString().trim().notEmpty().isIn(Object.values(OntimeView)),
body('search').isString().trim(),
body('displayInNav').isBoolean(),
// options are currently only provided for cuesheet presets
options: presetOptionsSchema,
});
export type NewPresetInput = z.infer<typeof newPresetSchema>;
export const validateNewPreset = validateBody(newPresetSchema);
body('options').optional().isObject(),
body('options.*').isString().trim(),
const presetAliasParamSchema = z.object({ alias: z.string().trim().min(1) });
export type PresetAliasParam = z.infer<typeof presetAliasParamSchema>;
export const validatePresetParam = validateParams(presetAliasParamSchema);
requestValidationFunction,
];
// update reuses the same body shape as create, plus the alias param check
export type UpdatePresetInput = NewPresetInput;
export const validateUpdatePreset = [validateParams(presetAliasParamSchema), validateBody(newPresetSchema)];
export const validateUpdatePreset = [
param('alias').isString().trim().notEmpty(),
body().isObject().withMessage('No data found in request'),
body('enabled').isBoolean(),
body('alias').isString().trim().notEmpty(),
body('target').isString().trim().notEmpty().isIn(Object.values(OntimeView)),
body('search').isString().trim(),
body('displayInNav').isBoolean(),
// options are currently only provided for cuesheet presets
body('options').optional().isObject(),
body('options.*').isString().trim(),
requestValidationFunction,
];
export const validatePresetParam = [param('alias').isString().trim().notEmpty(), requestValidationFunction];
@@ -1,30 +0,0 @@
import type { NextFunction, Request, Response } from 'express';
/**
* Exercises a single Express middleware (e.g. validateBody(schema)) against a minimal
* fake req/res, without standing up supertest or a running app — matches this codebase's
* convention of testing validation logic directly rather than through an HTTP layer.
*/
export function runMiddleware(
middleware: (req: Request, res: Response, next: NextFunction) => void,
req: Partial<Request>,
) {
let statusCode: number | undefined;
let payload: unknown;
const res = {
status(code: number) {
statusCode = code;
return this;
},
json(data: unknown) {
payload = data;
},
} as Response;
let nextCalled = false;
middleware(req as Request, res, () => {
nextCalled = true;
});
return { nextCalled, statusCode, payload, req: req as Request };
}
@@ -1,47 +0,0 @@
import type { NextFunction, Request, Response } from 'express';
import { z, type ZodType } from 'zod';
type Target = 'body' | 'params';
/**
* Builds an Express middleware that safe-parses req[target] against `schema`.
* - Uses safeParse: no throw/catch on the hot invalid-input path.
* - On success, replaces req[target] with the parsed value (defaults filled,
* unknown keys stripped, .trim()/.transform() applied) and calls next().
* - On failure, responds 422 with { errors: [...] }.
*/
function validate<T extends ZodType>(target: Target, schema: T) {
return (req: Request, res: Response, next: NextFunction) => {
const result = schema.safeParse(req[target]);
if (!result.success) {
const errors = result.error.issues.map((issue) => ({
location: target,
path: issue.path.join('.'),
message: issue.message,
}));
res.status(422).json({ errors });
return;
}
req[target] = result.data;
next();
};
}
export const validateBody = <T extends ZodType>(schema: T) => validate('body', schema);
export const validateParams = <T extends ZodType>(schema: T) => validate('params', schema);
/** Direct replacement for the old paramsWithId */
export const idParamSchema = z.object({ id: z.string().trim().min(1) });
export const validateIdParam = validateParams(idParamSchema);
/**
* Direct replacement for requestValidationFunctionWithFile — unrelated to Zod (it's a
* check on multer's req.file, not on body/params shape), kept as its own middleware.
*/
export function requireUploadedFile(req: Request & { file?: unknown }, res: Response, next: NextFunction) {
if (!req.file) {
res.status(422).json({ errors: 'File not found' });
return;
}
next();
}
@@ -1,103 +0,0 @@
import { describe, expect, it, vi } from 'vitest';
vi.mock('../../api-data/project-data/projectData.dao.js', () => ({
editCurrentProjectData: vi.fn(),
getProjectData: vi.fn(() => ({ title: 'Test project' })),
}));
vi.mock('../../api-data/rundown/rundown.dao.js', () => ({
getProjectCustomFields: vi.fn(() => ({})),
getRundownMetadata: vi.fn(() => ({})),
}));
vi.mock('../../api-data/rundown/rundown.service.js', () => ({
createNewRundown: vi.fn(),
deleteRundown: vi.fn(),
duplicateExistingRundown: vi.fn(),
loadRundown: vi.fn(),
renameRundown: vi.fn(),
}));
vi.mock('../../classes/data-provider/DataProvider.js', () => ({
getDataProvider: vi.fn(() => ({ getProjectRundowns: () => ({}) })),
}));
vi.mock('../../models/dataModel.js', () => ({
makeNewProject: vi.fn(() => ({ project: {} })),
}));
vi.mock('../../services/project-service/ProjectService.js', () => ({
createProjectWithPatch: vi.fn(),
deleteProjectFile: vi.fn(),
duplicateProjectFile: vi.fn(),
getProjectList: vi.fn(),
loadProjectFile: vi.fn(),
renameProjectFile: vi.fn(),
}));
vi.mock('../../stores/runtimeState.js', () => ({
getState: vi.fn(() => ({})),
}));
vi.mock('../mcp.service.js', () => ({
batchCreateEntriesForMcp: vi.fn(),
batchUpdateEntriesForMcp: vi.fn(),
createCustomFieldForMcp: vi.fn(),
createEntryForMcp: vi.fn(),
deleteCustomFieldForMcp: vi.fn(),
deleteEntriesForMcp: vi.fn(),
findEntry: vi.fn(),
getRundownById: vi.fn(() => ({ id: 'r1', order: [], entries: {} })),
groupEntriesForMcp: vi.fn(),
reorderEntryForMcp: vi.fn(),
toRundownList: vi.fn(),
ungroupEntryForMcp: vi.fn(),
updateCustomFieldForMcp: vi.fn(),
updateEntryForMcp: vi.fn(),
}));
const { TOOL_DEFINITIONS, handleToolCall } = await import('../mcp.tools.js');
describe('MCP tool schema generation', () => {
it('generates a well-formed JSON Schema inputSchema for every tool', () => {
expect(TOOL_DEFINITIONS.length).toBeGreaterThan(0);
for (const tool of TOOL_DEFINITIONS) {
expect(tool.inputSchema).toMatchObject({ type: 'object' });
expect(typeof tool.inputSchema.properties).toBe('object');
}
});
});
describe('MCP tool-call argument validation', () => {
it('rejects a required field missing entirely (previously silently miscast)', async () => {
const result = await handleToolCall('ontime_create_rundown', {});
expect(result.isError).toBe(true);
});
it('rejects a field with the wrong primitive type', async () => {
const result = await handleToolCall('ontime_reorder_entry', {
entryId: 'a',
destinationId: 'b',
order: 'sideways', // not one of before/after/insert
});
expect(result.isError).toBe(true);
});
it('rejects an unknown enum value on a nested field', async () => {
const result = await handleToolCall('ontime_create_entry', {
type: 'not-a-real-type',
});
expect(result.isError).toBe(true);
});
it('accepts a minimal valid payload for a tool with no required fields', async () => {
const result = await handleToolCall('ontime_get_rundown', {});
expect(result.isError).toBeFalsy();
});
it('reports unknown tool names distinctly from validation failures', async () => {
const result = await handleToolCall('ontime_does_not_exist', {});
expect(result.isError).toBe(true);
expect(result.content[0]).toMatchObject({ type: 'text' });
});
});
+51 -58
View File
@@ -1,6 +1,3 @@
import { EndAction, TimerType, TimeStrategy } from 'ontime-types';
import { z } from 'zod';
/**
* Agent-facing Ontime MCP documentation.
*
@@ -12,74 +9,70 @@ import { z } from 'zod';
* Keep this file concise and update it when MCP-exposed fields change.
*/
// ---- Shared event field schemas ----
// Zod shape fragments, spread into z.object({...}) calls in mcp.tools.schema.ts.
// Field descriptions carry through into the generated inputSchema (z.toJSONSchema) and
// are what the MCP client/LLM actually reads — keep them in sync with reality.
// ---- Shared event field JSON schemas ----
// Imported by mcp.tools.ts and spread into tool inputSchema.properties.
export const EVENT_TIMER_FIELDS = {
timerType: z
.enum(TimerType)
.optional()
.describe('count-down: countdown from duration; count-up: elapsed time; clock: wall clock; none: no timer shown'),
endAction: z
.enum(EndAction)
.optional()
.describe('Action when event ends: none = stop, load-next = cue next event, play-next = auto-start next event'),
linkStart: z
.boolean()
.optional()
.describe(
timerType: {
type: 'string',
enum: ['count-down', 'count-up', 'clock', 'none'],
description: 'count-down: countdown from duration; count-up: elapsed time; clock: wall clock; none: no timer shown',
},
endAction: {
type: 'string',
enum: ['none', 'load-next', 'play-next'],
description: 'Action when event ends: none = stop, load-next = cue next event, play-next = auto-start next event',
},
linkStart: {
type: 'boolean',
description:
"Link this event's start time to the previous playable event's end time. Linked events allow time changes to propagate through the rundown. Unlinking would prevent propagation and lock this event's start time to the schedule",
),
countToEnd: z
.boolean()
.optional()
.describe(
},
countToEnd: {
type: 'boolean',
description:
'Advanced timing mode: countdown targets the scheduled timeEnd instead of the event duration. This can surprise operators when an event starts late or the schedule shifts; only set true after explaining the behaviour and confirming the user wants it. This can be useful for a deadline, where an event always needs to end at the schedule time, ie: a curfew or a broadcast window.',
),
timeStrategy: z
.enum(TimeStrategy)
.optional()
.describe(
},
timeStrategy: {
type: 'string',
enum: ['lock-duration', 'lock-end'],
description:
'How linked events adapt to an inherited start: lock-duration recalculates end, lock-end recalculates duration',
),
timeWarning: z.number().optional().describe('ms before timeEnd to enter warning state (e.g. 300000 = 5 min)'),
timeDanger: z.number().optional().describe('ms before timeEnd to enter danger state (e.g. 60000 = 1 min)'),
};
},
timeWarning: { type: 'number', description: 'ms before timeEnd to enter warning state (e.g. 300000 = 5 min)' },
timeDanger: { type: 'number', description: 'ms before timeEnd to enter danger state (e.g. 60000 = 1 min)' },
} as const;
export const EVENT_WRITABLE_FIELDS = {
cue: z.string().optional().describe('Short free-form cue label — ask the user what naming convention they prefer'),
title: z.string().optional().describe('Event title shown in the rundown and views'),
note: z.string().optional().describe('Free-text note for production notes or references'),
colour: z
.string()
.optional()
.describe(
cue: { type: 'string', description: 'Short free-form cue label — ask the user what naming convention they prefer' },
title: { type: 'string', description: 'Event title shown in the rundown and views' },
note: { type: 'string', description: 'Free-text note for production notes or references' },
colour: {
type: 'string',
description:
'Hex colour (#RRGGBB) for visual grouping — ask the user what colour convention they use, and prefer the default Ontime palette from ontime://style-guide so colours match the editor swatches',
),
skip: z.boolean().optional().describe('If true, event is skipped during playback'),
flag: z
.boolean()
.optional()
.describe('Mark the event as a critical operational marker — use sparingly for maximum impact'),
custom: z
.record(z.string(), z.string())
.optional()
.describe(
},
skip: { type: 'boolean', description: 'If true, event is skipped during playback' },
flag: {
type: 'boolean',
description: 'Mark the event as a critical operational marker — use sparingly for maximum impact',
},
custom: {
type: 'object',
additionalProperties: { type: 'string' },
description:
'Custom field values keyed by project field key, e.g. { "Camera": "CAM 2" }. Keys are case-sensitive — get them with ontime_get_custom_fields, and create missing fields with ontime_create_custom_field.',
),
},
...EVENT_TIMER_FIELDS,
};
} as const;
export const RUNDOWN_TARGET_FIELD = {
rundownId: z
.string()
.optional()
.describe(
rundownId: {
type: 'string',
description:
'Optional target rundown ID. Omit to target the currently loaded live rundown; provide an ID from ontime_list_rundowns to edit a background rundown without loading it.',
),
};
},
} as const;
// ---- Agent-readable schema document ----
// Served at ontime://schema. Agents read this once per session to orient themselves
+50 -27
View File
@@ -1,8 +1,12 @@
import {
EntryId,
EventPostPayload,
InsertOptions,
OntimeDelay,
OntimeEntry,
OntimeEvent,
OntimeGroup,
OntimeMilestone,
PatchWithId,
ProjectRundowns,
Rundown,
@@ -25,25 +29,40 @@ import {
} from '../api-data/rundown/rundown.service.js';
import { normalisedToRundownArray } from '../api-data/rundown/rundown.utils.js';
import { getDataProvider } from '../classes/data-provider/DataProvider.js';
// *Args types are now derived from the Zod schemas in mcp.tools.schema.ts — that file is
// the single source of truth for MCP tool input shape, validation, and typing.
import type {
BatchCreateEntriesArgs,
BatchCreateEntryArgs,
BatchUpdateEntriesArgs,
CreateCustomFieldArgs,
CreateEntryArgs,
DeleteCustomFieldArgs,
DeleteEntriesArgs,
EntryFieldArgs,
GetEntryArgs,
GroupEntriesArgs,
ReorderEntryArgs,
TargetRundownArgs,
UngroupEntryArgs,
UpdateCustomFieldArgs,
UpdateEntryArgs,
} from './mcp.tools.schema.js';
export type EventFieldArgs = Partial<
Pick<
OntimeEvent,
| 'cue'
| 'title'
| 'note'
| 'colour'
| 'skip'
| 'flag'
| 'custom'
| 'timerType'
| 'endAction'
| 'linkStart'
| 'countToEnd'
| 'timeStrategy'
| 'timeWarning'
| 'timeDanger'
| 'timeStart'
| 'timeEnd'
| 'duration'
>
>;
export type MilestoneFieldArgs = Partial<Pick<OntimeMilestone, 'cue' | 'title' | 'note' | 'colour' | 'custom'>>;
export type DelayFieldArgs = Partial<Pick<OntimeDelay, 'duration'>>;
export type GroupFieldArgs = Partial<Pick<OntimeGroup, 'title' | 'note' | 'colour' | 'targetDuration' | 'custom'>>;
export type EntryFieldArgs = EventFieldArgs & MilestoneFieldArgs & DelayFieldArgs & GroupFieldArgs;
export type TargetRundownArgs = { rundownId?: string };
export type CreateEntryArgs = EntryFieldArgs & InsertOptions & TargetRundownArgs & { type?: `${SupportedEntry}` };
export type BatchCreateEntryArgs = CreateEntryArgs & { children?: BatchCreateEntryArgs[] };
export type UpdateEntryArgs = EntryFieldArgs & TargetRundownArgs & { id: EntryId };
export type GroupEntriesArgs = GroupFieldArgs & TargetRundownArgs & { ids: EntryId[] };
export type UngroupEntryArgs = TargetRundownArgs & { id: EntryId };
export function resolveTargetRundownId(args: TargetRundownArgs): string {
return args.rundownId ?? getCurrentRundownId();
@@ -59,7 +78,7 @@ export function getRundownById(rundownId?: string): Readonly<Rundown> {
return targetId === getCurrentRundownId() ? getCurrentRundown() : getDataProvider().getRundown(targetId);
}
export function findEntry(args: GetEntryArgs): OntimeEntry | undefined {
export function findEntry(args: TargetRundownArgs & { id?: EntryId; cue?: string }): OntimeEntry | undefined {
const rundown = getRundownById(args.rundownId);
if (args.id) {
return rundown.entries[args.id];
@@ -175,13 +194,15 @@ export async function updateEntryForMcp(args: UpdateEntryArgs) {
return { target: getTargetMeta(rundownId), entry };
}
export async function deleteEntriesForMcp(args: DeleteEntriesArgs) {
export async function deleteEntriesForMcp(args: TargetRundownArgs & { ids: EntryId[] }) {
const rundownId = resolveTargetRundownId(args);
const rundown = await deleteEntries(rundownId, args.ids);
return { target: getTargetMeta(rundownId), deleted: args.ids, order: rundown.order };
}
export async function reorderEntryForMcp(args: ReorderEntryArgs) {
export async function reorderEntryForMcp(
args: TargetRundownArgs & { entryId: EntryId; destinationId: EntryId; order: 'before' | 'after' | 'insert' },
) {
const rundownId = resolveTargetRundownId(args);
const rundown = await reorderEntry(rundownId, args.entryId, args.destinationId, args.order);
return { target: getTargetMeta(rundownId), order: rundown.order };
@@ -238,7 +259,9 @@ export async function ungroupEntryForMcp(args: UngroupEntryArgs) {
return { target: getTargetMeta(rundownId), ungrouped: args.id, order: updatedRundown.order };
}
export async function batchCreateEntriesForMcp(args: BatchCreateEntriesArgs) {
export async function batchCreateEntriesForMcp(
args: TargetRundownArgs & { entries: BatchCreateEntryArgs[]; after?: EntryId },
) {
const { entries = [], after } = args;
validateBatchCreateEntries(entries);
const allEntries = flattenBatchCreateEntries(entries);
@@ -313,14 +336,14 @@ async function createBatchEntry(
return { entry, created };
}
export async function batchUpdateEntriesForMcp(args: BatchUpdateEntriesArgs) {
export async function batchUpdateEntriesForMcp(args: TargetRundownArgs & { ids: EntryId[]; data: EntryFieldArgs }) {
assertKnownCustomFields(args.data.custom);
const rundownId = resolveTargetRundownId(args);
const rundown = await batchEditEntries(rundownId, args.ids, args.data);
return { target: getTargetMeta(rundownId), updated: args.ids, order: rundown.order };
}
export async function createCustomFieldForMcp(args: CreateCustomFieldArgs) {
export async function createCustomFieldForMcp(args: { label: string; type: 'text' | 'image'; colour: string }) {
const label = args.label?.trim();
// same constraint the HTTP route enforces in customFields.validation.ts
if (!label || !checkRegex.isAlphanumericWithSpace(label)) {
@@ -341,13 +364,13 @@ export async function createCustomFieldForMcp(args: CreateCustomFieldArgs) {
return { key, customFields: updated };
}
export async function updateCustomFieldForMcp(args: UpdateCustomFieldArgs) {
export async function updateCustomFieldForMcp(args: { key: string; label?: string; colour?: string }) {
const projectRundowns = getDataProvider().getProjectRundowns();
const updated = await editCustomField(args.key, { label: args.label, colour: args.colour }, projectRundowns);
return { customFields: updated };
}
export async function deleteCustomFieldForMcp(args: DeleteCustomFieldArgs) {
export async function deleteCustomFieldForMcp(args: { key: string }) {
const projectRundowns = getDataProvider().getProjectRundowns();
const updated = await deleteCustomField(args.key, projectRundowns);
return { customFields: updated };
-226
View File
@@ -1,226 +0,0 @@
/**
* Zod schemas for MCP tool inputs.
*
* Each schema is the single source of truth for three things:
* - the generated `inputSchema` served to MCP clients (via z.toJSONSchema in mcp.tools.ts)
* - runtime validation of incoming tool-call arguments (via .safeParse in mcp.tools.ts)
* - the TypeScript types used by mcp.service.ts's business logic
*
* Field shapes intentionally mirror the hand-written JSON Schema this file replaces, not
* the full canonical domain types in ontime-types — e.g. `colour` stays a plain string,
* matching what was (not) validated before this migration.
*/
import { z } from 'zod';
import { EVENT_WRITABLE_FIELDS, RUNDOWN_TARGET_FIELD } from './mcp.schema.js';
// ---- Shared fragments ----
const entryTimingFields = {
timeStart: z.number().optional().describe('Start time in ms from midnight'),
timeEnd: z.number().optional().describe('End time in ms from midnight'),
duration: z.number().optional().describe('Duration in ms'),
targetDuration: z.number().optional().describe('Groups only: planned length of the group in ms'),
};
// All writable fields of any entry type, flattened — reused as the base for create/update/
// batch schemas via .extend(). Matches the previous EntryFieldArgs shape.
const entryFieldsSchema = z.object({ ...entryTimingFields, ...EVENT_WRITABLE_FIELDS });
export type EntryFieldArgs = z.infer<typeof entryFieldsSchema>;
const groupWritableFields = {
title: z.string().optional().describe('Group title shown in the rundown and views'),
note: z.string().optional().describe('Free-text group note for production notes or references'),
colour: z
.string()
.optional()
.describe('Hex colour (#RRGGBB) for the group — prefer the default Ontime palette from ontime://style-guide'),
custom: z
.record(z.string(), z.string())
.optional()
.describe('Custom field values keyed by existing project field key'),
targetDuration: z.number().optional().describe('Planned length of the group in ms'),
};
// ---- Rundown read ----
export const getRundownSchema = z.object({ ...RUNDOWN_TARGET_FIELD });
export const getRundownMetadataSchema = z.object({});
export const getEntrySchema = z.object({
...RUNDOWN_TARGET_FIELD,
id: z.string().optional().describe('Entry ID (from rundown.entries key or entry.id)'),
cue: z.string().optional().describe('Human-facing cue label'),
});
// ---- Rundown mutations ----
export const createEntrySchema = entryFieldsSchema.extend({
...RUNDOWN_TARGET_FIELD,
type: z
.enum(['event', 'delay', 'milestone', 'group'])
.optional()
.describe(
'Entry type, defaults to event. event: timed show item; milestone: non-timed marker; delay: schedule shift; group: named container of entries',
),
// Overrides entryFieldsSchema's generic timing descriptions with create-specific guidance.
timeStart: z.number().optional().describe('Event start time in ms from midnight (e.g. 09:00 = 32400000)'),
timeEnd: z.number().optional().describe('Event end time in ms from midnight'),
duration: z
.number()
.optional()
.describe('Duration in ms (events: should equal timeEnd - timeStart; delays: the schedule shift)'),
after: z.string().optional().describe('Insert after this entry ID'),
before: z.string().optional().describe('Insert before this entry ID'),
});
export const updateEntrySchema = entryFieldsSchema.extend({
...RUNDOWN_TARGET_FIELD,
id: z.string().describe('ID of the entry to update'),
});
export const deleteEntriesSchema = z.object({
...RUNDOWN_TARGET_FIELD,
ids: z.array(z.string()).describe('Array of entry IDs to delete'),
});
export const reorderEntrySchema = z.object({
...RUNDOWN_TARGET_FIELD,
entryId: z.string().describe('ID of the entry to move'),
destinationId: z.string().describe('ID of the target entry (sibling or parent group)'),
order: z.enum(['before', 'after', 'insert']).describe('before/after: place as sibling; insert: place inside a group'),
});
export const groupEntriesSchema = z.object({
...RUNDOWN_TARGET_FIELD,
ids: z.array(z.string()).describe('Existing top-level entry IDs to group'),
...groupWritableFields,
});
export const ungroupEntrySchema = z.object({
...RUNDOWN_TARGET_FIELD,
id: z.string().describe('Group entry ID to dissolve'),
});
// Recursive: a group entry in a batch may include `children` of the same shape. `type`/
// `children` are declared outside entryFieldsSchema so the lazy() wrapper can reference
// the schema being defined.
export interface BatchCreateEntryArgs extends EntryFieldArgs {
type?: 'event' | 'delay' | 'milestone' | 'group';
children?: BatchCreateEntryArgs[];
}
export const batchCreateEntrySchema: z.ZodType<BatchCreateEntryArgs> = z.lazy(() =>
entryFieldsSchema.extend({
type: z.enum(['event', 'delay', 'milestone', 'group']).optional().describe('Entry type, defaults to event'),
children: z
.array(batchCreateEntrySchema)
.optional()
.describe(
'For group entries only: child events, milestones, or delays to create inside this group in order. Nested groups are not supported.',
),
}),
);
export const batchCreateEntriesSchema = z.object({
...RUNDOWN_TARGET_FIELD,
after: z.string().optional().describe('Insert the first entry after this entry ID'),
entries: z.array(batchCreateEntrySchema).describe('Array of entries to create, in desired order'),
});
export const batchUpdateEntriesSchema = z.object({
...RUNDOWN_TARGET_FIELD,
ids: z.array(z.string()).describe('Array of entry IDs to update'),
data: entryFieldsSchema.describe('Partial entry fields to apply to every ID'),
});
// ---- Rundown management ----
export const listRundownsSchema = z.object({});
export const createRundownSchema = z.object({ title: z.string().describe('Title for the new rundown') });
export const loadRundownSchema = z.object({ id: z.string().describe('Rundown ID to load') });
export const renameRundownSchema = z.object({
id: z.string().describe('Rundown ID to rename'),
title: z.string().describe('New title'),
});
export const deleteRundownSchema = z.object({ id: z.string().describe('Rundown ID to delete') });
export const duplicateRundownSchema = z.object({ id: z.string().describe('Rundown ID to duplicate') });
// ---- Timer & project ----
export const getTimerStateSchema = z.object({});
export const getProjectInfoSchema = z.object({});
export const updateProjectInfoSchema = z.object({
title: z.string().optional().describe('Project title'),
description: z.string().optional().describe('Project description'),
url: z.string().optional().describe('URL shown on viewer pages'),
info: z.string().optional().describe('Info text shown on viewer pages'),
});
export const getCustomFieldsSchema = z.object({});
export const createCustomFieldSchema = z.object({
label: z
.string()
.describe(
'Human-readable label (letters, numbers and spaces, e.g. "Camera"). Determines the key. Reuse an existing field over creating near-duplicates like "Cam", "camera", "Cameras".',
),
type: z
.enum(['text', 'image'])
.describe(
'Field type — cannot be changed after creation. Use "text" for short text values; "image" for image URLs.',
),
colour: z
.string()
.describe(
'Hex colour (#RRGGBB) used to visually identify this column in the cuesheet — for department fields, match the department colour convention (see ontime://style-guide).',
),
});
export const updateCustomFieldSchema = z.object({
key: z.string().describe('Current field key (from ontime_get_custom_fields)'),
label: z
.string()
.optional()
.describe('New human-readable label (optional). Changes the derived key and cascades to all entries.'),
colour: z.string().optional().describe('New hex colour (#RRGGBB) (optional)'),
});
export const deleteCustomFieldSchema = z.object({
key: z.string().describe('Field key to delete (from ontime_get_custom_fields)'),
});
// ---- Project file management ----
export const listProjectsSchema = z.object({});
export const loadProjectSchema = z.object({
filename: z.string().describe('Project filename, e.g. "my-show.json"'),
});
export const createProjectSchema = z.object({
filename: z.string().describe('Filename without extension, e.g. "my-show"'),
title: z.string().optional().describe('Optional project title'),
description: z.string().optional().describe('Optional project description'),
});
export const renameProjectSchema = z.object({
filename: z.string().describe('Current filename (with .json extension)'),
newFilename: z.string().describe('New filename (with .json extension)'),
});
export const duplicateProjectSchema = z.object({
filename: z.string().describe('Source filename to copy (with .json extension)'),
newFilename: z.string().describe('Filename of the new copy (with .json extension)'),
});
export const deleteProjectSchema = z.object({
filename: z.string().describe('Project filename to delete (with .json extension)'),
});
// ---- Inferred types consumed by mcp.service.ts (replaces its hand-written *Args types) ----
export type TargetRundownArgs = z.infer<typeof getRundownSchema>;
export type GetEntryArgs = z.infer<typeof getEntrySchema>;
export type CreateEntryArgs = z.infer<typeof createEntrySchema>;
export type UpdateEntryArgs = z.infer<typeof updateEntrySchema>;
export type DeleteEntriesArgs = z.infer<typeof deleteEntriesSchema>;
export type ReorderEntryArgs = z.infer<typeof reorderEntrySchema>;
export type GroupEntriesArgs = z.infer<typeof groupEntriesSchema>;
export type UngroupEntryArgs = z.infer<typeof ungroupEntrySchema>;
export type BatchCreateEntriesArgs = z.infer<typeof batchCreateEntriesSchema>;
export type BatchUpdateEntriesArgs = z.infer<typeof batchUpdateEntriesSchema>;
export type ProjectInfoArgs = z.infer<typeof updateProjectInfoSchema>;
export type CreateCustomFieldArgs = z.infer<typeof createCustomFieldSchema>;
export type UpdateCustomFieldArgs = z.infer<typeof updateCustomFieldSchema>;
export type DeleteCustomFieldArgs = z.infer<typeof deleteCustomFieldSchema>;
+319 -68
View File
@@ -1,6 +1,5 @@
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
import { ProjectData } from 'ontime-types';
import { z } from 'zod';
import { EntryId, ProjectData } from 'ontime-types';
import { editCurrentProjectData, getProjectData } from '../api-data/project-data/projectData.dao.js';
import { getProjectCustomFields, getRundownMetadata } from '../api-data/rundown/rundown.dao.js';
@@ -22,6 +21,7 @@ import {
renameProjectFile,
} from '../services/project-service/ProjectService.js';
import { getState } from '../stores/runtimeState.js';
import { EVENT_WRITABLE_FIELDS, RUNDOWN_TARGET_FIELD } from './mcp.schema.js';
import {
batchCreateEntriesForMcp,
batchUpdateEntriesForMcp,
@@ -37,19 +37,14 @@ import {
ungroupEntryForMcp,
updateCustomFieldForMcp,
updateEntryForMcp,
type BatchCreateEntryArgs,
type CreateEntryArgs,
type EntryFieldArgs,
type GroupEntriesArgs,
type TargetRundownArgs,
type UngroupEntryArgs,
type UpdateEntryArgs,
} from './mcp.service.js';
import * as schemas from './mcp.tools.schema.js';
/**
* Parses tool-call arguments against `schema`, throwing on failure. handleToolCall (below)
* already wraps every handler in try/catch and formats thrown errors into a CallToolResult,
* so this reuses that existing error path rather than inventing a second one — unlike the
* REST validation layer (apps/server/src/api-data/validation-utils/validate.ts), tool calls
* are not a hot request path, so .parse()'s throw-based control flow costs nothing here.
*/
function parseArgs<T extends z.ZodType>(schema: T, args: Record<string, unknown>): z.infer<T> {
return schema.parse(args);
}
// Graceful truncation to keep tool responses within typical MCP context windows
const CHARACTER_LIMIT = 25_000;
@@ -73,21 +68,28 @@ export const TOOL_DEFINITIONS = [
name: 'ontime_get_rundown',
description:
'Get a rundown. Omit rundownId for the currently loaded live rundown, or provide a rundownId from ontime_list_rundowns to read a background rundown. Returns { order: EntryId[], entries: { [id]: OntimeEntry } }. If the rundown exceeds 25 000 chars, returns only the order array with a warning — fetch individual entries with ontime_get_entry.',
inputSchema: z.toJSONSchema(schemas.getRundownSchema),
inputSchema: { type: 'object', properties: { ...RUNDOWN_TARGET_FIELD } },
annotations: READ,
},
{
name: 'ontime_get_rundown_metadata',
description:
'Get cached metadata for the current rundown. Returns: totalDelay, totalDuration, totalDays, firstStart, lastEnd, flags (flagged entry IDs), playableEventOrder, timedEventOrder, flatEntryOrder.',
inputSchema: z.toJSONSchema(schemas.getRundownMetadataSchema),
inputSchema: { type: 'object', properties: {} },
annotations: READ,
},
{
name: 'ontime_get_entry',
description:
'Get a single entry by id or cue. Provide either id or cue (not both). Omit rundownId for the currently loaded live rundown, or provide a rundownId from ontime_list_rundowns to read a background rundown. Returns the full entry object.',
inputSchema: z.toJSONSchema(schemas.getEntrySchema),
inputSchema: {
type: 'object',
properties: {
...RUNDOWN_TARGET_FIELD,
id: { type: 'string', description: 'Entry ID (from rundown.entries key or entry.id)' },
cue: { type: 'string', description: 'Human-facing cue label' },
},
},
annotations: READ,
},
// --- Rundown mutations ---
@@ -95,56 +97,186 @@ export const TOOL_DEFINITIONS = [
name: 'ontime_create_entry',
description:
'Create a new entry. Omit rundownId for the currently loaded live rundown, or provide a rundownId from ontime_list_rundowns to edit a background rundown without loading it. If playback is running and rundownId is omitted or matches the loaded rundown, confirm the user intends to change the live rundown before calling. Omit after/before to append at the end. For type "event" provide title plus enough timing data for Ontime to infer a strategy: timeStart+duration calculates timeEnd, timeStart+timeEnd calculates duration and locks end, timeEnd+duration calculates timeStart, and all three prioritise duration. For "milestone" provide cue/title/note/colour and optional custom values using existing project custom field keys. For "delay" provide duration. For "group" provide title plus optional note/colour/custom/targetDuration.',
inputSchema: z.toJSONSchema(schemas.createEntrySchema),
inputSchema: {
type: 'object',
properties: {
...RUNDOWN_TARGET_FIELD,
type: {
type: 'string',
enum: ['event', 'delay', 'milestone', 'group'],
description:
'Entry type, defaults to event. event: timed show item; milestone: non-timed marker; delay: schedule shift; group: named container of entries',
},
timeStart: { type: 'number', description: 'Event start time in ms from midnight (e.g. 09:00 = 32400000)' },
timeEnd: { type: 'number', description: 'Event end time in ms from midnight' },
duration: {
type: 'number',
description: 'Duration in ms (events: should equal timeEnd - timeStart; delays: the schedule shift)',
},
targetDuration: { type: 'number', description: 'Groups only: planned length of the group in ms' },
after: { type: 'string', description: 'Insert after this entry ID' },
before: { type: 'string', description: 'Insert before this entry ID' },
...EVENT_WRITABLE_FIELDS,
},
},
annotations: WRITE,
},
{
name: 'ontime_update_entry',
description:
'Update fields of an existing entry (event, milestone, delay or group). Omit rundownId for the currently loaded live rundown, or provide a rundownId from ontime_list_rundowns to edit a background rundown without loading it. If playback is running and rundownId is omitted or matches the loaded rundown, confirm the user intends to change the live rundown before calling. Only provided fields are changed. Event time fields (timeStart, timeEnd, duration) are reconciled server-side — you may provide any combination. Group fields: title, note, colour, custom, targetDuration. Delay field: duration. Milestone fields: cue, title, note, colour, custom. Custom values must use existing project custom field keys; adding a new custom field is a separate operation.',
inputSchema: z.toJSONSchema(schemas.updateEntrySchema),
inputSchema: {
type: 'object',
required: ['id'],
properties: {
...RUNDOWN_TARGET_FIELD,
id: { type: 'string', description: 'ID of the entry to update' },
timeStart: { type: 'number', description: 'Start time in ms from midnight' },
timeEnd: { type: 'number', description: 'End time in ms from midnight' },
duration: { type: 'number', description: 'Duration in ms' },
targetDuration: { type: 'number', description: 'Groups only: planned length of the group in ms' },
...EVENT_WRITABLE_FIELDS,
},
},
annotations: WRITE_DESTRUCTIVE,
},
{
name: 'ontime_delete_entries',
description:
'Delete one or more entries (events, milestones, delays, or groups). Omit rundownId for the currently loaded live rundown, or provide a rundownId from ontime_list_rundowns to edit a background rundown without loading it.',
inputSchema: z.toJSONSchema(schemas.deleteEntriesSchema),
inputSchema: {
type: 'object',
required: ['ids'],
properties: {
...RUNDOWN_TARGET_FIELD,
ids: { type: 'array', items: { type: 'string' }, description: 'Array of entry IDs to delete' },
},
},
annotations: WRITE_DESTRUCTIVE,
},
{
name: 'ontime_reorder_entry',
description:
'Move an entry to a new position relative to another entry. Omit rundownId for the currently loaded live rundown, or provide a rundownId from ontime_list_rundowns to edit a background rundown without loading it. Use before/after for sibling reordering; use insert for targeted moves into a group. For grouping several existing top-level entries, prefer ontime_group_entries.',
inputSchema: z.toJSONSchema(schemas.reorderEntrySchema),
inputSchema: {
type: 'object',
required: ['entryId', 'destinationId', 'order'],
properties: {
...RUNDOWN_TARGET_FIELD,
entryId: { type: 'string', description: 'ID of the entry to move' },
destinationId: { type: 'string', description: 'ID of the target entry (sibling or parent group)' },
order: {
type: 'string',
enum: ['before', 'after', 'insert'],
description: 'before/after: place as sibling; insert: place inside a group',
},
},
},
annotations: WRITE_IDEM,
},
{
name: 'ontime_group_entries',
description:
'Create a group from existing top-level entries. Omit rundownId for the currently loaded live rundown, or provide a rundownId from ontime_list_rundowns to edit a background rundown without loading it. If playback is running and rundownId is omitted or matches the loaded rundown, confirm the user intends to change the live rundown before calling. Entries must be existing top-level non-group entries; groups cannot be nested. Optional title, note, colour, custom, and targetDuration are applied to the created group.',
inputSchema: z.toJSONSchema(schemas.groupEntriesSchema),
inputSchema: {
type: 'object',
required: ['ids'],
properties: {
...RUNDOWN_TARGET_FIELD,
ids: { type: 'array', items: { type: 'string' }, description: 'Existing top-level entry IDs to group' },
title: { type: 'string', description: 'Group title shown in the rundown and views' },
note: { type: 'string', description: 'Free-text group note for production notes or references' },
colour: {
type: 'string',
description:
'Hex colour (#RRGGBB) for the group — prefer the default Ontime palette from ontime://style-guide',
},
custom: {
type: 'object',
additionalProperties: { type: 'string' },
description: 'Custom field values keyed by existing project field key',
},
targetDuration: { type: 'number', description: 'Planned length of the group in ms' },
},
},
annotations: WRITE,
},
{
name: 'ontime_ungroup_entry',
description:
'Dissolve a group by moving its children to the top level where the group was. Omit rundownId for the currently loaded live rundown, or provide a rundownId from ontime_list_rundowns to edit a background rundown without loading it. If playback is running and rundownId is omitted or matches the loaded rundown, confirm the user intends to change the live rundown before calling.',
inputSchema: z.toJSONSchema(schemas.ungroupEntrySchema),
inputSchema: {
type: 'object',
required: ['id'],
properties: {
...RUNDOWN_TARGET_FIELD,
id: { type: 'string', description: 'Group entry ID to dissolve' },
},
},
annotations: WRITE_DESTRUCTIVE,
},
{
name: 'ontime_batch_create_entries',
description:
'Create multiple entries, including groups with nested children. Omit rundownId for the currently loaded live rundown, or provide a rundownId from ontime_list_rundowns to edit a background rundown without loading it. If playback is running and rundownId is omitted or matches the loaded rundown, confirm the user intends to change the live rundown before calling. Use this for "build from agenda" flows to avoid many round trips. Entries are inserted in array order; if `after` is provided it positions the first top-level entry, subsequent top-level entries chain from the previous. A group entry may include `children`; those entries are created inside the group in array order. Groups cannot be nested. For events, provide title plus enough timing data for Ontime to infer a strategy: timeStart+duration calculates timeEnd, timeStart+timeEnd calculates duration and locks end, timeEnd+duration calculates timeStart, and all three prioritise duration.',
inputSchema: z.toJSONSchema(schemas.batchCreateEntriesSchema),
inputSchema: {
type: 'object',
required: ['entries'],
properties: {
...RUNDOWN_TARGET_FIELD,
after: { type: 'string', description: 'Insert the first entry after this entry ID' },
entries: {
type: 'array',
description: 'Array of entries to create, in desired order',
items: {
type: 'object',
properties: {
type: {
type: 'string',
enum: ['event', 'delay', 'milestone', 'group'],
description: 'Entry type, defaults to event',
},
timeStart: { type: 'number', description: 'Event start time in ms from midnight' },
timeEnd: { type: 'number', description: 'Event end time in ms from midnight' },
duration: { type: 'number', description: 'Duration in ms' },
targetDuration: { type: 'number', description: 'Groups only: planned length of the group in ms' },
children: {
type: 'array',
description:
'For group entries only: child events, milestones, or delays to create inside this group in order. Nested groups are not supported.',
items: { type: 'object' },
},
...EVENT_WRITABLE_FIELDS,
},
},
},
},
},
annotations: WRITE,
},
{
name: 'ontime_batch_update_entries',
description:
'Apply the same field values to multiple entries by ID. Omit rundownId for the currently loaded live rundown, or provide a rundownId from ontime_list_rundowns to edit a background rundown without loading it. Use for bulk operations like recolouring all keynotes, skipping all breaks, or setting the same custom value on several entries. Custom values must use existing project custom field keys. Do not use for changes where each entry needs a different value, such as time shifts with different timeStart/timeEnd values; compute those per entry and call ontime_update_entry for each.',
inputSchema: z.toJSONSchema(schemas.batchUpdateEntriesSchema),
inputSchema: {
type: 'object',
required: ['ids', 'data'],
properties: {
...RUNDOWN_TARGET_FIELD,
ids: { type: 'array', items: { type: 'string' }, description: 'Array of entry IDs to update' },
data: {
type: 'object',
description: 'Partial entry fields to apply to every ID',
properties: {
timeStart: { type: 'number', description: 'Start time in ms from midnight' },
timeEnd: { type: 'number', description: 'End time in ms from midnight' },
duration: { type: 'number', description: 'Duration in ms' },
targetDuration: { type: 'number', description: 'Groups only: planned length of the group in ms' },
...EVENT_WRITABLE_FIELDS,
},
},
},
},
annotations: WRITE_DESTRUCTIVE,
},
// --- Rundown management ---
@@ -152,39 +284,62 @@ export const TOOL_DEFINITIONS = [
name: 'ontime_list_rundowns',
description:
'List all rundowns in the current project. Returns rundown IDs and titles, plus the ID of the currently loaded one.',
inputSchema: z.toJSONSchema(schemas.listRundownsSchema),
inputSchema: { type: 'object', properties: {} },
annotations: READ,
},
{
name: 'ontime_create_rundown',
description:
'Create a new empty rundown in the current project. Does not switch to it — use ontime_load_rundown to activate.',
inputSchema: z.toJSONSchema(schemas.createRundownSchema),
inputSchema: {
type: 'object',
required: ['title'],
properties: { title: { type: 'string', description: 'Title for the new rundown' } },
},
annotations: WRITE,
},
{
name: 'ontime_load_rundown',
description:
'Make a rundown the active rundown. This resets the runtime and clears playback state. If playback is running, confirm the user accepts interrupting the live rundown before calling. To edit a background rundown without interrupting playback, advise using the cuesheet view.',
inputSchema: z.toJSONSchema(schemas.loadRundownSchema),
inputSchema: {
type: 'object',
required: ['id'],
properties: { id: { type: 'string', description: 'Rundown ID to load' } },
},
annotations: WRITE_DESTRUCTIVE,
},
{
name: 'ontime_rename_rundown',
description: 'Rename an existing rundown',
inputSchema: z.toJSONSchema(schemas.renameRundownSchema),
inputSchema: {
type: 'object',
required: ['id', 'title'],
properties: {
id: { type: 'string', description: 'Rundown ID to rename' },
title: { type: 'string', description: 'New title' },
},
},
annotations: WRITE_IDEM,
},
{
name: 'ontime_delete_rundown',
description: 'Delete a rundown (cannot delete the currently loaded rundown or the last remaining rundown)',
inputSchema: z.toJSONSchema(schemas.deleteRundownSchema),
inputSchema: {
type: 'object',
required: ['id'],
properties: { id: { type: 'string', description: 'Rundown ID to delete' } },
},
annotations: WRITE_DESTRUCTIVE,
},
{
name: 'ontime_duplicate_rundown',
description: 'Duplicate a rundown, creating a copy with a new ID. Does not switch to the copy.',
inputSchema: z.toJSONSchema(schemas.duplicateRundownSchema),
inputSchema: {
type: 'object',
required: ['id'],
properties: { id: { type: 'string', description: 'Rundown ID to duplicate' } },
},
annotations: WRITE,
},
// --- Timer & project ---
@@ -192,93 +347,171 @@ export const TOOL_DEFINITIONS = [
name: 'ontime_get_timer_state',
description:
'Get the current timer/playback state. Returns: clock (time of day), timer ({ playback, current, elapsed, phase, expectedFinish, addedTime, startedAt }), eventNow (full event object or null), eventNext (full event object or null), offset.',
inputSchema: z.toJSONSchema(schemas.getTimerStateSchema),
inputSchema: { type: 'object', properties: {} },
annotations: READ,
},
{
name: 'ontime_get_project_info',
description:
'Get current project metadata: title, description, url, info, logo, and custom header fields (array of { title, value, url }).',
inputSchema: z.toJSONSchema(schemas.getProjectInfoSchema),
inputSchema: { type: 'object', properties: {} },
annotations: READ,
},
{
name: 'ontime_update_project_info',
description: 'Update project metadata fields. All fields are optional — only provided fields are updated.',
inputSchema: z.toJSONSchema(schemas.updateProjectInfoSchema),
inputSchema: {
type: 'object',
properties: {
title: { type: 'string', description: 'Project title' },
description: { type: 'string', description: 'Project description' },
url: { type: 'string', description: 'URL shown on viewer pages' },
info: { type: 'string', description: 'Info text shown on viewer pages' },
},
},
annotations: WRITE_DESTRUCTIVE,
},
{
name: 'ontime_get_custom_fields',
description:
'Get the project custom field definitions. Returns { [key]: { label, type: "text"|"image", colour } }. Keys are referenced in entry.custom[key].',
inputSchema: z.toJSONSchema(schemas.getCustomFieldsSchema),
inputSchema: { type: 'object', properties: {} },
annotations: READ,
},
{
name: 'ontime_create_custom_field',
description:
'Create a new project-level custom field definition. Custom fields add typed columns to every entry in all rundowns. The key is auto-derived from the label (spaces → underscores, e.g. "Camera Angle" → "Camera_Angle"). Creation is non-destructive — check ontime_get_custom_fields for an existing field covering the concept, and if none exists create directly without asking the user. After creation, use the returned key in entry.custom.',
inputSchema: z.toJSONSchema(schemas.createCustomFieldSchema),
inputSchema: {
type: 'object',
required: ['label', 'type', 'colour'],
properties: {
label: {
type: 'string',
description:
'Human-readable label (letters, numbers and spaces, e.g. "Camera"). Determines the key. Reuse an existing field over creating near-duplicates like "Cam", "camera", "Cameras".',
},
type: {
type: 'string',
enum: ['text', 'image'],
description:
'Field type — cannot be changed after creation. Use "text" for short text values; "image" for image URLs.',
},
colour: {
type: 'string',
description:
'Hex colour (#RRGGBB) used to visually identify this column in the cuesheet — for department fields, match the department colour convention (see ontime://style-guide).',
},
},
},
annotations: WRITE,
},
{
name: 'ontime_update_custom_field',
description:
'Update a custom field label or colour. Changing the label renames the derived key (spaces → underscores) and updates all entry references across all rundowns. Field type cannot be changed.',
inputSchema: z.toJSONSchema(schemas.updateCustomFieldSchema),
inputSchema: {
type: 'object',
required: ['key'],
properties: {
key: { type: 'string', description: 'Current field key (from ontime_get_custom_fields)' },
label: {
type: 'string',
description: 'New human-readable label (optional). Changes the derived key and cascades to all entries.',
},
colour: { type: 'string', description: 'New hex colour (#RRGGBB) (optional)' },
},
},
annotations: WRITE_IDEM,
},
{
name: 'ontime_delete_custom_field',
description:
'Delete a custom field definition and remove its values from all entries in all rundowns. Destructive and cannot be undone — confirm with the user before calling.',
inputSchema: z.toJSONSchema(schemas.deleteCustomFieldSchema),
inputSchema: {
type: 'object',
required: ['key'],
properties: {
key: { type: 'string', description: 'Field key to delete (from ontime_get_custom_fields)' },
},
},
annotations: WRITE_DESTRUCTIVE,
},
// --- Project file management ---
{
name: 'ontime_list_projects',
description: 'List all project files on disk. Returns filenames, timestamps, and the last-loaded project name.',
inputSchema: z.toJSONSchema(schemas.listProjectsSchema),
inputSchema: { type: 'object', properties: {} },
annotations: READ,
},
{
name: 'ontime_load_project',
description:
'Load a different project file by filename. This swaps the database and reinitialises runtime. If playback is running, confirm the user accepts interrupting the live project before calling.',
inputSchema: z.toJSONSchema(schemas.loadProjectSchema),
inputSchema: {
type: 'object',
required: ['filename'],
properties: { filename: { type: 'string', description: 'Project filename, e.g. "my-show.json"' } },
},
annotations: WRITE_DESTRUCTIVE,
},
{
name: 'ontime_create_project',
description:
'Create a new project file and switch to it. This swaps the loaded project. If playback is running, confirm the user accepts interrupting the live project before calling. Omit the .json extension — Ontime appends it.',
inputSchema: z.toJSONSchema(schemas.createProjectSchema),
inputSchema: {
type: 'object',
required: ['filename'],
properties: {
filename: { type: 'string', description: 'Filename without extension, e.g. "my-show"' },
title: { type: 'string', description: 'Optional project title' },
description: { type: 'string', description: 'Optional project description' },
},
},
annotations: WRITE_DESTRUCTIVE,
},
{
name: 'ontime_rename_project',
description: 'Rename a project file. If the renamed project is currently loaded, it is reloaded with the new name.',
inputSchema: z.toJSONSchema(schemas.renameProjectSchema),
inputSchema: {
type: 'object',
required: ['filename', 'newFilename'],
properties: {
filename: { type: 'string', description: 'Current filename (with .json extension)' },
newFilename: { type: 'string', description: 'New filename (with .json extension)' },
},
},
annotations: WRITE_IDEM,
},
{
name: 'ontime_duplicate_project',
description: 'Duplicate a project file on disk with a new filename. Does not switch to the copy.',
inputSchema: z.toJSONSchema(schemas.duplicateProjectSchema),
inputSchema: {
type: 'object',
required: ['filename', 'newFilename'],
properties: {
filename: { type: 'string', description: 'Source filename to copy (with .json extension)' },
newFilename: { type: 'string', description: 'Filename of the new copy (with .json extension)' },
},
},
annotations: WRITE,
},
{
name: 'ontime_delete_project',
description: 'Delete a project file from disk. Fails if the file is currently loaded.',
inputSchema: z.toJSONSchema(schemas.deleteProjectSchema),
inputSchema: {
type: 'object',
required: ['filename'],
properties: { filename: { type: 'string', description: 'Project filename to delete (with .json extension)' } },
},
annotations: WRITE_DESTRUCTIVE,
},
] as const;
type ToolName = (typeof TOOL_DEFINITIONS)[number]['name'];
type ProjectInfoArgs = Partial<Pick<ProjectData, 'title' | 'description' | 'url' | 'info'>>;
// ---- Response helpers (module-level to avoid re-allocation on every tool call) ----
const text = (data: unknown): string => JSON.stringify(data);
@@ -295,7 +528,7 @@ export const err = (e: unknown): CallToolResult => ({
// into an existing service and formats the response. Business logic belongs in the services.
const TOOL_HANDLERS: Record<ToolName, (args: Record<string, unknown>) => Promise<CallToolResult>> = {
ontime_get_rundown: async (args) => {
const targetArgs = parseArgs(schemas.getRundownSchema, args);
const targetArgs = args as TargetRundownArgs;
const rundown = getRundownById(targetArgs.rundownId);
const data = { order: rundown.order, entries: rundown.entries };
const serialised = text(data);
@@ -313,7 +546,7 @@ const TOOL_HANDLERS: Record<ToolName, (args: Record<string, unknown>) => Promise
ontime_get_rundown_metadata: async () => ok(getRundownMetadata()),
ontime_get_entry: async (args) => {
const entryArgs = parseArgs(schemas.getEntrySchema, args);
const entryArgs = args as TargetRundownArgs & { id?: EntryId; cue?: string };
const entry = findEntry(entryArgs);
if (entry) return ok(entry);
if (entryArgs.id) return err(`No entry with id ${entryArgs.id}`);
@@ -322,61 +555,71 @@ const TOOL_HANDLERS: Record<ToolName, (args: Record<string, unknown>) => Promise
},
ontime_create_entry: async (args) => {
return ok(await createEntryForMcp(parseArgs(schemas.createEntrySchema, args)));
return ok(await createEntryForMcp(args as CreateEntryArgs));
},
ontime_update_entry: async (args) => {
return ok(await updateEntryForMcp(parseArgs(schemas.updateEntrySchema, args)));
return ok(await updateEntryForMcp(args as UpdateEntryArgs));
},
ontime_delete_entries: async (args) => {
return ok(await deleteEntriesForMcp(parseArgs(schemas.deleteEntriesSchema, args)));
return ok(await deleteEntriesForMcp(args as TargetRundownArgs & { ids: EntryId[] }));
},
ontime_reorder_entry: async (args) => {
return ok(await reorderEntryForMcp(parseArgs(schemas.reorderEntrySchema, args)));
return ok(
await reorderEntryForMcp(
args as TargetRundownArgs & {
entryId: EntryId;
destinationId: EntryId;
order: 'before' | 'after' | 'insert';
},
),
);
},
ontime_group_entries: async (args) => {
return ok(await groupEntriesForMcp(parseArgs(schemas.groupEntriesSchema, args)));
return ok(await groupEntriesForMcp(args as GroupEntriesArgs));
},
ontime_ungroup_entry: async (args) => {
return ok(await ungroupEntryForMcp(parseArgs(schemas.ungroupEntrySchema, args)));
return ok(await ungroupEntryForMcp(args as UngroupEntryArgs));
},
ontime_batch_create_entries: async (args) => {
return ok(await batchCreateEntriesForMcp(parseArgs(schemas.batchCreateEntriesSchema, args)));
return ok(
await batchCreateEntriesForMcp(args as TargetRundownArgs & { entries: BatchCreateEntryArgs[]; after?: EntryId }),
);
},
ontime_batch_update_entries: async (args) => {
return ok(await batchUpdateEntriesForMcp(parseArgs(schemas.batchUpdateEntriesSchema, args)));
return ok(await batchUpdateEntriesForMcp(args as TargetRundownArgs & { ids: EntryId[]; data: EntryFieldArgs }));
},
ontime_list_rundowns: async () => ok(toRundownList(getDataProvider().getProjectRundowns())),
ontime_create_rundown: async (args) => {
const { title } = parseArgs(schemas.createRundownSchema, args);
const { title } = args as { title: string };
return ok(toRundownList(await createNewRundown(title)));
},
ontime_load_rundown: async (args) => {
const { id } = parseArgs(schemas.loadRundownSchema, args);
const { id } = args as { id: string };
return ok(toRundownList(await loadRundown(id)));
},
ontime_rename_rundown: async (args) => {
const { id, title } = parseArgs(schemas.renameRundownSchema, args);
const { id, title } = args as { id: string; title: string };
return ok(toRundownList(await renameRundown(id, title)));
},
ontime_delete_rundown: async (args) => {
const { id } = parseArgs(schemas.deleteRundownSchema, args);
const { id } = args as { id: string };
return ok(toRundownList(await deleteRundown(id)));
},
ontime_duplicate_rundown: async (args) => {
const { id } = parseArgs(schemas.duplicateRundownSchema, args);
const { id } = args as { id: string };
return ok(toRundownList(await duplicateExistingRundown(id)));
},
@@ -388,53 +631,61 @@ const TOOL_HANDLERS: Record<ToolName, (args: Record<string, unknown>) => Promise
ontime_get_project_info: async () => ok(getProjectData()),
ontime_update_project_info: async (args) => {
const updated = await editCurrentProjectData(parseArgs(schemas.updateProjectInfoSchema, args));
const updated = await editCurrentProjectData(args as ProjectInfoArgs);
return ok(updated);
},
ontime_get_custom_fields: async () => ok(getProjectCustomFields()),
ontime_create_custom_field: async (args) => {
return ok(await createCustomFieldForMcp(parseArgs(schemas.createCustomFieldSchema, args)));
return ok(await createCustomFieldForMcp(args as { label: string; type: 'text' | 'image'; colour: string }));
},
ontime_update_custom_field: async (args) => {
return ok(await updateCustomFieldForMcp(parseArgs(schemas.updateCustomFieldSchema, args)));
return ok(await updateCustomFieldForMcp(args as { key: string; label?: string; colour?: string }));
},
ontime_delete_custom_field: async (args) => {
return ok(await deleteCustomFieldForMcp(parseArgs(schemas.deleteCustomFieldSchema, args)));
return ok(await deleteCustomFieldForMcp(args as { key: string }));
},
ontime_list_projects: async () => ok(await getProjectList()),
ontime_load_project: async (args) => {
const { filename } = parseArgs(schemas.loadProjectSchema, args);
const { filename } = args as { filename: string };
await loadProjectFile(filename);
return ok(await getProjectList());
},
ontime_create_project: async (args) => {
const { filename, title = '', description = '' } = parseArgs(schemas.createProjectSchema, args);
const {
filename,
title = '',
description = '',
} = args as {
filename: string;
title?: string;
description?: string;
};
const project: ProjectData = { ...makeNewProject().project, title, description };
const newFileName = await createProjectWithPatch(filename, { project });
return ok({ filename: newFileName });
},
ontime_rename_project: async (args) => {
const { filename, newFilename } = parseArgs(schemas.renameProjectSchema, args);
const { filename, newFilename } = args as { filename: string; newFilename: string };
await renameProjectFile(filename, newFilename);
return ok(await getProjectList());
},
ontime_duplicate_project: async (args) => {
const { filename, newFilename } = parseArgs(schemas.duplicateProjectSchema, args);
const { filename, newFilename } = args as { filename: string; newFilename: string };
await duplicateProjectFile(filename, newFilename);
return ok(await getProjectList());
},
ontime_delete_project: async (args) => {
const { filename } = parseArgs(schemas.deleteProjectSchema, args);
const { filename } = args as { filename: string };
await deleteProjectFile(filename);
return ok(await getProjectList());
},
@@ -33,4 +33,11 @@ describe('validateTimerMessage()', () => {
expect(validateTimerMessage(payload)).toStrictEqual(expected);
});
it('coerces the secondary placement to a permitted value', () => {
expect(validateTimerMessage({ secondaryPlacement: 'main' })).toStrictEqual({ secondaryPlacement: 'main' });
expect(validateTimerMessage({ secondaryPlacement: 'below' })).toStrictEqual({ secondaryPlacement: 'below' });
});
it('falls back to below for an invalid placement', () => {
expect(validateTimerMessage({ secondaryPlacement: 'nonsense' })).toStrictEqual({ secondaryPlacement: 'below' });
});
});
@@ -25,6 +25,7 @@ export function validateTimerMessage(message: unknown): Partial<TimerMessage> {
if ('blink' in message) result.blink = coerceBoolean(message.blink);
if ('blackout' in message) result.blackout = coerceBoolean(message.blackout);
if ('secondarySource' in message) result.secondarySource = coerceSecondary(message.secondarySource);
if ('secondaryPlacement' in message) result.secondaryPlacement = coercePlacement(message.secondaryPlacement);
return result;
}
@@ -45,3 +46,20 @@ function coerceSecondary(source: unknown): TimerMessage['secondarySource'] {
}
return source;
}
/**
* Asserts that the placement value is one of the permitted values
*/
function assertPlacement(placement: unknown): placement is TimerMessage['secondaryPlacement'] {
return placement === 'below' || placement === 'main';
}
/**
* Ensures that the placement value is one of the permitted values
*/
function coercePlacement(placement: unknown): TimerMessage['secondaryPlacement'] {
if (!assertPlacement(placement)) {
return 'below';
}
return placement;
}
@@ -1,11 +1,19 @@
export type SecondarySource = 'aux1' | 'aux2' | 'aux3' | 'secondary' | null;
/**
* Where the selected secondary source is displayed in the timer view
* - below: shown as a smaller timer under the main timer (default)
* - main: swapped into the main slot, demoting the event timer to the secondary slot
*/
export type SecondaryPlacement = 'below' | 'main';
export type TimerMessage = {
text: string;
visible: boolean;
blink: boolean;
blackout: boolean;
secondarySource: SecondarySource;
secondaryPlacement: SecondaryPlacement;
};
export type MessageState = {
@@ -24,6 +24,7 @@ export const runtimeStorePlaceholder: Readonly<RuntimeStore> = {
blink: false,
blackout: false,
secondarySource: null,
secondaryPlacement: 'below',
},
secondary: '',
},
+6 -1
View File
@@ -108,7 +108,12 @@ export type { ApiAction, ApiActionTag, ApiResponse } from './api/websocket/api.t
export { type Log, LogLevel, type LogMessage, LogOrigin } from './definitions/runtime/Logger.type.js';
export { Playback } from './definitions/runtime/Playback.type.js';
export { TimerLifeCycle, timerLifecycleValues } from './definitions/core/TimerLifecycle.type.js';
export type { TimerMessage, MessageState, SecondarySource } from './definitions/runtime/MessageControl.type.js';
export type {
TimerMessage,
MessageState,
SecondarySource,
SecondaryPlacement,
} from './definitions/runtime/MessageControl.type.js';
export type { RundownState } from './definitions/runtime/RundownState.type.js';
export type { Offset } from './definitions/runtime/Offset.type.js';
-6
View File
@@ -21,9 +21,6 @@ catalogs:
vitest:
specifier: 4.0.17
version: 4.0.17
zod:
specifier: 4.4.3
version: 4.4.3
importers:
@@ -278,9 +275,6 @@ importers:
xlsx:
specifier: ^0.18.5
version: 0.18.5
zod:
specifier: 'catalog:'
version: 4.4.3
devDependencies:
'@types/cookie-parser':
specifier: 1.4.10
-1
View File
@@ -8,7 +8,6 @@ catalog:
ts-essentials: 10.1.1
typescript: 7.0.2
vitest: 4.0.17
zod: 4.4.3
allowBuilds:
'@parcel/watcher': true