@owdproject/nuxt 0.0.0-stage → 4.0.0-alpha.4

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 (169) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +77 -2
  3. package/dist/kit/authoring.d.ts +88 -0
  4. package/dist/kit/authoring.js +276 -0
  5. package/dist/kit/defineDesktopApp.d.ts +1 -0
  6. package/dist/kit/defineDesktopApp.js +1 -0
  7. package/dist/kit/defineDesktopPlugin.d.ts +1 -0
  8. package/dist/kit/defineDesktopPlugin.js +1 -0
  9. package/dist/module.d.mts +245 -0
  10. package/dist/module.json +12 -0
  11. package/dist/module.mjs +681 -0
  12. package/dist/runtime/components/Application/DesktopCoreApplicationRender.d.vue.ts +6 -0
  13. package/dist/runtime/components/Application/DesktopCoreApplicationRender.vue +18 -0
  14. package/dist/runtime/components/Application/DesktopCoreApplicationRender.vue.d.ts +6 -0
  15. package/dist/runtime/components/Application/DesktopCoreApplicationWindowsRender.d.vue.ts +9 -0
  16. package/dist/runtime/components/Application/DesktopCoreApplicationWindowsRender.vue +31 -0
  17. package/dist/runtime/components/Application/DesktopCoreApplicationWindowsRender.vue.d.ts +9 -0
  18. package/dist/runtime/components/DesktopCore.d.vue.ts +19 -0
  19. package/dist/runtime/components/DesktopCore.vue +37 -0
  20. package/dist/runtime/components/DesktopCore.vue.d.ts +19 -0
  21. package/dist/runtime/components/background/DesktopCoreBackground.d.vue.ts +13 -0
  22. package/dist/runtime/components/background/DesktopCoreBackground.vue +16 -0
  23. package/dist/runtime/components/background/DesktopCoreBackground.vue.d.ts +13 -0
  24. package/dist/runtime/components/time/DesktopCoreTime.d.vue.ts +3 -0
  25. package/dist/runtime/components/time/DesktopCoreTime.vue +44 -0
  26. package/dist/runtime/components/time/DesktopCoreTime.vue.d.ts +3 -0
  27. package/dist/runtime/components/window/DesktopCoreWindow.d.vue.ts +49 -0
  28. package/dist/runtime/components/window/DesktopCoreWindow.vue +438 -0
  29. package/dist/runtime/components/window/DesktopCoreWindow.vue.d.ts +49 -0
  30. package/dist/runtime/components/window/DesktopCoreWindowContent.d.vue.ts +13 -0
  31. package/dist/runtime/components/window/DesktopCoreWindowContent.vue +34 -0
  32. package/dist/runtime/components/window/DesktopCoreWindowContent.vue.d.ts +13 -0
  33. package/dist/runtime/components/window/DesktopCoreWindowNav.d.vue.ts +13 -0
  34. package/dist/runtime/components/window/DesktopCoreWindowNav.vue +54 -0
  35. package/dist/runtime/components/window/DesktopCoreWindowNav.vue.d.ts +13 -0
  36. package/dist/runtime/components/window/DesktopCoreWindowSnapHintsBase.d.vue.ts +19 -0
  37. package/dist/runtime/components/window/DesktopCoreWindowSnapHintsBase.vue +46 -0
  38. package/dist/runtime/components/window/DesktopCoreWindowSnapHintsBase.vue.d.ts +19 -0
  39. package/dist/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.d.vue.ts +24 -0
  40. package/dist/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.vue +50 -0
  41. package/dist/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.vue.d.ts +24 -0
  42. package/dist/runtime/composables/application/state.d.ts +1 -0
  43. package/dist/runtime/composables/application/state.js +2 -0
  44. package/dist/runtime/composables/application/useDesktopApplicationDefine.d.ts +4 -0
  45. package/dist/runtime/composables/application/useDesktopApplicationDefine.js +36 -0
  46. package/dist/runtime/composables/application/useDesktopApplicationExec.d.ts +3 -0
  47. package/dist/runtime/composables/application/useDesktopApplicationExec.js +26 -0
  48. package/dist/runtime/composables/application/useDesktopApplicationProcess.d.ts +24 -0
  49. package/dist/runtime/composables/application/useDesktopApplicationProcess.js +140 -0
  50. package/dist/runtime/composables/application/useDesktopApplicationRegistry.d.ts +11 -0
  51. package/dist/runtime/composables/application/useDesktopApplicationRegistry.js +60 -0
  52. package/dist/runtime/composables/useApplicationEntries.d.ts +5 -0
  53. package/dist/runtime/composables/useApplicationEntries.js +10 -0
  54. package/dist/runtime/composables/useApplicationManager.d.ts +16 -0
  55. package/dist/runtime/composables/useApplicationManager.js +30 -0
  56. package/dist/runtime/composables/useBlockNonInputContextMenu.d.ts +5 -0
  57. package/dist/runtime/composables/useBlockNonInputContextMenu.js +19 -0
  58. package/dist/runtime/composables/useDesktop.d.ts +210 -0
  59. package/dist/runtime/composables/useDesktop.js +52 -0
  60. package/dist/runtime/composables/useDesktopApplication.d.ts +34 -0
  61. package/dist/runtime/composables/useDesktopApplication.js +17 -0
  62. package/dist/runtime/composables/useDesktopCommands.d.ts +12 -0
  63. package/dist/runtime/composables/useDesktopCommands.js +348 -0
  64. package/dist/runtime/composables/useDesktopConfig.d.ts +3 -0
  65. package/dist/runtime/composables/useDesktopConfig.js +10 -0
  66. package/dist/runtime/composables/useDesktopDefaultApps.d.ts +15 -0
  67. package/dist/runtime/composables/useDesktopDefaultApps.js +21 -0
  68. package/dist/runtime/composables/useDesktopDialogs.d.ts +5 -0
  69. package/dist/runtime/composables/useDesktopDialogs.js +8 -0
  70. package/dist/runtime/composables/useDesktopDrag.d.ts +1 -0
  71. package/dist/runtime/composables/useDesktopDrag.js +1 -0
  72. package/dist/runtime/composables/useDesktopHooks.d.ts +15 -0
  73. package/dist/runtime/composables/useDesktopHooks.js +12 -0
  74. package/dist/runtime/composables/useDesktopIPC.d.ts +35 -0
  75. package/dist/runtime/composables/useDesktopIPC.js +72 -0
  76. package/dist/runtime/composables/useDesktopIdentity.d.ts +22 -0
  77. package/dist/runtime/composables/useDesktopIdentity.js +65 -0
  78. package/dist/runtime/composables/useDesktopManifest.d.ts +6 -0
  79. package/dist/runtime/composables/useDesktopManifest.js +17 -0
  80. package/dist/runtime/composables/useDesktopNotification.d.ts +13 -0
  81. package/dist/runtime/composables/useDesktopNotification.js +13 -0
  82. package/dist/runtime/composables/useDesktopResize.d.ts +1 -0
  83. package/dist/runtime/composables/useDesktopResize.js +1 -0
  84. package/dist/runtime/composables/useDesktopSession.d.ts +4 -0
  85. package/dist/runtime/composables/useDesktopSession.js +17 -0
  86. package/dist/runtime/composables/useDesktopShellIdentity.d.ts +1 -0
  87. package/dist/runtime/composables/useDesktopShellIdentity.js +3 -0
  88. package/dist/runtime/composables/useDesktopShellOptions.d.ts +5 -0
  89. package/dist/runtime/composables/useDesktopShellOptions.js +18 -0
  90. package/dist/runtime/composables/useDesktopTray.d.ts +5 -0
  91. package/dist/runtime/composables/useDesktopTray.js +10 -0
  92. package/dist/runtime/composables/useDesktopVolume.d.ts +4 -0
  93. package/dist/runtime/composables/useDesktopVolume.js +9 -0
  94. package/dist/runtime/composables/useDesktopWorkArea.d.ts +1 -0
  95. package/dist/runtime/composables/useDesktopWorkArea.js +3 -0
  96. package/dist/runtime/composables/useDesktopWorkarea.d.ts +12 -0
  97. package/dist/runtime/composables/useDesktopWorkarea.js +72 -0
  98. package/dist/runtime/composables/useTerminalManager.d.ts +15 -0
  99. package/dist/runtime/composables/useTerminalManager.js +9 -0
  100. package/dist/runtime/composables/useToggleWindowMaximize.d.ts +1 -0
  101. package/dist/runtime/composables/useToggleWindowMaximize.js +12 -0
  102. package/dist/runtime/composables/useWindowDragHandlers.d.ts +7 -0
  103. package/dist/runtime/composables/useWindowDragHandlers.js +7 -0
  104. package/dist/runtime/composables/window/useDesktopWindow.d.ts +14 -0
  105. package/dist/runtime/composables/window/useDesktopWindow.js +192 -0
  106. package/dist/runtime/composables/window/useDesktopWindowSnapDrop.d.ts +13 -0
  107. package/dist/runtime/composables/window/useDesktopWindowSnapDrop.js +78 -0
  108. package/dist/runtime/composables/workspace/useDesktopWorkspaceEdgeDrop.d.ts +25 -0
  109. package/dist/runtime/composables/workspace/useDesktopWorkspaceEdgeDrop.js +119 -0
  110. package/dist/runtime/composables/workspace/useDesktopWorkspaceManager.d.ts +8 -0
  111. package/dist/runtime/composables/workspace/useDesktopWorkspaceManager.js +46 -0
  112. package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewCapture.d.ts +20 -0
  113. package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewCapture.js +60 -0
  114. package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewLiveScale.d.ts +31 -0
  115. package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewLiveScale.js +92 -0
  116. package/dist/runtime/constants/desktopShellKeys.d.ts +5 -0
  117. package/dist/runtime/constants/desktopShellKeys.js +2 -0
  118. package/dist/runtime/constants/shellLayout.d.ts +4 -0
  119. package/dist/runtime/constants/shellLayout.js +2 -0
  120. package/dist/runtime/dialogs/desktopDialogProvider.d.ts +6 -0
  121. package/dist/runtime/dialogs/desktopDialogProvider.js +12 -0
  122. package/dist/runtime/internal/controllers/ApplicationController.d.ts +44 -0
  123. package/dist/runtime/internal/controllers/ApplicationController.js +470 -0
  124. package/dist/runtime/internal/controllers/WindowController.d.ts +83 -0
  125. package/dist/runtime/internal/controllers/WindowController.js +435 -0
  126. package/dist/runtime/plugins/01.desktop-shell-init.client.d.ts +2 -0
  127. package/dist/runtime/plugins/01.desktop-shell-init.client.js +18 -0
  128. package/dist/runtime/plugins/02.desktop-register-desktop-apps.client.d.ts +2 -0
  129. package/dist/runtime/plugins/02.desktop-register-desktop-apps.client.js +7 -0
  130. package/dist/runtime/stores/storeApplicationMeta.d.ts +2 -0
  131. package/dist/runtime/stores/storeApplicationMeta.js +30 -0
  132. package/dist/runtime/stores/storeApplicationWindows.d.ts +2 -0
  133. package/dist/runtime/stores/storeApplicationWindows.js +43 -0
  134. package/dist/runtime/stores/storeDesktop.d.ts +17 -0
  135. package/dist/runtime/stores/storeDesktop.js +29 -0
  136. package/dist/runtime/stores/storeDesktopDefaultApps.d.ts +8 -0
  137. package/dist/runtime/stores/storeDesktopDefaultApps.js +21 -0
  138. package/dist/runtime/stores/storeDesktopTray.d.ts +6 -0
  139. package/dist/runtime/stores/storeDesktopTray.js +21 -0
  140. package/dist/runtime/stores/storeDesktopVolume.d.ts +4 -0
  141. package/dist/runtime/stores/storeDesktopVolume.js +12 -0
  142. package/dist/runtime/stores/storeDesktopWorkspace.d.ts +26 -0
  143. package/dist/runtime/stores/storeDesktopWorkspace.js +103 -0
  144. package/dist/runtime/stores/storeNotification.d.ts +27 -0
  145. package/dist/runtime/stores/storeNotification.js +62 -0
  146. package/dist/runtime/types/index.d.ts +1 -0
  147. package/dist/runtime/types/index.js +1 -0
  148. package/dist/runtime/utils/defineDesktopApp.d.ts +2 -0
  149. package/dist/runtime/utils/defineDesktopApp.js +5 -0
  150. package/dist/runtime/utils/defineDesktopPlugin.d.ts +19 -0
  151. package/dist/runtime/utils/defineDesktopPlugin.js +29 -0
  152. package/dist/runtime/utils/utilApp.d.ts +2 -0
  153. package/dist/runtime/utils/utilApp.js +9 -0
  154. package/dist/runtime/utils/utilCaptureElementToCanvas.d.ts +1 -0
  155. package/dist/runtime/utils/utilCaptureElementToCanvas.js +21 -0
  156. package/dist/runtime/utils/utilDebug.d.ts +4 -0
  157. package/dist/runtime/utils/utilDebug.js +24 -0
  158. package/dist/runtime/utils/utilDetectSnapZone.d.ts +1 -0
  159. package/dist/runtime/utils/utilDetectSnapZone.js +5 -0
  160. package/dist/runtime/utils/utilWindowControllerAdapter.d.ts +2 -0
  161. package/dist/runtime/utils/utilWindowControllerAdapter.js +151 -0
  162. package/dist/runtime/utils/utilWindowLayout.d.ts +4 -0
  163. package/dist/runtime/utils/utilWindowLayout.js +34 -0
  164. package/dist/runtime/utils/utilWorkspaceWindows.d.ts +2 -0
  165. package/dist/runtime/utils/utilWorkspaceWindows.js +12 -0
  166. package/dist/types/index.d.ts +164 -0
  167. package/dist/types/index.js +1 -0
  168. package/dist/types.d.mts +2 -0
  169. package/package.json +151 -4
