@michengai/dsh-automation 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +9 -0
  3. package/README.md +136 -0
  4. package/README.zh-CN.md +136 -0
  5. package/cordis.patch.yml +9 -0
  6. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/00-/351/230/205/350/257/273/345/257/274/350/210/252.md +11 -0
  7. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/01-/351/241/271/347/233/256/346/246/202/350/247/210.md +22 -0
  8. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/02-/345/275/223/345/211/215/347/212/266/346/200/201.md +9 -0
  9. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/03-/345/276/205/345/212/236/344/270/216/351/230/273/345/241/236.md +7 -0
  10. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/04-/350/277/255/344/273/243/350/267/257/347/272/277/345/233/276.md +5 -0
  11. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/05-/346/212/200/346/234/257/346/236/266/346/236/204/345/237/272/347/272/277.md +10 -0
  12. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/06-/346/226/207/346/241/243/347/274/226/345/206/231/350/247/204/350/214/203.md +8 -0
  13. package/docs/01-/345/275/223/345/211/215/345/267/245/344/275/234/I001-/344/273/273/345/212/241/350/207/252/345/212/250/345/214/226/346/217/222/344/273/266/00-/350/277/255/344/273/243/346/200/273/350/247/210.md +47 -0
  14. package/docs/03-/346/212/200/346/234/257/346/236/266/346/236/204/00-/351/242/206/345/237/237/347/264/242/345/274/225.md +5 -0
  15. package/docs/03-/346/212/200/346/234/257/346/236/266/346/236/204/01-/350/260/203/345/272/246/344/270/216/346/211/247/350/241/214/346/250/241/345/236/213.md +30 -0
  16. package/lib/client.js +2792 -0
  17. package/lib/client.js.map +7 -0
  18. package/lib/index.js +22869 -0
  19. package/lib/types/client/AutomationView.d.ts +2 -0
  20. package/lib/types/client/ScheduleRail.d.ts +34 -0
  21. package/lib/types/client/contracts.d.ts +57 -0
  22. package/lib/types/client/create-modal.d.ts +30 -0
  23. package/lib/types/client/helpers.d.ts +67 -0
  24. package/lib/types/client/icons.d.ts +28 -0
  25. package/lib/types/client/index.d.ts +4 -0
  26. package/lib/types/client/locales.d.ts +187 -0
  27. package/lib/types/client/menu.d.ts +53 -0
  28. package/lib/types/client/native-session-list.d.ts +14 -0
  29. package/lib/types/client/native-tabs.d.ts +23 -0
  30. package/lib/types/client/prefill.d.ts +6 -0
  31. package/lib/types/client/protocol.d.ts +153 -0
  32. package/lib/types/client/runtime.d.ts +29 -0
  33. package/lib/types/client/schedule-rail-model.d.ts +87 -0
  34. package/lib/types/client/styles.d.ts +1 -0
  35. package/lib/types/domain.d.ts +67 -0
  36. package/lib/types/executor.d.ts +30 -0
  37. package/lib/types/index.d.ts +20 -0
  38. package/lib/types/recurrence.d.ts +7 -0
  39. package/lib/types/rpc.d.ts +13 -0
  40. package/lib/types/run-title.d.ts +3 -0
  41. package/lib/types/service.d.ts +110 -0
  42. package/lib/types/tools.d.ts +12 -0
  43. package/lib/types/types.d.ts +146 -0
  44. package/package.json +99 -0
