Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(ai): Scheduled agents frontend (#2633)

Eric Hayes70fd84991926
diff --git a/js/app/bun.lock b/js/app/bun.lock
index 32f790548e..a265db8541 100644
--- a/js/app/bun.lock
+++ b/js/app/bun.lock
@@ -158,6 +158,9 @@
"typescript": "^5.0.0",
},
},
+ "packages/block-automation": {
+ "name": "block-automation",
+ },
"packages/block-call": {
"name": "block-call",
},
@@ -1457,6 +1460,8 @@
"bl": ["[email protected]", "", { "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="],
+ "block-automation": ["block-automation@workspace:packages/block-automation"],
+
"block-call": ["block-call@workspace:packages/block-call"],
"block-canvas": ["block-canvas@workspace:packages/block-canvas"],
diff --git a/js/app/packages/app/component/Launcher.tsx b/js/app/packages/app/component/Launcher.tsx
index fc90e0e31a..b535150880 100644
--- a/js/app/packages/app/component/Launcher.tsx
+++ b/js/app/packages/app/component/Launcher.tsx
@@ -51,6 +51,7 @@ import { Dynamic } from 'solid-js/web';
import { type FocusableElement, tabbable } from 'tabbable';
import { useSplitLayout } from './split-layout/layout';
import { cn } from '@ui/utils/classname';
+import { setAutomationComposerOpen } from '@block-automation/component';
const createBlock = async (spec: {
blockName: BlockName | BlockAlias;
@@ -226,6 +227,10 @@ export function runCreateAction(
shouldInsert,
});
return;
+ case 'automation':
+ setCreateMenuOpen(false, false);
+ setAutomationComposerOpen(true, false);
+ return;
}
}
diff --git a/js/app/packages/app/component/Layout.tsx b/js/app/packages/app/component/Layout.tsx
index fa3e87827b..240d460304 100644
--- a/js/app/packages/app/component/Layout.tsx
+++ b/js/app/packages/app/component/Layout.tsx
@@ -28,6 +28,7 @@ import { CommandMenu } from './command';
import GlobalShortcuts from './GlobalHotkeys';
import { ItemDndProvider } from './ItemDragAndDrop';
import { createMenuOpen, Launcher, setCreateMenuOpen } from './Launcher';
+import { AutomationComposer } from '@block-automation/component';
import { Paywall } from './paywall/Paywall';
import { PropertyEditorModal } from './property-edit-modal/PropertyEditorModal';
import { SettingsWrapper } from './settings/SettingsWrapper';
@@ -213,6 +214,7 @@ function LayoutInner(props: RouteSectionProps) {
when={isAuthenticated() && !AUTH_URLS.includes(location.pathname)}
>
<Launcher open={createMenuOpen()} onOpenChange={setCreateMenuOpen} />
+ <AutomationComposer />
</Show>
</Suspense>
</div>
diff --git a/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts b/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
index 2c9c8d0546..844a4b0eec 100644
--- a/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
+++ b/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
@@ -117,6 +117,12 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
queryFilters: QUERY_FILTERS.agent,
clientFilters: { and: ['agent', 'shared-agent'] },
}),
+ automations: () => ({
+ // Server returns nothing useful here — automations are merged
+ // into the soup client-side via `additionalEntities`.
+ queryFilters: QUERY_FILTERS.agent,
+ clientFilters: { and: ['automation'] },
+ }),
},
},
mail: {
diff --git a/js/app/packages/app/component/next-soup/filters/configs.ts b/js/app/packages/app/component/next-soup/filters/configs.ts
index 16310b50ea..08eba4b6c8 100644
--- a/js/app/packages/app/component/next-soup/filters/configs.ts
+++ b/js/app/packages/app/component/next-soup/filters/configs.ts
@@ -37,6 +37,7 @@ import {
notDoneFilter,
peopleFilter,
projectFilter,
+ automationFilter,
taskFilter,
teamsFilter,
unreadFilter,
@@ -70,6 +71,12 @@ export const ENTITY_TYPE_FILTER_CONFIGS = [
predicate: agentFilter,
group: 'entity-type',
},
+ {
+ id: 'automation',
+ label: 'Scheduled',
+ predicate: automationFilter,
+ group: 'entity-type',
+ },
{
id: 'people',
label: 'People',
diff --git a/js/app/packages/app/component/next-soup/filters/inbox-filters.ts b/js/app/packages/app/component/next-soup/filters/inbox-filters.ts
index 3275916272..0cf7e39327 100644
--- a/js/app/packages/app/component/next-soup/filters/inbox-filters.ts
+++ b/js/app/packages/app/component/next-soup/filters/inbox-filters.ts
@@ -158,6 +158,9 @@ export function signalFilter(entity: EntityData): boolean {
return true;
case 'call':
return true;
+ case 'automation':
+ // Automations only show in the Agents > Scheduled tab, not Inbox.
+ return false;
}
}
diff --git a/js/app/packages/app/component/next-soup/filters/predicates.ts b/js/app/packages/app/component/next-soup/filters/predicates.ts
index eb3a9abc11..274d5f50cf 100644
--- a/js/app/packages/app/component/next-soup/filters/predicates.ts
+++ b/js/app/packages/app/component/next-soup/filters/predicates.ts
@@ -81,6 +81,10 @@ export function agentFilter(entity: EntityData): boolean {
return entity.type === 'chat';
}
+export function automationFilter(entity: EntityData): boolean {
+ return entity.type === 'automation';
+}
+
export function projectFilter(entity: EntityData): boolean {
return entity.type === 'project';
}
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
index d4c596288b..46c192d6ef 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
@@ -104,6 +104,11 @@ interface SoupViewContextProviderProps {
soup?: SoupState;
queryFilters?: SoupBody;
disableLocalSearch?: boolean;
+ /**
+ * Additional client-side entities to merge into the soup item stream.
+ * Visibility is still controlled by the active client filters.
+ */
+ additionalEntities?: Accessor<EntityData[]>;
}
type ApiSortMethod = NonNullable<SoupParams['sort_method']>;
@@ -250,9 +255,15 @@ export const SoupViewContextProvider: FlowComponent<
if (!searching) {
const data = itemsQuery.data;
if (!data) return prev;
- return data.map((e) =>
+ const base = data.map((e) =>
isWithNotification(e) ? e : attachNotifications(e)
) as SoupEntity[];
+ const extras = props.additionalEntities?.() ?? [];
+ if (extras.length === 0) return base;
+ const extraEntities = extras.map((e) =>
+ isWithNotification(e) ? e : attachNotifications(e)
+ ) as SoupEntity[];
+ return [...extraEntities, ...base];
}
const local = search.localFuzzyResults();
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsx
index da63fdfbb3..1544ef1068 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsx
@@ -17,7 +17,7 @@ import { NewCallButton } from './NewCallButton';
const VIEW_CREATE_BLOCKNAMES: Partial<Record<ListView, BlockName[]>> = {
documents: ['md', 'canvas', 'code'],
tasks: ['task'],
- agents: ['chat'],
+ agents: ['chat', 'automation'],
mail: ['email'],
channels: ['channel'],
folders: ['project'],
@@ -30,12 +30,23 @@ type CreateOption = {
const IMPORT_OPTION: CreateOption = { id: 'import', label: 'Import' };
+/**
+ * Fallback labels for blocks that shouldn't appear in the global launcher
+ * (and thus aren't in CREATABLE_BLOCKS) but still need a create entry in
+ * specific list views.
+ */
+const VIEW_ONLY_BLOCK_LABELS: Partial<Record<BlockName, string>> = {
+ automation: 'Automation',
+};
+
function getViewCreateOptions(view: ListView): CreateOption[] {
const createNames = VIEW_CREATE_BLOCKNAMES[view] ?? [];
const options: CreateOption[] = createNames.flatMap((name) => {
const block = CREATABLE_BLOCKS.find((b) => b.blockName === name);
- if (!block) return [];
- return [{ id: block.blockName, label: block.label }];
+ if (block) return [{ id: block.blockName, label: block.label }];
+ const viewOnlyLabel = VIEW_ONLY_BLOCK_LABELS[name];
+ if (viewOnlyLabel) return [{ id: name, label: viewOnlyLabel }];
+ return [];
});
if (view === 'documents') options.push(IMPORT_OPTION);
return options;
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx
index b9dabc6f28..b4d3c01907 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx
@@ -31,6 +31,7 @@ export const VIEW_TAB_LISTS: Record<TabbedListView, TabItem[]> = {
{ value: 'owned', label: 'Owned' },
{ value: 'running', label: 'Running' },
{ value: 'shared', label: 'Shared' },
+ { value: 'automations', label: 'Automations' },
],
mail: [
{ value: 'important', label: 'Signal' },
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
index addf422758..d86a0ae3b1 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
@@ -190,6 +190,13 @@ interface SoupViewProps {
initialClientFilters?: { and?: FilterID[]; or?: FilterID[] };
queryFilters?: SoupItemsQueryFilters;
disableLocalSearch?: boolean;
+ /**
+ * Client-side entities to merge into the soup results. Useful for entity
+ * types (e.g. automation) that don't come back from the soup API.
+ * Visibility is controlled by the active client filter set — use a tab
+ * preset whose `clientFilters` include a predicate that matches them.
+ */
+ additionalEntities?: Accessor<EntityData[]>;
}
export const SoupView = (props: SoupViewProps) => {
@@ -254,6 +261,7 @@ export const SoupView = (props: SoupViewProps) => {
soup={soup}
queryFilters={props.queryFilters}
disableLocalSearch={props.disableLocalSearch}
+ additionalEntities={props.additionalEntities}
>
<div class="size-full flex flex-col">
<div class="flex flex-col w-full">
diff --git a/js/app/packages/app/component/split-layout/componentRegistry.tsx b/js/app/packages/app/component/split-layout/componentRegistry.tsx
index 1079b2d0b1..035e5537b4 100644
--- a/js/app/packages/app/component/split-layout/componentRegistry.tsx
+++ b/js/app/packages/app/component/split-layout/componentRegistry.tsx
@@ -9,6 +9,7 @@ import { DEV_MODE_ENV, LOCAL_ONLY } from '@core/constant/featureFlags';
import { useUserContext } from '@core/context/user';
import type { ViewId } from '@core/types/view';
import NotificationRoute from '@notifications/components/NotificationRoute';
+import { useAutomationEntities } from '@queries/agent-schedule/entities';
import { type Component, type JSXElement, lazy, onMount, Show } from 'solid-js';
import { EmailCompose } from '../../../block-email/component/compose/Compose';
import { SettingsPanelComponentWrapper } from '../settings/Settings';
@@ -124,11 +125,13 @@ registerComponent(
userId: user.userId(),
email: user.email(),
});
+ const automationEntities = useAutomationEntities();
return (
<SoupView
viewName="Agents"
queryFilters={preset.queryFilters}
initialClientFilters={preset.clientFilters}
+ additionalEntities={automationEntities}
/>
);
})
diff --git a/js/app/packages/app/constants/list-views.ts b/js/app/packages/app/constants/list-views.ts
index 0ff44dff60..131c87d4db 100644
--- a/js/app/packages/app/constants/list-views.ts
+++ b/js/app/packages/app/constants/list-views.ts
@@ -65,6 +65,7 @@ const BLOCK_LIST_VIEW_MAP = {
unknown: 'inbox',
video: 'documents',
write: 'documents',
+ automation: 'agents',
} as const satisfies Record<BlockName | BlockAlias, ListView>;
export const getBlockListView = (block: BlockName | BlockAlias): ListView => {
diff --git a/js/app/packages/block-automation/component/Automation.tsx b/js/app/packages/block-automation/component/Automation.tsx
new file mode 100644
index 0000000000..f54e4cf9ae
--- /dev/null
+++ b/js/app/packages/block-automation/component/Automation.tsx
@@ -0,0 +1,452 @@
+import { SplitHeaderLeft } from '@app/component/split-layout/components/SplitHeader';
+import { useSplitLayout } from '@app/component/split-layout/layout';
+import { useSplitPanelOrThrow } from '@app/component/split-layout/layoutUtils';
+import { useBlockId } from '@core/block';
+import { EntityIcon } from '@core/component/EntityIcon';
+import { toast } from '@core/component/Toast/Toast';
+import { whenSettled } from '@core/util/whenSettled';
+import { formatDateAndTime } from '@entity';
+import {
+ invalidateSchedules,
+ useRunScheduleNowMutation,
+ useScheduleHistoryQuery,
+ useSchedulesQuery,
+ useUpdateScheduleMutation,
+} from '@queries/agent-schedule/schedules';
+import { useChatQuery } from '@queries/chat';
+import { debounce } from '@solid-primitives/scheduled';
+import { Button } from '@ui/components/Button';
+import { cn } from '@ui/utils/classname';
+import { createMemo, createSignal, For, onMount, Show } from 'solid-js';
+import { AutomationPromptEditor } from './AutomationPromptEditor';
+import { AutomationRenameModal } from './AutomationRenameModal';
+import { AutomationTimePicker } from './AutomationTimePicker';
+import {
+ describeSchedule,
+ draftFromSchedule,
+ draftToUpdateBody,
+ FREQUENCY_OPTIONS,
+ getDefaultTimezone,
+ getErrorMessage,
+ INPUT_CLASS,
+ isValidTime,
+ WEEKDAY_OPTIONS,
+} from './automationUtils';
+import type { ScheduleDraft } from './types';
+
+type HistoryRecord = {
+ id?: string | null;
+ resource_id?: string | null;
+ start_time?: string | null;
+ is_success?: boolean | null;
+};
+
+function HistoryRow(props: { record: HistoryRecord }) {
+ const { replaceOrInsertSplit } = useSplitLayout();
+ const chatId = () => props.record.resource_id ?? undefined;
+ const chatQuery = useChatQuery(chatId);
+ const name = () =>
+ chatQuery.data?.chat?.name?.trim() ||
+ (chatQuery.isLoading ? '' : 'Untitled run');
+
+ const clickable = () => Boolean(chatId());
+ // Synthetic pending rows (no id) are inserted by the websocket sync on
+ // `started` and replaced on `stopped`. Treat them as neutral rather than
+ // failures — the panel header already surfaces running state.
+ const isPending = () => !props.record.id;
+
+ return (
+ <div
+ class={cn(
+ 'flex items-center gap-2 border-b border-edge-muted px-3 py-2 text-sm',
+ clickable() ? 'cursor-default hover:bg-hover/30' : 'cursor-default'
+ )}
+ onClick={() => {
+ const id = chatId();
+ if (id) replaceOrInsertSplit({ type: 'chat', id });
+ }}
+ >
+ <div class="size-4 shrink-0">
+ <EntityIcon targetType="chat" size="xs" />
+ </div>
+ <span class="min-w-0 flex-1 truncate">{name()}</span>
+ <span
+ class={cn(
+ 'ml-auto shrink-0 text-xs font-mono uppercase font-light',
+ isPending() || props.record.is_success
+ ? 'text-ink-extra-muted'
+ : 'text-failure'
+ )}
+ >
+ {formatDateAndTime(props.record.start_time ?? new Date())}
+ </span>
+ </div>
+ );
+}
+
+function HistoryList(props: { records: HistoryRecord[]; isPending: boolean }) {
+ return (
+ <Show
+ when={props.records.length > 0}
+ fallback={
+ <Show
+ when={!props.isPending}
+ fallback={
+ <div class="px-3 py-8 text-center text-xs text-ink-muted">
+ Loading…
+ </div>
+ }
+ >
+ <div class="px-3 py-8 text-center text-xs text-ink-muted">
+ No runs yet.
+ </div>
+ </Show>
+ }
+ >
+ <div class="min-h-0 h-full overflow-y-scroll">
+ <For each={props.records.slice(0, 50)}>
+ {(record) => <HistoryRow record={record} />}
+ </For>
+ </div>
+ </Show>
+ );
+}
+
+export function Automation() {
+ const scheduleId = useBlockId();
+ const panel = useSplitPanelOrThrow();
+
+ const schedulesQuery = useSchedulesQuery(() => true);
+ const schedule = createMemo(() =>
+ schedulesQuery.data?.find((item) => item.id === scheduleId)
+ );
+
+ const [state, setRawState] = createSignal<ScheduleDraft | undefined>();
+
+ const currentSummary = createMemo(() => {
+ const d = state();
+ if (!d) return '';
+ return describeSchedule(d, getDefaultTimezone());
+ });
+
+ const formError = createMemo(() => {
+ const d = state();
+ if (!d) return null;
+ if (!d.prompt.trim()) return 'Prompt is required.';
+ if (!isValidTime(d.time)) return 'Choose a valid time.';
+ if (d.frequency === 'week' && d.daysOfWeek.length === 0) {
+ return 'Select at least one day.';
+ }
+ if (d.frequency === 'month') {
+ const day = Number(d.dayOfMonth);
+ if (!Number.isInteger(day) || day < 1 || day > 31) {
+ return 'Pick a day between 1 and 31';
+ }
+ }
+ return null;
+ });
+
+ const updateMutation = useUpdateScheduleMutation({
+ onError: (error) =>
+ toast.alert('Failed to update automation', getErrorMessage(error)),
+ });
+
+ const save = () => {
+ if (formError()) return;
+ const d = state();
+ const previous = schedule();
+ if (!d || !previous) return;
+ updateMutation.mutate({
+ scheduleId,
+ body: draftToUpdateBody(d, previous),
+ });
+ };
+
+ const debouncedSave = debounce(save, 300);
+
+ const setState = (update: (prev: ScheduleDraft) => ScheduleDraft) => {
+ const current = state();
+ if (!current) return;
+ const next = update(current);
+ setRawState(next);
+ if (next.name !== current.name) {
+ panel.handle.setDisplayName(next.name);
+ }
+ debouncedSave();
+ };
+
+ whenSettled(schedulesQuery, () => {
+ const current = schedule();
+ if (!current) return;
+ setRawState(draftFromSchedule(current));
+ panel.handle.setDisplayName(current.name);
+ });
+
+ const historyQuery = useScheduleHistoryQuery(
+ () => scheduleId,
+ () => true
+ );
+ const history = createMemo(() => historyQuery.data ?? []);
+
+ const [renameOpen, setRenameOpen] = createSignal(false);
+
+ const runNowMutation = useRunScheduleNowMutation({
+ onError: (error) =>
+ toast.alert('Failed to start run', getErrorMessage(error)),
+ });
+
+ // Treat an action as "running" when the server has a fresh claim on it.
+ // The backend's MAX_ACTION_TIME is 20 minutes — after that a claim is
+ // considered stale (e.g. executor crashed) and we stop showing the
+ // running indicator. The websocket sync patches `claimed` live; GETs seed
+ // it on page load.
+ const MAX_CLAIMED_MS = 20 * 60 * 1000;
+ const isRunning = createMemo(() => {
+ const claimed = schedule()?.claimed;
+ if (!claimed) return false;
+ return Date.now() - Date.parse(claimed) < MAX_CLAIMED_MS;
+ });
+
+ onMount(() => {
+ invalidateSchedules();
+ });
+
+ return (
+ <Show
+ when={state()}
+ fallback={
+ <Show
+ when={!schedulesQuery.isPending && !schedule()}
+ fallback={
+ <div class="flex size-full items-center justify-center text-xs text-ink-muted">
+ Loading…
+ </div>
+ }
+ >
+ <div class="flex size-full items-center justify-center text-xs text-ink-muted">
+ Automation not found.
+ </div>
+ </Show>
+ }
+ >
+ {(d) => (
+ <>
+ <SplitHeaderLeft>
+ <div class="z-3 relative flex h-full w-screen max-w-full shrink items-center gap-2">
+ <EntityIcon class="shrink-0" targetType="automation" size="xs" />
+ <span
+ class="inline-block min-w-0 flex-1 truncate text-sm"
+ onDblClick={() => setRenameOpen(true)}
+ onContextMenu={(e) => {
+ e.preventDefault();
+ setRenameOpen(true);
+ }}
+ >
+ {d().name || 'Untitled automation'}
+ </span>
+ </div>
+ </SplitHeaderLeft>
+ <AutomationRenameModal
+ isOpen={renameOpen}
+ setIsOpen={setRenameOpen}
+ name={d().name}
+ onRename={(newName) =>
+ setState((current) => ({ ...current, name: newName }))
+ }
+ />
+
+ <div class="flex min-h-0 size-full cursor-default flex-col text-ink">
+ <div class="flex shrink-0 flex-col gap-3 p-3">
+ <div class="flex items-center gap-2">
+ <Button
+ variant="accent"
+ size="sm"
+ class="cursor-default"
+ disabled={runNowMutation.isPending || isRunning()}
+ onClick={() => runNowMutation.mutate({ scheduleId })}
+ >
+ Run Now
+ </Button>
+ <Button
+ variant="secondary"
+ size="sm"
+ class="cursor-default"
+ onClick={() =>
+ setState((current) => ({
+ ...current,
+ enabled: !current.enabled,
+ }))
+ }
+ >
+ {d().enabled ? 'Pause' : 'Resume'}
+ </Button>
+ <div class="ml-auto text-xs font-mono text-right uppercase font-light">
+ <Show
+ when={isRunning()}
+ fallback={
+ <span class="text-ink-extra-muted">
+ <Show
+ when={d().enabled && schedule()?.next_run_at}
+ fallback={<>Paused</>}
+ >
+ {(nextRunAt) => (
+ <>Next run {formatDateAndTime(nextRunAt())}</>
+ )}
+ </Show>
+ </span>
+ }
+ >
+ <span class="flex items-center justify-end gap-1.5 text-accent">
+ <span class="size-1.5 animate-pulse rounded-full bg-accent" />
+ Running
+ </span>
+ </Show>
+ </div>
+ </div>
+
+ <div class="grid gap-1.5">
+ <h1 class="text-sm font-semibold">Instructions</h1>
+ <AutomationPromptEditor
+ initialValue={d().prompt}
+ onChange={(markdown) =>
+ setState((current) => ({
+ ...current,
+ prompt: markdown,
+ }))
+ }
+ />
+ </div>
+
+ <div>
+ <h1 class="text-sm font-semibold">Schedule</h1>
+ <p class="mt-0.5 text-xs text-ink-muted">{currentSummary()}</p>
+ </div>
+
+ <div class="flex flex-wrap gap-1">
+ <For each={FREQUENCY_OPTIONS}>
+ {(option) => (
+ <button
+ type="button"
+ class={cn(
+ 'cursor-default border rounded-sm px-2 py-1 text-xs transition-colors',
+ d().frequency === option.value
+ ? 'border-accent/30 bg-accent/10 text-accent'
+ : 'border-edge-muted text-ink-muted hover:bg-hover/30'
+ )}
+ onClick={() =>
+ setState((current) => ({
+ ...current,
+ frequency: option.value,
+ }))
+ }
+ >
+ {option.label}
+ </button>
+ )}
+ </For>
+ </div>
+
+ <Show when={d().frequency === 'week'}>
+ <div class="grid gap-1.5">
+ <label class="text-xs font-medium text-ink-muted cursor-default">
+ Days
+ </label>
+ <div class="flex flex-wrap gap-1">
+ <For each={WEEKDAY_OPTIONS}>
+ {(option) => {
+ const active = () =>
+ d().daysOfWeek.includes(option.value);
+ return (
+ <button
+ type="button"
+ class={cn(
+ 'cursor-default border rounded-sm px-2 py-1 text-xs transition-colors',
+ active()
+ ? 'border-accent/30 bg-accent/10 text-accent'
+ : 'border-edge-muted text-ink-muted hover:bg-hover/30'
+ )}
+ onClick={() =>
+ setState((current) => {
+ const has = current.daysOfWeek.includes(
+ option.value
+ );
+ return {
+ ...current,
+ daysOfWeek: has
+ ? current.daysOfWeek.filter(
+ (v) => v !== option.value
+ )
+ : [...current.daysOfWeek, option.value],
+ };
+ })
+ }
+ >
+ {option.label}
+ </button>
+ );
+ }}
+ </For>
+ </div>
+ </div>
+ </Show>
+
+ <Show when={d().frequency === 'month'}>
+ <div class="grid gap-1.5">
+ <label class="text-xs font-medium text-ink-muted cursor-default">
+ Day of Month
+ </label>
+ <input
+ type="number"
+ min="1"
+ max="31"
+ class={INPUT_CLASS}
+ value={d().dayOfMonth}
+ onInput={(event) =>
+ setState((current) => ({
+ ...current,
+ dayOfMonth: event.currentTarget.value,
+ }))
+ }
+ />
+ </div>
+ </Show>
+
+ <div class="grid gap-1.5">
+ <label class="text-xs font-medium text-ink-muted cursor-default">
+ Time
+ </label>
+ <AutomationTimePicker
+ value={d().time}
+ onChange={(value) =>
+ setState((current) => ({
+ ...current,
+ time: value,
+ }))
+ }
+ />
+ </div>
+
+ <Show when={formError()}>
+ {(message) => (
+ <div class="border border-failure/20 bg-failure/5 rounded-sm px-2 py-1.5 text-xs text-failure">
+ {message()}
+ </div>
+ )}
+ </Show>
+ </div>
+
+ <div class="flex min-h-0 flex-1 flex-col">
+ <div class="border-b border-edge-muted px-3 py-2 text-xs font-semibold uppercase tracking-wide text-ink-muted">
+ History
+ </div>
+ <HistoryList
+ records={history()}
+ isPending={historyQuery.isPending}
+ />
+ </div>
+ </div>
+ </>
+ )}
+ </Show>
+ );
+}
diff --git a/js/app/packages/block-automation/component/AutomationComposer.tsx b/js/app/packages/block-automation/component/AutomationComposer.tsx
new file mode 100644
index 0000000000..d96b2a4854
--- /dev/null
+++ b/js/app/packages/block-automation/component/AutomationComposer.tsx
@@ -0,0 +1,327 @@
+import { useSplitLayout } from '@app/component/split-layout/layout';
+import { DialogWrapper } from '@core/component/DialogWrapper';
+import { toast } from '@core/component/Toast/Toast';
+import { createControlledOpenSignal } from '@core/util/createControlledOpenSignal';
+import { useCreateScheduleMutation } from '@queries/agent-schedule/schedules';
+import { Dialog } from '@kobalte/core/dialog';
+import { debounce } from '@solid-primitives/scheduled';
+import { Button } from '@ui/components/Button';
+import { cn } from '@ui/utils/classname';
+import {
+ createEffect,
+ createMemo,
+ createSignal,
+ For,
+ on,
+ Show,
+} from 'solid-js';
+import {
+ clearAutomationComposerDraft,
+ loadAutomationComposerDraft,
+ saveAutomationComposerDraft,
+} from '../util/automationComposerStorage';
+import { AutomationPromptEditor } from './AutomationPromptEditor';
+import { AutomationTimePicker } from './AutomationTimePicker';
+import {
+ createEmptyDraft,
+ describeSchedule,
+ draftToCreateBody,
+ FREQUENCY_OPTIONS,
+ getDefaultTimezone,
+ getErrorMessage,
+ INPUT_CLASS,
+ isValidTime,
+ WEEKDAY_OPTIONS,
+} from './automationUtils';
+import type { ScheduleDraft } from './types';
+
+/**
+ * Open/close signal for the automation composer modal. Flip to `true` from
+ * anywhere (e.g. launcher / unified-list create button) to pop the dialog.
+ */
+export const [automationComposerOpen, setAutomationComposerOpen] =
+ createControlledOpenSignal(false, { id: 'automation-composer' });
+
+/**
+ * Create-only automation composer modal. Mount once (see Layout.tsx) — the
+ * dialog is driven by the `automationComposerOpen` signal.
+ */
+export function AutomationComposer() {
+ const { openWithSplit } = useSplitLayout();
+
+ const [draft, setRawDraft] = createSignal<ScheduleDraft>(createEmptyDraft());
+ const [submitAttempted, setSubmitAttempted] = createSignal(false);
+ // Snapshots the prompt value at dialog-open time so the editor gets a
+ // stable initialValue per open (the editor only reads it on mount).
+ const [initialPrompt, setInitialPrompt] = createSignal('');
+
+ const setDraft = (
+ update: ScheduleDraft | ((prev: ScheduleDraft) => ScheduleDraft)
+ ) => {
+ setRawDraft(update as typeof update & ScheduleDraft);
+ };
+
+ let skipNextSave = false;
+ const debouncedSave = debounce(saveAutomationComposerDraft, 300);
+
+ createEffect(
+ on(automationComposerOpen, (open) => {
+ if (!open) return;
+ const loaded = loadAutomationComposerDraft();
+ const next = loaded ?? createEmptyDraft();
+ skipNextSave = true;
+ setRawDraft(next);
+ setInitialPrompt(next.prompt);
+ setSubmitAttempted(false);
+ })
+ );
+
+ createEffect(() => {
+ const current = draft();
+ if (skipNextSave) {
+ skipNextSave = false;
+ return;
+ }
+ debouncedSave(current);
+ });
+
+ const currentSummary = createMemo(() =>
+ describeSchedule(draft(), getDefaultTimezone())
+ );
+
+ const formError = createMemo(() => {
+ if (!draft().prompt.trim()) return 'Prompt is required.';
+ if (!isValidTime(draft().time)) return 'Choose a valid time.';
+ if (draft().frequency === 'week' && draft().daysOfWeek.length === 0) {
+ return 'Select at least one day.';
+ }
+ if (draft().frequency === 'month') {
+ const day = Number(draft().dayOfMonth);
+ if (!Number.isInteger(day) || day < 1 || day > 31) {
+ return 'Pick a day between 1 and 31.';
+ }
+ }
+ return null;
+ });
+
+ const createMutation = useCreateScheduleMutation({
+ onSuccess: async (schedule) => {
+ clearAutomationComposerDraft();
+ setAutomationComposerOpen(false, false);
+ if (schedule.id) {
+ openWithSplit(
+ { type: 'automation', id: schedule.id },
+ { referredFrom: 'launcher' }
+ );
+ }
+ toast.success('Automation created', 'The automation is now scheduled.');
+ },
+ onError: (error) => {
+ toast.alert('Failed to create automation', getErrorMessage(error));
+ },
+ });
+
+ const handleCreate = () => {
+ const error = formError();
+ if (error) {
+ setSubmitAttempted(true);
+ return;
+ }
+ createMutation.mutate(draftToCreateBody(draft()));
+ };
+
+ const toggleClass = (active: boolean) =>
+ cn(
+ 'cursor-default border rounded-sm px-2 py-1 text-xs transition-colors',
+ active
+ ? 'border-accent/30 bg-accent/10 text-accent'
+ : 'border-edge-muted text-ink-muted hover:bg-hover/30'
+ );
+
+ return (
+ <Dialog
+ open={automationComposerOpen()}
+ onOpenChange={(open) => setAutomationComposerOpen(open, false)}
+ >
+ <Dialog.Portal>
+ <DialogWrapper width="800px">
+ <div class="flex cursor-default flex-col text-ink">
+ <div class="flex items-center justify-between border-b border-edge-muted px-3 py-2">
+ <Dialog.Title class="m-0 p-0 text-sm font-semibold">
+ New Automation
+ </Dialog.Title>
+ <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm">
+ &times;
+ </Dialog.CloseButton>
+ </div>
+
+ <div class="grid max-h-[70vh] gap-3 overflow-y-auto px-3 py-3">
+ <div class="grid gap-1.5">
+ <label class="text-xs font-medium text-ink-muted cursor-default">
+ Name
+ </label>
+ <input
+ class={INPUT_CLASS}
+ placeholder="e.g. Morning standup summary"
+ value={draft().name}
+ onInput={(event) =>
+ setDraft((current) => ({
+ ...current,
+ name: event.currentTarget.value,
+ }))
+ }
+ />
+ </div>
+
+ <div class="grid gap-1.5">
+ <label class="text-xs font-medium text-ink-muted cursor-default">
+ Instructions
+ </label>
+ <AutomationPromptEditor
+ initialValue={initialPrompt()}
+ onChange={(markdown) =>
+ setDraft((current) => ({
+ ...current,
+ prompt: markdown,
+ }))
+ }
+ />
+ </div>
+
+ <div class="grid gap-3 border border-edge-muted rounded-sm p-3">
+ <div>
+ <p class="text-sm font-semibold">Schedule</p>
+ <p class="mt-0.5 text-xs text-ink-muted">
+ {currentSummary()}
+ </p>
+ </div>
+
+ <div class="flex flex-wrap gap-1">
+ <For each={FREQUENCY_OPTIONS}>
+ {(option) => (
+ <button
+ type="button"
+ class={toggleClass(draft().frequency === option.value)}
+ onClick={() =>
+ setDraft((current) => ({
+ ...current,
+ frequency: option.value,
+ }))
+ }
+ >
+ {option.label}
+ </button>
+ )}
+ </For>
+ </div>
+
+ <Show when={draft().frequency === 'week'}>
+ <div class="grid gap-1.5">
+ <label class="text-xs font-medium text-ink-muted cursor-default">
+ Days
+ </label>
+ <div class="flex flex-wrap gap-1">
+ <For each={WEEKDAY_OPTIONS}>
+ {(option) => {
+ const active = () =>
+ draft().daysOfWeek.includes(option.value);
+ return (
+ <button
+ type="button"
+ class={toggleClass(active())}
+ onClick={() =>
+ setDraft((current) => {
+ const has = current.daysOfWeek.includes(
+ option.value
+ );
+ return {
+ ...current,
+ daysOfWeek: has
+ ? current.daysOfWeek.filter(
+ (v) => v !== option.value
+ )
+ : [...current.daysOfWeek, option.value],
+ };
+ })
+ }
+ >
+ {option.label}
+ </button>
+ );
+ }}
+ </For>
+ </div>
+ </div>
+ </Show>
+
+ <Show when={draft().frequency === 'month'}>
+ <div class="grid gap-1.5">
+ <label class="text-xs font-medium text-ink-muted cursor-default">
+ Day of Month
+ </label>
+ <input
+ type="number"
+ min="1"
+ max="31"
+ class={INPUT_CLASS}
+ value={draft().dayOfMonth}
+ onInput={(event) =>
+ setDraft((current) => ({
+ ...current,
+ dayOfMonth: event.currentTarget.value,
+ }))
+ }
+ />
+ </div>
+ </Show>
+
+ <div class="grid gap-1.5">
+ <label class="text-xs font-medium text-ink-muted cursor-default">
+ Time
+ </label>
+ <AutomationTimePicker
+ value={draft().time}
+ onChange={(value) =>
+ setDraft((current) => ({
+ ...current,
+ time: value,
+ }))
+ }
+ />
+ </div>
+ </div>
+
+ <Show when={submitAttempted() && formError()}>
+ {(message) => (
+ <div class="border border-failure/20 bg-failure/5 rounded-sm px-2 py-1.5 text-xs text-failure">
+ {message()}
+ </div>
+ )}
+ </Show>
+ </div>
+
+ <div class="flex items-center justify-end gap-2 border-t border-edge-muted px-3 py-2">
+ <Button
+ variant="secondary"
+ size="sm"
+ class="cursor-default"
+ onClick={() => setAutomationComposerOpen(false, false)}
+ >
+ Cancel
+ </Button>
+ <Button
+ variant="accent"
+ size="sm"
+ class="cursor-default"
+ disabled={createMutation.isPending}
+ onClick={handleCreate}
+ >
+ {createMutation.isPending ? 'Creating…' : 'Create'}
+ </Button>
+ </div>
+ </div>
+ </DialogWrapper>
+ </Dialog.Portal>
+ </Dialog>
+ );
+}
diff --git a/js/app/packages/block-automation/component/AutomationPromptEditor.tsx b/js/app/packages/block-automation/component/AutomationPromptEditor.tsx
new file mode 100644
index 0000000000..ff4128b226
--- /dev/null
+++ b/js/app/packages/block-automation/component/AutomationPromptEditor.tsx
@@ -0,0 +1,26 @@
+import { EditorConfigBuilder } from '@core/component/LexicalMarkdown/builder/MarkdownConfigBuilder';
+import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
+
+export function AutomationPromptEditor(props: {
+ initialValue: string;
+ onChange: (markdown: string) => void;
+}) {
+ const editor = new EditorConfigBuilder()
+ .namespace('automation-prompt')
+ .withHistory()
+ .withLinks()
+ .withMentions()
+ .onChange(props.onChange);
+
+ return (
+ <div class="min-h-[180px] border border-edge-muted rounded-sm bg-input [&_[contenteditable]]:px-2 [&_[contenteditable]]:py-1.5 [&_[contenteditable]]:text-sm [&_[contenteditable]]:outline-none cursor-default">
+ <MarkdownShell
+ config={editor}
+ initialValue={props.initialValue}
+ placeholder=""
+ portalScope="local"
+ class="min-h-[180px]"
+ />
+ </div>
+ );
+}
diff --git a/js/app/packages/block-automation/component/AutomationRenameModal.tsx b/js/app/packages/block-automation/component/AutomationRenameModal.tsx
new file mode 100644
index 0000000000..adb58e02e6
--- /dev/null
+++ b/js/app/packages/block-automation/component/AutomationRenameModal.tsx
@@ -0,0 +1,110 @@
+import { getSplitPanelRef } from '@app/component/split-layout/layoutUtils';
+import {
+ EntityModalActionFooter,
+ EntityModalTitle,
+} from '@app/component/EntityModal/EntityModal';
+import clickOutside from '@core/directive/clickOutside';
+import { Dialog } from '@kobalte/core/dialog';
+import {
+ type Accessor,
+ type Setter,
+ Show,
+ createSignal,
+ onMount,
+} from 'solid-js';
+import { Portal } from 'solid-js/web';
+
+false && clickOutside;
+
+export function AutomationRenameModal(props: {
+ isOpen: Accessor<boolean>;
+ setIsOpen: Setter<boolean>;
+ name: string;
+ onRename: (newName: string) => void;
+}) {
+ return (
+ <Show when={props.isOpen()}>
+ <AutomationRenameModalContent
+ isOpen={props.isOpen}
+ setIsOpen={props.setIsOpen}
+ name={props.name}
+ onRename={props.onRename}
+ />
+ </Show>
+ );
+}
+
+function AutomationRenameModalContent(props: {
+ isOpen: Accessor<boolean>;
+ setIsOpen: Setter<boolean>;
+ name: string;
+ onRename: (newName: string) => void;
+}) {
+ let inputRef: HTMLInputElement | undefined;
+ const [editValue, setEditValue] = createSignal(props.name);
+
+ const close = () => props.setIsOpen(false);
+
+ const finishEditing = () => {
+ const newValue = editValue().trim();
+ if (newValue) {
+ props.onRename(newValue);
+ }
+ close();
+ };
+
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ finishEditing();
+ } else if (e.key === 'Escape') {
+ e.preventDefault();
+ close();
+ }
+ };
+
+ return (
+ <Dialog open={props.isOpen()} onOpenChange={props.setIsOpen} modal={true}>
+ <Portal mount={getSplitPanelRef() ?? undefined}>
+ <Dialog.Overlay
+ as="div"
+ class="absolute z-modal left-[1px] right-[1px] bottom-[1px] top-[1px] bg-modal-overlay"
+ use:clickOutside={close}
+ on:click={close}
+ />
+ <div class="absolute z-modal pointer-events-none px-2 left-[1px] right-[1px] bottom-[1px] top-[1px]">
+ <Dialog.Content class="pointer-events-none!">
+ <div class="pointer-events-auto w-full max-w-[min(36rem,calc(100%-1rem))] mx-auto mt-16 bg-menu border border-edge h-fit p-2">
+ <div class="w-full my-1">
+ <EntityModalTitle title="Rename" />
+ <div class="w-full focus-within:bracket-offset-2">
+ <input
+ ref={(el) => {
+ inputRef = el;
+ onMount(() => {
+ setTimeout(() => {
+ inputRef?.focus();
+ inputRef?.select();
+ });
+ });
+ }}
+ value={editValue()}
+ onInput={(e) => setEditValue(e.currentTarget.value)}
+ onKeyDown={handleKeyDown}
+ class="w-full p-2 text-sm border-1 border-edge/20 bg-menu text-ink placeholder:text-ink-placeholder focus:outline-none selection:bg-ink selection:text-panel"
+ placeholder="Enter title..."
+ />
+ </div>
+ <EntityModalActionFooter
+ onCancel={close}
+ onConfirm={finishEditing}
+ confirmText="Rename"
+ />
+ </div>
+ </div>
+ </Dialog.Content>
+ </div>
+ </Portal>
+ </Dialog>
+ );
+}
diff --git a/js/app/packages/block-automation/component/AutomationTimePicker.tsx b/js/app/packages/block-automation/component/AutomationTimePicker.tsx
new file mode 100644
index 0000000000..9d281ab4f2
--- /dev/null
+++ b/js/app/packages/block-automation/component/AutomationTimePicker.tsx
@@ -0,0 +1,190 @@
+import clickOutside from '@core/directive/clickOutside';
+import { cn } from '@ui/utils/classname';
+import { createEffect, createSignal, on, Show } from 'solid-js';
+import { INPUT_CLASS, isValidTime } from './automationUtils';
+
+false && clickOutside;
+
+function parseHHMM(value: string): {
+ hour: number;
+ minute: number;
+ period: 'AM' | 'PM';
+} {
+ if (!isValidTime(value)) return { hour: 9, minute: 0, period: 'AM' };
+ const [h, m] = value.split(':').map(Number);
+ return {
+ hour: h % 12 || 12,
+ minute: m,
+ period: h >= 12 ? 'PM' : 'AM',
+ };
+}
+
+function formatTimeLabel(value: string) {
+ if (!isValidTime(value)) return '—';
+ const [h, m] = value.split(':').map(Number);
+ const date = new Date(2026, 0, 1, h, m);
+ return new Intl.DateTimeFormat(undefined, {
+ hour: 'numeric',
+ minute: '2-digit',
+ }).format(date);
+}
+
+function toHHMM(hour12: number, minute: number, period: 'AM' | 'PM') {
+ const h24 =
+ period === 'AM'
+ ? hour12 === 12
+ ? 0
+ : hour12
+ : hour12 === 12
+ ? 12
+ : hour12 + 12;
+ return `${String(h24).padStart(2, '0')}:${String(minute).padStart(2, '0')}`;
+}
+
+export function AutomationTimePicker(props: {
+ value: string;
+ onChange: (hhmm: string) => void;
+}) {
+ const [open, setOpen] = createSignal(false);
+
+ const initial = parseHHMM(props.value);
+ const [hour, setHour] = createSignal(initial.hour);
+ const [hourDisplay, setHourDisplay] = createSignal(initial.hour.toString());
+ const [minute, setMinute] = createSignal(initial.minute);
+ const [minuteDisplay, setMinuteDisplay] = createSignal(
+ initial.minute.toString().padStart(2, '0')
+ );
+ const [period, setPeriod] = createSignal<'AM' | 'PM'>(initial.period);
+
+ createEffect(
+ on(
+ () => props.value,
+ (value) => {
+ const p = parseHHMM(value);
+ setHour(p.hour);
+ setHourDisplay(p.hour.toString());
+ setMinute(p.minute);
+ setMinuteDisplay(p.minute.toString().padStart(2, '0'));
+ setPeriod(p.period);
+ },
+ { defer: true }
+ )
+ );
+
+ const commit = (
+ nextHour: number,
+ nextMinute: number,
+ nextPeriod: 'AM' | 'PM'
+ ) => {
+ props.onChange(toHHMM(nextHour, nextMinute, nextPeriod));
+ };
+
+ return (
+ <div class="relative">
+ <button
+ type="button"
+ class={cn(INPUT_CLASS, 'text-left')}
+ onClick={() => setOpen((v) => !v)}
+ >
+ {formatTimeLabel(props.value)}
+ </button>
+ <Show when={open()}>
+ <div
+ class="absolute left-0 right-0 top-full mt-1 z-action-menu bg-dialog border border-edge-muted rounded-sm p-3"
+ use:clickOutside={() => setOpen(false)}
+ >
+ <div class="flex items-center gap-2">
+ <div class="flex items-center gap-1">
+ <input
+ type="text"
+ inputmode="numeric"
+ maxLength={2}
+ aria-label="Hour"
+ class="w-10 text-center bg-active border border-edge-muted rounded-sm px-1 py-1 text-sm focus:outline-none focus:border-accent"
+ value={hourDisplay()}
+ onKeyDown={(e) => {
+ if (e.key.length === 1 && !/\d/.test(e.key)) {
+ e.preventDefault();
+ }
+ }}
+ onInput={(e) => {
+ const raw = e.currentTarget.value;
+ setHourDisplay(raw);
+ const val = parseInt(raw);
+ if (!isNaN(val) && val >= 1 && val <= 12) {
+ setHour(val);
+ commit(val, minute(), period());
+ }
+ }}
+ onBlur={() => setHourDisplay(hour().toString())}
+ />
+ <span class="text-sm font-medium">:</span>
+ <input
+ type="text"
+ inputmode="numeric"
+ maxLength={2}
+ aria-label="Minute"
+ class="w-10 text-center bg-active border border-edge-muted rounded-sm px-1 py-1 text-sm focus:outline-none focus:border-accent"
+ value={minuteDisplay()}
+ onKeyDown={(e) => {
+ if (e.key.length === 1 && !/\d/.test(e.key)) {
+ e.preventDefault();
+ }
+ }}
+ onInput={(e) => {
+ const raw = e.currentTarget.value;
+ setMinuteDisplay(raw);
+ const val = parseInt(raw);
+ if (!isNaN(val) && val >= 0 && val <= 59) {
+ setMinute(val);
+ commit(hour(), val, period());
+ }
+ }}
+ onBlur={() =>
+ setMinuteDisplay(minute().toString().padStart(2, '0'))
+ }
+ />
+ </div>
+ <div class="flex border border-edge-muted rounded-sm text-sm overflow-hidden">
+ <button
+ type="button"
+ class="px-2 py-1 transition-colors"
+ classList={{
+ 'bg-accent text-dialog': period() === 'AM',
+ 'hover:bg-active': period() !== 'AM',
+ }}
+ onClick={() => {
+ setPeriod('AM');
+ commit(hour(), minute(), 'AM');
+ }}
+ >
+ AM
+ </button>
+ <button
+ type="button"
+ class="px-2 py-1 transition-colors"
+ classList={{
+ 'bg-accent text-dialog': period() === 'PM',
+ 'hover:bg-active': period() !== 'PM',
+ }}
+ onClick={() => {
+ setPeriod('PM');
+ commit(hour(), minute(), 'PM');
+ }}
+ >
+ PM
+ </button>
+ </div>
+ <button
+ type="button"
+ class="ml-auto px-2 py-1 border border-accent/30 bg-accent/10 text-accent rounded-sm text-sm hover:bg-accent/20"
+ onClick={() => setOpen(false)}
+ >
+ Done
+ </button>
+ </div>
+ </div>
+ </Show>
+ </div>
+ );
+}
diff --git a/js/app/packages/block-automation/component/automationUtils.ts b/js/app/packages/block-automation/component/automationUtils.ts
new file mode 100644
index 0000000000..708e6cf017
--- /dev/null
+++ b/js/app/packages/block-automation/component/automationUtils.ts
@@ -0,0 +1,335 @@
+import { DEFAULT_MODEL } from '@core/component/AI/constant';
+import type { Model } from '@core/component/AI/types';
+import { MaybeResultError } from '@core/util/maybeResult';
+import type {
+ AgentTask,
+ CreateScheduledAction,
+ ScheduledAction,
+ UpdateScheduledAction,
+} from '@service-scheduled-action/generated/schemas';
+import type { ScheduleDraft, ScheduleFrequency } from './types';
+
+export const INPUT_CLASS =
+ 'w-full border border-edge-muted rounded-sm bg-input px-2 py-1.5 text-sm text-ink outline-none placeholder:text-ink/30 focus:border-accent/20 cursor-default';
+export const DEFAULT_TIME = '09:00';
+
+export const FREQUENCY_OPTIONS: Array<{
+ value: ScheduleFrequency;
+ label: string;
+}> = [
+ { value: 'week', label: 'Every week' },
+ { value: 'month', label: 'Every month' },
+];
+
+// Day-of-week values match the `cron` Rust crate convention:
+// 1 = Sun, 2 = Mon, 3 = Tue, 4 = Wed, 5 = Thu, 6 = Fri, 7 = Sat
+export const WEEKDAY_OPTIONS = [
+ { value: '1', label: 'Sun', fullLabel: 'Sunday' },
+ { value: '2', label: 'Mon', fullLabel: 'Monday' },
+ { value: '3', label: 'Tue', fullLabel: 'Tuesday' },
+ { value: '4', label: 'Wed', fullLabel: 'Wednesday' },
+ { value: '5', label: 'Thu', fullLabel: 'Thursday' },
+ { value: '6', label: 'Fri', fullLabel: 'Friday' },
+ { value: '7', label: 'Sat', fullLabel: 'Saturday' },
+];
+
+const DOW_VALUES = WEEKDAY_OPTIONS.map((option) => option.value);
+const DEFAULT_WEEKDAYS = ['2', '3', '4', '5', '6']; // Mon-Fri
+
+export function getDefaultTimezone() {
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
+}
+
+function normalizePrompt(value: string) {
+ return value
+ .trim()
+ .split(/\n+/)
+ .map((line) => line.trim())
+ .filter(Boolean)
+ .join(' ');
+}
+
+function deriveScheduleName(prompt: string) {
+ const summary = normalizePrompt(prompt);
+ if (!summary) return 'Untitled automation';
+ return summary.length > 72 ? `${summary.slice(0, 71)}…` : summary;
+}
+
+export function isValidTime(value: string) {
+ return /^\d{2}:\d{2}$/.test(value);
+}
+
+function toTimeValue(hour: string, minute: string) {
+ const safeHour = Number(hour);
+ const safeMinute = Number(minute);
+ if (
+ Number.isNaN(safeHour) ||
+ Number.isNaN(safeMinute) ||
+ safeHour < 0 ||
+ safeHour > 23 ||
+ safeMinute < 0 ||
+ safeMinute > 59
+ ) {
+ return DEFAULT_TIME;
+ }
+
+ return `${String(safeHour).padStart(2, '0')}:${String(safeMinute).padStart(2, '0')}`;
+}
+
+function formatTimeLabel(value: string) {
+ if (!isValidTime(value)) return value;
+ const [hour, minute] = value.split(':').map(Number);
+ const date = new Date(2026, 0, 1, hour, minute);
+ return new Intl.DateTimeFormat(undefined, {
+ hour: 'numeric',
+ minute: '2-digit',
+ }).format(date);
+}
+
+function formatDayList(daysOfWeek: string[]): string {
+ if (daysOfWeek.length === 0) return 'no days';
+ const sorted = [...daysOfWeek].sort(
+ (a, b) => DOW_VALUES.indexOf(a) - DOW_VALUES.indexOf(b)
+ );
+ if (sorted.length === 7) return 'every day';
+ if (
+ sorted.length === 5 &&
+ sorted.every((d) => DEFAULT_WEEKDAYS.includes(d))
+ ) {
+ return 'weekdays';
+ }
+ if (sorted.length === 2 && sorted.includes('1') && sorted.includes('7')) {
+ return 'weekends';
+ }
+ return sorted
+ .map((d) => WEEKDAY_OPTIONS.find((opt) => opt.value === d)?.fullLabel)
+ .filter(Boolean)
+ .join(', ');
+}
+
+function nthSuffix(n: number): string {
+ const tens = n % 100;
+ if (tens >= 11 && tens <= 13) return 'th';
+ switch (n % 10) {
+ case 1:
+ return 'st';
+ case 2:
+ return 'nd';
+ case 3:
+ return 'rd';
+ default:
+ return 'th';
+ }
+}
+
+export function describeSchedule(draft: ScheduleDraft, timezone: string) {
+ const timeLabel = formatTimeLabel(draft.time);
+ if (draft.frequency === 'week') {
+ return `${formatDayList(draft.daysOfWeek)} at ${timeLabel} (${timezone})`;
+ }
+ const day = Number(draft.dayOfMonth);
+ if (Number.isInteger(day) && day >= 1 && day <= 31) {
+ return `${day}${nthSuffix(day)} of each month at ${timeLabel} (${timezone})`;
+ }
+ return `Each month at ${timeLabel} (${timezone})`;
+}
+
+type ParsedCron = Pick<
+ ScheduleDraft,
+ 'frequency' | 'time' | 'daysOfWeek' | 'dayOfMonth'
+>;
+
+export function parseCron(cron: string): ParsedCron {
+ const fallback: ParsedCron = {
+ frequency: 'week',
+ time: DEFAULT_TIME,
+ daysOfWeek: [...DEFAULT_WEEKDAYS],
+ dayOfMonth: '1',
+ };
+
+ const fields = cron.trim().split(/\s+/);
+ // The Rust `cron` crate requires 6 (`sec min hour dom mon dow`) or
+ // 7 (with year) fields.
+ if (fields.length !== 6 && fields.length !== 7) return fallback;
+
+ const [, minute, hour, dayOfMonth, month, dayOfWeek] = fields;
+ const time = toTimeValue(hour, minute);
+
+ if (month !== '*') return { ...fallback, time };
+
+ // Weekly-ish: dom="*" with a dow list/range.
+ if (dayOfMonth === '*') {
+ if (dayOfWeek === '*') {
+ return {
+ frequency: 'week',
+ time,
+ daysOfWeek: [...DOW_VALUES],
+ dayOfMonth: '1',
+ };
+ }
+ const days = expandDowExpression(dayOfWeek);
+ if (days.length > 0) {
+ return {
+ frequency: 'week',
+ time,
+ daysOfWeek: days,
+ dayOfMonth: '1',
+ };
+ }
+ return { ...fallback, time };
+ }
+
+ // Monthly: specific day-of-month, dow="*".
+ if (dayOfWeek === '*' && /^(?:[1-9]|[12]\d|3[01])$/.test(dayOfMonth)) {
+ return {
+ frequency: 'month',
+ time,
+ daysOfWeek: [...DEFAULT_WEEKDAYS],
+ dayOfMonth,
+ };
+ }
+
+ return { ...fallback, time };
+}
+
+/**
+ * Expands a day-of-week cron expression like "2,4,6" or "2-6" into a list of
+ * single DOW values. Returns `[]` if anything in the expression can't be
+ * interpreted — caller should fall back to defaults.
+ */
+function expandDowExpression(expr: string): string[] {
+ const parts = expr.split(',');
+ const set = new Set<string>();
+ for (const raw of parts) {
+ const part = raw.trim();
+ if (/^[1-7]$/.test(part)) {
+ set.add(part);
+ continue;
+ }
+ const range = part.match(/^([1-7])-([1-7])$/);
+ if (range) {
+ const [, lo, hi] = range;
+ const loN = Number(lo);
+ const hiN = Number(hi);
+ if (loN <= hiN) {
+ for (let n = loN; n <= hiN; n++) set.add(String(n));
+ continue;
+ }
+ }
+ return [];
+ }
+ return [...set].sort((a, b) => DOW_VALUES.indexOf(a) - DOW_VALUES.indexOf(b));
+}
+
+function buildCron(draft: ScheduleDraft) {
+ const [hour, minute] = (isValidTime(draft.time) ? draft.time : DEFAULT_TIME)
+ .split(':')
+ .map((value) => Number(value));
+
+ // 6-field format required by the Rust `cron` crate:
+ // sec min hour dayOfMonth month dayOfWeek
+ if (draft.frequency === 'week') {
+ const days = draft.daysOfWeek.length
+ ? [...draft.daysOfWeek]
+ .sort((a, b) => DOW_VALUES.indexOf(a) - DOW_VALUES.indexOf(b))
+ .join(',')
+ : '*';
+ return `0 ${minute} ${hour} * * ${days}`;
+ }
+ const day = Number(draft.dayOfMonth);
+ const safeDay = Number.isInteger(day) && day >= 1 && day <= 31 ? day : 1;
+ return `0 ${minute} ${hour} ${safeDay} * *`;
+}
+
+export function createEmptyDraft(): ScheduleDraft {
+ return {
+ name: '',
+ prompt: '',
+ frequency: 'week',
+ time: DEFAULT_TIME,
+ daysOfWeek: [...DEFAULT_WEEKDAYS],
+ dayOfMonth: '1',
+ model: DEFAULT_MODEL,
+ enabled: true,
+ };
+}
+
+function getAgentTask(schedule: ScheduledAction): AgentTask {
+ // Backend stores task as a JSON object; for kind === "Agent" it is shaped
+ // like AgentTask. Cast through unknown to satisfy the open-ended type.
+ return schedule.task as unknown as AgentTask;
+}
+
+export function draftFromSchedule(schedule: ScheduledAction): ScheduleDraft {
+ const parsed = parseCron(schedule.schedule);
+ const task = getAgentTask(schedule);
+
+ return {
+ id: schedule.id ?? undefined,
+ name: schedule.name,
+ prompt: task.user_prompt ?? '',
+ frequency: parsed.frequency,
+ time: parsed.time,
+ daysOfWeek: parsed.daysOfWeek,
+ dayOfMonth: parsed.dayOfMonth,
+ model: (task.model as Model) ?? undefined,
+ enabled: schedule.enabled,
+ };
+}
+
+function buildAgentTask(draft: ScheduleDraft): AgentTask {
+ return {
+ model: draft.model,
+ prompt: '',
+ user_prompt: draft.prompt.trim(),
+ };
+}
+
+export function draftToCreateBody(draft: ScheduleDraft): CreateScheduledAction {
+ return {
+ name: draft.name.trim() || deriveScheduleName(draft.prompt),
+ schedule: buildCron(draft),
+ kind: 'Agent',
+ timezone: getDefaultTimezone(),
+ task: buildAgentTask(draft) as unknown as CreateScheduledAction['task'],
+ enabled: draft.enabled,
+ };
+}
+
+export function draftToUpdateBody(
+ draft: ScheduleDraft,
+ previous: ScheduledAction
+): UpdateScheduledAction {
+ return {
+ name: draft.name.trim() || deriveScheduleName(draft.prompt),
+ schedule: buildCron(draft),
+ kind: 'Agent',
+ timezone: previous.timezone || getDefaultTimezone(),
+ task: buildAgentTask(draft) as unknown as UpdateScheduledAction['task'],
+ enabled: draft.enabled,
+ };
+}
+
+export function formatDateTime(value: string | null | undefined) {
+ if (!value) return 'Never';
+
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) return 'Invalid date';
+
+ return new Intl.DateTimeFormat(undefined, {
+ dateStyle: 'medium',
+ timeStyle: 'short',
+ }).format(date);
+}
+
+export function getErrorMessage(error: unknown) {
+ if (error instanceof MaybeResultError) {
+ return error.errors.map((item) => item.message).join(', ');
+ }
+
+ if (error instanceof Error && error.message.length > 0) {
+ return error.message;
+ }
+
+ return 'Please try again.';
+}
diff --git a/js/app/packages/block-automation/component/index.ts b/js/app/packages/block-automation/component/index.ts
new file mode 100644
index 0000000000..419db33ad9
--- /dev/null
+++ b/js/app/packages/block-automation/component/index.ts
@@ -0,0 +1,6 @@
+export { Automation } from './Automation';
+export {
+ AutomationComposer,
+ automationComposerOpen,
+ setAutomationComposerOpen,
+} from './AutomationComposer';
diff --git a/js/app/packages/block-automation/component/types.ts b/js/app/packages/block-automation/component/types.ts
new file mode 100644
index 0000000000..69df8dcffa
--- /dev/null
+++ b/js/app/packages/block-automation/component/types.ts
@@ -0,0 +1,17 @@
+import type { Model } from '@core/component/AI/types';
+
+export type ScheduleFrequency = 'week' | 'month';
+
+export type ScheduleDraft = {
+ id?: string;
+ name: string;
+ prompt: string;
+ frequency: ScheduleFrequency;
+ time: string;
+ /** Day-of-week values using the cron crate's 1-7 numbering (1=Sun). */
+ daysOfWeek: string[];
+ /** 1-31 day-of-month when frequency === "month". */
+ dayOfMonth: string;
+ model: Model;
+ enabled: boolean;
+};
diff --git a/js/app/packages/block-automation/definition.ts b/js/app/packages/block-automation/definition.ts
new file mode 100644
index 0000000000..6f53b1e130
--- /dev/null
+++ b/js/app/packages/block-automation/definition.ts
@@ -0,0 +1,26 @@
+import { defineBlock, type ExtractLoadType, LoadErrors } from '@core/block';
+import { ok } from '@core/util/maybeResult';
+import { Automation } from './component/Automation';
+
+export const definition = defineBlock({
+ name: 'automation',
+ description: 'view and edit a single automation',
+ defaultFilename: 'Automation',
+ component: Automation,
+ accepted: {},
+ async load(source, intent) {
+ if (source.type === 'dss') {
+ if (intent === 'preload') {
+ return ok({
+ type: 'preload',
+ origin: source,
+ });
+ }
+ return ok({ scheduleId: source.id });
+ }
+ return LoadErrors.INVALID;
+ },
+ liveTrackingEnabled: false,
+});
+
+export type AutomationData = ExtractLoadType<(typeof definition)['load']>;
diff --git a/js/app/packages/block-automation/package.json b/js/app/packages/block-automation/package.json
new file mode 100644
index 0000000000..2f9f66e7ab
--- /dev/null
+++ b/js/app/packages/block-automation/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "block-automation",
+ "private": true,
+ "scripts": {},
+ "dependencies": {}
+}
diff --git a/js/app/packages/block-automation/tsconfig.json b/js/app/packages/block-automation/tsconfig.json
new file mode 100644
index 0000000000..63e20a2cf0
--- /dev/null
+++ b/js/app/packages/block-automation/tsconfig.json
@@ -0,0 +1,4 @@
+{
+ "extends": "../../tsconfig.json",
+ "include": ["./**/*"]
+}
diff --git a/js/app/packages/block-automation/util/automationComposerStorage.ts b/js/app/packages/block-automation/util/automationComposerStorage.ts
new file mode 100644
index 0000000000..8b4ee485b0
--- /dev/null
+++ b/js/app/packages/block-automation/util/automationComposerStorage.ts
@@ -0,0 +1,44 @@
+import type { ScheduleDraft } from '../component/types';
+
+const STORAGE_KEY = 'automation-composer-draft';
+const EXPIRY_TIME_MS = 3 * 60 * 1000;
+
+interface StoredDraft {
+ draft: ScheduleDraft;
+ timestamp: number;
+}
+
+export function saveAutomationComposerDraft(draft: ScheduleDraft): void {
+ try {
+ const payload: StoredDraft = { draft, timestamp: Date.now() };
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(payload));
+ } catch (error) {
+ console.warn('Failed to save automation composer draft:', error);
+ }
+}
+
+export function loadAutomationComposerDraft(): ScheduleDraft | null {
+ try {
+ const stored = localStorage.getItem(STORAGE_KEY);
+ if (!stored) return null;
+
+ const payload: StoredDraft = JSON.parse(stored);
+ if (Date.now() - payload.timestamp > EXPIRY_TIME_MS) {
+ clearAutomationComposerDraft();
+ return null;
+ }
+ return payload.draft;
+ } catch (error) {
+ console.warn('Failed to load automation composer draft:', error);
+ clearAutomationComposerDraft();
+ return null;
+ }
+}
+
+export function clearAutomationComposerDraft(): void {
+ try {
+ localStorage.removeItem(STORAGE_KEY);
+ } catch (error) {
+ console.warn('Failed to clear automation composer draft:', error);
+ }
+}
diff --git a/js/app/packages/block-canvas/component/CanvasController.tsx b/js/app/packages/block-canvas/component/CanvasController.tsx
index 0113adf7ff..190d2e3af8 100644
--- a/js/app/packages/block-canvas/component/CanvasController.tsx
+++ b/js/app/packages/block-canvas/component/CanvasController.tsx
@@ -864,6 +864,8 @@ export function CanvasController(props: ParentProps) {
// TODO: add channel message support
if (entityType === 'channel_message') return;
if (entityType === 'call') return;
+ // Automation entities aren't yet renderable as canvas mentions.
+ if (entityType === 'automation') return;
// Track document mention and get UUID
let mentionUuid: string | undefined;
diff --git a/js/app/packages/channel/Attachments/attachment-utils.ts b/js/app/packages/channel/Attachments/attachment-utils.ts
index 4ab63d4411..25090101bb 100644
--- a/js/app/packages/channel/Attachments/attachment-utils.ts
+++ b/js/app/packages/channel/Attachments/attachment-utils.ts
@@ -101,5 +101,9 @@ export function getEntityClickContent(entity: EntityData): SplitContent {
type: 'call' as const,
id: e.id,
}))
+ .with({ type: 'automation' }, (e) => ({
+ type: 'automation' as const,
+ id: e.id,
+ }))
.exhaustive();
}
diff --git a/js/app/packages/core/block.ts b/js/app/packages/core/block.ts
index 6fd6a4a057..e2596379ae 100644
--- a/js/app/packages/core/block.ts
+++ b/js/app/packages/core/block.ts
@@ -60,6 +60,7 @@ export const BlockRegistry = [
'email',
'contact',
'task',
+ 'automation',
] as const;
type BlockNameKeys = keyof typeof BlockRegistry & number;
@@ -93,6 +94,7 @@ export const NonDocumentBlockTypes = [
'project',
'email',
'contact',
+ 'automation',
] as const as (BlockName | BlockAlias)[];
/**
@@ -143,6 +145,7 @@ export const ValidBlockCombinations: BlockCombinationRules = {
video: allBlockNames,
contact: allBlockNames,
task: allBlockNames,
+ automation: allBlockNames,
} as const;
// maps block name to valid parents
@@ -162,6 +165,7 @@ export const ValidNestingCombinations: BlockCombinationRules = {
video: new Set([]),
contact: new Set([]),
task: new Set([]),
+ automation: new Set([]),
};
export const LoadErrors = {
diff --git a/js/app/packages/core/blockMethodRegistry.ts b/js/app/packages/core/blockMethodRegistry.ts
index dd09cf2e68..2b31029d67 100644
--- a/js/app/packages/core/blockMethodRegistry.ts
+++ b/js/app/packages/core/blockMethodRegistry.ts
@@ -37,6 +37,7 @@ export interface BlockMethodRegistry {
color: EmptySpec;
component: EmptySpec;
task: EmptySpec;
+ automation: EmptySpec;
}
// Type helper to get the method spec for a block name
diff --git a/js/app/packages/core/component/AI/hook/useEntityDropAttachment.ts b/js/app/packages/core/component/AI/hook/useEntityDropAttachment.ts
index 71a0e2bc86..e1919f7bd2 100644
--- a/js/app/packages/core/component/AI/hook/useEntityDropAttachment.ts
+++ b/js/app/packages/core/component/AI/hook/useEntityDropAttachment.ts
@@ -129,6 +129,7 @@ export function useEntityDropAttachment(
})
.with('chat', () => undefined)
.with('call', () => undefined)
+ .with('automation', () => undefined)
.exhaustive() satisfies Attachment | undefined;
if (attachment) {
diff --git a/js/app/packages/core/component/EntityIcon.tsx b/js/app/packages/core/component/EntityIcon.tsx
index ad781a162a..6ab63f07f4 100644
--- a/js/app/packages/core/component/EntityIcon.tsx
+++ b/js/app/packages/core/component/EntityIcon.tsx
@@ -23,6 +23,7 @@ import FileVideo from '@icon/duotone/file-video-duotone.svg';
import FileImage from '@icon/duotone/image-duotone.svg';
import PhoneCall from '@icon/duotone/phone-call-duotone.svg';
import Canvas from '@icon/duotone/pencil-circle-duotone.svg';
+import Robot from '@icon/duotone/robot-duotone.svg';
import User from '@icon/duotone/user-duotone.svg';
import Users from '@icon/duotone/users-duotone.svg';
import Folder from '@icon/fill/folder-simple-fill.svg';
@@ -247,6 +248,12 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
background: 'bg-task-bg',
prettyName: 'Task',
},
+ automation: {
+ icon: Robot,
+ foreground: 'text-default',
+ background: 'bg-default-bg',
+ prettyName: 'Automation',
+ },
};
// this will match fall-through cases like code files which match multiple extensions
@@ -302,6 +309,7 @@ export const WIDE_ICONS: Record<EntityWithValidIcon, Component> = {
emailRead: WideEmail,
emailInvite: WideCalendar,
task: WideTask,
+ automation: Robot,
};
export const ICON_SIZES = {
diff --git a/js/app/packages/core/component/FileList/constants.tsx b/js/app/packages/core/component/FileList/constants.tsx
index 807f43263a..c0c3ce74f7 100644
--- a/js/app/packages/core/component/FileList/constants.tsx
+++ b/js/app/packages/core/component/FileList/constants.tsx
@@ -77,4 +77,5 @@ export const fileTypeColors: Record<
project: defaultFileColor,
unknown: defaultFileColor,
task: defaultFileColor,
+ automation: defaultFileColor,
};
diff --git a/js/app/packages/core/component/FileList/itemOperations.ts b/js/app/packages/core/component/FileList/itemOperations.ts
index 39ef8b8250..c0d4091336 100644
--- a/js/app/packages/core/component/FileList/itemOperations.ts
+++ b/js/app/packages/core/component/FileList/itemOperations.ts
@@ -182,7 +182,8 @@ export async function deleteItem(args: {
if (
itemType === 'channel' ||
itemType === 'email' ||
- itemType === 'channel_message'
+ itemType === 'channel_message' ||
+ itemType === 'automation'
)
return false;
const removed = await removeHistoryItem(itemType, id);
diff --git a/js/app/packages/core/component/Properties/utils/entityConversion.ts b/js/app/packages/core/component/Properties/utils/entityConversion.ts
index 12e6853aba..495b2c6cd7 100644
--- a/js/app/packages/core/component/Properties/utils/entityConversion.ts
+++ b/js/app/packages/core/component/Properties/utils/entityConversion.ts
@@ -73,5 +73,8 @@ export function macroEntityToPropertyEntityType(
.with({ type: 'document' }, () => EntityType.DOCUMENT)
.with({ type: 'channel_message' }, () => EntityType.CHANNEL)
.with({ type: 'call' }, () => EntityType.CHANNEL)
+ .with({ type: 'automation' }, () => {
+ throw new Error('automation entities do not support properties');
+ })
.exhaustive();
}
diff --git a/js/app/packages/core/constant/servers.ts b/js/app/packages/core/constant/servers.ts
index f0d6e869b8..1e45df3d7a 100644
--- a/js/app/packages/core/constant/servers.ts
+++ b/js/app/packages/core/constant/servers.ts
@@ -12,6 +12,7 @@ const serverHostLocal: Servers = {
contacts: 'http://localhost:8083',
'email-service': 'http://localhost:8087',
'image-proxy-service': 'http://localhost:8097',
+ 'scheduled-action': 'http://localhost:8098',
} as const;
const devServerSuffix = import.meta.env.MODE === 'development' ? '-dev' : '';
@@ -35,6 +36,7 @@ const serverHostRemote = {
contacts: `https://contacts${devServerSuffix}.macro.com`,
'email-service': `https://email-service${devServerSuffix}.macro.com`,
'image-proxy-service': `https://image-proxy${devServerSuffix}.macro.com`,
+ 'scheduled-action': `https://agent-schedule${devServerSuffix}.macro.com`,
} as const;
type Servers = Record<keyof typeof serverHostRemote, string>;
diff --git a/js/app/packages/core/types/index.ts b/js/app/packages/core/types/index.ts
index 89c75df700..70424eb97a 100644
--- a/js/app/packages/core/types/index.ts
+++ b/js/app/packages/core/types/index.ts
@@ -5,6 +5,7 @@ export const EntityType = {
...BaseEntityType,
email: 'email',
channel_message: 'channel_message',
+ automation: 'automation',
} as const;
export type EntityType = (typeof EntityType)[keyof typeof EntityType];
diff --git a/js/app/packages/entity/src/composed/ListEntity.tsx b/js/app/packages/entity/src/composed/ListEntity.tsx
index 3565f2c38d..8c5c15e143 100644
--- a/js/app/packages/entity/src/composed/ListEntity.tsx
+++ b/js/app/packages/entity/src/composed/ListEntity.tsx
@@ -1,79 +1,82 @@
import './ListEntity.css';
+import { EntityRow, EntityRowContext } from '@app/component/mobile/EntityRow';
+import { useSplitPanel } from '@app/component/split-layout/layoutUtils';
+import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
+import {
+ twoLineClampMarkdownTheme,
+ unifiedListMarkdownTheme,
+} from '@core/component/LexicalMarkdown/theme';
+import { UserIcon } from '@core/component/UserIcon';
+import { isMobile } from '@core/mobile/isMobile';
+import type { NotificationType } from '@core/types';
+import { tryMacroId, useDisplayNameParts } from '@core/user';
import type { DateValue } from '@core/util/date';
import {
+ HighlightRender,
visibleLength,
windowSearchMatch,
- HighlightRender,
} from '@core/util/searchHighlight';
-import { Entity } from '../entity';
+import { DisplayName } from '@entity/components/DisplayName';
+import { stackNotifications } from '@notifications';
import type { StreamEvent } from '@service-connection/generated/schemas';
import {
- isCallEntity,
- isChannelEntity,
- isChannelMessageEntity,
- isEmailEntity,
- isProjectContainedEntity,
- type ChannelEntity,
- type EmailEntity,
- type ProjectEntity,
- type EntityData,
- isTaskEntity,
-} from '../types/entity';
+ getStreamState,
+ subscribeToStreamState,
+} from '@service-connection/stream-events';
+import { mergeRefs } from '@solid-primitives/refs';
+import { createElementSize } from '@solid-primitives/resize-observer';
+import { cn } from '@ui/utils/classname';
import {
type Accessor,
createContext,
createEffect,
createMemo,
createSignal,
+ type JSX,
Match,
onCleanup,
+ type Ref,
Show,
Switch,
useContext,
- type Ref,
- type JSX,
} from 'solid-js';
+import { DraftBadge, SharedBadge } from '../components/Badges';
+import { MultiSelectCheckbox } from '../components/MultiSelectCheckbox';
+import { ProjectBreadCrumb } from '../components/ProjectBreadCrumb';
+import { UnreadIndicator } from '../components/UnreadIndicator';
+import { Entity } from '../entity';
+import type { EntityRowConfig } from '../extractors-notification';
+import { getActionVerb } from '../extractors-notification/notification-description-helpers';
+import { SearchContent } from '../extractors-search/search-content';
+import { SearchSender } from '../extractors-search/search-sender';
import {
- getStreamState,
- subscribeToStreamState,
-} from '@service-connection/stream-events';
+ type ChannelEntity,
+ type EmailEntity,
+ type EntityData,
+ isCallEntity,
+ isChannelEntity,
+ isChannelMessageEntity,
+ isEmailEntity,
+ isProjectContainedEntity,
+ isAutomationEntity,
+ isTaskEntity,
+ type ProjectEntity,
+ type AutomationEntity,
+} from '../types/entity';
import {
isWithNotification,
type WithNotification,
} from '../types/notification';
-import { unreadFilterFn } from '../utils/filter';
-import { cn } from '@ui/utils/classname';
-import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
-import {
- twoLineClampMarkdownTheme,
- unifiedListMarkdownTheme,
-} from '@core/component/LexicalMarkdown/theme';
import type { SearchLocation } from '../types/search';
import { isSearchEntity } from '../types/search';
-import { UserIcon } from '@core/component/UserIcon';
-import { SearchContent } from '../extractors-search/search-content';
-import { SearchSender } from '../extractors-search/search-sender';
import { createEntityDraggable } from '../utils/draggable';
-import { UnreadIndicator } from '../components/UnreadIndicator';
-import { MultiSelectCheckbox } from '../components/MultiSelectCheckbox';
-import { DraftBadge, SharedBadge } from '../components/Badges';
-import { useIsShared } from '../utils/shared';
-import { ProjectBreadCrumb } from '../components/ProjectBreadCrumb';
+import { unreadFilterFn } from '../utils/filter';
import {
filterNotDoneNotifications,
filterValidNotifications,
} from '../utils/notification';
-import { getActionVerb } from '../extractors-notification/notification-description-helpers';
-import type { NotificationType } from '@core/types';
-import { useSplitPanel } from '@app/component/split-layout/layoutUtils';
-import { EntityRow, EntityRowContext } from '@app/component/mobile/EntityRow';
-import { stackNotifications } from '@notifications';
-import { mergeRefs } from '@solid-primitives/refs';
-import type { EntityRowConfig } from '../extractors-notification';
-import { createElementSize } from '@solid-primitives/resize-observer';
-import { isMobile } from '@core/mobile/isMobile';
-import { tryMacroId, useDisplayNameParts } from '@core/user';
-import { DisplayName } from '@entity/components/DisplayName';
+import { useIsShared } from '../utils/shared';
+import { formatDateAndTime } from '../utils/timestamp';
import { formatCallDuration } from '@block-call/utils';
const WIDE_BREAKPOINT = 512; // @lg container query = 32rem
@@ -218,6 +221,31 @@ function EmailSnippet(props: {
);
}
+function AutomationSubtitle(props: { entity: AutomationEntity }) {
+ return (
+ <div class="text-xs font-mono text-right uppercase font-light">
+ <Switch>
+ <Match when={props.entity.isRunning}>
+ <span class="flex items-center justify-end gap-1.5 text-accent">
+ <span class="size-1.5 animate-pulse rounded-full bg-accent" />
+ Running
+ </span>
+ </Match>
+ <Match when={props.entity.enabled && props.entity.nextRunAt}>
+ {(nextRunAt) => (
+ <span class="text-ink-extra-muted">
+ Next run {formatDateAndTime(nextRunAt())}
+ </span>
+ )}
+ </Match>
+ <Match when={!props.entity.enabled}>
+ <span class="text-ink-extra-muted">Paused</span>
+ </Match>
+ </Switch>
+ </div>
+ );
+}
+
function ChannelMessage(props: {
message: NonNullable<ChannelEntity['latestMessage']>;
}) {
@@ -709,6 +737,18 @@ function WideLayout(props: LayoutProps) {
</>
)}
</Match>
+ <Match when={isAutomationEntity(props.entity) && props.entity}>
+ {(entity) => (
+ <>
+ <span class="w-(--title-width) shrink-0 truncate">
+ <Entity.Title entity={entity()} />
+ </span>
+ <span class="">
+ <AutomationSubtitle entity={entity()} />
+ </span>
+ </>
+ )}
+ </Match>
<Match when={props.entity}>
{(entity) => <Entity.Title entity={entity()} />}
</Match>
diff --git a/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx b/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx
index a1aeb2a5ec..1f2e827f40 100644
--- a/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx
+++ b/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx
@@ -32,6 +32,9 @@ function getEntityType(entity: EntityData): EntityType {
.with({ type: 'document' }, () => EntityType.DOCUMENT)
.with({ type: 'channel_message' }, () => EntityType.CHANNEL)
.with({ type: 'call' }, () => EntityType.CHANNEL)
+ .with({ type: 'automation' }, () => {
+ throw new Error('automation entities do not support properties');
+ })
.exhaustive();
}
diff --git a/js/app/packages/entity/src/extractors/entity-icon.tsx b/js/app/packages/entity/src/extractors/entity-icon.tsx
index d9d426fd17..3921201667 100644
--- a/js/app/packages/entity/src/extractors/entity-icon.tsx
+++ b/js/app/packages/entity/src/extractors/entity-icon.tsx
@@ -79,6 +79,7 @@ export function EntityIcon(props: EntityIconProps) {
hasIcsAttachment ? 'emailInvite' : isRead ? 'emailRead' : 'email'
)
.when(isCallEntity, () => 'call')
+ .with({ type: 'automation' }, () => 'automation')
.otherwise(() => 'default');
};
diff --git a/js/app/packages/entity/src/extractors/entity-title.tsx b/js/app/packages/entity/src/extractors/entity-title.tsx
index e5e5d9f9ae..4fbe4aa7ac 100644
--- a/js/app/packages/entity/src/extractors/entity-title.tsx
+++ b/js/app/packages/entity/src/extractors/entity-title.tsx
@@ -19,6 +19,7 @@ function extractRawTitle(entity: EntityData): string {
.with({ type: 'email' }, (e) => e.name || '(No Subject)')
.with({ type: 'chat' }, (e) => e.name)
.with({ type: 'call' }, (e) => e.name)
+ .with({ type: 'automation' }, (e) => e.name || 'Untitled automation')
.otherwise(() => 'Unknown');
}
diff --git a/js/app/packages/entity/src/index.ts b/js/app/packages/entity/src/index.ts
index f9d95263d5..5f2c3f3c6a 100644
--- a/js/app/packages/entity/src/index.ts
+++ b/js/app/packages/entity/src/index.ts
@@ -18,6 +18,11 @@ export { DisplayName } from './components/DisplayName';
export { ProjectBreadCrumb } from './components/ProjectBreadCrumb';
export { useIsShared } from './utils/shared';
+export {
+ formatTimestamp,
+ formatRelativeTimestamp,
+ formatDateAndTime,
+} from './utils/timestamp';
export {
filterNotDoneNotifications,
filterValidNotifications,
diff --git a/js/app/packages/entity/src/types/entity.ts b/js/app/packages/entity/src/types/entity.ts
index 0d2f23ea35..ba629628fc 100644
--- a/js/app/packages/entity/src/types/entity.ts
+++ b/js/app/packages/entity/src/types/entity.ts
@@ -1,4 +1,3 @@
-import { isEntityType } from '@core/types/utils';
import type { DateValue } from '@core/util/date';
import type { ApiLabel } from '@service-email/generated/schemas';
import type {
@@ -128,6 +127,22 @@ export type CallEntity = EntityBase & {
participantIds: string[];
};
+export type AutomationEntity = EntityBase & {
+ type: 'automation';
+ /** Cron expression controlling when the automation runs. */
+ cron: string;
+ /** Whether the automation is currently enabled. */
+ enabled: boolean;
+ /** ISO timestamp of the next scheduled run, or null when paused / unscheduled. */
+ nextRunAt?: string | null;
+ /** ISO timestamp of the last completed run. */
+ lastRunAt?: string | null;
+ /** True when a run is actively claimed on the server. Derived from the
+ * scheduled action's `claimed` timestamp + the backend's stale-claim
+ * window; updated live via the connection-gateway websocket. */
+ isRunning?: boolean;
+};
+
export type EntityData =
| ChannelEntity
| ChannelMessageEntity
@@ -136,7 +151,19 @@ export type EntityData =
| TaskEntity
| EmailEntity
| ProjectEntity
- | CallEntity;
+ | CallEntity
+ | AutomationEntity;
+
+const ENTITY_TYPE_VALUES = new Set<EntityData['type']>([
+ 'channel',
+ 'channel_message',
+ 'chat',
+ 'document',
+ 'email',
+ 'project',
+ 'call',
+ 'automation',
+]);
export const isEntityData = (item: unknown): item is EntityData => {
if (typeof item !== 'object') return false;
@@ -147,7 +174,7 @@ export const isEntityData = (item: unknown): item is EntityData => {
if (typeof item.type !== 'string') return false;
- return isEntityType(item.type);
+ return ENTITY_TYPE_VALUES.has(item.type as EntityData['type']);
};
export const isTaskEntity = (entity: EntityData): entity is TaskEntity => {
@@ -188,6 +215,12 @@ export const isCallEntity = (entity: EntityData): entity is CallEntity => {
return entity.type === 'call';
};
+export const isAutomationEntity = (
+ entity: EntityData
+): entity is AutomationEntity => {
+ return entity.type === 'automation';
+};
+
export const isDocumentEntity = (
entity: EntityData
): entity is DocumentEntity => {
diff --git a/js/app/packages/entity/src/utils/timestamp.ts b/js/app/packages/entity/src/utils/timestamp.ts
index 1463672e04..1b55cb2ea4 100644
--- a/js/app/packages/entity/src/utils/timestamp.ts
+++ b/js/app/packages/entity/src/utils/timestamp.ts
@@ -67,3 +67,17 @@ export interface TimestampData {
formatted: string;
raw: number;
}
+
+/**
+ * Formats a date + time in a single concise line, e.g. "Apr 15, 2:30 PM" or
+ * "1/27/24, 2:30 PM". Used when a row needs both pieces (e.g. automation
+ * next-run times).
+ */
+export function formatDateAndTime(date: DateValue): string {
+ const d = typeof date === 'string' ? new Date(date) : date;
+ const dateLabel = isSameYear(d, new Date())
+ ? format(d, 'MMM d')
+ : format(d, 'M/d/yy');
+ const timeLabel = format(d, 'h:mm a');
+ return `${dateLabel}, ${timeLabel}`;
+}
diff --git a/js/app/packages/macro-entity/src/queries/dss.ts b/js/app/packages/macro-entity/src/queries/dss.ts
index 1ceb889f5a..6114f7c923 100644
--- a/js/app/packages/macro-entity/src/queries/dss.ts
+++ b/js/app/packages/macro-entity/src/queries/dss.ts
@@ -8,6 +8,8 @@ import { toast } from '@core/component/Toast/Toast';
import { useMutation } from '@tanstack/solid-query';
import type { EntityData } from '@entity';
import { callServiceClient } from '@service-call/client';
+import { scheduledActionClient } from '@service-scheduled-action/client';
+import { scheduledActionKeys } from '@queries/agent-schedule/keys';
import type { ItemType } from '@service-storage/client';
import { queryClient } from '@queries/client';
import { soupKeys } from '@queries/soup/keys';
@@ -26,7 +28,8 @@ export function createBulkDeleteDssItemsMutation() {
type === 'chat' ||
type === 'document' ||
type === 'project' ||
- type === 'call'
+ type === 'call' ||
+ type === 'automation'
);
};
return useMutation(() => ({
@@ -39,12 +42,34 @@ export function createBulkDeleteDssItemsMutation() {
callServiceClient.deleteCallRecord(e.id)
).then(() => true);
}
+ if (e.type === 'automation') {
+ return throwOnErr(() =>
+ scheduledActionClient.deleteSchedule({ scheduleId: e.id })
+ ).then(() => true);
+ }
return deleteItem({ id: e.id, itemType: e.type as ItemType });
})
);
if (deletable.some((e) => e.type === 'call')) {
queryClient.invalidateQueries({ queryKey: ['call'] });
}
+ if (deletable.some((e) => e.type === 'automation')) {
+ const deletedIds = new Set(
+ deletable.filter((e) => e.type === 'automation').map((e) => e.id)
+ );
+ queryClient.setQueryData(
+ scheduledActionKeys.list.queryKey,
+ (current: unknown) => {
+ if (!Array.isArray(current)) return current;
+ return current.filter(
+ (item: { id?: string }) => !item.id || !deletedIds.has(item.id)
+ );
+ }
+ );
+ queryClient.invalidateQueries({
+ queryKey: scheduledActionKeys.list.queryKey,
+ });
+ }
return results;
},
onMutate: async (entities: EntityData[]) => {
diff --git a/js/app/packages/macro-entity/src/queries/rename.ts b/js/app/packages/macro-entity/src/queries/rename.ts
index 9ea425cff5..75287f2206 100644
--- a/js/app/packages/macro-entity/src/queries/rename.ts
+++ b/js/app/packages/macro-entity/src/queries/rename.ts
@@ -110,7 +110,11 @@ const renameDssSetData = (
frecency_score: score,
})
);
- } else if (itemType !== 'email' && itemType !== 'channel_message') {
+ } else if (
+ itemType !== 'email' &&
+ itemType !== 'channel_message' &&
+ itemType !== 'automation'
+ ) {
txns.set(
id,
optimisticUpdateSoupEntity({
diff --git a/js/app/packages/queries/agent-schedule/entities.ts b/js/app/packages/queries/agent-schedule/entities.ts
new file mode 100644
index 0000000000..02b496342b
--- /dev/null
+++ b/js/app/packages/queries/agent-schedule/entities.ts
@@ -0,0 +1,52 @@
+import type { AutomationEntity } from '@entity';
+import type { ScheduledAction } from '@service-scheduled-action/generated/schemas';
+import { createMemo } from 'solid-js';
+import { useSchedulesQuery } from './schedules';
+
+// Must match `MAX_ACTION_TIME` on the backend
+// (rust/cloud-storage/scheduled_action/src/domain/models.rs). After this window
+// a claim is treated as stale — an executor crashed mid-run — so we stop
+// reporting the action as running.
+const MAX_CLAIMED_MS = 20 * 60 * 1000;
+
+function isClaimActive(claimed: string | undefined | null): boolean {
+ if (!claimed) return false;
+ return Date.now() - Date.parse(claimed) < MAX_CLAIMED_MS;
+}
+
+function scheduleToEntity(
+ schedule: ScheduledAction
+): AutomationEntity | undefined {
+ if (!schedule.id) return undefined;
+ return {
+ id: schedule.id,
+ type: 'automation',
+ name: schedule.name,
+ ownerId: schedule.owner,
+ createdAt: schedule.created_at,
+ updatedAt: schedule.updated_at,
+ cron: schedule.schedule,
+ enabled: schedule.enabled,
+ nextRunAt: schedule.next_run_at,
+ isRunning: isClaimActive(schedule.claimed),
+ };
+}
+
+/**
+ * Reactive list of automation entities derived from the scheduled-action
+ * query. Safe to call from any component tree that's under a QueryClient —
+ * returns `[]` until the query resolves.
+ */
+export function useAutomationEntities() {
+ const schedulesQuery = useSchedulesQuery(() => true);
+ return createMemo<AutomationEntity[]>(() => {
+ const data = schedulesQuery.data;
+ if (!data) return [];
+ const out: AutomationEntity[] = [];
+ for (const schedule of data) {
+ const entity = scheduleToEntity(schedule);
+ if (entity) out.push(entity);
+ }
+ return out;
+ });
+}
diff --git a/js/app/packages/queries/agent-schedule/keys.ts b/js/app/packages/queries/agent-schedule/keys.ts
new file mode 100644
index 0000000000..2e72f80d82
--- /dev/null
+++ b/js/app/packages/queries/agent-schedule/keys.ts
@@ -0,0 +1,12 @@
+import { createQueryKeys } from '@lukemorales/query-key-factory';
+
+export const scheduledActionKeys = createQueryKeys('scheduledAction', {
+ all: null,
+ list: null,
+ detail: (params: { scheduleId: string }) => ({
+ queryKey: [params.scheduleId],
+ }),
+ history: (params: { scheduleId: string }) => ({
+ queryKey: [params.scheduleId, 'history'],
+ }),
+});
diff --git a/js/app/packages/queries/agent-schedule/schedules.ts b/js/app/packages/queries/agent-schedule/schedules.ts
new file mode 100644
index 0000000000..0ff08112f4
--- /dev/null
+++ b/js/app/packages/queries/agent-schedule/schedules.ts
@@ -0,0 +1,187 @@
+import { throwOnErr } from '@core/util/maybeResult';
+import { queryClient } from '@queries/client';
+import { type MutationCallbacks, withCallbacks } from '@queries/utils';
+import { scheduledActionClient } from '@service-scheduled-action/client';
+import type {
+ ActionExecutionRecord,
+ CreateScheduledAction,
+ InProgressExecution,
+ ScheduledAction,
+ UpdateScheduledAction,
+} from '@service-scheduled-action/generated/schemas';
+import { useMutation, useQuery } from '@tanstack/solid-query';
+import type { Accessor } from 'solid-js';
+import { scheduledActionKeys } from './keys';
+
+const QUERY_REFETCH_BEHAVIOR = {
+ refetchOnMount: 'always' as const,
+ refetchOnWindowFocus: 'always' as const,
+};
+
+function upsertSchedule(schedule: ScheduledAction) {
+ queryClient.setQueryData(
+ scheduledActionKeys.list.queryKey,
+ (current: ScheduledAction[] | undefined) => {
+ if (!current) return [schedule];
+
+ const index = current.findIndex((item) => item.id === schedule.id);
+ if (index === -1) return [schedule, ...current];
+
+ const next = [...current];
+ next[index] = schedule;
+ return next;
+ }
+ );
+}
+
+function removeSchedule(scheduleId: string) {
+ queryClient.setQueryData(
+ scheduledActionKeys.list.queryKey,
+ (current: ScheduledAction[] | undefined) =>
+ current?.filter((item) => item.id !== scheduleId) ?? current
+ );
+}
+
+export function useSchedulesQuery(enabled: Accessor<boolean>) {
+ return useQuery(() => ({
+ queryKey: scheduledActionKeys.list.queryKey,
+ enabled: enabled(),
+ queryFn: async () =>
+ throwOnErr(async () => await scheduledActionClient.listSchedules()),
+ placeholderData: (prev: ScheduledAction[] | undefined) => prev,
+ reconcile: 'id',
+ ...QUERY_REFETCH_BEHAVIOR,
+ }));
+}
+
+export function useScheduleHistoryQuery(
+ scheduleId: Accessor<string | null | undefined>,
+ enabled: Accessor<boolean>
+) {
+ return useQuery(() => {
+ const currentScheduleId = scheduleId();
+
+ return {
+ queryKey: scheduledActionKeys.history({
+ scheduleId: currentScheduleId ?? '__none__',
+ }).queryKey,
+ enabled: enabled() && Boolean(currentScheduleId),
+ queryFn: async () =>
+ throwOnErr(
+ async () =>
+ await scheduledActionClient.listHistory({
+ scheduleId: currentScheduleId!,
+ })
+ ),
+ placeholderData: (prev: ActionExecutionRecord[] | undefined) => prev,
+ ...QUERY_REFETCH_BEHAVIOR,
+ };
+ });
+}
+
+export function invalidateSchedules() {
+ return queryClient.invalidateQueries({
+ queryKey: scheduledActionKeys.list.queryKey,
+ });
+}
+
+export function invalidateScheduleHistory(scheduleId: string) {
+ return queryClient.invalidateQueries({
+ queryKey: scheduledActionKeys.history({ scheduleId }).queryKey,
+ });
+}
+
+export function useCreateScheduleMutation(
+ callbacks?: MutationCallbacks<ScheduledAction, Error, CreateScheduledAction>
+) {
+ return useMutation(() => ({
+ mutationFn: async (request: CreateScheduledAction) =>
+ throwOnErr(
+ async () => await scheduledActionClient.createSchedule(request)
+ ),
+ ...withCallbacks(
+ {
+ onSuccess: async (schedule) => {
+ upsertSchedule(schedule);
+ await invalidateSchedules();
+ },
+ },
+ callbacks
+ ),
+ }));
+}
+
+export function useUpdateScheduleMutation(
+ callbacks?: MutationCallbacks<
+ ScheduledAction,
+ Error,
+ { scheduleId: string; body: UpdateScheduledAction }
+ >
+) {
+ return useMutation(() => ({
+ mutationFn: async (args: {
+ scheduleId: string;
+ body: UpdateScheduledAction;
+ }) =>
+ throwOnErr(async () => await scheduledActionClient.updateSchedule(args)),
+ ...withCallbacks(
+ {
+ onSuccess: async (schedule) => {
+ upsertSchedule(schedule);
+ await invalidateSchedules();
+ },
+ },
+ callbacks
+ ),
+ }));
+}
+
+export function useDeleteScheduleMutation(
+ callbacks?: MutationCallbacks<
+ { success: boolean },
+ Error,
+ { scheduleId: string }
+ >
+) {
+ return useMutation(() => ({
+ mutationFn: async ({ scheduleId }: { scheduleId: string }) =>
+ throwOnErr(
+ async () => await scheduledActionClient.deleteSchedule({ scheduleId })
+ ),
+ ...withCallbacks(
+ {
+ onSuccess: async (_result, variables) => {
+ removeSchedule(variables.scheduleId);
+ queryClient.removeQueries({
+ queryKey: scheduledActionKeys.history({
+ scheduleId: variables.scheduleId,
+ }).queryKey,
+ });
+ await invalidateSchedules();
+ },
+ },
+ callbacks
+ ),
+ }));
+}
+
+export function useRunScheduleNowMutation(
+ callbacks?: MutationCallbacks<
+ InProgressExecution,
+ Error,
+ { scheduleId: string }
+ >
+) {
+ // History and claimed-state updates now arrive via the scheduled-action
+ // websocket sync (packages/queries/agent-schedule/sync.ts). Invalidating on
+ // HTTP success would race the synthetic pending row from the `started`
+ // event and wipe it before the server persists the real record — so the
+ // success path is intentionally a no-op here.
+ return useMutation(() => ({
+ mutationFn: async ({ scheduleId }: { scheduleId: string }) =>
+ throwOnErr(
+ async () => await scheduledActionClient.runNow({ scheduleId })
+ ),
+ ...withCallbacks({}, callbacks),
+ }));
+}
diff --git a/js/app/packages/queries/agent-schedule/sync.ts b/js/app/packages/queries/agent-schedule/sync.ts
new file mode 100644
index 0000000000..dd083d88ce
--- /dev/null
+++ b/js/app/packages/queries/agent-schedule/sync.ts
@@ -0,0 +1,122 @@
+import { queryClient } from '@queries/client';
+import { createConnectionWebsocketEffect } from '@service-connection/websocket';
+import type {
+ ActionExecutionRecord,
+ ScheduledAction,
+} from '@service-scheduled-action/generated/schemas';
+import { scheduledActionKeys } from './keys';
+
+const UPDATE = 'scheduled_action_update';
+
+type StartedPayload = {
+ type: 'started';
+ owner: string;
+ action_id: string;
+ chat_id: string;
+};
+type StoppedPayload = {
+ type: 'stopped';
+ owner: string;
+ action_id: string;
+ chat_id: string;
+ is_success: boolean;
+};
+type UpdatePayload = StartedPayload | StoppedPayload;
+
+function parsePayload(data: unknown): UpdatePayload | undefined {
+ try {
+ const parsed =
+ typeof data === 'string' ? (JSON.parse(data) as unknown) : data;
+ if (
+ parsed &&
+ typeof parsed === 'object' &&
+ 'type' in parsed &&
+ (parsed.type === 'started' || parsed.type === 'stopped')
+ ) {
+ return parsed as UpdatePayload;
+ }
+ return undefined;
+ } catch (e) {
+ console.warn('scheduled-action live update: unparsable payload', data, e);
+ return undefined;
+ }
+}
+
+function patchClaimed(actionId: string, claimed: string | null) {
+ queryClient.setQueryData(
+ scheduledActionKeys.list.queryKey,
+ (current: ScheduledAction[] | undefined) => {
+ if (!current) return current;
+ const idx = current.findIndex((a) => a.id === actionId);
+ if (idx === -1) return current;
+ const next = [...current];
+ next[idx] = { ...next[idx], claimed: claimed ?? undefined };
+ return next;
+ }
+ );
+}
+
+function upsertPendingHistoryRow(payload: StartedPayload) {
+ queryClient.setQueryData(
+ scheduledActionKeys.history({ scheduleId: payload.action_id }).queryKey,
+ (current: ActionExecutionRecord[] | undefined) => {
+ const synthetic: ActionExecutionRecord = {
+ action_id: payload.action_id,
+ resource_id: payload.chat_id,
+ start_time: new Date().toISOString(),
+ // `end_time` is not nullable on the server record, but the stop event
+ // triggers a refetch which replaces this synthetic row with the real
+ // persisted one. The missing `id` flags this row as pending — the UI
+ // checks for that to render the running affordance rather than a
+ // final state.
+ end_time: new Date().toISOString(),
+ is_success: false,
+ result: {},
+ created_at: new Date().toISOString(),
+ };
+ if (!current) return [synthetic];
+ const existingIdx = current.findIndex(
+ (r) => !r.id && r.resource_id === payload.chat_id
+ );
+ if (existingIdx !== -1) {
+ const next = [...current];
+ next[existingIdx] = synthetic;
+ return next;
+ }
+ return [synthetic, ...current];
+ }
+ );
+}
+
+function removePendingHistoryRow(chatId: string, scheduleId: string) {
+ queryClient.setQueryData(
+ scheduledActionKeys.history({ scheduleId }).queryKey,
+ (current: ActionExecutionRecord[] | undefined) => {
+ if (!current) return current;
+ return current.filter((r) => !(!r.id && r.resource_id === chatId));
+ }
+ );
+}
+
+createConnectionWebsocketEffect((data) => {
+ if (data.type !== UPDATE) return;
+ const payload = parsePayload(data.data);
+ if (!payload) return;
+
+ if (payload.type === 'started') {
+ patchClaimed(payload.action_id, new Date().toISOString());
+ upsertPendingHistoryRow(payload);
+ return;
+ }
+
+ // stopped: drop the synthetic pending row immediately so the UI stops
+ // showing it as running, then invalidate to refetch the server-persisted
+ // record (with end_time, is_success, and a real id).
+ patchClaimed(payload.action_id, null);
+ removePendingHistoryRow(payload.chat_id, payload.action_id);
+ queryClient.invalidateQueries({
+ queryKey: scheduledActionKeys.history({
+ scheduleId: payload.action_id,
+ }).queryKey,
+ });
+});
diff --git a/js/app/packages/queries/soup/normalized-cache/operations.ts b/js/app/packages/queries/soup/normalized-cache/operations.ts
index 9cf295d990..46082e748e 100644
--- a/js/app/packages/queries/soup/normalized-cache/operations.ts
+++ b/js/app/packages/queries/soup/normalized-cache/operations.ts
@@ -1,26 +1,26 @@
-import type { InfiniteData, QueryKey } from '@tanstack/solid-query';
+import { isErr } from '@core/util/maybeResult';
+import type { UnifiedSearchResponseItem } from '@service-search/generated/models';
import type {
PostSoupRequest,
SoupApiItem,
} from '@service-storage/generated/schemas';
import type { SoupPage } from '@service-storage/generated/schemas/soupPage';
-import type { UnifiedSearchResponseItem } from '@service-search/generated/models';
-import { isErr } from '@core/util/maybeResult';
+import type { InfiniteData, QueryKey } from '@tanstack/solid-query';
+import { isAfter } from 'date-fns';
import { match } from 'ts-pattern';
import { queryClient } from '../../client';
+import type { SoupApiItemFilter } from '../items';
import { soupKeys } from '../keys';
import {
- getSoupNormalizer,
getNormalizationObjectKey,
+ getSoupNormalizer,
type NormalizerData,
} from './normalizer';
import type {
- SoupTransaction,
- SoupEntityTag,
SoupEntityPartial,
+ SoupEntityTag,
+ SoupTransaction,
} from './types';
-import type { SoupApiItemFilter } from '../items';
-import { isAfter } from 'date-fns';
/**
* Optimistically update a single soup entity across all queries that reference it.
diff --git a/js/app/packages/queries/sync/SyncProvider.tsx b/js/app/packages/queries/sync/SyncProvider.tsx
index babaa0cd91..07b78ba123 100644
--- a/js/app/packages/queries/sync/SyncProvider.tsx
+++ b/js/app/packages/queries/sync/SyncProvider.tsx
@@ -5,6 +5,10 @@ import {
handleCommsReaction,
} from '@queries/channel/sync';
import { handleCommsTyping } from '@queries/channel/typing';
+// Side-effect import: registers the scheduled-action live-update websocket
+// listener. Must be imported somewhere that always loads on app start — this
+// provider is guaranteed to mount alongside the other sync handlers.
+import '@queries/agent-schedule/sync';
import { createConnectionWebsocketEffect } from '@service-connection/websocket';
import type { Accessor, ParentProps } from 'solid-js';
import { match } from 'ts-pattern';
diff --git a/js/app/packages/service-clients/orval.config.ts b/js/app/packages/service-clients/orval.config.ts
index ea18ed00f3..e2b5b2c9c6 100644
--- a/js/app/packages/service-clients/orval.config.ts
+++ b/js/app/packages/service-clients/orval.config.ts
@@ -125,6 +125,19 @@ export default defineConfig({
target: './service-properties/openapi.json',
},
},
+ scheduledActionService: {
+ output: {
+ client: 'fetch',
+ target: './service-scheduled-action/generated/client.ts',
+ schemas: './service-scheduled-action/generated/schemas',
+ override: {
+ useDates: false,
+ },
+ },
+ input: {
+ target: './service-scheduled-action/openapi.json',
+ },
+ },
searchService: {
output: {
client: 'fetch',
diff --git a/js/app/packages/service-clients/service-scheduled-action/client.ts b/js/app/packages/service-clients/service-scheduled-action/client.ts
new file mode 100644
index 0000000000..e7d870e080
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/client.ts
@@ -0,0 +1,83 @@
+import { SERVER_HOSTS } from '@core/constant/servers';
+import {
+ type FetchWithTokenErrorCode,
+ fetchWithToken,
+} from '@core/util/fetchWithToken';
+import {
+ type MaybeError,
+ type MaybeResult,
+ mapOk,
+ type ObjectLike,
+} from '@core/util/maybeResult';
+import type { SafeFetchInit } from '@core/util/safeFetch';
+import type {
+ ActionExecutionRecord,
+ CreateScheduledAction,
+ InProgressExecution,
+ ScheduledAction,
+ UpdateScheduledAction,
+} from './generated/schemas';
+
+const scheduledActionHost: string = SERVER_HOSTS['scheduled-action'];
+
+export function scheduledActionFetch(
+ url: string,
+ init?: SafeFetchInit
+): Promise<MaybeError<FetchWithTokenErrorCode>>;
+export function scheduledActionFetch<T extends ObjectLike>(
+ url: string,
+ init?: SafeFetchInit
+): Promise<MaybeResult<FetchWithTokenErrorCode, T>>;
+export function scheduledActionFetch<T extends ObjectLike = never>(
+ url: string,
+ init?: SafeFetchInit
+):
+ | Promise<MaybeResult<FetchWithTokenErrorCode, T>>
+ | Promise<MaybeError<FetchWithTokenErrorCode>> {
+ return fetchWithToken<T>(`${scheduledActionHost}${url}`, init);
+}
+
+export const scheduledActionClient = {
+ listSchedules: async () =>
+ scheduledActionFetch<ScheduledAction[]>('/scheduled-actions', {
+ method: 'GET',
+ }),
+
+ createSchedule: async (body: CreateScheduledAction) =>
+ scheduledActionFetch<ScheduledAction>('/scheduled-actions', {
+ method: 'POST',
+ body: JSON.stringify(body),
+ }),
+
+ updateSchedule: async (args: {
+ scheduleId: string;
+ body: UpdateScheduledAction;
+ }) =>
+ scheduledActionFetch<ScheduledAction>(
+ `/scheduled-actions/${args.scheduleId}`,
+ {
+ method: 'PUT',
+ body: JSON.stringify(args.body),
+ }
+ ),
+
+ deleteSchedule: async (args: { scheduleId: string }) => {
+ const result = await scheduledActionFetch<{}>(
+ `/scheduled-actions/${args.scheduleId}`,
+ { method: 'DELETE' }
+ );
+ return mapOk(result, () => ({ success: true }));
+ },
+
+ runNow: async (args: { scheduleId: string }) =>
+ scheduledActionFetch<InProgressExecution>(
+ `/scheduled-actions/${args.scheduleId}/execute`,
+ { method: 'POST' }
+ ),
+
+ listHistory: async (args: { scheduleId: string }) =>
+ scheduledActionFetch<ActionExecutionRecord[]>(
+ `/scheduled-actions/${args.scheduleId}/history`,
+ { method: 'GET' }
+ ),
+};
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/client.ts b/js/app/packages/service-clients/service-scheduled-action/generated/client.ts
new file mode 100644
index 0000000000..c7c6d69763
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/client.ts
@@ -0,0 +1,416 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+import type {
+ ActionExecutionRecord,
+ CreateScheduledAction,
+ EmptyResponse,
+ InProgressExecution,
+ ScheduledAction,
+ UpdateScheduledAction,
+} from './schemas';
+
+export type scheduledActionHealthResponse200 = {
+ data: EmptyResponse;
+ status: 200;
+};
+
+export type scheduledActionHealthResponseSuccess =
+ scheduledActionHealthResponse200 & {
+ headers: Headers;
+ };
+
+export type scheduledActionHealthResponse =
+ scheduledActionHealthResponseSuccess;
+
+export const getScheduledActionHealthUrl = () => {
+ return `/health`;
+};
+
+export const scheduledActionHealth = async (
+ options?: RequestInit
+): Promise<scheduledActionHealthResponse> => {
+ const res = await fetch(getScheduledActionHealthUrl(), {
+ ...options,
+ method: 'GET',
+ });
+
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
+
+ const data: scheduledActionHealthResponse['data'] = body
+ ? JSON.parse(body)
+ : {};
+ return {
+ data,
+ status: res.status,
+ headers: res.headers,
+ } as scheduledActionHealthResponse;
+};
+
+export type listScheduledActionsResponse200 = {
+ data: ScheduledAction[];
+ status: 200;
+};
+
+export type listScheduledActionsResponse401 = {
+ data: string;
+ status: 401;
+};
+
+export type listScheduledActionsResponse500 = {
+ data: string;
+ status: 500;
+};
+
+export type listScheduledActionsResponseSuccess =
+ listScheduledActionsResponse200 & {
+ headers: Headers;
+ };
+export type listScheduledActionsResponseError = (
+ | listScheduledActionsResponse401
+ | listScheduledActionsResponse500
+) & {
+ headers: Headers;
+};
+
+export type listScheduledActionsResponse =
+ | listScheduledActionsResponseSuccess
+ | listScheduledActionsResponseError;
+
+export const getListScheduledActionsUrl = () => {
+ return `/scheduled-actions`;
+};
+
+export const listScheduledActions = async (
+ options?: RequestInit
+): Promise<listScheduledActionsResponse> => {
+ const res = await fetch(getListScheduledActionsUrl(), {
+ ...options,
+ method: 'GET',
+ });
+
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
+
+ const data: listScheduledActionsResponse['data'] = body
+ ? JSON.parse(body)
+ : {};
+ return {
+ data,
+ status: res.status,
+ headers: res.headers,
+ } as listScheduledActionsResponse;
+};
+
+export type createScheduledActionResponse201 = {
+ data: ScheduledAction;
+ status: 201;
+};
+
+export type createScheduledActionResponse401 = {
+ data: string;
+ status: 401;
+};
+
+export type createScheduledActionResponse500 = {
+ data: string;
+ status: 500;
+};
+
+export type createScheduledActionResponseSuccess =
+ createScheduledActionResponse201 & {
+ headers: Headers;
+ };
+export type createScheduledActionResponseError = (
+ | createScheduledActionResponse401
+ | createScheduledActionResponse500
+) & {
+ headers: Headers;
+};
+
+export type createScheduledActionResponse =
+ | createScheduledActionResponseSuccess
+ | createScheduledActionResponseError;
+
+export const getCreateScheduledActionUrl = () => {
+ return `/scheduled-actions`;
+};
+
+export const createScheduledAction = async (
+ createScheduledAction: CreateScheduledAction,
+ options?: RequestInit
+): Promise<createScheduledActionResponse> => {
+ const res = await fetch(getCreateScheduledActionUrl(), {
+ ...options,
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(createScheduledAction),
+ });
+
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
+
+ const data: createScheduledActionResponse['data'] = body
+ ? JSON.parse(body)
+ : {};
+ return {
+ data,
+ status: res.status,
+ headers: res.headers,
+ } as createScheduledActionResponse;
+};
+
+export type updateScheduledActionResponse200 = {
+ data: ScheduledAction;
+ status: 200;
+};
+
+export type updateScheduledActionResponse401 = {
+ data: string;
+ status: 401;
+};
+
+export type updateScheduledActionResponse404 = {
+ data: string;
+ status: 404;
+};
+
+export type updateScheduledActionResponse500 = {
+ data: string;
+ status: 500;
+};
+
+export type updateScheduledActionResponseSuccess =
+ updateScheduledActionResponse200 & {
+ headers: Headers;
+ };
+export type updateScheduledActionResponseError = (
+ | updateScheduledActionResponse401
+ | updateScheduledActionResponse404
+ | updateScheduledActionResponse500
+) & {
+ headers: Headers;
+};
+
+export type updateScheduledActionResponse =
+ | updateScheduledActionResponseSuccess
+ | updateScheduledActionResponseError;
+
+export const getUpdateScheduledActionUrl = (id: string) => {
+ return `/scheduled-actions/${id}`;
+};
+
+export const updateScheduledAction = async (
+ id: string,
+ updateScheduledAction: UpdateScheduledAction,
+ options?: RequestInit
+): Promise<updateScheduledActionResponse> => {
+ const res = await fetch(getUpdateScheduledActionUrl(id), {
+ ...options,
+ method: 'PUT',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(updateScheduledAction),
+ });
+
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
+
+ const data: updateScheduledActionResponse['data'] = body
+ ? JSON.parse(body)
+ : {};
+ return {
+ data,
+ status: res.status,
+ headers: res.headers,
+ } as updateScheduledActionResponse;
+};
+
+export type deleteScheduledActionResponse204 = {
+ data: void;
+ status: 204;
+};
+
+export type deleteScheduledActionResponse401 = {
+ data: string;
+ status: 401;
+};
+
+export type deleteScheduledActionResponse404 = {
+ data: string;
+ status: 404;
+};
+
+export type deleteScheduledActionResponse500 = {
+ data: string;
+ status: 500;
+};
+
+export type deleteScheduledActionResponseSuccess =
+ deleteScheduledActionResponse204 & {
+ headers: Headers;
+ };
+export type deleteScheduledActionResponseError = (
+ | deleteScheduledActionResponse401
+ | deleteScheduledActionResponse404
+ | deleteScheduledActionResponse500
+) & {
+ headers: Headers;
+};
+
+export type deleteScheduledActionResponse =
+ | deleteScheduledActionResponseSuccess
+ | deleteScheduledActionResponseError;
+
+export const getDeleteScheduledActionUrl = (id: string) => {
+ return `/scheduled-actions/${id}`;
+};
+
+export const deleteScheduledAction = async (
+ id: string,
+ options?: RequestInit
+): Promise<deleteScheduledActionResponse> => {
+ const res = await fetch(getDeleteScheduledActionUrl(id), {
+ ...options,
+ method: 'DELETE',
+ });
+
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
+
+ const data: deleteScheduledActionResponse['data'] = body
+ ? JSON.parse(body)
+ : {};
+ return {
+ data,
+ status: res.status,
+ headers: res.headers,
+ } as deleteScheduledActionResponse;
+};
+
+export type executeScheduledActionNowResponse200 = {
+ data: InProgressExecution;
+ status: 200;
+};
+
+export type executeScheduledActionNowResponse401 = {
+ data: string;
+ status: 401;
+};
+
+export type executeScheduledActionNowResponse404 = {
+ data: string;
+ status: 404;
+};
+
+export type executeScheduledActionNowResponse409 = {
+ data: string;
+ status: 409;
+};
+
+export type executeScheduledActionNowResponse500 = {
+ data: string;
+ status: 500;
+};
+
+export type executeScheduledActionNowResponseSuccess =
+ executeScheduledActionNowResponse200 & {
+ headers: Headers;
+ };
+export type executeScheduledActionNowResponseError = (
+ | executeScheduledActionNowResponse401
+ | executeScheduledActionNowResponse404
+ | executeScheduledActionNowResponse409
+ | executeScheduledActionNowResponse500
+) & {
+ headers: Headers;
+};
+
+export type executeScheduledActionNowResponse =
+ | executeScheduledActionNowResponseSuccess
+ | executeScheduledActionNowResponseError;
+
+export const getExecuteScheduledActionNowUrl = (id: string) => {
+ return `/scheduled-actions/${id}/execute`;
+};
+
+export const executeScheduledActionNow = async (
+ id: string,
+ options?: RequestInit
+): Promise<executeScheduledActionNowResponse> => {
+ const res = await fetch(getExecuteScheduledActionNowUrl(id), {
+ ...options,
+ method: 'POST',
+ });
+
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
+
+ const data: executeScheduledActionNowResponse['data'] = body
+ ? JSON.parse(body)
+ : {};
+ return {
+ data,
+ status: res.status,
+ headers: res.headers,
+ } as executeScheduledActionNowResponse;
+};
+
+export type listScheduledActionHistoryResponse200 = {
+ data: ActionExecutionRecord[];
+ status: 200;
+};
+
+export type listScheduledActionHistoryResponse401 = {
+ data: string;
+ status: 401;
+};
+
+export type listScheduledActionHistoryResponse404 = {
+ data: string;
+ status: 404;
+};
+
+export type listScheduledActionHistoryResponse500 = {
+ data: string;
+ status: 500;
+};
+
+export type listScheduledActionHistoryResponseSuccess =
+ listScheduledActionHistoryResponse200 & {
+ headers: Headers;
+ };
+export type listScheduledActionHistoryResponseError = (
+ | listScheduledActionHistoryResponse401
+ | listScheduledActionHistoryResponse404
+ | listScheduledActionHistoryResponse500
+) & {
+ headers: Headers;
+};
+
+export type listScheduledActionHistoryResponse =
+ | listScheduledActionHistoryResponseSuccess
+ | listScheduledActionHistoryResponseError;
+
+export const getListScheduledActionHistoryUrl = (id: string) => {
+ return `/scheduled-actions/${id}/history`;
+};
+
+export const listScheduledActionHistory = async (
+ id: string,
+ options?: RequestInit
+): Promise<listScheduledActionHistoryResponse> => {
+ const res = await fetch(getListScheduledActionHistoryUrl(id), {
+ ...options,
+ method: 'GET',
+ });
+
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
+
+ const data: listScheduledActionHistoryResponse['data'] = body
+ ? JSON.parse(body)
+ : {};
+ return {
+ data,
+ status: res.status,
+ headers: res.headers,
+ } as listScheduledActionHistoryResponse;
+};
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecord.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecord.ts
new file mode 100644
index 0000000000..0af1716b59
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecord.ts
@@ -0,0 +1,23 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+import type { ActionExecutionRecordId } from './actionExecutionRecordId';
+import type { ActionExecutionRecordResourceId } from './actionExecutionRecordResourceId';
+import type { ActionExecutionRecordResult } from './actionExecutionRecordResult';
+
+export interface ActionExecutionRecord {
+ action_id: string;
+ created_at: string;
+ end_time: string;
+ id?: ActionExecutionRecordId;
+ is_success: boolean;
+ /** ID of the primary resource produced by this run (e.g. a chat thread).
+Opaque to the scheduler; the UI interprets it based on the action kind. */
+ resource_id?: ActionExecutionRecordResourceId;
+ result: ActionExecutionRecordResult;
+ start_time: string;
+}
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecordId.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecordId.ts
new file mode 100644
index 0000000000..00b177e7c5
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecordId.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type ActionExecutionRecordId = string | null;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecordResourceId.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecordResourceId.ts
new file mode 100644
index 0000000000..16f908cff7
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecordResourceId.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * ID of the primary resource produced by this run (e.g. a chat thread).
+Opaque to the scheduler; the UI interprets it based on the action kind.
+ */
+export type ActionExecutionRecordResourceId = string | null;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecordResult.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecordResult.ts
new file mode 100644
index 0000000000..5fa78d8e4c
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionExecutionRecordResult.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type ActionExecutionRecordResult = { [key: string]: unknown };
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionKind.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionKind.ts
new file mode 100644
index 0000000000..096329dd7b
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/actionKind.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type ActionKind = (typeof ActionKind)[keyof typeof ActionKind];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const ActionKind = {
+ Agent: 'Agent',
+} as const;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/agentTask.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/agentTask.ts
new file mode 100644
index 0000000000..b2404fb59e
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/agentTask.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+import type { Model } from './model';
+
+export interface AgentTask {
+ model: Model;
+ prompt: string;
+ user_prompt: string;
+}
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/createScheduledAction.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/createScheduledAction.ts
new file mode 100644
index 0000000000..4cc1afff60
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/createScheduledAction.ts
@@ -0,0 +1,24 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+import type { ActionKind } from './actionKind';
+import type { CreateScheduledActionTask } from './createScheduledActionTask';
+import type { Schedule } from './schedule';
+
+/**
+ * Client-supplied payload for creating a scheduled action. The server fills
+in `id`, `owner` (from the authenticated user), timestamps, `claimed`, and
+`next_run_at` (derived from the cron).
+ */
+export interface CreateScheduledAction {
+ enabled: boolean;
+ kind: ActionKind;
+ name: string;
+ schedule: Schedule;
+ task: CreateScheduledActionTask;
+ timezone: string;
+}
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/createScheduledActionTask.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/createScheduledActionTask.ts
new file mode 100644
index 0000000000..a684a3c4c3
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/createScheduledActionTask.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type CreateScheduledActionTask = { [key: string]: unknown };
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/emptyResponse.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/emptyResponse.ts
new file mode 100644
index 0000000000..c52a89f08e
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/emptyResponse.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Empty response is required due to custom fetch forcing `response.json()`
+ */
+export interface EmptyResponse {
+ [key: string]: unknown;
+}
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/inProgressExecution.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/inProgressExecution.ts
new file mode 100644
index 0000000000..be7dc5767e
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/inProgressExecution.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+import type { InProgressExecutionChatId } from './inProgressExecutionChatId';
+
+export interface InProgressExecution {
+ action_id: string;
+ chat_id?: InProgressExecutionChatId;
+}
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/inProgressExecutionChatId.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/inProgressExecutionChatId.ts
new file mode 100644
index 0000000000..b7eb3b81cb
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/inProgressExecutionChatId.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type InProgressExecutionChatId = string | null;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/index.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/index.ts
new file mode 100644
index 0000000000..04dd47caf3
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/index.ts
@@ -0,0 +1,32 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export * from './actionExecutionRecord';
+export * from './actionExecutionRecordId';
+export * from './actionExecutionRecordResourceId';
+export * from './actionExecutionRecordResult';
+export * from './actionKind';
+export * from './agentTask';
+export * from './createScheduledAction';
+export * from './createScheduledActionTask';
+export * from './emptyResponse';
+export * from './inProgressExecution';
+export * from './inProgressExecutionChatId';
+export * from './model';
+export * from './schedule';
+export * from './scheduledAction';
+export * from './scheduledActionClaimed';
+export * from './scheduledActionId';
+export * from './scheduledActionTask';
+export * from './scheduledActionUpdate';
+export * from './scheduledActionUpdateOneOf';
+export * from './scheduledActionUpdateOneOfThree';
+export * from './scheduledActionUpdateOneOfThreeType';
+export * from './scheduledActionUpdateOneOfType';
+export * from './updateScheduledAction';
+export * from './updateScheduledActionTask';
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/model.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/model.ts
new file mode 100644
index 0000000000..5e78eafddb
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/model.ts
@@ -0,0 +1,32 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type Model = (typeof Model)[keyof typeof Model];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const Model = {
+ 'gemini-25-pro': 'gemini-2.5-pro',
+ 'gemini-20-flash-001': 'gemini-2.0-flash-001',
+ 'gemini-20-flash-lite-001': 'gemini-2.0-flash-lite-001',
+ 'gemini-pro-15': 'gemini-pro-1.5',
+ 'gpt-5': 'gpt-5',
+ 'gpt-41': 'gpt-4.1',
+ 'gpt-4o': 'gpt-4o',
+ 'gpt-4o-mini': 'gpt-4o-mini',
+ o1: 'o1',
+ 'gpt-4o-search-preview': 'gpt-4o-search-preview',
+ o3: 'o3',
+ 'claude-3-5-sonnet': 'claude-3-5-sonnet',
+ 'claude-3-7-sonnet': 'claude-3-7-sonnet',
+ 'claude-sonnet-4': 'claude-sonnet-4',
+ 'claude-sonnet-4-5': 'claude-sonnet-4-5',
+ 'claude-sonnet-4-6': 'claude-sonnet-4-6',
+ 'claude-haiku-4-5': 'claude-haiku-4-5',
+ 'claude-opus-4-5': 'claude-opus-4-5',
+ 'claude-opus-4-6': 'claude-opus-4-6',
+} as const;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/schedule.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/schedule.ts
new file mode 100644
index 0000000000..4c13e5f2e3
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/schedule.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type Schedule = string;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledAction.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledAction.ts
new file mode 100644
index 0000000000..5bdccd1b4f
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledAction.ts
@@ -0,0 +1,32 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+import type { ActionKind } from './actionKind';
+import type { Schedule } from './schedule';
+import type { ScheduledActionClaimed } from './scheduledActionClaimed';
+import type { ScheduledActionId } from './scheduledActionId';
+import type { ScheduledActionTask } from './scheduledActionTask';
+
+export interface ScheduledAction {
+ claimed?: ScheduledActionClaimed;
+ created_at: string;
+ /** When false, the cron dispatcher skips this schedule. `run_now` remains
+available regardless. */
+ enabled: boolean;
+ id?: ScheduledActionId;
+ kind: ActionKind;
+ name: string;
+ /** Time of the next scheduled firing (derived from the cron on write). UI
+uses this to render "next run" without having to parse the cron itself. */
+ next_run_at: string;
+ owner: string;
+ schedule: Schedule;
+ task: ScheduledActionTask;
+ timezone: string;
+ updated_at: string;
+}
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionClaimed.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionClaimed.ts
new file mode 100644
index 0000000000..67aa4b4af8
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionClaimed.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type ScheduledActionClaimed = string | null;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionId.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionId.ts
new file mode 100644
index 0000000000..4dab8ee595
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionId.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type ScheduledActionId = string | null;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionTask.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionTask.ts
new file mode 100644
index 0000000000..b8e8ef1fd0
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionTask.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type ScheduledActionTask = { [key: string]: unknown };
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdate.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdate.ts
new file mode 100644
index 0000000000..132b5d7198
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdate.ts
@@ -0,0 +1,21 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+import type { ScheduledActionUpdateOneOf } from './scheduledActionUpdateOneOf';
+import type { ScheduledActionUpdateOneOfThree } from './scheduledActionUpdateOneOfThree';
+
+/**
+ * Live status update for a scheduled-action run, broadcast via the connection
+gateway to the owner. Clients use the `chat_id` to navigate to the run
+transcript and the variant tag to toggle the running indicator.
+
+Serialized with a `type` tag (`started`/`stopped`) and delivered over the
+single `scheduled_action_update` message type on the gateway.
+ */
+export type ScheduledActionUpdate =
+ | ScheduledActionUpdateOneOf
+ | ScheduledActionUpdateOneOfThree;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOf.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOf.ts
new file mode 100644
index 0000000000..124be18a16
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOf.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+import type { ScheduledActionUpdateOneOfType } from './scheduledActionUpdateOneOfType';
+
+export type ScheduledActionUpdateOneOf = {
+ action_id: string;
+ chat_id: string;
+ owner: string;
+ type: ScheduledActionUpdateOneOfType;
+};
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOfThree.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOfThree.ts
new file mode 100644
index 0000000000..9fffc365ef
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOfThree.ts
@@ -0,0 +1,16 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+import type { ScheduledActionUpdateOneOfThreeType } from './scheduledActionUpdateOneOfThreeType';
+
+export type ScheduledActionUpdateOneOfThree = {
+ action_id: string;
+ chat_id: string;
+ is_success: boolean;
+ owner: string;
+ type: ScheduledActionUpdateOneOfThreeType;
+};
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOfThreeType.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOfThreeType.ts
new file mode 100644
index 0000000000..5a9df7e1e8
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOfThreeType.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type ScheduledActionUpdateOneOfThreeType =
+ (typeof ScheduledActionUpdateOneOfThreeType)[keyof typeof ScheduledActionUpdateOneOfThreeType];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const ScheduledActionUpdateOneOfThreeType = {
+ stopped: 'stopped',
+} as const;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOfType.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOfType.ts
new file mode 100644
index 0000000000..5dc68f688f
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/scheduledActionUpdateOneOfType.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type ScheduledActionUpdateOneOfType =
+ (typeof ScheduledActionUpdateOneOfType)[keyof typeof ScheduledActionUpdateOneOfType];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const ScheduledActionUpdateOneOfType = {
+ started: 'started',
+} as const;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/updateScheduledAction.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/updateScheduledAction.ts
new file mode 100644
index 0000000000..27306e6bf0
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/updateScheduledAction.ts
@@ -0,0 +1,24 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+import type { ActionKind } from './actionKind';
+import type { Schedule } from './schedule';
+import type { UpdateScheduledActionTask } from './updateScheduledActionTask';
+
+/**
+ * Client-supplied payload for updating a scheduled action. Mirrors the fields
+the repository actually writes — `id`/`owner`/timestamps/`claimed`/
+`next_run_at` are not client-mutable.
+ */
+export interface UpdateScheduledAction {
+ enabled: boolean;
+ kind: ActionKind;
+ name: string;
+ schedule: Schedule;
+ task: UpdateScheduledActionTask;
+ timezone: string;
+}
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/updateScheduledActionTask.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/updateScheduledActionTask.ts
new file mode 100644
index 0000000000..01228cc43f
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/updateScheduledActionTask.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type UpdateScheduledActionTask = { [key: string]: unknown };
diff --git a/js/app/packages/service-clients/service-scheduled-action/openapi.json b/js/app/packages/service-clients/service-scheduled-action/openapi.json
new file mode 100644
index 0000000000..7eeac70b3b
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/openapi.json
@@ -0,0 +1,643 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "title": "scheduled_action",
+ "description": "API for managing scheduled actions",
+ "termsOfService": "https://macro.com/terms",
+ "license": {
+ "name": ""
+ },
+ "version": "0.1.0"
+ },
+ "paths": {
+ "/health": {
+ "get": {
+ "tags": ["scheduled actions"],
+ "operationId": "scheduled_action_health",
+ "responses": {
+ "200": {
+ "description": "health",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/EmptyResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/scheduled-actions": {
+ "get": {
+ "tags": ["scheduled actions"],
+ "operationId": "list_scheduled_actions",
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ScheduledAction"
+ }
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "tags": ["scheduled actions"],
+ "operationId": "create_scheduled_action",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateScheduledAction"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "201": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ScheduledAction"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/scheduled-actions/{id}": {
+ "put": {
+ "tags": ["scheduled actions"],
+ "operationId": "update_scheduled_action",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "ID of the scheduled action",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateScheduledAction"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ScheduledAction"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "delete": {
+ "tags": ["scheduled actions"],
+ "operationId": "delete_scheduled_action",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "ID of the scheduled action",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": ""
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/scheduled-actions/{id}/execute": {
+ "post": {
+ "tags": ["scheduled actions"],
+ "operationId": "execute_scheduled_action_now",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "ID of the scheduled action",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/InProgressExecution"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "409": {
+ "description": "Action is already running",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/scheduled-actions/{id}/history": {
+ "get": {
+ "tags": ["scheduled actions"],
+ "operationId": "list_scheduled_action_history",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "ID of the scheduled action",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ActionExecutionRecord"
+ }
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "ActionExecutionRecord": {
+ "type": "object",
+ "required": [
+ "action_id",
+ "start_time",
+ "end_time",
+ "is_success",
+ "result",
+ "created_at"
+ ],
+ "properties": {
+ "action_id": {
+ "type": "string",
+ "format": "uuid"
+ },
+ "created_at": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "end_time": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "id": {
+ "type": ["string", "null"],
+ "format": "uuid"
+ },
+ "is_success": {
+ "type": "boolean"
+ },
+ "resource_id": {
+ "type": ["string", "null"],
+ "description": "ID of the primary resource produced by this run (e.g. a chat thread).\nOpaque to the scheduler; the UI interprets it based on the action kind."
+ },
+ "result": {
+ "type": "object"
+ },
+ "start_time": {
+ "type": "string",
+ "format": "date-time"
+ }
+ }
+ },
+ "ActionKind": {
+ "type": "string",
+ "enum": ["Agent"]
+ },
+ "AgentTask": {
+ "type": "object",
+ "required": ["model", "prompt", "user_prompt"],
+ "properties": {
+ "model": {
+ "$ref": "#/components/schemas/Model"
+ },
+ "prompt": {
+ "type": "string"
+ },
+ "user_prompt": {
+ "type": "string"
+ }
+ }
+ },
+ "CreateScheduledAction": {
+ "type": "object",
+ "description": "Client-supplied payload for creating a scheduled action. The server fills\nin `id`, `owner` (from the authenticated user), timestamps, `claimed`, and\n`next_run_at` (derived from the cron).",
+ "required": ["name", "schedule", "kind", "timezone", "task", "enabled"],
+ "properties": {
+ "enabled": {
+ "type": "boolean"
+ },
+ "kind": {
+ "$ref": "#/components/schemas/ActionKind"
+ },
+ "name": {
+ "type": "string"
+ },
+ "schedule": {
+ "$ref": "#/components/schemas/Schedule"
+ },
+ "task": {
+ "type": "object"
+ },
+ "timezone": {
+ "type": "string"
+ }
+ }
+ },
+ "EmptyResponse": {
+ "type": "object",
+ "description": "Empty response is required due to custom fetch forcing `response.json()`"
+ },
+ "InProgressExecution": {
+ "type": "object",
+ "required": ["action_id"],
+ "properties": {
+ "action_id": {
+ "type": "string",
+ "format": "uuid"
+ },
+ "chat_id": {
+ "type": ["string", "null"]
+ }
+ }
+ },
+ "Model": {
+ "type": "string",
+ "enum": [
+ "gemini-2.5-pro",
+ "gemini-2.0-flash-001",
+ "gemini-2.0-flash-lite-001",
+ "gemini-pro-1.5",
+ "gpt-5",
+ "gpt-4.1",
+ "gpt-4o",
+ "gpt-4o-mini",
+ "o1",
+ "gpt-4o-search-preview",
+ "o3",
+ "claude-3-5-sonnet",
+ "claude-3-7-sonnet",
+ "claude-sonnet-4",
+ "claude-sonnet-4-5",
+ "claude-sonnet-4-6",
+ "claude-haiku-4-5",
+ "claude-opus-4-5",
+ "claude-opus-4-6"
+ ]
+ },
+ "Schedule": {
+ "type": "string"
+ },
+ "ScheduledAction": {
+ "type": "object",
+ "required": [
+ "owner",
+ "name",
+ "schedule",
+ "kind",
+ "created_at",
+ "updated_at",
+ "timezone",
+ "task",
+ "next_run_at",
+ "enabled"
+ ],
+ "properties": {
+ "claimed": {
+ "type": ["string", "null"],
+ "format": "date-time"
+ },
+ "created_at": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "enabled": {
+ "type": "boolean",
+ "description": "When false, the cron dispatcher skips this schedule. `run_now` remains\navailable regardless."
+ },
+ "id": {
+ "type": ["string", "null"],
+ "format": "uuid"
+ },
+ "kind": {
+ "$ref": "#/components/schemas/ActionKind"
+ },
+ "name": {
+ "type": "string"
+ },
+ "next_run_at": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Time of the next scheduled firing (derived from the cron on write). UI\nuses this to render \"next run\" without having to parse the cron itself."
+ },
+ "owner": {
+ "type": "string"
+ },
+ "schedule": {
+ "$ref": "#/components/schemas/Schedule"
+ },
+ "task": {
+ "type": "object"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "updated_at": {
+ "type": "string",
+ "format": "date-time"
+ }
+ }
+ },
+ "ScheduledActionUpdate": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": ["owner", "action_id", "chat_id", "type"],
+ "properties": {
+ "action_id": {
+ "type": "string",
+ "format": "uuid"
+ },
+ "chat_id": {
+ "type": "string"
+ },
+ "owner": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "enum": ["started"]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": ["owner", "action_id", "chat_id", "is_success", "type"],
+ "properties": {
+ "action_id": {
+ "type": "string",
+ "format": "uuid"
+ },
+ "chat_id": {
+ "type": "string"
+ },
+ "is_success": {
+ "type": "boolean"
+ },
+ "owner": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "enum": ["stopped"]
+ }
+ }
+ }
+ ],
+ "description": "Live status update for a scheduled-action run, broadcast via the connection\ngateway to the owner. Clients use the `chat_id` to navigate to the run\ntranscript and the variant tag to toggle the running indicator.\n\nSerialized with a `type` tag (`started`/`stopped`) and delivered over the\nsingle `scheduled_action_update` message type on the gateway."
+ },
+ "UpdateScheduledAction": {
+ "type": "object",
+ "description": "Client-supplied payload for updating a scheduled action. Mirrors the fields\nthe repository actually writes — `id`/`owner`/timestamps/`claimed`/\n`next_run_at` are not client-mutable.",
+ "required": ["name", "schedule", "kind", "timezone", "task", "enabled"],
+ "properties": {
+ "enabled": {
+ "type": "boolean"
+ },
+ "kind": {
+ "$ref": "#/components/schemas/ActionKind"
+ },
+ "name": {
+ "type": "string"
+ },
+ "schedule": {
+ "$ref": "#/components/schemas/Schedule"
+ },
+ "task": {
+ "type": "object"
+ },
+ "timezone": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "tags": [
+ {
+ "name": "scheduled actions",
+ "description": "Scheduled action service"
+ }
+ ]
+}
diff --git a/js/app/packages/service-clients/service-storage/client.ts b/js/app/packages/service-clients/service-storage/client.ts
index 4d36206302..f03ff65ff9 100644
--- a/js/app/packages/service-clients/service-storage/client.ts
+++ b/js/app/packages/service-clients/service-storage/client.ts
@@ -126,7 +126,8 @@ export type ItemType =
| CloudStorageItemType
| 'channel'
| 'email'
- | 'channel_message';
+ | 'channel_message'
+ | 'automation';
export const DEFAULT_ITEM_TYPE: ItemType = 'document';
@@ -155,6 +156,8 @@ export function blockNameToItemType(
return 'project';
case 'email':
return 'email';
+ case 'automation':
+ return 'automation';
default:
return DEFAULT_ITEM_TYPE;
}
diff --git a/js/app/scripts/generate-api-schema.ts b/js/app/scripts/generate-api-schema.ts
index d61fe2338d..b5804d2280 100644
--- a/js/app/scripts/generate-api-schema.ts
+++ b/js/app/scripts/generate-api-schema.ts
@@ -27,6 +27,7 @@ const serviceToCrate: Record<string, string> = {
"unfurl-service": "unfurl_service",
"email-service": "email_service",
"search-service": "search_service",
+ "scheduled-action": "scheduled_action",
};
const getRustCloudStorageDir = () =>
@@ -283,7 +284,7 @@ async function main() {
);
console.error("The following files have changed:");
if (diff.trim()) console.error(diff);
- if (untrackedFiles.trim()) console.error("Untracked:\n" + untrackedFiles);
+ if (untrackedFiles.trim()) console.error(`Untracked:\n${untrackedFiles}`);
const gitStatus = await $`git status`.text();
console.error("`git status` output:");
console.error(gitStatus.trim());
diff --git a/js/app/scripts/services.ts b/js/app/scripts/services.ts
index c5065a469d..6759e6e4ad 100644
--- a/js/app/scripts/services.ts
+++ b/js/app/scripts/services.ts
@@ -1,129 +1,137 @@
export type Service = {
- name: string;
- dev: string;
- prod: string;
- local: string;
- output: string;
- orvalKey: string;
+ name: string;
+ dev: string;
+ prod: string;
+ local: string;
+ output: string;
+ orvalKey: string;
};
export const services: Service[] = [
- {
- name: "cloud-storage",
- dev: "https://cloud-storage-dev.macro.com/api-doc/openapi.json",
- prod: "https://cloud-storage.macro.com/api-doc/openapi.json",
- local: "http://localhost:8086/api-doc/openapi.json",
- output: "../packages/service-clients/service-storage/",
- orvalKey: "storageService",
- },
- {
- name: "comms-service",
- dev: "https://cloud-storage-dev.macro.com/comms/api-doc/openapi.json",
- prod: "https://cloud-storage.macro.com/comms/api-doc/openapi.json",
- local: "http://localhost:8086/comms/api-doc/openapi.json",
- output: "../packages/service-clients/service-comms/",
- orvalKey: "commsService",
- },
- {
- name: "properties-service",
- dev: "https://cloud-storage-dev.macro.com/properties/api-doc/openapi.json",
- prod: "https://cloud-storage.macro.com/properties/api-doc/openapi.json",
- local: "http://localhost:8086/properties/api-doc/openapi.json",
- output: "../packages/service-clients/service-properties/",
- orvalKey: "propertiesService",
- },
- {
- name: "document-cognition",
- dev: "https://document-cognition-dev.macro.com/api-doc/openapi.json",
- prod: "https://document-cognition-dev.macro.com/api-doc/openapi.json",
- local: "http://localhost:8085/api-doc/openapi.json",
- output: "../packages/service-clients/service-cognition/",
- orvalKey: "cognitionService",
- },
- {
- name: "auth-service",
- dev: "https://auth-service-dev.macro.com/api-doc/openapi.json",
- prod: "https://auth-service.macro.com/api-doc/openapi.json",
- local: "http://localhost:8080/api-doc/openapi.json",
- output: "../packages/service-clients/service-auth/",
- orvalKey: "authService",
- },
- {
- name: "notification-service",
- dev: "https://notifications-dev.macro.com/api-doc/openapi.json",
- prod: "https://notifications.macro.com/api-doc/openapi.json",
- local: "http://localhost:8089/api-doc/openapi.json",
- output: "../packages/service-clients/service-notification/",
- orvalKey: "notificationService",
- },
- {
- name: "static-files",
- dev: "https://static-file-service-dev.macro.com/api/api-doc/openapi.json",
- prod: "https://static-file-service.macro.com/api/api-doc/openapi.json",
- local: "http://localhost:8094/api/api-doc/openapi.json",
- output: "../packages/service-clients/service-static-files/",
- orvalKey: "staticFileService",
- },
- {
- name: "connection-gateway",
- dev: "https://connection-gateway-dev.macro.com/api-doc/openapi.json",
- prod: "https://connection-gateway-service.macro.com/api-doc/openapi.json",
- local: "http://localhost:8082/api-doc/openapi.json",
- output: "../packages/service-clients/service-connection/",
- orvalKey: "connectionGateway",
- },
- {
- name: "contacts-service",
- dev: "https://contacts-dev.macro.com/api-doc/openapi.json",
- prod: "https://contacts.macro.com/api-doc/openapi.json",
- local: "http://localhost:8083/api-doc/openapi.json",
- output: "../packages/service-clients/service-contacts/",
- orvalKey: "contactService",
- },
- {
- name: "unfurl-service",
- dev: "https://unfurl-service-dev.macro.com/api-doc/openapi.json",
- prod: "https://unfurl-service.macro.com/api-doc/openapi.json",
- local: "http://localhost:8095/api-doc/openapi.json",
- output: "../packages/service-clients/service-unfurl/",
- orvalKey: "unfurlService",
- },
- {
- name: "email-service",
- dev: "https://email-service-dev.macro.com/api-doc/openapi.json",
- prod: "https://email-service.macro.com/api-doc/openapi.json",
- local: "http://localhost:8087/api-doc/openapi.json",
- output: "../packages/service-clients/service-email/",
- orvalKey: "emailService",
- },
- {
- name: "search-service",
- dev: "https://search-service-dev.macro.com/api-doc/openapi.json",
- prod: "https://search-service.macro.com/api-doc/openapi.json",
- local: "http://localhost:8093/api-doc/openapi.json",
- output: "../packages/service-clients/service-search/",
- orvalKey: "searchService",
- },
+ {
+ name: "cloud-storage",
+ dev: "https://cloud-storage-dev.macro.com/api-doc/openapi.json",
+ prod: "https://cloud-storage.macro.com/api-doc/openapi.json",
+ local: "http://localhost:8086/api-doc/openapi.json",
+ output: "../packages/service-clients/service-storage/",
+ orvalKey: "storageService",
+ },
+ {
+ name: "comms-service",
+ dev: "https://cloud-storage-dev.macro.com/comms/api-doc/openapi.json",
+ prod: "https://cloud-storage.macro.com/comms/api-doc/openapi.json",
+ local: "http://localhost:8086/comms/api-doc/openapi.json",
+ output: "../packages/service-clients/service-comms/",
+ orvalKey: "commsService",
+ },
+ {
+ name: "properties-service",
+ dev: "https://cloud-storage-dev.macro.com/properties/api-doc/openapi.json",
+ prod: "https://cloud-storage.macro.com/properties/api-doc/openapi.json",
+ local: "http://localhost:8086/properties/api-doc/openapi.json",
+ output: "../packages/service-clients/service-properties/",
+ orvalKey: "propertiesService",
+ },
+ {
+ name: "document-cognition",
+ dev: "https://document-cognition-dev.macro.com/api-doc/openapi.json",
+ prod: "https://document-cognition-dev.macro.com/api-doc/openapi.json",
+ local: "http://localhost:8085/api-doc/openapi.json",
+ output: "../packages/service-clients/service-cognition/",
+ orvalKey: "cognitionService",
+ },
+ {
+ name: "auth-service",
+ dev: "https://auth-service-dev.macro.com/api-doc/openapi.json",
+ prod: "https://auth-service.macro.com/api-doc/openapi.json",
+ local: "http://localhost:8080/api-doc/openapi.json",
+ output: "../packages/service-clients/service-auth/",
+ orvalKey: "authService",
+ },
+ {
+ name: "notification-service",
+ dev: "https://notifications-dev.macro.com/api-doc/openapi.json",
+ prod: "https://notifications.macro.com/api-doc/openapi.json",
+ local: "http://localhost:8089/api-doc/openapi.json",
+ output: "../packages/service-clients/service-notification/",
+ orvalKey: "notificationService",
+ },
+ {
+ name: "static-files",
+ dev: "https://static-file-service-dev.macro.com/api/api-doc/openapi.json",
+ prod: "https://static-file-service.macro.com/api/api-doc/openapi.json",
+ local: "http://localhost:8094/api/api-doc/openapi.json",
+ output: "../packages/service-clients/service-static-files/",
+ orvalKey: "staticFileService",
+ },
+ {
+ name: "connection-gateway",
+ dev: "https://connection-gateway-dev.macro.com/api-doc/openapi.json",
+ prod: "https://connection-gateway-service.macro.com/api-doc/openapi.json",
+ local: "http://localhost:8082/api-doc/openapi.json",
+ output: "../packages/service-clients/service-connection/",
+ orvalKey: "connectionGateway",
+ },
+ {
+ name: "contacts-service",
+ dev: "https://contacts-dev.macro.com/api-doc/openapi.json",
+ prod: "https://contacts.macro.com/api-doc/openapi.json",
+ local: "http://localhost:8083/api-doc/openapi.json",
+ output: "../packages/service-clients/service-contacts/",
+ orvalKey: "contactService",
+ },
+ {
+ name: "unfurl-service",
+ dev: "https://unfurl-service-dev.macro.com/api-doc/openapi.json",
+ prod: "https://unfurl-service.macro.com/api-doc/openapi.json",
+ local: "http://localhost:8095/api-doc/openapi.json",
+ output: "../packages/service-clients/service-unfurl/",
+ orvalKey: "unfurlService",
+ },
+ {
+ name: "email-service",
+ dev: "https://email-service-dev.macro.com/api-doc/openapi.json",
+ prod: "https://email-service.macro.com/api-doc/openapi.json",
+ local: "http://localhost:8087/api-doc/openapi.json",
+ output: "../packages/service-clients/service-email/",
+ orvalKey: "emailService",
+ },
+ {
+ name: "search-service",
+ dev: "https://search-service-dev.macro.com/api-doc/openapi.json",
+ prod: "https://search-service.macro.com/api-doc/openapi.json",
+ local: "http://localhost:8093/api-doc/openapi.json",
+ output: "../packages/service-clients/service-search/",
+ orvalKey: "searchService",
+ },
+ {
+ name: "scheduled-action",
+ dev: "https://scheduled-action-dev.macro.com/api-doc/openapi.json",
+ prod: "https://scheduled-action.macro.com/api-doc/openapi.json",
+ local: "http://localhost:8099/api-doc/openapi.json",
+ output: "../packages/service-clients/service-scheduled-action/",
+ orvalKey: "scheduledActionService",
+ },
];
export const documentCognitionBase: Service = {
- name: "document-cognition",
- dev: "https://document-cognition-dev.macro.com",
- prod: "https://document-cognition.macro.com",
- local: "http://localhost:8085",
- output: "../packages/service-clients/service-cognition/",
- orvalKey: "cognitionService",
+ name: "document-cognition",
+ dev: "https://document-cognition-dev.macro.com",
+ prod: "https://document-cognition.macro.com",
+ local: "http://localhost:8085",
+ output: "../packages/service-clients/service-cognition/",
+ orvalKey: "cognitionService",
};
export function serviceUrl(service: Service): string {
- const isProd = process.env.MODE === "production";
- const isLocal =
- process.env.MODE === "local" || process.env.LOCAL_BACKEND === "true";
- const schemaUrl = isLocal
- ? service.local
- : isProd
- ? service.prod
- : service.dev;
- console.log(`resolved schema: ${schemaUrl}`)
- return schemaUrl;
+ const isProd = process.env.MODE === "production";
+ const isLocal =
+ process.env.MODE === "local" || process.env.LOCAL_BACKEND === "true";
+ const schemaUrl = isLocal
+ ? service.local
+ : isProd
+ ? service.prod
+ : service.dev;
+ console.log(`resolved schema: ${schemaUrl}`);
+ return schemaUrl;
}
diff --git a/js/app/tsconfig.json b/js/app/tsconfig.json
index 6c6695d132..4473e1ba47 100644
--- a/js/app/tsconfig.json
+++ b/js/app/tsconfig.json
@@ -108,6 +108,9 @@
"@service-unfurl/*": [
"./packages/service-clients/service-unfurl/*"
],
+ "@service-scheduled-action/*": [
+ "./packages/service-clients/service-scheduled-action/*"
+ ],
"@service-email/*": [
"./packages/service-clients/service-email/*"
],
@@ -129,6 +132,9 @@
"@block-channel/*": [
"./packages/block-channel/*"
],
+ "@block-automation/*": [
+ "./packages/block-automation/*"
+ ],
"@channel/*": [
"./packages/channel/*"
],