leaf-coding-agent 1.0.1 → 1.0.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"slash-commands.d.ts","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,mBAAmB,CAsBrE,CAAC","sourcesContent":["import { APP_NAME } from \"../config.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for Ctrl+P cycling\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
1
+ {"version":3,"file":"slash-commands.d.ts","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,mBAAmB,CAuBrE,CAAC","sourcesContent":["import { APP_NAME } from \"../config.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for Ctrl+P cycling\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"worker\", description: \"Enable/disable Worker mode for parallel task execution\" },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
@@ -20,6 +20,7 @@ export const BUILTIN_SLASH_COMMANDS = [
20
20
  { name: "compact", description: "Manually compact the session context" },
21
21
  { name: "resume", description: "Resume a different session" },
22
22
  { name: "reload", description: "Reload keybindings, extensions, skills, prompts, and themes" },
23
+ { name: "worker", description: "Enable/disable Worker mode for parallel task execution" },
23
24
  { name: "quit", description: `Quit ${APP_NAME}` },
24
25
  ];
25
26
  //# sourceMappingURL=slash-commands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAiBxC,MAAM,CAAC,MAAM,sBAAsB,GAAuC;IACzE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE;IACvD,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,kCAAkC,EAAE;IAClE,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,0CAA0C,EAAE;IAClF,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8DAA8D,EAAE;IAC/F,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+CAA+C,EAAE;IAChF,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,uCAAuC,EAAE;IACvE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACrE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,0BAA0B,EAAE;IACzD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,6BAA6B,EAAE;IAC/D,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,wBAAwB,EAAE;IAC5D,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,6BAA6B,EAAE;IAC/D,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,gDAAgD,EAAE;IAC/E,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,uDAAuD,EAAE;IACvF,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,yCAAyC,EAAE;IACxE,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,mCAAmC,EAAE;IACnE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gCAAgC,EAAE;IACjE,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE;IACnD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACxE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAC7D,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6DAA6D,EAAE;IAC9F,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,QAAQ,EAAE,EAAE;CACjD,CAAC","sourcesContent":["import { APP_NAME } from \"../config.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for Ctrl+P cycling\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
1
+ {"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAiBxC,MAAM,CAAC,MAAM,sBAAsB,GAAuC;IACzE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE;IACvD,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,kCAAkC,EAAE;IAClE,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,0CAA0C,EAAE;IAClF,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8DAA8D,EAAE;IAC/F,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+CAA+C,EAAE;IAChF,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,uCAAuC,EAAE;IACvE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACrE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,0BAA0B,EAAE;IACzD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,6BAA6B,EAAE;IAC/D,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,wBAAwB,EAAE;IAC5D,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,6BAA6B,EAAE;IAC/D,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,gDAAgD,EAAE;IAC/E,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,uDAAuD,EAAE;IACvF,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,yCAAyC,EAAE;IACxE,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,mCAAmC,EAAE;IACnE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gCAAgC,EAAE;IACjE,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE;IACnD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACxE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAC7D,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6DAA6D,EAAE;IAC9F,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wDAAwD,EAAE;IACzF,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,QAAQ,EAAE,EAAE;CACjD,CAAC","sourcesContent":["import { APP_NAME } from \"../config.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for Ctrl+P cycling\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"worker\", description: \"Enable/disable Worker mode for parallel task execution\" },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
@@ -0,0 +1,19 @@
1
+ import { Container, SettingsList } from "@looze/leaf-tui";
2
+ export interface WorkerConfig {
3
+ enabled: boolean;
4
+ maxWorkers: number;
5
+ communicationMode: "socket" | "message" | "shared";
6
+ }
7
+ export interface WorkerSelectorCallbacks {
8
+ onEnabledChange: (enabled: boolean) => void;
9
+ onMaxWorkersChange: (maxWorkers: number) => void;
10
+ onCommunicationModeChange: (mode: "socket" | "message" | "shared") => void;
11
+ onAbortAll: () => void;
12
+ onCancel: () => void;
13
+ }
14
+ export declare class WorkerSelectorComponent extends Container {
15
+ private settingsList;
16
+ constructor(config: WorkerConfig, callbacks: WorkerSelectorCallbacks);
17
+ getSettingsList(): SettingsList;
18
+ }
19
+ //# sourceMappingURL=worker-selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/worker-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EAET,YAAY,EAGZ,MAAM,iBAAiB,CAAC;AAIzB,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;CACnD;AAED,MAAM,WAAW,uBAAuB;IACvC,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,kBAAkB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,yBAAyB,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,KAAK,IAAI,CAAC;IAC3E,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,qBAAa,uBAAwB,SAAQ,SAAS;IACrD,OAAO,CAAC,YAAY,CAAe;IAEnC,YACC,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,uBAAuB,EAwElC;IAED,eAAe,IAAI,YAAY,CAE9B;CACD","sourcesContent":["import {\n\tContainer,\n\ttype SettingItem,\n\tSettingsList,\n\tSpacer,\n\tText,\n} from \"@looze/leaf-tui\";\nimport { getSettingsListTheme, theme } from \"../theme/theme.ts\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\n\nexport interface WorkerConfig {\n\tenabled: boolean;\n\tmaxWorkers: number;\n\tcommunicationMode: \"socket\" | \"message\" | \"shared\";\n}\n\nexport interface WorkerSelectorCallbacks {\n\tonEnabledChange: (enabled: boolean) => void;\n\tonMaxWorkersChange: (maxWorkers: number) => void;\n\tonCommunicationModeChange: (mode: \"socket\" | \"message\" | \"shared\") => void;\n\tonAbortAll: () => void;\n\tonCancel: () => void;\n}\n\nexport class WorkerSelectorComponent extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(\n\t\tconfig: WorkerConfig,\n\t\tcallbacks: WorkerSelectorCallbacks,\n\t) {\n\t\tsuper();\n\n\t\t// 标题\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Worker 设置\")), 1, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// 添加边框\n\t\tthis.addChild(new DynamicBorder());\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"worker-enabled\",\n\t\t\t\tlabel: \"Worker 模式\",\n\t\t\t\tdescription: \"启用或禁用 Worker 并行执行模式\",\n\t\t\t\tcurrentValue: config.enabled ? \"开启\" : \"关闭\",\n\t\t\t\tvalues: [\"开启\", \"关闭\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"max-workers\",\n\t\t\t\tlabel: \"最大 Worker 数\",\n\t\t\t\tdescription: \"同时运行的最大 Worker 数量\",\n\t\t\t\tcurrentValue: String(config.maxWorkers),\n\t\t\t\tvalues: [\"1\", \"2\", \"4\", \"8\", \"16\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"communication-mode\",\n\t\t\t\tlabel: \"通信模式\",\n\t\t\t\tdescription: \"Worker 之间的通信方式\",\n\t\t\t\tcurrentValue: config.communicationMode,\n\t\t\t\tvalues: [\"message\", \"socket\", \"shared\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"abort-all\",\n\t\t\t\tlabel: \"中止所有 Worker\",\n\t\t\t\tdescription: \"立即停止所有正在运行的 Worker\",\n\t\t\t\tcurrentValue: \"执行\",\n\t\t\t\tvalues: [\"执行\"],\n\t\t\t},\n\t\t];\n\n\t\t// 添加边框\n\t\tthis.addChild(new DynamicBorder());\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\t10,\n\t\t\tgetSettingsListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"worker-enabled\":\n\t\t\t\t\t\tcallbacks.onEnabledChange(newValue === \"开启\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"max-workers\":\n\t\t\t\t\t\tcallbacks.onMaxWorkersChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"communication-mode\":\n\t\t\t\t\t\tcallbacks.onCommunicationModeChange(newValue as \"socket\" | \"message\" | \"shared\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"abort-all\":\n\t\t\t\t\t\tcallbacks.onAbortAll();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcallbacks.onCancel,\n\t\t\t{ enableSearch: false },\n\t\t);\n\n\t\tthis.addChild(this.settingsList);\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSettingsList(): SettingsList {\n\t\treturn this.settingsList;\n\t}\n}\n"]}
@@ -0,0 +1,69 @@
1
+ import { Container, SettingsList, Spacer, Text, } from "@looze/leaf-tui";
2
+ import { getSettingsListTheme, theme } from "../theme/theme.js";
3
+ import { DynamicBorder } from "./dynamic-border.js";
4
+ export class WorkerSelectorComponent extends Container {
5
+ settingsList;
6
+ constructor(config, callbacks) {
7
+ super();
8
+ // 标题
9
+ this.addChild(new Spacer(1));
10
+ this.addChild(new Text(theme.bold(theme.fg("accent", "Worker 设置")), 1, 0));
11
+ this.addChild(new Spacer(1));
12
+ // 添加边框
13
+ this.addChild(new DynamicBorder());
14
+ const items = [
15
+ {
16
+ id: "worker-enabled",
17
+ label: "Worker 模式",
18
+ description: "启用或禁用 Worker 并行执行模式",
19
+ currentValue: config.enabled ? "开启" : "关闭",
20
+ values: ["开启", "关闭"],
21
+ },
22
+ {
23
+ id: "max-workers",
24
+ label: "最大 Worker 数",
25
+ description: "同时运行的最大 Worker 数量",
26
+ currentValue: String(config.maxWorkers),
27
+ values: ["1", "2", "4", "8", "16"],
28
+ },
29
+ {
30
+ id: "communication-mode",
31
+ label: "通信模式",
32
+ description: "Worker 之间的通信方式",
33
+ currentValue: config.communicationMode,
34
+ values: ["message", "socket", "shared"],
35
+ },
36
+ {
37
+ id: "abort-all",
38
+ label: "中止所有 Worker",
39
+ description: "立即停止所有正在运行的 Worker",
40
+ currentValue: "执行",
41
+ values: ["执行"],
42
+ },
43
+ ];
44
+ // 添加边框
45
+ this.addChild(new DynamicBorder());
46
+ this.settingsList = new SettingsList(items, 10, getSettingsListTheme(), (id, newValue) => {
47
+ switch (id) {
48
+ case "worker-enabled":
49
+ callbacks.onEnabledChange(newValue === "开启");
50
+ break;
51
+ case "max-workers":
52
+ callbacks.onMaxWorkersChange(parseInt(newValue, 10));
53
+ break;
54
+ case "communication-mode":
55
+ callbacks.onCommunicationModeChange(newValue);
56
+ break;
57
+ case "abort-all":
58
+ callbacks.onAbortAll();
59
+ break;
60
+ }
61
+ }, callbacks.onCancel, { enableSearch: false });
62
+ this.addChild(this.settingsList);
63
+ this.addChild(new DynamicBorder());
64
+ }
65
+ getSettingsList() {
66
+ return this.settingsList;
67
+ }
68
+ }
69
+ //# sourceMappingURL=worker-selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-selector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/worker-selector.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n\tContainer,\n\ttype SettingItem,\n\tSettingsList,\n\tSpacer,\n\tText,\n} from \"@looze/leaf-tui\";\nimport { getSettingsListTheme, theme } from \"../theme/theme.ts\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\n\nexport interface WorkerConfig {\n\tenabled: boolean;\n\tmaxWorkers: number;\n\tcommunicationMode: \"socket\" | \"message\" | \"shared\";\n}\n\nexport interface WorkerSelectorCallbacks {\n\tonEnabledChange: (enabled: boolean) => void;\n\tonMaxWorkersChange: (maxWorkers: number) => void;\n\tonCommunicationModeChange: (mode: \"socket\" | \"message\" | \"shared\") => void;\n\tonAbortAll: () => void;\n\tonCancel: () => void;\n}\n\nexport class WorkerSelectorComponent extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(\n\t\tconfig: WorkerConfig,\n\t\tcallbacks: WorkerSelectorCallbacks,\n\t) {\n\t\tsuper();\n\n\t\t// 标题\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Worker 设置\")), 1, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// 添加边框\n\t\tthis.addChild(new DynamicBorder());\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"worker-enabled\",\n\t\t\t\tlabel: \"Worker 模式\",\n\t\t\t\tdescription: \"启用或禁用 Worker 并行执行模式\",\n\t\t\t\tcurrentValue: config.enabled ? \"开启\" : \"关闭\",\n\t\t\t\tvalues: [\"开启\", \"关闭\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"max-workers\",\n\t\t\t\tlabel: \"最大 Worker 数\",\n\t\t\t\tdescription: \"同时运行的最大 Worker 数量\",\n\t\t\t\tcurrentValue: String(config.maxWorkers),\n\t\t\t\tvalues: [\"1\", \"2\", \"4\", \"8\", \"16\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"communication-mode\",\n\t\t\t\tlabel: \"通信模式\",\n\t\t\t\tdescription: \"Worker 之间的通信方式\",\n\t\t\t\tcurrentValue: config.communicationMode,\n\t\t\t\tvalues: [\"message\", \"socket\", \"shared\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"abort-all\",\n\t\t\t\tlabel: \"中止所有 Worker\",\n\t\t\t\tdescription: \"立即停止所有正在运行的 Worker\",\n\t\t\t\tcurrentValue: \"执行\",\n\t\t\t\tvalues: [\"执行\"],\n\t\t\t},\n\t\t];\n\n\t\t// 添加边框\n\t\tthis.addChild(new DynamicBorder());\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\t10,\n\t\t\tgetSettingsListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"worker-enabled\":\n\t\t\t\t\t\tcallbacks.onEnabledChange(newValue === \"开启\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"max-workers\":\n\t\t\t\t\t\tcallbacks.onMaxWorkersChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"communication-mode\":\n\t\t\t\t\t\tcallbacks.onCommunicationModeChange(newValue as \"socket\" | \"message\" | \"shared\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"abort-all\":\n\t\t\t\t\t\tcallbacks.onAbortAll();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcallbacks.onCancel,\n\t\t\t{ enableSearch: false },\n\t\t);\n\n\t\tthis.addChild(this.settingsList);\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSettingsList(): SettingsList {\n\t\treturn this.settingsList;\n\t}\n}\n"]}
@@ -347,6 +347,8 @@ export declare class InteractiveMode {
347
347
  private handleCopyCommand;
348
348
  private handleNameCommand;
349
349
  private handleSessionCommand;
350
+ private handleWorkerCommand;
351
+ private showWorkerSelector;
350
352
  private handleChangelogCommand;
351
353
  /**
352
354
  * Get capitalized display string for an app keybinding action.