@@ -0,0 +1,2 @@
1
+ import type { AutomationViewProps } from './contracts.js';
2
+ export declare function AutomationView({ t, runtime, closeSettings }: AutomationViewProps): JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { type ComponentType, type ReactNode } from 'react';
2
+ import type { Translate } from './contracts.js';
3
+ import type { AutomationRuntime } from './runtime.js';
4
+ import { type NativeSessionLike, type NativeWorkspaceLike } from './schedule-rail-model.js';
5
+ import type { NativeTabRegistry } from './native-tabs.js';
6
+ type SessionSelector = <S>(select: (state: {
7
+ ids?: string[];
8
+ byId?: Record<string, NativeSessionLike>;
9
+ current?: string | null;
10
+ }) => S) => S;
11
+ type WorkspaceSelector = <S>(select: (state: {
12
+ items?: NativeWorkspaceLike[];
13
+ archivedSessionIds?: string[];
14
+ }) => S) => S;
15
+ export declare function ScheduleRail({ t, runtime, openSession, }: {
16
+ readonly t: Translate;
17
+ readonly runtime: AutomationRuntime;
18
+ readonly openSession?: (sessionId: string) => void;
19
+ }): JSX.Element;
20
+ export declare function NativeScheduleShell({ t, runtime, officialTree, hostProps, openSession, useSessions, useWorkspaces, renderSlot, hasChannels, subscribeChannels, tabRegistry, wide, }: {
21
+ readonly t: Translate;
22
+ readonly runtime: AutomationRuntime;
23
+ readonly officialTree?: ComponentType<any>;
24
+ readonly hostProps?: Record<string, unknown>;
25
+ readonly openSession?: (sessionId: string) => void;
26
+ readonly useSessions?: SessionSelector;
27
+ readonly useWorkspaces?: WorkspaceSelector;
28
+ readonly renderSlot?: (name: string, props?: Record<string, unknown>) => ReactNode;
29
+ readonly hasChannels?: () => boolean;
30
+ readonly subscribeChannels?: (listener: () => void) => () => void;
31
+ readonly tabRegistry?: NativeTabRegistry;
32
+ readonly wide?: boolean;
33
+ }): JSX.Element | null;
34
+ export {};
@@ -0,0 +1,57 @@
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import type { AutomationLocaleKey } from './locales.js';
3
+ import type { AutomationRuntime } from './runtime.js';
4
+ export type Translate = (key: AutomationLocaleKey, params?: Record<string, unknown>) => string;
5
+ export interface AutomationViewProps {
6
+ readonly t: Translate;
7
+ readonly runtime: AutomationRuntime;
8
+ readonly closeSettings?: () => void;
9
+ }
10
+ export interface ClientRpc {
11
+ call(channel: string, endpoint: string, payload: unknown, signal?: AbortSignal): Promise<unknown>;
12
+ }
13
+ export interface SlotRegisterOptions {
14
+ readonly name: string;
15
+ readonly id?: string;
16
+ readonly order?: number;
17
+ readonly locale?: string;
18
+ readonly label?: () => string;
19
+ readonly icon?: string;
20
+ readonly priority?: number;
21
+ readonly children?: Record<string, {
22
+ readonly kind: string;
23
+ readonly scope: string;
24
+ }>;
25
+ readonly inject?: () => Record<string, unknown>;
26
+ }
27
+ export interface ClientContext {
28
+ effect(factory: () => void | (() => void), label?: string): void;
29
+ connection: {
30
+ readonly rpc: ClientRpc;
31
+ };
32
+ sessions?: {
33
+ open(id: string): void;
34
+ };
35
+ locale: {
36
+ register(namespace: string, dictionaries: {
37
+ readonly zh: Record<string, string>;
38
+ readonly en: Record<string, string>;
39
+ }): () => void;
40
+ bind(namespace: string): Translate;
41
+ };
42
+ slots: {
43
+ inject(name: string, register: () => void | (() => void)): void;
44
+ register(options: SlotRegisterOptions, component: ComponentType<any>): () => void;
45
+ entries?(name: string): readonly unknown[];
46
+ entriesOfSlot?(name: string): readonly unknown[];
47
+ subscribe?(name: string, listener: () => void): () => void;
48
+ };
49
+ }
50
+ export interface NativeSwitcherProps {
51
+ readonly wide?: boolean;
52
+ readonly openSession?: (sessionId: string) => void;
53
+ readonly open?: (sessionId: string) => void;
54
+ readonly useSessions?: (select: (state: any) => any) => any;
55
+ readonly useWorkspaces?: (select: (state: any) => any) => any;
56
+ readonly renderSlot?: (name: string, props?: Record<string, unknown>) => ReactNode;
57
+ }
@@ -0,0 +1,30 @@
1
+ import type { Translate } from './contracts.js';
2
+ import { type AutomationFormState } from './helpers.js';
3
+ export declare function CreateModal({ t, busy, workspaces, models, defaultModel, skills, draft, editing, onClose, onSubmit, onAddWorkspace, }: {
4
+ readonly t: Translate;
5
+ readonly busy: boolean;
6
+ readonly workspaces: readonly {
7
+ id: string;
8
+ title: string;
9
+ path: string;
10
+ }[];
11
+ readonly models: readonly {
12
+ provider: string;
13
+ model: string;
14
+ label: string;
15
+ }[];
16
+ readonly defaultModel: {
17
+ provider: string;
18
+ model: string;
19
+ label: string;
20
+ } | null;
21
+ readonly skills: readonly {
22
+ id: string;
23
+ name: string;
24
+ }[];
25
+ readonly draft?: Partial<AutomationFormState>;
26
+ readonly editing?: boolean;
27
+ readonly onClose: () => void;
28
+ readonly onSubmit: (form: AutomationFormState) => Promise<void>;
29
+ readonly onAddWorkspace?: (path: string) => Promise<string>;
30
+ }): JSX.Element;
@@ -0,0 +1,67 @@
1
+ import type { Translate } from './contracts.js';
2
+ import type { AutomationSchedule, AutomationSnapshot, CreateAutomationInput, ModelOption, WorkspaceOption } from './protocol.js';
3
+ export type ScheduleKind = 'once' | 'interval' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'custom';
4
+ export interface AutomationFormState {
5
+ readonly name: string;
6
+ readonly prompt: string;
7
+ readonly scheduleKind: ScheduleKind;
8
+ readonly onceAt: string;
9
+ readonly everyMinutes: string;
10
+ readonly time: string;
11
+ readonly weekdays: readonly number[];
12
+ readonly hourlyMinute: string;
13
+ readonly monthDay: string;
14
+ readonly customDays: string;
15
+ readonly timeZone: string;
16
+ readonly permission: CreateAutomationInput['permission'];
17
+ readonly workspaceId: string;
18
+ readonly modelKey: string;
19
+ readonly reasoningEffort: string;
20
+ readonly skills: readonly string[];
21
+ }
22
+ export type FormErrorKey = 'form.error.name' | 'form.error.prompt' | 'form.error.once' | 'form.error.interval' | 'form.error.weekdays' | 'form.error.workspace';
23
+ export declare class AutomationFormError extends Error {
24
+ readonly key: FormErrorKey;
25
+ constructor(key: FormErrorKey);
26
+ }
27
+ /** Chat 点选技能后写入输入框的 `/name` 文本。优先用合法技能名,否则回退到目录 id。 */
28
+ export declare function skillGestureToken(skill: {
29
+ readonly id: string;
30
+ readonly name: string;
31
+ }): string;
32
+ /** 在光标处插入技能手势;已存在相同 token 时不重复插入。 */
33
+ export declare function insertSkillGesture(prompt: string, token: string, caret: number): {
34
+ readonly text: string;
35
+ readonly caret: number;
36
+ };
37
+ export declare function localDateTimeValue(date?: Date): string;
38
+ export declare function defaultFormState(now?: Date, workspaces?: readonly WorkspaceOption[], defaultModel?: ModelOption | null): AutomationFormState;
39
+ export declare function buildCreateInput(form: AutomationFormState, workspaces: readonly WorkspaceOption[], models: readonly ModelOption[], now?: Date, options?: {
40
+ readonly allowPastOnce?: boolean;
41
+ }): CreateAutomationInput;
42
+ export interface OverviewStats {
43
+ readonly total: number;
44
+ readonly active: number;
45
+ readonly attention: number;
46
+ readonly nextRunAt?: string;
47
+ }
48
+ export declare function deriveOverview(snapshot: AutomationSnapshot): OverviewStats;
49
+ export declare function formatRelativeTime(iso: string, now: Date, t: Translate): string;
50
+ export declare function shortSessionId(sessionId: string): string;
51
+ export declare function formatSchedule(schedule: AutomationSchedule, t: Translate): string;
52
+ export declare function workspaceLabel(item: {
53
+ readonly workspaceId?: string;
54
+ readonly cwd?: string;
55
+ }, workspaces: readonly WorkspaceOption[]): string;
56
+ export declare function formatWithin(iso: string, now: Date, t: Translate): string;
57
+ export declare function formatDuration(startedAt?: string, finishedAt?: string): string | undefined;
58
+ export declare function clockTime(iso: string): string;
59
+ export type HistoryRange = 'day' | 'week' | 'month';
60
+ export interface HistoryGroup {
61
+ readonly key: string;
62
+ readonly label: string;
63
+ readonly items: readonly import('./protocol.js').AutomationRunViewModel[];
64
+ }
65
+ export declare function groupHistory(runs: readonly import('./protocol.js').AutomationRunViewModel[], range: HistoryRange, now: Date, t: Translate): HistoryGroup[];
66
+ export declare function formFromAutomation(item: import('./protocol.js').AutomationViewModel, workspaces?: readonly WorkspaceOption[], defaultModel?: ModelOption | null): AutomationFormState;
67
+ export declare function prettyModelName(model: string): string;
@@ -0,0 +1,28 @@
1
+ import type { SVGProps } from 'react';
2
+ type IconProps = SVGProps<SVGSVGElement>;
3
+ export declare function AutomationIcon(props: IconProps): JSX.Element;
4
+ export declare function PlusIcon(props: IconProps): JSX.Element;
5
+ export declare function RefreshIcon(props: IconProps): JSX.Element;
6
+ export declare function PlayIcon(props: IconProps): JSX.Element;
7
+ export declare function PauseIcon(props: IconProps): JSX.Element;
8
+ export declare function TrashIcon(props: IconProps): JSX.Element;
9
+ export declare function ShieldIcon(props: IconProps): JSX.Element;
10
+ export declare function CalendarIcon(props: IconProps): JSX.Element;
11
+ export declare function CheckIcon(props: IconProps): JSX.Element;
12
+ export declare function AlertIcon(props: IconProps): JSX.Element;
13
+ export declare function MoreIcon(props: IconProps): JSX.Element;
14
+ export declare function InfoIcon(props: IconProps): JSX.Element;
15
+ export declare function ClockIcon(props: IconProps): JSX.Element;
16
+ export declare function ChatIcon(props: IconProps): JSX.Element;
17
+ export declare function FolderIcon(props: IconProps): JSX.Element;
18
+ export declare function SparkleIcon(props: IconProps): JSX.Element;
19
+ export declare function FolderClosedIcon(props: IconProps): JSX.Element;
20
+ export declare function FolderOpenIcon(props: IconProps): JSX.Element;
21
+ export declare function ChevronIcon(props: IconProps): JSX.Element;
22
+ export declare function EllipsisIcon(props: IconProps): JSX.Element;
23
+ export declare function PencilIcon(props: IconProps): JSX.Element;
24
+ export declare function BranchIcon(props: IconProps): JSX.Element;
25
+ export declare function ArchiveIcon(props: IconProps): JSX.Element;
26
+ /** 复刻官方任务树 running StateDot:3x3 像素绕圈。 */
27
+ export declare function RunningStateDot(): JSX.Element;
28
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ClientContext } from './contracts.js';
2
+ export declare const name = "dsh-automation-client";
3
+ export declare const inject: string[];
4
+ export declare function apply(ctx: ClientContext): void;
@@ -0,0 +1,187 @@
1
+ export declare const NS = "dsh-automation";
2
+ export declare const en: {
3
+ readonly tab: "Scheduled tasks";
4
+ readonly 'sidebar.tab': "Scheduled";
5
+ readonly 'sidebar.tabs': "Workspace views";
6
+ readonly 'sidebar.tasksTab': "Tasks";
7
+ readonly 'sidebar.channelsTab': "Channels";
8
+ readonly 'sidebar.empty': "No scheduled runs yet.";
9
+ readonly 'sidebar.tasksEmpty': "No web tasks yet.";
10
+ readonly 'sidebar.ungrouped': "Ungrouped";
11
+ readonly 'sidebar.section': "Scheduled";
12
+ readonly 'header.lead': "Plan automatic tasks, or trigger them by hand. Describe the recurring work in any chat to create it quickly.";
13
+ readonly 'examples.title': "Recommended examples";
14
+ readonly 'examples.1.title': "Daily regression check";
15
+ readonly 'examples.1.body': "Create a scheduled task that runs every day and inspects new test failures.";
16
+ readonly 'examples.1.chip': "Every day 09:00";
17
+ readonly 'examples.2.title': "Weekly dependency review";
18
+ readonly 'examples.2.body': "Create a scheduled task that runs every Monday and reports outdated or risky dependencies.";
19
+ readonly 'examples.2.chip': "Monday 10:00";
20
+ readonly 'examples.3.title': "Weekday morning briefing";
21
+ readonly 'examples.3.body': "Create a scheduled task that runs on weekdays and summarizes overnight changes.";
22
+ readonly 'examples.3.chip': "Weekdays 08:00";
23
+ readonly 'chat.hint': "In any conversation, describe the recurring work and ask the Agent to call automation_create.";
24
+ readonly 'chat.prompt': "I want to create a scheduled task that runs every [interval] and does [the actual task]";
25
+ readonly 'menu.run': "Run now";
26
+ readonly 'menu.delete': "Delete task";
27
+ readonly 'session.rename': "Rename";
28
+ readonly 'session.fork': "Fork session";
29
+ readonly 'session.archive': "Archive session";
30
+ readonly 'session.delete': "Delete session";
31
+ readonly 'session.deleteFolder': "Delete folder";
32
+ readonly 'history.range.day': "By day";
33
+ readonly 'history.range.week': "By week";
34
+ readonly 'history.range.month': "By month";
35
+ readonly 'history.allTasks': "All tasks";
36
+ readonly 'history.allStatus': "All statuses";
37
+ readonly 'history.today': "Today";
38
+ readonly 'history.yesterday': "Yesterday";
39
+ readonly 'history.date': "{date}";
40
+ readonly 'history.week': "Week of {date}";
41
+ readonly 'history.month': "{month}";
42
+ readonly 'history.trigger': "Scheduled";
43
+ readonly 'history.nextApprox': "Next run in about {when}";
44
+ readonly 'time.withinMinute': "about {count} minutes";
45
+ readonly 'time.withinHour': "about {count} hours";
46
+ readonly 'time.withinDay': "about {count} days";
47
+ readonly 'search.placeholder': "Search scheduled tasks...";
48
+ readonly 'action.chatCreate': "Create in chat";
49
+ readonly 'action.create': "New scheduled task";
50
+ readonly 'banner.wake': "Scheduled tasks run only while this computer stays awake.";
51
+ readonly 'tabs.mine': "My tasks";
52
+ readonly 'tabs.runs': "Run history";
53
+ readonly 'sort.created': "Newest first";
54
+ readonly 'form.workspace': "Workspace";
55
+ readonly 'form.addWorkspace': "Add workspace...";
56
+ readonly 'form.workspacePath': "Folder path";
57
+ readonly 'form.workspacePathPlaceholder': "D:\\work\\project";
58
+ readonly 'form.model': "Model";
59
+ readonly 'form.modelDefault': "Follow default model";
60
+ readonly 'form.effort': "Reasoning";
61
+ readonly 'form.effort.none': "Default";
62
+ readonly 'form.effort.low': "Low";
63
+ readonly 'form.effort.medium': "Medium";
64
+ readonly 'form.effort.high': "High";
65
+ readonly 'form.error.workspace': "Select a workspace.";
66
+ readonly 'modal.title': "New scheduled task";
67
+ readonly 'modal.edit': "Edit scheduled task";
68
+ readonly 'modal.save': "Save";
69
+ readonly 'header.eyebrow': "Unattended coding work";
70
+ readonly 'header.title': "Automations";
71
+ readonly 'header.subtitle': "Schedule standalone, auditable Agent runs for this workspace.";
72
+ readonly 'header.create': "New automation";
73
+ readonly 'header.closeCreate': "Hide form";
74
+ readonly 'scope.workspace': "Workspace";
75
+ readonly 'scope.folder': "Working directory";
76
+ readonly 'stats.total': "All";
77
+ readonly 'stats.active': "Active";
78
+ readonly 'stats.next': "Next run";
79
+ readonly 'stats.attention': "Needs attention";
80
+ readonly 'stats.noneScheduled': "None scheduled";
81
+ readonly 'stats.noAttention': "All clear";
82
+ readonly 'section.automations': "Workspace automations";
83
+ readonly 'section.automationsHint': "Each trigger starts a fresh DSH Session and keeps its own audit record.";
84
+ readonly 'section.runs': "Recent runs";
85
+ readonly 'section.runsHint': "Latest outcomes for this workspace.";
86
+ readonly 'section.refresh': "Refresh";
87
+ readonly 'empty.title': "Let recurring coding work run itself";
88
+ readonly 'empty.body': "Save a self-contained task, a schedule, and a permission boundary. Every run starts in a new Session.";
89
+ readonly 'empty.action': "Create the first automation";
90
+ readonly 'runs.empty': "No runs yet. Run one now, or wait for the next scheduled occurrence.";
91
+ readonly 'form.title': "Create automation";
92
+ readonly 'form.subtitle': "Write a complete, standalone task. Scheduled runs do not inherit this conversation.";
93
+ readonly 'form.name': "Name";
94
+ readonly 'form.namePlaceholder': "Daily regression triage";
95
+ readonly 'form.prompt': "Task prompt";
96
+ readonly 'form.promptPlaceholder': "Inspect new test failures, locate the regression, and propose a verified minimal fix…";
97
+ readonly 'form.schedule': "Schedule";
98
+ readonly 'form.planTime': "Schedule";
99
+ readonly 'form.hourly': "Hourly";
100
+ readonly 'form.monthly': "Monthly";
101
+ readonly 'form.custom': "Custom";
102
+ readonly 'form.minutesShort': "min";
103
+ readonly 'form.daysShort': "days";
104
+ readonly 'form.monthDay': "Day {day} of month";
105
+ readonly 'form.skills': "Skills";
106
+ readonly 'form.skillsEmpty': "No skills available";
107
+ readonly 'schedule.hourlyAt': "Every hour at :{minute}";
108
+ readonly 'schedule.monthlyAt': "Monthly on day {day} · {time}";
109
+ readonly 'schedule.customAt': "Every {count} days · {time}";
110
+ readonly 'form.once': "Does not repeat";
111
+ readonly 'form.interval': "Interval";
112
+ readonly 'form.daily': "Daily";
113
+ readonly 'form.weekly': "Weekly";
114
+ readonly 'form.runAt': "Run at";
115
+ readonly 'form.every': "Every";
116
+ readonly 'form.minutes': "minutes";
117
+ readonly 'form.time': "Time";
118
+ readonly 'form.days': "Weekdays";
119
+ readonly 'form.timeZone': "Time zone";
120
+ readonly 'form.permission': "Permission boundary";
121
+ readonly 'form.readOnly': "Read Only";
122
+ readonly 'form.readOnlyHint': "Inspect the workspace without changing files.";
123
+ readonly 'form.workspaceWrite': "Workspace Write";
124
+ readonly 'form.fullAccess': "Full access";
125
+ readonly 'form.workspaceWriteHint': "May change files in this workspace; past approvals are not reused.";
126
+ readonly 'form.cancel': "Cancel";
127
+ readonly 'form.submit': "Create automation";
128
+ readonly 'form.submitting': "Creating…";
129
+ readonly 'form.error.name': "Enter a name.";
130
+ readonly 'form.error.prompt': "Enter a complete, standalone task prompt.";
131
+ readonly 'form.error.once': "Choose a valid future date and time.";
132
+ readonly 'form.error.interval': "The interval must be between 5 and 43,200 minutes.";
133
+ readonly 'form.error.weekdays': "Select at least one weekday.";
134
+ readonly 'day.1': "Mon";
135
+ readonly 'day.2': "Tue";
136
+ readonly 'day.3': "Wed";
137
+ readonly 'day.4': "Thu";
138
+ readonly 'day.5': "Fri";
139
+ readonly 'day.6': "Sat";
140
+ readonly 'day.7': "Sun";
141
+ readonly 'status.active': "Active";
142
+ readonly 'status.paused': "Paused";
143
+ readonly 'status.queued': "Queued";
144
+ readonly 'status.running': "Running";
145
+ readonly 'status.succeeded': "Succeeded";
146
+ readonly 'status.failed': "Failed";
147
+ readonly 'status.skipped': "Skipped";
148
+ readonly 'status.cancelled': "Cancelled";
149
+ readonly 'status.interrupted': "Interrupted";
150
+ readonly 'card.nextRun': "Next";
151
+ readonly 'card.lastRun': "Last";
152
+ readonly 'card.never': "Not yet run";
153
+ readonly 'card.permission.read-only': "Read-only";
154
+ readonly 'card.permission.workspace-write': "Workspace write";
155
+ readonly 'card.permission.full-access': "Full access";
156
+ readonly 'schedule.onceAt': "Once · {time}";
157
+ readonly 'schedule.everyMinutes': "Every {count} minutes";
158
+ readonly 'schedule.dailyAt': "Daily · {time}";
159
+ readonly 'schedule.weeklyAt': "{days} · {time}";
160
+ readonly 'card.pause': "Pause";
161
+ readonly 'card.resume': "Resume";
162
+ readonly 'card.runNow': "Run now";
163
+ readonly 'card.delete': "Delete";
164
+ readonly 'card.confirmDelete': "Delete this automation?";
165
+ readonly 'card.confirmDeleteHint': "Run history is kept for audit.";
166
+ readonly 'card.confirm': "Delete";
167
+ readonly 'card.cancel': "Cancel";
168
+ readonly 'run.trigger.schedule': "Scheduled";
169
+ readonly 'run.trigger.manual': "Manual";
170
+ readonly 'run.trigger.catch-up': "Catch-up";
171
+ readonly 'run.openSession': "Session {id}";
172
+ readonly 'run.markRead': "Mark reviewed";
173
+ readonly loading: "Loading automations…";
174
+ readonly 'error.title': "Automations could not be loaded";
175
+ readonly 'error.retry': "Try again";
176
+ readonly 'error.action': "The action failed. Please try again.";
177
+ readonly 'error.offline': "Could not reach the local automation service. Check that DSH is still running and try again.";
178
+ readonly 'time.now': "now";
179
+ readonly 'time.minuteAgo': "{count}m ago";
180
+ readonly 'time.hourAgo': "{count}h ago";
181
+ readonly 'time.dayAgo': "{count}d ago";
182
+ readonly 'time.inMinute': "in {count}m";
183
+ readonly 'time.inHour': "in {count}h";
184
+ readonly 'time.inDay': "in {count}d";
185
+ };
186
+ export type AutomationLocaleKey = keyof typeof en;
187
+ export declare const zh: Record<AutomationLocaleKey, string>;
@@ -0,0 +1,53 @@
1
+ import { type ReactNode, type RefObject } from 'react';
2
+ export interface MenuOption<T extends string> {
3
+ readonly value: T;
4
+ readonly label: string;
5
+ readonly icon?: ReactNode;
6
+ }
7
+ declare function useMenuOpen(): {
8
+ readonly open: boolean;
9
+ readonly setOpen: (value: boolean | ((current: boolean) => boolean)) => void;
10
+ readonly root: React.RefObject<HTMLDivElement>;
11
+ readonly menu: React.RefObject<HTMLDivElement>;
12
+ };
13
+ export declare function MenuPopup({ open, anchor, menuRef, up, end, className, children, onClick, }: {
14
+ readonly open: boolean;
15
+ readonly anchor: RefObject<HTMLElement>;
16
+ readonly menuRef: RefObject<HTMLDivElement>;
17
+ readonly up?: boolean | undefined;
18
+ readonly end?: boolean | undefined;
19
+ readonly className: string;
20
+ readonly children: ReactNode;
21
+ readonly onClick?: () => void;
22
+ }): JSX.Element | null;
23
+ export declare function MenuHostProvider({ host, children, }: {
24
+ readonly host: HTMLElement | null;
25
+ readonly children: ReactNode;
26
+ }): JSX.Element;
27
+ export declare function MenuRow({ icon, label, hint, active, chevron, kv, onClick, }: {
28
+ readonly icon?: ReactNode;
29
+ readonly label: ReactNode;
30
+ readonly hint?: ReactNode;
31
+ readonly active?: boolean;
32
+ readonly chevron?: boolean;
33
+ readonly kv?: boolean;
34
+ readonly onClick: () => void;
35
+ }): JSX.Element;
36
+ export declare function MenuSelect<T extends string>({ value, options, onChange, wide, pill, up, icon, }: {
37
+ readonly value: T;
38
+ readonly options: readonly MenuOption<T>[];
39
+ readonly onChange: (value: T) => void;
40
+ readonly wide?: boolean;
41
+ readonly pill?: boolean;
42
+ readonly up?: boolean;
43
+ readonly icon?: ReactNode;
44
+ }): JSX.Element;
45
+ export declare function MenuPanel({ label, children, ghost, up, persist, }: {
46
+ readonly label: ReactNode;
47
+ readonly children: ReactNode;
48
+ readonly ghost?: boolean;
49
+ readonly up?: boolean;
50
+ readonly persist?: boolean;
51
+ }): JSX.Element;
52
+ export declare function useMenuState(): ReturnType<typeof useMenuOpen>;
53
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { Translate } from './contracts.js';
2
+ import type { AutomationRuntime } from './runtime.js';
3
+ export declare function relativeTime(value: string): string;
4
+ export declare function NativeScheduleSessionList(props: {
5
+ readonly t: Translate;
6
+ readonly runtime: AutomationRuntime;
7
+ readonly openSession?: (sessionId: string) => void;
8
+ readonly useSessions?: (select: (state: any) => any) => any;
9
+ readonly useWorkspaces?: (select: (state: any) => any) => any;
10
+ readonly renameSession?: (sessionId: string, title: string) => void | Promise<void>;
11
+ readonly archiveSession?: (sessionId: string) => void | Promise<void>;
12
+ readonly deleteSession?: (sessionId: string) => void | Promise<void>;
13
+ readonly forkSession?: (sessionId: string) => void | Promise<void>;
14
+ }): JSX.Element;
@@ -0,0 +1,23 @@
1
+ /** 原生侧栏页签协作协议。两套插件各自复制这份约定,不互相 import。 */
2
+ export declare const NATIVE_TABS_KEY = "__dshNativeTabs";
3
+ export interface NativeSidebarTab {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ readonly order?: number;
7
+ matchSession?(sessionId: string): boolean;
8
+ render(props: Record<string, unknown>): unknown;
9
+ }
10
+ export interface NativeTabRegistry {
11
+ readonly version: 1;
12
+ officialTree: unknown;
13
+ readonly sessionFilters: Array<(id: string) => boolean>;
14
+ getTabs(): NativeSidebarTab[];
15
+ subscribe(listener: () => void): () => void;
16
+ insert(tab: NativeSidebarTab): () => void;
17
+ addSessionFilter(filter: (id: string) => boolean): () => void;
18
+ }
19
+ export declare function createNativeTabRegistry(officialTree: unknown): NativeTabRegistry;
20
+ export declare function getNativeTabRegistry(target: unknown): NativeTabRegistry | undefined;
21
+ export declare function attachNativeTabRegistry<T>(target: T, registry: NativeTabRegistry): NativeTabRegistry;
22
+ export declare function findNativeTabRegistry(entry: unknown): NativeTabRegistry | undefined;
23
+ export declare function isForeignSidebarHost(component: unknown): boolean;
@@ -0,0 +1,6 @@
1
+ /** 设置页「通过对话创建」交给会话输入框的待填草稿。 */
2
+ export declare function setChatPrefill(text: string): void;
3
+ export declare function takeChatPrefill(): string | null;
4
+ export declare function peekChatPrefill(): string | null;
5
+ export declare function subscribeChatPrefill(listener: (text: string | null) => void): () => void;
6
+ export declare function applyPrefillToDom(text: string): boolean;