@@ -0,0 +1,210 @@
1
+ export declare function registerDesktopExtension(name: string, extension: any): void;
2
+ export declare function useDesktop(): {
3
+ config: import("vue").ComputedRef<unknown>;
4
+ applications: {
5
+ define: (id: string, config: ApplicationConfig) => Promise<any>;
6
+ defineApp: (id: string, config: ApplicationConfig) => Promise<any>;
7
+ exec: (id: string, rawCommand: string) => Promise<CommandOutput>;
8
+ running: import("vue").ComputedRef<IApplicationController[]>;
9
+ processes: import("vue").ComputedRef<{
10
+ id: string;
11
+ title: string;
12
+ icon?: string;
13
+ category?: string;
14
+ pid: number | null;
15
+ state: string;
16
+ isRunning: boolean;
17
+ isSuspended: boolean;
18
+ windowCount: number;
19
+ startedAt: number | null;
20
+ controller: IApplicationController;
21
+ }[]>;
22
+ isRunning: (id: string | undefined) => boolean;
23
+ findByPid: (pid: number) => IApplicationController | undefined;
24
+ resolveApp: (idOrPid: string | number) => IApplicationController | undefined;
25
+ launch: (id: string, entryKey?: string, argument?: string) => Promise<any>;
26
+ suspend: (idOrPid: string | number) => boolean;
27
+ resume: (idOrPid: string | number) => boolean;
28
+ kill: (idOrPid: string | number, signal?: "SIGTERM" | "SIGKILL" | "SIGSTOP" | "SIGCONT") => boolean;
29
+ close: (id: string) => void;
30
+ list: import("vue").ComputedRef<any[]>;
31
+ categories: import("vue").ComputedRef<Record<string, IApplicationController[]>>;
32
+ apps: import("vue").Reactive<Map<string, IApplicationController>>;
33
+ get: (id: string) => any;
34
+ isAppDefined: (id: string) => boolean;
35
+ getSortedEntries: (sortBy?: import("./application/useDesktopApplicationRegistry.js").SortBy, visibility?: import("./application/useDesktopApplicationRegistry.js").Visibility) => import("vue").ComputedRef<any[]>;
36
+ };
37
+ services: Readonly<{
38
+ register: (id: string, service: any) => void;
39
+ unregister: (id: string) => void;
40
+ get: (id: string) => any;
41
+ has: (id: string) => boolean;
42
+ }>;
43
+ hooks: import("./useDesktopHooks.js").DesktopHooksAPI;
44
+ ipc: {
45
+ events: import("vue").Ref<{
46
+ id: string;
47
+ timestamp: number;
48
+ channel: string;
49
+ source: string;
50
+ severity: "info" | "warn" | "error";
51
+ payload?: any;
52
+ }[], import("./useDesktopIPC.js").DesktopKernelEvent[] | {
53
+ id: string;
54
+ timestamp: number;
55
+ channel: string;
56
+ source: string;
57
+ severity: "info" | "warn" | "error";
58
+ payload?: any;
59
+ }[]>;
60
+ activeChannels: import("vue").ComputedRef<string[]>;
61
+ emit: (channel: string, payload?: any, options?: {
62
+ source?: string;
63
+ severity?: "info" | "warn" | "error";
64
+ }) => import("./useDesktopIPC.js").DesktopKernelEvent;
65
+ on: (channel: string, handler: (event: import("./useDesktopIPC.js").DesktopKernelEvent) => void) => () => void;
66
+ off: (channel: string, handler: (event: import("./useDesktopIPC.js").DesktopKernelEvent) => void) => void;
67
+ clearEvents: () => void;
68
+ };
69
+ windows: {
70
+ list: import("vue").ComputedRef<IWindowController[]>;
71
+ index: import("vue").ComputedRef<Map<string, IWindowController>>;
72
+ activeWorkspaceWindows: import("vue").ComputedRef<IWindowController[]>;
73
+ focused: import("vue").ComputedRef<any>;
74
+ topMaximizedWindow: import("vue").ComputedRef<any>;
75
+ get: (windowId: string) => IWindowController | undefined;
76
+ tileWindows: (mode?: "horizontal" | "vertical" | "grid", workspaceId?: string) => number;
77
+ minimizeAll: (workspaceId?: string) => void;
78
+ restoreAll: (workspaceId?: string) => void;
79
+ close: (windowId: string) => void;
80
+ closeAll: (appId?: string) => void;
81
+ };
82
+ workspace: import("pinia").Store<"desktop/workspace", Pick<{
83
+ list: import("vue").Ref<string[], string[]>;
84
+ active: import("vue").Ref<string, string>;
85
+ overview: import("vue").Ref<boolean, boolean>;
86
+ workarea: import("vue").Ref<{
87
+ x: number;
88
+ y: number;
89
+ width: number;
90
+ height: number;
91
+ }, import("@owdproject/core").DesktopWorkareaRect | {
92
+ x: number;
93
+ y: number;
94
+ width: number;
95
+ height: number;
96
+ }>;
97
+ workspaceActiveIndex: import("vue").ComputedRef<number>;
98
+ setWorkspace: (workspaceId: string) => boolean;
99
+ setOverview: (value: boolean) => void;
100
+ toggleOverview: () => void;
101
+ setWorkarea: (rect: import("@owdproject/core").DesktopWorkareaRect) => void;
102
+ addWorkspace: (id?: string) => string;
103
+ removeWorkspace: (workspaceId: string) => boolean;
104
+ resolveWorkspaceFallback: (removedId: string) => string | null;
105
+ }, "list" | "active" | "overview" | "workarea">, Pick<{
106
+ list: import("vue").Ref<string[], string[]>;
107
+ active: import("vue").Ref<string, string>;
108
+ overview: import("vue").Ref<boolean, boolean>;
109
+ workarea: import("vue").Ref<{
110
+ x: number;
111
+ y: number;
112
+ width: number;
113
+ height: number;
114
+ }, import("@owdproject/core").DesktopWorkareaRect | {
115
+ x: number;
116
+ y: number;
117
+ width: number;
118
+ height: number;
119
+ }>;
120
+ workspaceActiveIndex: import("vue").ComputedRef<number>;
121
+ setWorkspace: (workspaceId: string) => boolean;
122
+ setOverview: (value: boolean) => void;
123
+ toggleOverview: () => void;
124
+ setWorkarea: (rect: import("@owdproject/core").DesktopWorkareaRect) => void;
125
+ addWorkspace: (id?: string) => string;
126
+ removeWorkspace: (workspaceId: string) => boolean;
127
+ resolveWorkspaceFallback: (removedId: string) => string | null;
128
+ }, "workspaceActiveIndex">, Pick<{
129
+ list: import("vue").Ref<string[], string[]>;
130
+ active: import("vue").Ref<string, string>;
131
+ overview: import("vue").Ref<boolean, boolean>;
132
+ workarea: import("vue").Ref<{
133
+ x: number;
134
+ y: number;
135
+ width: number;
136
+ height: number;
137
+ }, import("@owdproject/core").DesktopWorkareaRect | {
138
+ x: number;
139
+ y: number;
140
+ width: number;
141
+ height: number;
142
+ }>;
143
+ workspaceActiveIndex: import("vue").ComputedRef<number>;
144
+ setWorkspace: (workspaceId: string) => boolean;
145
+ setOverview: (value: boolean) => void;
146
+ toggleOverview: () => void;
147
+ setWorkarea: (rect: import("@owdproject/core").DesktopWorkareaRect) => void;
148
+ addWorkspace: (id?: string) => string;
149
+ removeWorkspace: (workspaceId: string) => boolean;
150
+ resolveWorkspaceFallback: (removedId: string) => string | null;
151
+ }, "setWorkspace" | "setOverview" | "toggleOverview" | "setWorkarea" | "addWorkspace" | "removeWorkspace" | "resolveWorkspaceFallback">>;
152
+ defaultApps: {
153
+ defaultApps: import("vue").ComputedRef<Record<string, {
154
+ applicationId: string;
155
+ entry: string;
156
+ }>>;
157
+ getDefaultApp: (feature: string) => {
158
+ applicationId: string;
159
+ entry: string;
160
+ };
161
+ setDefaultApp: (feature: string, application: IApplicationController, entry: string) => void;
162
+ };
163
+ identity: {
164
+ userId: import("vue").ComputedRef<string>;
165
+ displayName: import("vue").ComputedRef<string>;
166
+ avatarUrl: import("vue").ComputedRef<string | null>;
167
+ userHome: import("vue").ComputedRef<string>;
168
+ isGuest: import("vue").ComputedRef<boolean>;
169
+ setDesktopIdentity: (partial: Partial<import("./useDesktopIdentity.js").ShellIdentity>) => void;
170
+ clear: () => void;
171
+ };
172
+ session: {
173
+ shuttingDown: import("vue").Ref<boolean, boolean>;
174
+ initiateShutdownToStart: () => void;
175
+ };
176
+ commands: {
177
+ register: (command: DesktopCommand) => void;
178
+ list: () => string[];
179
+ get: (name: string) => DesktopCommand | undefined;
180
+ all: () => DesktopCommand[];
181
+ exec: (input: string) => Promise<CommandOutput | void>;
182
+ addCommand: (command: DesktopCommand) => void;
183
+ listCommands: () => string[];
184
+ getCommand: (name: string) => DesktopCommand | undefined;
185
+ getAllCommands: () => DesktopCommand[];
186
+ execCommand: (input: string) => Promise<CommandOutput | void>;
187
+ };
188
+ volume: {
189
+ master: import("vue").ComputedRef<number>;
190
+ setMaster: (value: number) => void;
191
+ };
192
+ notifications: {
193
+ list: any;
194
+ add: (payload: {
195
+ title: string;
196
+ body?: string;
197
+ icon?: string;
198
+ appId?: string;
199
+ }) => DesktopNotificationItem;
200
+ remove: (id: string) => void;
201
+ clear: () => void;
202
+ markAsRead: (id: string) => void;
203
+ markAllAsRead: () => void;
204
+ };
205
+ tray: {
206
+ items: import("vue").ComputedRef<any>;
207
+ registerIcon: (item: DesktopTrayItem) => void;
208
+ unregisterIcon: (id: string) => void;
209
+ };
210
+ };
@@ -0,0 +1,52 @@
1
+ import { reactive } from "vue";
2
+ import { useDesktopWorkspaceStore } from "../stores/storeDesktopWorkspace.js";
3
+ import { useDesktopConfig } from "./useDesktopConfig.js";
4
+ import { useDesktopIdentity } from "./useDesktopIdentity.js";
5
+ import { useDesktopSession } from "./useDesktopSession.js";
6
+ import { useDesktopCommands } from "./useDesktopCommands.js";
7
+ import { useDesktopDefaultApps } from "./useDesktopDefaultApps.js";
8
+ import { useDesktopApplication } from "./useDesktopApplication.js";
9
+ import { useDesktopWindow } from "./window/useDesktopWindow.js";
10
+ import { useDesktopVolume } from "./useDesktopVolume.js";
11
+ import { useDesktopNotification } from "./useDesktopNotification.js";
12
+ import { useDesktopTray } from "./useDesktopTray.js";
13
+ import { useDesktopIPC } from "./useDesktopIPC.js";
14
+ import { useDesktopHooks } from "./useDesktopHooks.js";
15
+ const services = reactive(/* @__PURE__ */ new Map());
16
+ const extensions = reactive({});
17
+ export function registerDesktopExtension(name, extension) {
18
+ extensions[name] = extension;
19
+ }
20
+ const servicesRegistry = Object.freeze({
21
+ register: (id, service) => {
22
+ services.set(id, service);
23
+ },
24
+ unregister: (id) => {
25
+ services.delete(id);
26
+ },
27
+ get: (id) => {
28
+ return services.get(id);
29
+ },
30
+ has: (id) => {
31
+ return services.has(id);
32
+ }
33
+ });
34
+ export function useDesktop() {
35
+ return {
36
+ config: useDesktopConfig(),
37
+ applications: useDesktopApplication(),
38
+ services: servicesRegistry,
39
+ hooks: useDesktopHooks(),
40
+ ipc: useDesktopIPC(),
41
+ windows: useDesktopWindow(),
42
+ workspace: useDesktopWorkspaceStore(),
43
+ defaultApps: useDesktopDefaultApps(),
44
+ identity: useDesktopIdentity(),
45
+ session: useDesktopSession(),
46
+ commands: useDesktopCommands(),
47
+ volume: useDesktopVolume(),
48
+ notifications: useDesktopNotification(),
49
+ tray: useDesktopTray(),
50
+ ...extensions
51
+ };
52
+ }
@@ -0,0 +1,34 @@
1
+ export declare function useDesktopApplication(): {
2
+ define: (id: string, config: ApplicationConfig) => Promise<any>;
3
+ defineApp: (id: string, config: ApplicationConfig) => Promise<any>;
4
+ exec: (id: string, rawCommand: string) => Promise<CommandOutput>;
5
+ running: import("vue").ComputedRef<IApplicationController[]>;
6
+ processes: import("vue").ComputedRef<{
7
+ id: string;
8
+ title: string;
9
+ icon?: string;
10
+ category?: string;
11
+ pid: number | null;
12
+ state: string;
13
+ isRunning: boolean;
14
+ isSuspended: boolean;
15
+ windowCount: number;
16
+ startedAt: number | null;
17
+ controller: IApplicationController;
18
+ }[]>;
19
+ isRunning: (id: string | undefined) => boolean;
20
+ findByPid: (pid: number) => IApplicationController | undefined;
21
+ resolveApp: (idOrPid: string | number) => IApplicationController | undefined;
22
+ launch: (id: string, entryKey?: string, argument?: string) => Promise<any>;
23
+ suspend: (idOrPid: string | number) => boolean;
24
+ resume: (idOrPid: string | number) => boolean;
25
+ kill: (idOrPid: string | number, signal?: "SIGTERM" | "SIGKILL" | "SIGSTOP" | "SIGCONT") => boolean;
26
+ close: (id: string) => void;
27
+ list: import("vue").ComputedRef<any[]>;
28
+ categories: import("vue").ComputedRef<Record<string, IApplicationController[]>>;
29
+ apps: import("vue").Reactive<Map<string, IApplicationController>>;
30
+ get: (id: string) => any;
31
+ isAppDefined: (id: string) => boolean;
32
+ getSortedEntries: (sortBy?: import("./application/useDesktopApplicationRegistry.js").SortBy, visibility?: import("./application/useDesktopApplicationRegistry.js").Visibility) => import("vue").ComputedRef<any[]>;
33
+ };
34
+ export declare const useDesktopApplications: typeof useDesktopApplication;
@@ -0,0 +1,17 @@
1
+ import { useDesktopApplicationRegistry } from "./application/useDesktopApplicationRegistry.js";
2
+ import { useDesktopApplicationProcess } from "./application/useDesktopApplicationProcess.js";
3
+ import { useDesktopApplicationExec } from "./application/useDesktopApplicationExec.js";
4
+ import { useDesktopApplicationDefine } from "./application/useDesktopApplicationDefine.js";
5
+ export function useDesktopApplication() {
6
+ const registry = useDesktopApplicationRegistry();
7
+ const process = useDesktopApplicationProcess();
8
+ const exec = useDesktopApplicationExec();
9
+ const define = useDesktopApplicationDefine();
10
+ return {
11
+ ...registry,
12
+ ...process,
13
+ ...exec,
14
+ ...define
15
+ };
16
+ }
17
+ export const useDesktopApplications = useDesktopApplication;
@@ -0,0 +1,12 @@
1
+ export declare function useDesktopCommands(): {
2
+ register: (command: DesktopCommand) => void;
3
+ list: () => string[];
4
+ get: (name: string) => DesktopCommand | undefined;
5
+ all: () => DesktopCommand[];
6
+ exec: (input: string) => Promise<CommandOutput | void>;
7
+ addCommand: (command: DesktopCommand) => void;
8
+ listCommands: () => string[];
9
+ getCommand: (name: string) => DesktopCommand | undefined;
10
+ getAllCommands: () => DesktopCommand[];
11
+ execCommand: (input: string) => Promise<CommandOutput | void>;
12
+ };
@@ -0,0 +1,348 @@
1
+ import { useDesktopApplication } from "./useDesktopApplication.js";
2
+ import { useDesktopWindow } from "./window/useDesktopWindow.js";
3
+ import { useDesktopWorkspaceStore } from "../stores/storeDesktopWorkspace.js";
4
+ import { useDesktopNotification } from "./useDesktopNotification.js";
5
+ import { useDesktopIPC } from "./useDesktopIPC.js";
6
+ import { useDesktopHooks } from "./useDesktopHooks.js";
7
+ import { debugLog } from "../utils/utilDebug.js";
8
+ const commands = /* @__PURE__ */ new Map();
9
+ const systemBootTimestamp = Date.now();
10
+ function padEnd(str, len) {
11
+ return str.length >= len ? str : str + " ".repeat(len - str.length);
12
+ }
13
+ function formatDuration(ms) {
14
+ const totalSec = Math.max(0, Math.floor(ms / 1e3));
15
+ const m = Math.floor(totalSec / 60);
16
+ const s = totalSec % 60;
17
+ return `${String(m).padStart(2, "0")}m ${String(s).padStart(2, "0")}s`;
18
+ }
19
+ const BUILTIN_COMMANDS = [
20
+ { name: "help", description: "Show available kernel and application commands", usage: "help [command]" },
21
+ { name: "ps", description: "List all registered processes, PIDs, and XState states", usage: "ps [-a]" },
22
+ { name: "open", description: "Launch an application by ID or short name", usage: "open <app-name>" },
23
+ { name: "kill", description: "Send a signal (SIGTERM/SIGKILL/SIGSTOP/SIGCONT) to a PID or app", usage: "kill [-s SIGNAL] <pid|app>" },
24
+ { name: "suspend", description: "Suspend a running process (SIGSTOP)", usage: "suspend <pid|app>" },
25
+ { name: "resume", description: "Resume a suspended process (SIGCONT)", usage: "resume <pid|app>" },
26
+ { name: "ws", description: "List or switch virtual workspaces (1..4)", usage: "ws [index]" },
27
+ { name: "tile", description: "Tile open windows in active workspace (horizontal|vertical|grid)", usage: "tile [horizontal|vertical|grid]" },
28
+ { name: "notify", description: "Dispatch a desktop system notification", usage: "notify <message>" },
29
+ { name: "ipc", description: "Emit an IPC event or inspect recent kernel events", usage: "ipc [emit <channel> <payload> | log]" },
30
+ { name: "uptime", description: "Show Open Web Desktop uptime and active process count", usage: "uptime" },
31
+ { name: "echo", description: "Print arguments to standard output", usage: "echo <text>" }
32
+ ];
33
+ function buildHelpList() {
34
+ const appCmds = Array.from(commands.values()).sort(
35
+ (a, b) => a.name.localeCompare(b.name)
36
+ );
37
+ const allNames = [
38
+ ...BUILTIN_COMMANDS.map((c) => c.name),
39
+ ...appCmds.map((c) => c.name)
40
+ ];
41
+ const colWidth = Math.max(12, ...allNames.map((n) => n.length)) + 4;
42
+ const builtinRows = BUILTIN_COMMANDS.map(
43
+ (cmd) => ` ${padEnd(cmd.name, colWidth)}${cmd.description}`
44
+ ).join("\n");
45
+ const appRows = appCmds.map(
46
+ (cmd) => ` ${padEnd(cmd.name, colWidth)}${cmd.description ?? `Run ${cmd.name} (${cmd.applicationId})`}`
47
+ ).join("\n");
48
+ return `Open Web Desktop \u2014 Built-in Commands:
49
+ ` + builtinRows + (appRows ? `
50
+
51
+ Application Commands:
52
+ ${appRows}` : "") + `
53
+
54
+ Type 'help <command>' for usage details.`;
55
+ }
56
+ function buildHelpDetail(cmd) {
57
+ const lines = [];
58
+ lines.push(` ${cmd.name}${cmd.description ? ` \u2014 ${cmd.description}` : ""}`);
59
+ lines.push("");
60
+ if (cmd.usage) {
61
+ lines.push(` Usage: ${cmd.usage}`);
62
+ lines.push("");
63
+ }
64
+ if (cmd.args && cmd.args.length > 0) {
65
+ lines.push(" Arguments:");
66
+ const argColW = Math.max(...cmd.args.map((a) => a.name.length)) + 4;
67
+ for (const arg of cmd.args) {
68
+ const required = arg.required ? "" : " (optional)";
69
+ lines.push(
70
+ ` ${padEnd(arg.name, argColW)}${arg.description ?? ""}${required}`
71
+ );
72
+ }
73
+ lines.push("");
74
+ }
75
+ if (cmd.options && cmd.options.length > 0) {
76
+ lines.push(" Options:");
77
+ const optColW = Math.max(...cmd.options.map((o) => o.flag.length)) + 4;
78
+ for (const opt of cmd.options) {
79
+ lines.push(` ${padEnd(opt.flag, optColW)}${opt.description ?? ""}`);
80
+ }
81
+ lines.push("");
82
+ }
83
+ return lines.join("\n").trimEnd();
84
+ }
85
+ export function useDesktopCommands() {
86
+ const register = (command) => {
87
+ commands.set(command.name, command);
88
+ debugLog(`Registered command: ${command.name} \u2192 ${command.applicationId}`);
89
+ };
90
+ const list = () => {
91
+ return [
92
+ ...BUILTIN_COMMANDS.map((c) => c.name),
93
+ ...Array.from(commands.keys())
94
+ ];
95
+ };
96
+ const get = (name) => {
97
+ return commands.get(name);
98
+ };
99
+ const all = () => {
100
+ return Array.from(commands.values());
101
+ };
102
+ const runCommandInternal = async (trimmed, name, rest) => {
103
+ const applications = useDesktopApplication();
104
+ const windows = useDesktopWindow();
105
+ const workspaceStore = useDesktopWorkspaceStore();
106
+ const notifications = useDesktopNotification();
107
+ const ipc = useDesktopIPC();
108
+ if (name === "help") {
109
+ const target = rest[0];
110
+ if (!target) {
111
+ return { message: buildHelpList() };
112
+ }
113
+ const builtin = BUILTIN_COMMANDS.find((c) => c.name === target);
114
+ if (builtin) {
115
+ return {
116
+ message: ` ${builtin.name} \u2014 ${builtin.description}
117
+ Usage: ${builtin.usage}`
118
+ };
119
+ }
120
+ const cmd = commands.get(target);
121
+ if (!cmd) {
122
+ return {
123
+ message: `help: command not found: '${target}'
124
+ Type 'help' to list available commands.`,
125
+ isError: true
126
+ };
127
+ }
128
+ return { message: buildHelpDetail(cmd) };
129
+ }
130
+ if (name === "ps") {
131
+ const procs = applications.processes.value;
132
+ const header = ` ${padEnd("PID", 8)}${padEnd("STATE", 20)}${padEnd("WIN", 6)}${padEnd("UPTIME", 12)}APPLICATION`;
133
+ const divider = ` ${"-".repeat(72)}`;
134
+ const rows = procs.map((p) => {
135
+ const pidStr = p.pid ? String(p.pid) : "-";
136
+ const upStr = p.startedAt ? formatDuration(Date.now() - p.startedAt) : "-";
137
+ return ` ${padEnd(pidStr, 8)}${padEnd(p.state, 20)}${padEnd(String(p.windowCount), 6)}${padEnd(upStr, 12)}${p.title} (${p.id})`;
138
+ });
139
+ return {
140
+ message: [header, divider, ...rows].join("\n")
141
+ };
142
+ }
143
+ if (name === "open") {
144
+ const target = rest[0];
145
+ if (!target) {
146
+ return {
147
+ message: `Usage: open <app-name>
148
+ Available apps: ${applications.processes.value.map((p) => p.title.toLowerCase()).join(", ")}`,
149
+ isError: true
150
+ };
151
+ }
152
+ try {
153
+ await applications.launch(target, void 0, rest.slice(1).join(" "));
154
+ const app = applications.resolveApp(target);
155
+ return {
156
+ message: `Launched ${app?.config.title ?? target} (PID ${app?.pid ?? "active"})`
157
+ };
158
+ } catch (err) {
159
+ return {
160
+ message: `open: ${err?.message ?? String(err)}`,
161
+ isError: true
162
+ };
163
+ }
164
+ }
165
+ if (name === "kill") {
166
+ let signal = "SIGTERM";
167
+ let target = rest[0];
168
+ if (target === "-9" || target === "-SIGKILL") {
169
+ signal = "SIGKILL";
170
+ target = rest[1];
171
+ } else if (target === "-s" && rest[1]) {
172
+ const sig = rest[1].toUpperCase();
173
+ if (sig === "SIGKILL" || sig === "SIGTERM" || sig === "SIGSTOP" || sig === "SIGCONT") {
174
+ signal = sig;
175
+ }
176
+ target = rest[2];
177
+ }
178
+ if (!target) {
179
+ return {
180
+ message: `Usage: kill [-9 | -s SIGNAL] <pid|app-id>`,
181
+ isError: true
182
+ };
183
+ }
184
+ const app = applications.resolveApp(target);
185
+ if (!app) {
186
+ return {
187
+ message: `kill: process '${target}' not found`,
188
+ isError: true
189
+ };
190
+ }
191
+ const pid = app.pid;
192
+ applications.kill(target, signal);
193
+ return {
194
+ message: `Sent ${signal} to ${app.config.title} (${app.id}${pid ? `, PID ${pid}` : ""})`
195
+ };
196
+ }
197
+ if (name === "suspend") {
198
+ const target = rest[0];
199
+ if (!target) {
200
+ return { message: "Usage: suspend <pid|app>", isError: true };
201
+ }
202
+ const ok = applications.suspend(target);
203
+ if (!ok) {
204
+ return { message: `suspend: running process '${target}' not found`, isError: true };
205
+ }
206
+ return { message: `Suspended process '${target}' (SIGSTOP)` };
207
+ }
208
+ if (name === "resume") {
209
+ const target = rest[0];
210
+ if (!target) {
211
+ return { message: "Usage: resume <pid|app>", isError: true };
212
+ }
213
+ const ok = applications.resume(target);
214
+ if (!ok) {
215
+ return { message: `resume: suspended process '${target}' not found`, isError: true };
216
+ }
217
+ return { message: `Resumed process '${target}' (SIGCONT)` };
218
+ }
219
+ if (name === "ws") {
220
+ const arg = rest[0];
221
+ const list2 = workspaceStore.list;
222
+ if (!arg) {
223
+ const lines = list2.map((id, idx2) => {
224
+ const activeMark = id === workspaceStore.active ? "*" : " ";
225
+ const winCount = windows.list.value.filter((w) => w.state.workspace === id).length;
226
+ return ` ${activeMark} Workspace ${idx2 + 1} [${id}] \u2014 ${winCount} window(s)`;
227
+ });
228
+ return { message: `Virtual Workspaces:
229
+ ${lines.join("\n")}` };
230
+ }
231
+ const idx = Number.parseInt(arg, 10) - 1;
232
+ if (Number.isNaN(idx) || idx < 0 || idx >= list2.length) {
233
+ return {
234
+ message: `ws: invalid workspace index '${arg}'. Valid range: 1..${list2.length}`,
235
+ isError: true
236
+ };
237
+ }
238
+ const targetId = list2[idx];
239
+ workspaceStore.setWorkspace(targetId);
240
+ ipc.emit("workspace:switched", { index: idx + 1, workspaceId: targetId }, { source: "cli" });
241
+ return { message: `Switched to Workspace ${idx + 1} [${targetId}]` };
242
+ }
243
+ if (name === "tile") {
244
+ const modeArg = (rest[0] || "horizontal").toLowerCase();
245
+ const mode = modeArg === "grid" || modeArg === "vertical" ? modeArg : "horizontal";
246
+ const count = windows.tileWindows(mode);
247
+ return {
248
+ message: count > 0 ? `Tiled ${count} active window(s) in '${mode}' layout.` : `No active windows in current workspace to tile.`
249
+ };
250
+ }
251
+ if (name === "notify") {
252
+ const body = rest.join(" ");
253
+ if (!body) {
254
+ return { message: "Usage: notify <message>", isError: true };
255
+ }
256
+ notifications.add({
257
+ title: "System CLI Notification",
258
+ body,
259
+ icon: "i-heroicons-command-line",
260
+ appId: "kernel.cli"
261
+ });
262
+ return { message: `Notification dispatched: "${body}"` };
263
+ }
264
+ if (name === "ipc") {
265
+ const sub = rest[0] || "log";
266
+ if (sub === "emit") {
267
+ const channel = rest[1];
268
+ const payload = rest.slice(2).join(" ");
269
+ if (!channel) {
270
+ return { message: "Usage: ipc emit <channel> [payload]", isError: true };
271
+ }
272
+ const evt = ipc.emit(channel, { message: payload || "CLI ping" }, { source: "cli" });
273
+ return { message: `Emitted IPC event [${evt.id}] on channel '${channel}'` };
274
+ }
275
+ const recent = ipc.events.value.slice(0, 10);
276
+ if (recent.length === 0) {
277
+ return { message: "No IPC kernel events recorded." };
278
+ }
279
+ const lines = recent.map((e) => {
280
+ const time = new Date(e.timestamp).toLocaleTimeString([], { hour12: false });
281
+ return ` [${time}] ${padEnd(e.channel, 20)} (${e.source}) \u2192 ${JSON.stringify(e.payload ?? {})}`;
282
+ });
283
+ return { message: `Recent Kernel IPC Events:
284
+ ${lines.join("\n")}` };
285
+ }
286
+ if (name === "uptime") {
287
+ const up = formatDuration(Date.now() - systemBootTimestamp);
288
+ const runningCount = applications.running.value.length;
289
+ const winCount = windows.list.value.length;
290
+ return {
291
+ message: `Open Web Desktop up ${up} | ${runningCount} active process(es) | ${winCount} open window(s)`
292
+ };
293
+ }
294
+ if (name === "echo") {
295
+ return { message: rest.join(" ") };
296
+ }
297
+ if (!commands.has(name)) {
298
+ return {
299
+ message: `Command not found: '${name}'
300
+ Type 'help' to list available commands.`,
301
+ isError: true
302
+ };
303
+ }
304
+ const application = commands.get(name);
305
+ return applications.exec(application.applicationId, trimmed);
306
+ };
307
+ const exec = async (input) => {
308
+ const trimmed = input.trim();
309
+ const [name, ...rest] = trimmed.split(/\s+/);
310
+ if (!name) return;
311
+ const { callHook } = useDesktopHooks();
312
+ const execCtx = {
313
+ input: trimmed,
314
+ commandName: name,
315
+ args: rest,
316
+ cancel: false,
317
+ overrideOutput: void 0
318
+ };
319
+ await callHook("command:before-exec", execCtx);
320
+ if (execCtx.cancel) {
321
+ return execCtx.overrideOutput;
322
+ }
323
+ const output = execCtx.overrideOutput ?? await runCommandInternal(
324
+ execCtx.input,
325
+ execCtx.commandName,
326
+ execCtx.args
327
+ );
328
+ await callHook("command:after-exec", {
329
+ input: execCtx.input,
330
+ commandName: execCtx.commandName,
331
+ output
332
+ });
333
+ return output;
334
+ };
335
+ return {
336
+ register,
337
+ list,
338
+ get,
339
+ all,
340
+ exec,
341
+ // Retrocompatibility aliases for legacy apps (like app-terminal)
342
+ addCommand: register,
343
+ listCommands: list,
344
+ getCommand: get,
345
+ getAllCommands: all,
346
+ execCommand: exec
347
+ };
348
+ }
@@ -0,0 +1,3 @@
1
+ /** Reactive view of `runtimeConfig.public.desktop` (full desktop.config merge + coreVersion). */
2
+ export declare function useDesktopConfig(): import("vue").ComputedRef<unknown>;
3
+ export declare function useDesktopExtension<T = Record<string, unknown>>(key: string): import("vue").ComputedRef<T | undefined>;