@mediadatafusion/pi-workflow-suite 0.0.18 → 0.0.20

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.
@@ -0,0 +1,114 @@
1
+ import type { KeyId } from "@earendil-works/pi-tui";
2
+
3
+ export type WorkflowShortcutPlatform = "darwin" | "win32" | "linux";
4
+ export type WorkflowShortcutActionId =
5
+ | "workflow.widget.top.toggle"
6
+ | "workflow.widget.bottom.toggle"
7
+ | "workflow.presets.cycle"
8
+ | "workflow.standard.toggle"
9
+ | "workflow.plan.toggle"
10
+ | "workflow.mission.toggle";
11
+
12
+ export interface WorkflowShortcutDefinition {
13
+ id: WorkflowShortcutActionId;
14
+ description: string;
15
+ fallbackCommand: string;
16
+ keys: Record<WorkflowShortcutPlatform, KeyId>;
17
+ }
18
+
19
+ export const WORKFLOW_SHORTCUTS: WorkflowShortcutDefinition[] = [
20
+ {
21
+ id: "workflow.widget.top.toggle",
22
+ description: "Toggle active Plan/Mission/Standard top workflow widget",
23
+ fallbackCommand: "/workflow widgets toggle top",
24
+ keys: { darwin: "ctrl+shift+t", win32: "f2", linux: "f2" },
25
+ },
26
+ {
27
+ id: "workflow.widget.bottom.toggle",
28
+ description: "Toggle active Plan/Mission/Standard bottom workflow widget",
29
+ fallbackCommand: "/workflow widgets toggle bottom",
30
+ keys: { darwin: "ctrl+shift+b", win32: "f3", linux: "f3" },
31
+ },
32
+ {
33
+ id: "workflow.presets.cycle",
34
+ description: "Cycle workflow presets during Plan/Mission/Standard Mode",
35
+ fallbackCommand: "/workflow presets next",
36
+ keys: { darwin: "ctrl+shift+u", win32: "f4", linux: "f4" },
37
+ },
38
+ {
39
+ id: "workflow.standard.toggle",
40
+ description: "Toggle Standard Mode",
41
+ fallbackCommand: "/standard",
42
+ keys: { darwin: "ctrl+shift+s", win32: "f6", linux: "f6" },
43
+ },
44
+ {
45
+ id: "workflow.plan.toggle",
46
+ description: "Enter Plan Mode",
47
+ fallbackCommand: "/plan",
48
+ keys: { darwin: "ctrl+shift+l", win32: "f7", linux: "f7" },
49
+ },
50
+ {
51
+ id: "workflow.mission.toggle",
52
+ description: "Toggle Mission Mode",
53
+ fallbackCommand: "/mission",
54
+ keys: { darwin: "ctrl+shift+m", win32: "f8", linux: "f8" },
55
+ },
56
+ ];
57
+
58
+ const SHORTCUT_BY_ID = new Map(WORKFLOW_SHORTCUTS.map((shortcut) => [shortcut.id, shortcut]));
59
+
60
+ export function workflowShortcutPlatform(platform = process.platform): WorkflowShortcutPlatform {
61
+ if (platform === "darwin" || platform === "win32" || platform === "linux") return platform;
62
+ return "linux";
63
+ }
64
+
65
+ export function workflowShortcutKey(id: WorkflowShortcutActionId, platform = process.platform): KeyId {
66
+ return workflowShortcutDefinition(id).keys[workflowShortcutPlatform(platform)];
67
+ }
68
+
69
+ export function workflowShortcutDefinition(id: WorkflowShortcutActionId): WorkflowShortcutDefinition {
70
+ const shortcut = SHORTCUT_BY_ID.get(id);
71
+ if (!shortcut) throw new Error(`Unknown Workflow Suite shortcut: ${id}`);
72
+ return shortcut;
73
+ }
74
+
75
+ export function workflowShortcutLabel(id: WorkflowShortcutActionId, platform = process.platform): string {
76
+ return workflowShortcutKeyLabel(workflowShortcutKey(id, platform));
77
+ }
78
+
79
+ export function workflowShortcutKeyLabel(key: KeyId): string {
80
+ return key.split("+").map((part) => {
81
+ if (/^f\d+$/i.test(part)) return part.toUpperCase();
82
+ return part.charAt(0).toUpperCase() + part.slice(1).toLowerCase();
83
+ }).join("+");
84
+ }
85
+
86
+ export function workflowEntryShortcutLabel(mode: "standard" | "plan" | "mission", platform = process.platform): string {
87
+ if (mode === "standard") return `Standard:${workflowShortcutLabel("workflow.standard.toggle", platform)}`;
88
+ if (mode === "plan") return `Plan:${workflowShortcutLabel("workflow.plan.toggle", platform)}`;
89
+ return `Mission:${workflowShortcutLabel("workflow.mission.toggle", platform)}`;
90
+ }
91
+
92
+ export function workflowWidgetShortcutLabel(includeBottom: boolean, platform = process.platform): string {
93
+ const prefix = includeBottom ? "Widgets" : "Widget";
94
+ if (!includeBottom) return `${prefix}:${workflowShortcutLabel("workflow.widget.top.toggle", platform)}`;
95
+ const activePlatform = workflowShortcutPlatform(platform);
96
+ if (activePlatform === "darwin") return `${prefix}:Ctrl+Shift+T/B`;
97
+ return `${prefix}:${workflowShortcutLabel("workflow.widget.top.toggle", platform)}/${workflowShortcutLabel("workflow.widget.bottom.toggle", platform)}`;
98
+ }
99
+
100
+ export function workflowPresetCycleShortcutLabel(platform = process.platform): string {
101
+ return workflowShortcutLabel("workflow.presets.cycle", platform);
102
+ }
103
+
104
+ export function workflowSettingsShortcutLines(platform = process.platform): string[] {
105
+ return [
106
+ `Standard Shortcut: ${workflowShortcutLabel("workflow.standard.toggle", platform)} toggles Standard Mode`,
107
+ `Plan Shortcut: ${workflowShortcutLabel("workflow.plan.toggle", platform)} enters Plan Mode`,
108
+ `Mission Shortcut: ${workflowShortcutLabel("workflow.mission.toggle", platform)} enters Mission Mode`,
109
+ `Widget Shortcuts: ${workflowWidgetShortcutLabel(true, platform).replace(/^Widgets:/, "")} while Plan/Mission/Standard Mode is active`,
110
+ `Preset Cycle Shortcut: ${workflowPresetCycleShortcutLabel(platform)} while Plan/Mission/Standard Mode is active`,
111
+ ];
112
+ }
113
+
114
+ export default function workflowShortcutsNoopExtension(): void {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediadatafusion/pi-workflow-suite",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "Multi-agent workflow suite for Pi with Idle, Standard, Plan, Mission, approval gates, reviewer/validator roles, sub-agents, model routing, web search/fetch, browser checks, diagrams, compaction, presets, settings, themes, widgets, and Repo Lock.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -68,6 +68,7 @@ warn_unexpected_loadable_extensions() {
68
68
  extensions/subagent/index.ts
69
69
  extensions/workflow-model-router.ts
70
70
  extensions/workflow-modes.ts
71
+ extensions/workflow-shortcuts.ts
71
72
  extensions/workflow-parsers.ts
72
73
  extensions/workflow-settings-capabilities.ts
73
74
  extensions/workflow-state.ts
@@ -96,6 +97,7 @@ require_file "extensions/workflow-state.ts"
96
97
  require_file "extensions/workflow-summary.ts"
97
98
  require_file "extensions/workflow-tool-guard.ts"
98
99
  require_file "extensions/workflow-model-router.ts"
100
+ require_file "extensions/workflow-shortcuts.ts"
99
101
  require_file "extensions/subagent/index.ts"
100
102
  require_file "extensions/subagent/agents.ts"
101
103
  require_file "package.json"