@dxos/plugin-native 0.8.4-main.fd6878d → 0.9.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 (104) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +284 -0
  3. package/README.md +1 -1
  4. package/dist/lib/neutral/NativePlugin.mjs +46 -0
  5. package/dist/lib/neutral/NativePlugin.mjs.map +7 -0
  6. package/dist/lib/neutral/NativeSettings-CLYG5TJH.mjs +113 -0
  7. package/dist/lib/neutral/NativeSettings-CLYG5TJH.mjs.map +7 -0
  8. package/dist/lib/neutral/capabilities/index.mjs +17 -0
  9. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  10. package/dist/lib/neutral/chunk-75E24KAJ.mjs +34 -0
  11. package/dist/lib/neutral/chunk-75E24KAJ.mjs.map +7 -0
  12. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  13. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  14. package/dist/lib/neutral/components/index.mjs +9 -0
  15. package/dist/lib/neutral/components/index.mjs.map +7 -0
  16. package/dist/lib/neutral/index.mjs +8 -0
  17. package/dist/lib/neutral/index.mjs.map +7 -0
  18. package/dist/lib/neutral/meta.json +1 -0
  19. package/dist/lib/neutral/meta.mjs +8 -0
  20. package/dist/lib/neutral/meta.mjs.map +7 -0
  21. package/dist/lib/{browser/ollama-MF7YNEDS.mjs → neutral/ollama-BHWFTROM.mjs} +20 -31
  22. package/dist/lib/neutral/ollama-BHWFTROM.mjs.map +7 -0
  23. package/dist/lib/neutral/plugin.mjs +12 -0
  24. package/dist/lib/neutral/plugin.mjs.map +7 -0
  25. package/dist/lib/neutral/react-surface-ETNGHN4X.mjs +27 -0
  26. package/dist/lib/neutral/react-surface-ETNGHN4X.mjs.map +7 -0
  27. package/dist/lib/neutral/settings-HF6TQNU4.mjs +28 -0
  28. package/dist/lib/neutral/settings-HF6TQNU4.mjs.map +7 -0
  29. package/dist/lib/neutral/spotlight-listener-K7S6LGL3.mjs +48 -0
  30. package/dist/lib/neutral/spotlight-listener-K7S6LGL3.mjs.map +7 -0
  31. package/dist/lib/neutral/translations.mjs +35 -0
  32. package/dist/lib/neutral/translations.mjs.map +7 -0
  33. package/dist/lib/neutral/types/index.mjs +31 -0
  34. package/dist/lib/neutral/types/index.mjs.map +7 -0
  35. package/dist/lib/neutral/updater-JEBXWSSK.mjs +244 -0
  36. package/dist/lib/neutral/updater-JEBXWSSK.mjs.map +7 -0
  37. package/dist/types/src/NativePlugin.d.ts +3 -1
  38. package/dist/types/src/NativePlugin.d.ts.map +1 -1
  39. package/dist/types/src/capabilities/index.d.ts +6 -2
  40. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  41. package/dist/types/src/capabilities/ollama.d.ts +5 -4
  42. package/dist/types/src/capabilities/ollama.d.ts.map +1 -1
  43. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  44. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  45. package/dist/types/src/capabilities/settings.d.ts +7 -0
  46. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  47. package/dist/types/src/capabilities/spotlight-listener.d.ts +8 -0
  48. package/dist/types/src/capabilities/spotlight-listener.d.ts.map +1 -0
  49. package/dist/types/src/capabilities/updater.d.ts +4 -2
  50. package/dist/types/src/capabilities/updater.d.ts.map +1 -1
  51. package/dist/types/src/components/NativeSettings/NativeSettings.d.ts +6 -0
  52. package/dist/types/src/components/NativeSettings/NativeSettings.d.ts.map +1 -0
  53. package/dist/types/src/components/NativeSettings/index.d.ts +2 -0
  54. package/dist/types/src/components/NativeSettings/index.d.ts.map +1 -0
  55. package/dist/types/src/components/index.d.ts +3 -0
  56. package/dist/types/src/components/index.d.ts.map +1 -0
  57. package/dist/types/src/constants.d.ts +2 -0
  58. package/dist/types/src/constants.d.ts.map +1 -0
  59. package/dist/types/src/index.d.ts +0 -1
  60. package/dist/types/src/index.d.ts.map +1 -1
  61. package/dist/types/src/meta.d.ts +2 -3
  62. package/dist/types/src/meta.d.ts.map +1 -1
  63. package/dist/types/src/plugin.d.ts +3 -0
  64. package/dist/types/src/plugin.d.ts.map +1 -0
  65. package/dist/types/src/translations.d.ts +20 -6
  66. package/dist/types/src/translations.d.ts.map +1 -1
  67. package/dist/types/src/types/NativeCapabilities.d.ts +5 -0
  68. package/dist/types/src/types/NativeCapabilities.d.ts.map +1 -0
  69. package/dist/types/src/types/Settings.d.ts +5 -0
  70. package/dist/types/src/types/Settings.d.ts.map +1 -0
  71. package/dist/types/src/types/Update.d.ts +30 -0
  72. package/dist/types/src/types/Update.d.ts.map +1 -0
  73. package/dist/types/src/types/index.d.ts +4 -0
  74. package/dist/types/src/types/index.d.ts.map +1 -0
  75. package/dist/types/tsconfig.tsbuildinfo +1 -1
  76. package/package.json +79 -24
  77. package/src/NativePlugin.tsx +34 -22
  78. package/src/capabilities/index.ts +6 -3
  79. package/src/capabilities/ollama.ts +32 -23
  80. package/src/capabilities/react-surface.tsx +29 -0
  81. package/src/capabilities/settings.ts +31 -0
  82. package/src/capabilities/spotlight-listener.ts +58 -0
  83. package/src/capabilities/updater.ts +164 -49
  84. package/src/components/NativeSettings/NativeSettings.tsx +132 -0
  85. package/src/components/NativeSettings/index.ts +5 -0
  86. package/src/components/index.ts +7 -0
  87. package/src/constants.ts +7 -0
  88. package/src/index.ts +0 -1
  89. package/src/meta.ts +26 -6
  90. package/src/plugin.ts +9 -0
  91. package/src/translations.ts +20 -5
  92. package/src/types/NativeCapabilities.ts +16 -0
  93. package/src/types/Settings.ts +11 -0
  94. package/src/types/Update.ts +24 -0
  95. package/src/types/index.ts +7 -0
  96. package/src/vite-env.d.ts +10 -0
  97. package/dist/lib/browser/chunk-E2JDGVJI.mjs +0 -12
  98. package/dist/lib/browser/chunk-E2JDGVJI.mjs.map +0 -7
  99. package/dist/lib/browser/index.mjs +0 -52
  100. package/dist/lib/browser/index.mjs.map +0 -7
  101. package/dist/lib/browser/meta.json +0 -1
  102. package/dist/lib/browser/ollama-MF7YNEDS.mjs.map +0 -7
  103. package/dist/lib/browser/updater-MCAQYHED.mjs +0 -133
  104. package/dist/lib/browser/updater-MCAQYHED.mjs.map +0 -7
package/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2022 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
package/PLUGIN.mdl ADDED
@@ -0,0 +1,284 @@
1
+ ---
2
+ id: org.dxos.plugin.native
3
+ name: NativePlugin
4
+ version: 0.1.0
5
+ ---
6
+
7
+ A Tauri-based native platform integration plugin for DXOS Composer that enables desktop-specific
8
+ capabilities on macOS, Linux, and Windows. It manages Spotlight window integration, over-the-air
9
+ application updates, and an Ollama sidecar process for local AI model inference.
10
+
11
+ ## Extensions
12
+
13
+ The following extension dialects are used in this document.
14
+ Each extension is defined in the Appendix or resolved via its URI.
15
+
16
+ | Term | URI |
17
+ |-------------|--------------------------------|
18
+ | `type` | `org.dxos.mdl.type@1.0` |
19
+ | `feat` | `org.dxos.mdl.feat@1.0` |
20
+ | `test` | `org.dxos.mdl.test@1.0` |
21
+ | `component` | `org.dxos.mdl.component@1.0` |
22
+ | `op` | `org.dxos.mdl.op@1.0` |
23
+
24
+ ## Types
25
+
26
+ ```mdl
27
+ type Settings
28
+ fields:
29
+ # No user-visible settings fields yet; reserved for future configuration.
30
+ ```
31
+
32
+ ```mdl
33
+ type UpdateStatus
34
+ literals: unsupported | idle | checking | up-to-date | available | downloading | ready | failed
35
+ ```
36
+
37
+ ```mdl
38
+ type UpdateState
39
+ fields:
40
+ kind: UpdateStatus
41
+ version?: string # set when kind = available
42
+ checkedAt?: number # epoch ms; set when kind = up-to-date
43
+ downloaded?: number # bytes received; set when kind = downloading
44
+ contentLength?: number # total bytes; set when kind = downloading
45
+ error?: string # set when kind = failed
46
+ ```
47
+
48
+ ## Components
49
+
50
+ ```mdl
51
+ component NativeSettings
52
+ desc: |
53
+ Settings panel section rendered inside the global Settings dialog under the
54
+ App (native) plugin entry. Shows the current update status and exposes
55
+ Check / Update Now / Relaunch actions depending on the UpdateState.
56
+ props:
57
+ settings: Settings
58
+ onSettingsChange(patch: Partial<Settings>)
59
+ state:
60
+ pending: null | 'check' | 'install' | 'relaunch'
61
+ status: UpdateState # derived from UpdateManager capability
62
+ actions:
63
+ checkForUpdate()
64
+ installUpdate()
65
+ relaunchApp()
66
+ layout: |
67
+ ┌─────────────────────────────────────────┐
68
+ │ Updates │
69
+ ├─────────────────────────────────────────┤
70
+ │ [status description] [Check / Update]│
71
+ └─────────────────────────────────────────┘
72
+ ```
73
+
74
+ ## Operations
75
+
76
+ ```mdl
77
+ op CheckForUpdate
78
+ desc: |
79
+ Initiates an OTA update check via the Tauri updater plugin.
80
+ Updates the UpdateManager status atom as the check progresses.
81
+ input: void
82
+ output: void
83
+ effects: [http]
84
+ note: No-op on unsupported platforms; guarded by SUPPORTS_OTA list.
85
+ ```
86
+
87
+ ```mdl
88
+ op InstallUpdate
89
+ desc: |
90
+ Downloads and installs a pending update, streaming progress events to the
91
+ UpdateManager status atom. Does not relaunch the app automatically.
92
+ input: void
93
+ output: void
94
+ effects: [http, fs]
95
+ note: Only valid when UpdateManager status kind = available.
96
+ ```
97
+
98
+ ```mdl
99
+ op RelaunchApp
100
+ desc: |
101
+ Relaunches the Tauri app process to apply the installed update.
102
+ input: void
103
+ output: void
104
+ effects: [process]
105
+ ```
106
+
107
+ ## Features
108
+
109
+ ```mdl
110
+ feat F-1: Spotlight Window Integration
111
+
112
+ req F-1.1:
113
+ when: the main Composer window receives a spotlight:invoke Tauri event with operation = 'open'
114
+ then: the LayoutOperation.Open intent is dispatched with the provided payload
115
+
116
+ req F-1.2:
117
+ when: the main Composer window receives a spotlight:invoke event with operation = 'switch-workspace'
118
+ then: the LayoutOperation.SwitchWorkspace intent is dispatched with the provided payload
119
+
120
+ req F-1.3:
121
+ when: a spotlight:invoke event is handled successfully
122
+ then: the main Composer window is shown and brought to focus
123
+
124
+ req F-1.4:
125
+ when: a spotlight:invoke event carries an unrecognised operation
126
+ then: a warning is logged and no intent is dispatched
127
+ ```
128
+
129
+ ```mdl
130
+ feat F-2: Over-the-Air Updates
131
+
132
+ req F-2.1:
133
+ when: the Updater module activates on a supported platform (macOS, Linux, Windows) in production
134
+ then: a background Effect fiber is started that checks for updates immediately and repeats hourly
135
+
136
+ req F-2.2:
137
+ when: an update is available and successfully downloaded
138
+ then: a toast notification is shown with a Relaunch action; the status atom transitions to ready
139
+
140
+ req F-2.3:
141
+ when: the Tauri updater check throws
142
+ then: the status atom transitions to failed with a human-readable error string
143
+
144
+ req F-2.4:
145
+ when: the app is running in a dev-server build (port ≠ TAURI_LOCALHOST_PORT)
146
+ then: the updater is disabled and status remains unsupported
147
+
148
+ req F-2.5:
149
+ when: the Updater module is torn down
150
+ then: the background update-check fiber is interrupted cleanly
151
+ ```
152
+
153
+ ```mdl
154
+ feat F-3: Ollama Sidecar
155
+
156
+ req F-3.1:
157
+ when: the AssistantEvents.SetupAiServiceProviders event fires
158
+ then: the Ollama sidecar binary is spawned via Tauri shell on localhost port 21434
159
+
160
+ req F-3.2:
161
+ when: the Ollama sidecar is running
162
+ then: it is registered as an AiModelResolver under AppCapabilities.AiModelResolver
163
+
164
+ req F-3.3:
165
+ when: the Ollama capability is torn down
166
+ then: the sidecar process is killed and the managed runtime is disposed
167
+ ```
168
+
169
+ ## Acceptance
170
+
171
+ ```mdl
172
+ test T-1: Spotlight open dispatches LayoutOperation.Open
173
+ given: Composer is running and SpotlightListener is active
174
+ when: a spotlight:invoke Tauri event arrives with operation = 'open' and payload { spaceId: 'abc' }
175
+ then:
176
+ - LayoutOperation.Open is invoked with { spaceId: 'abc' }
177
+ - main window is visible and focused
178
+ ```
179
+
180
+ ```mdl
181
+ test T-2: Unknown spotlight operation is silently dropped
182
+ given: SpotlightListener is active
183
+ when: a spotlight:invoke event arrives with operation = 'foobar'
184
+ then:
185
+ - no intent is dispatched
186
+ - a warning log entry is emitted with the unknown operation name
187
+ ```
188
+
189
+ ```mdl
190
+ test T-3: Update check transitions status atom
191
+ given: Updater module is active on a supported platform
192
+ when: CheckForUpdate is called
193
+ then:
194
+ - status transitions to checking while the HTTP call is in-flight
195
+ - status transitions to up-to-date if no update is available
196
+ - status transitions to available with a version string if an update exists
197
+ ```
198
+
199
+ ```mdl
200
+ test T-4: Failed update check transitions to failed status
201
+ given: Updater module is active
202
+ when: the Tauri updater plugin throws an error during check
203
+ then:
204
+ - status transitions to failed
205
+ - status.error contains a human-readable description
206
+ ```
207
+
208
+ ```mdl
209
+ test T-5: Dev-server build disables updater
210
+ given: the app is served on a port other than TAURI_LOCALHOST_PORT
211
+ when: the Updater module activates
212
+ then:
213
+ - status is set to unsupported immediately
214
+ - no HTTP update check is performed
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Appendix: Extension Definitions
220
+
221
+ Extension block types used in this document are defined below using
222
+ the core `ext` primitive — the only construct the base language provides.
223
+
224
+ ```mdl
225
+ ext type
226
+ uri: org.dxos.mdl.type@1.0
227
+ desc: A named data structure with typed fields and optional literals.
228
+ fields:
229
+ desc?: Prose
230
+ fields?: FieldMap # name[?]: TypeExpr (# inline comment)
231
+ literals?: UnionList # a | b | c
232
+ extends?: TypeRef[]
233
+ ```
234
+
235
+ ```mdl
236
+ ext feat
237
+ uri: org.dxos.mdl.feat@1.0
238
+ desc: A named feature grouping one or more requirements.
239
+ fields:
240
+ desc?: Prose
241
+ req: RequirementList
242
+ nesting: self # feat blocks may contain feat blocks
243
+ ```
244
+
245
+ ```mdl
246
+ ext test
247
+ uri: org.dxos.mdl.test@1.0
248
+ desc: An acceptance scenario expressed as given / when / then steps.
249
+ fields:
250
+ given?: Step | Step[]
251
+ when?: Step | Step[]
252
+ then: Step | Step[]
253
+ tags?: TagList
254
+ ```
255
+
256
+ ```mdl
257
+ ext component
258
+ uri: org.dxos.mdl.component@1.0
259
+ desc: A UI component with props, internal state, slots, actions, and events.
260
+ fields:
261
+ desc?: Prose
262
+ props?: FieldMap # external inputs (immutable inside component)
263
+ state?: FieldMap # internal reactive state
264
+ slots?: FieldMap # named ReactNode injection points
265
+ actions?: ActionMap # methods the component exposes or handles
266
+ emits?: EventMap # events the component raises to its parent
267
+ layout?: CodeBlock # ASCII sketch of visual structure (non-normative)
268
+ ```
269
+
270
+ ```mdl
271
+ ext op
272
+ uri: org.dxos.mdl.op@1.0
273
+ desc: |
274
+ A named operation with typed inputs, outputs, and declared errors.
275
+ Pure ops have no effects or requires. Effectful ops declare both.
276
+ fields:
277
+ desc?: Prose
278
+ input?: FieldMap # named input parameters
279
+ output?: TypeExpr # return type
280
+ errors?: ErrorMap # name: Prose (when this error occurs)
281
+ effects?: EffectList # echo:read | echo:write | http | fs | ...
282
+ requires?: ServiceList # injected service dependencies
283
+ note?: Prose # implementation guidance (non-normative)
284
+ ```
package/README.md CHANGED
@@ -12,4 +12,4 @@ Composer plugin that runs when being used by the Socket Supply Co. runtime on a
12
12
 
13
13
  Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
14
14
 
15
- License: [MIT](./LICENSE) Copyright 2023 © DXOS
15
+ License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2023 © DXOS
@@ -0,0 +1,46 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/NativePlugin.tsx
4
+ import { ActivationEvents, Plugin } from "@dxos/app-framework";
5
+ import { AppPlugin } from "@dxos/app-toolkit";
6
+ import { AssistantEvents } from "@dxos/plugin-assistant";
7
+ import { NativeSettings, Ollama, ReactSurface, SpotlightListener, Updater } from "#capabilities";
8
+ import { meta } from "#meta";
9
+ import { translations } from "#translations";
10
+
11
+ // raw-loader:/__w/dxos/dxos/packages/plugins/plugin-native/PLUGIN.mdl?raw
12
+ var PLUGIN_default = "---\nid: org.dxos.plugin.native\nname: NativePlugin\nversion: 0.1.0\n---\n\nA Tauri-based native platform integration plugin for DXOS Composer that enables desktop-specific\ncapabilities on macOS, Linux, and Windows. It manages Spotlight window integration, over-the-air\napplication updates, and an Ollama sidecar process for local AI model inference.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype Settings\n fields:\n # No user-visible settings fields yet; reserved for future configuration.\n```\n\n```mdl\ntype UpdateStatus\n literals: unsupported | idle | checking | up-to-date | available | downloading | ready | failed\n```\n\n```mdl\ntype UpdateState\n fields:\n kind: UpdateStatus\n version?: string # set when kind = available\n checkedAt?: number # epoch ms; set when kind = up-to-date\n downloaded?: number # bytes received; set when kind = downloading\n contentLength?: number # total bytes; set when kind = downloading\n error?: string # set when kind = failed\n```\n\n## Components\n\n```mdl\ncomponent NativeSettings\n desc: |\n Settings panel section rendered inside the global Settings dialog under the\n App (native) plugin entry. Shows the current update status and exposes\n Check / Update Now / Relaunch actions depending on the UpdateState.\n props:\n settings: Settings\n onSettingsChange(patch: Partial<Settings>)\n state:\n pending: null | 'check' | 'install' | 'relaunch'\n status: UpdateState # derived from UpdateManager capability\n actions:\n checkForUpdate()\n installUpdate()\n relaunchApp()\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 Updates \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 [status description] [Check / Update]\u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n## Operations\n\n```mdl\nop CheckForUpdate\n desc: |\n Initiates an OTA update check via the Tauri updater plugin.\n Updates the UpdateManager status atom as the check progresses.\n input: void\n output: void\n effects: [http]\n note: No-op on unsupported platforms; guarded by SUPPORTS_OTA list.\n```\n\n```mdl\nop InstallUpdate\n desc: |\n Downloads and installs a pending update, streaming progress events to the\n UpdateManager status atom. Does not relaunch the app automatically.\n input: void\n output: void\n effects: [http, fs]\n note: Only valid when UpdateManager status kind = available.\n```\n\n```mdl\nop RelaunchApp\n desc: |\n Relaunches the Tauri app process to apply the installed update.\n input: void\n output: void\n effects: [process]\n```\n\n## Features\n\n```mdl\nfeat F-1: Spotlight Window Integration\n\n req F-1.1:\n when: the main Composer window receives a spotlight:invoke Tauri event with operation = 'open'\n then: the LayoutOperation.Open intent is dispatched with the provided payload\n\n req F-1.2:\n when: the main Composer window receives a spotlight:invoke event with operation = 'switch-workspace'\n then: the LayoutOperation.SwitchWorkspace intent is dispatched with the provided payload\n\n req F-1.3:\n when: a spotlight:invoke event is handled successfully\n then: the main Composer window is shown and brought to focus\n\n req F-1.4:\n when: a spotlight:invoke event carries an unrecognised operation\n then: a warning is logged and no intent is dispatched\n```\n\n```mdl\nfeat F-2: Over-the-Air Updates\n\n req F-2.1:\n when: the Updater module activates on a supported platform (macOS, Linux, Windows) in production\n then: a background Effect fiber is started that checks for updates immediately and repeats hourly\n\n req F-2.2:\n when: an update is available and successfully downloaded\n then: a toast notification is shown with a Relaunch action; the status atom transitions to ready\n\n req F-2.3:\n when: the Tauri updater check throws\n then: the status atom transitions to failed with a human-readable error string\n\n req F-2.4:\n when: the app is running in a dev-server build (port \u2260 TAURI_LOCALHOST_PORT)\n then: the updater is disabled and status remains unsupported\n\n req F-2.5:\n when: the Updater module is torn down\n then: the background update-check fiber is interrupted cleanly\n```\n\n```mdl\nfeat F-3: Ollama Sidecar\n\n req F-3.1:\n when: the AssistantEvents.SetupAiServiceProviders event fires\n then: the Ollama sidecar binary is spawned via Tauri shell on localhost port 21434\n\n req F-3.2:\n when: the Ollama sidecar is running\n then: it is registered as an AiModelResolver under AppCapabilities.AiModelResolver\n\n req F-3.3:\n when: the Ollama capability is torn down\n then: the sidecar process is killed and the managed runtime is disposed\n```\n\n## Acceptance\n\n```mdl\ntest T-1: Spotlight open dispatches LayoutOperation.Open\n given: Composer is running and SpotlightListener is active\n when: a spotlight:invoke Tauri event arrives with operation = 'open' and payload { spaceId: 'abc' }\n then:\n - LayoutOperation.Open is invoked with { spaceId: 'abc' }\n - main window is visible and focused\n```\n\n```mdl\ntest T-2: Unknown spotlight operation is silently dropped\n given: SpotlightListener is active\n when: a spotlight:invoke event arrives with operation = 'foobar'\n then:\n - no intent is dispatched\n - a warning log entry is emitted with the unknown operation name\n```\n\n```mdl\ntest T-3: Update check transitions status atom\n given: Updater module is active on a supported platform\n when: CheckForUpdate is called\n then:\n - status transitions to checking while the HTTP call is in-flight\n - status transitions to up-to-date if no update is available\n - status transitions to available with a version string if an update exists\n```\n\n```mdl\ntest T-4: Failed update check transitions to failed status\n given: Updater module is active\n when: the Tauri updater plugin throws an error during check\n then:\n - status transitions to failed\n - status.error contains a human-readable description\n```\n\n```mdl\ntest T-5: Dev-server build disables updater\n given: the app is served on a port other than TAURI_LOCALHOST_PORT\n when: the Updater module activates\n then:\n - status is set to unsupported immediately\n - no HTTP update check is performed\n```\n\n---\n\n## Appendix: Extension Definitions\n\nExtension block types used in this document are defined below using\nthe core `ext` primitive \u2014 the only construct the base language provides.\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap # name[?]: TypeExpr (# inline comment)\n literals?: UnionList # a | b | c\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self # feat blocks may contain feat blocks\n```\n\n```mdl\next test\n uri: org.dxos.mdl.test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap # external inputs (immutable inside component)\n state?: FieldMap # internal reactive state\n slots?: FieldMap # named ReactNode injection points\n actions?: ActionMap # methods the component exposes or handles\n emits?: EventMap # events the component raises to its parent\n layout?: CodeBlock # ASCII sketch of visual structure (non-normative)\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap # named input parameters\n output?: TypeExpr # return type\n errors?: ErrorMap # name: Prose (when this error occurs)\n effects?: EffectList # echo:read | echo:write | http | fs | ...\n requires?: ServiceList # injected service dependencies\n note?: Prose # implementation guidance (non-normative)\n```\n";
13
+
14
+ // src/NativePlugin.tsx
15
+ var NativePlugin = Plugin.define(meta).pipe(AppPlugin.addSettingsModule({
16
+ activate: NativeSettings
17
+ }), AppPlugin.addSurfaceModule({
18
+ activate: ReactSurface
19
+ }), AppPlugin.addTranslationsModule({
20
+ translations
21
+ }), Plugin.addModule({
22
+ id: "spotlight-listener",
23
+ activatesOn: ActivationEvents.ProcessManagerReady,
24
+ activate: SpotlightListener
25
+ }), Plugin.addModule({
26
+ id: "updater",
27
+ activatesOn: ActivationEvents.ProcessManagerReady,
28
+ activate: Updater
29
+ }), Plugin.addModule({
30
+ id: "ollama",
31
+ activatesOn: AssistantEvents.SetupAiServiceProviders,
32
+ activate: Ollama
33
+ }), AppPlugin.addPluginAssetModule({
34
+ asset: {
35
+ pluginId: meta.id,
36
+ path: "PLUGIN.mdl",
37
+ content: PLUGIN_default,
38
+ mimeType: "application/x-mdl"
39
+ }
40
+ }), Plugin.make);
41
+ var NativePlugin_default = NativePlugin;
42
+ export {
43
+ NativePlugin,
44
+ NativePlugin_default as default
45
+ };
46
+ //# sourceMappingURL=NativePlugin.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/NativePlugin.tsx", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-native/PLUGIN.mdl?raw"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { ActivationEvents, Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { AssistantEvents } from '@dxos/plugin-assistant';\n\nimport { NativeSettings, Ollama, ReactSurface, SpotlightListener, Updater } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../PLUGIN.mdl?raw';\n\nexport const NativePlugin = Plugin.define(meta).pipe(\n AppPlugin.addSettingsModule({ activate: NativeSettings }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n id: 'spotlight-listener',\n activatesOn: ActivationEvents.ProcessManagerReady,\n activate: SpotlightListener,\n }),\n Plugin.addModule({\n id: 'updater',\n activatesOn: ActivationEvents.ProcessManagerReady,\n activate: Updater,\n }),\n Plugin.addModule({\n id: 'ollama',\n activatesOn: AssistantEvents.SetupAiServiceProviders,\n activate: Ollama,\n }),\n AppPlugin.addPluginAssetModule({\n asset: { pluginId: meta.id, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },\n }),\n Plugin.make,\n);\n\nexport default NativePlugin;\n", "---\nid: org.dxos.plugin.native\nname: NativePlugin\nversion: 0.1.0\n---\n\nA Tauri-based native platform integration plugin for DXOS Composer that enables desktop-specific\ncapabilities on macOS, Linux, and Windows. It manages Spotlight window integration, over-the-air\napplication updates, and an Ollama sidecar process for local AI model inference.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype Settings\n fields:\n # No user-visible settings fields yet; reserved for future configuration.\n```\n\n```mdl\ntype UpdateStatus\n literals: unsupported | idle | checking | up-to-date | available | downloading | ready | failed\n```\n\n```mdl\ntype UpdateState\n fields:\n kind: UpdateStatus\n version?: string # set when kind = available\n checkedAt?: number # epoch ms; set when kind = up-to-date\n downloaded?: number # bytes received; set when kind = downloading\n contentLength?: number # total bytes; set when kind = downloading\n error?: string # set when kind = failed\n```\n\n## Components\n\n```mdl\ncomponent NativeSettings\n desc: |\n Settings panel section rendered inside the global Settings dialog under the\n App (native) plugin entry. Shows the current update status and exposes\n Check / Update Now / Relaunch actions depending on the UpdateState.\n props:\n settings: Settings\n onSettingsChange(patch: Partial<Settings>)\n state:\n pending: null | 'check' | 'install' | 'relaunch'\n status: UpdateState # derived from UpdateManager capability\n actions:\n checkForUpdate()\n installUpdate()\n relaunchApp()\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 Updates \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 [status description] [Check / Update]\u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n## Operations\n\n```mdl\nop CheckForUpdate\n desc: |\n Initiates an OTA update check via the Tauri updater plugin.\n Updates the UpdateManager status atom as the check progresses.\n input: void\n output: void\n effects: [http]\n note: No-op on unsupported platforms; guarded by SUPPORTS_OTA list.\n```\n\n```mdl\nop InstallUpdate\n desc: |\n Downloads and installs a pending update, streaming progress events to the\n UpdateManager status atom. Does not relaunch the app automatically.\n input: void\n output: void\n effects: [http, fs]\n note: Only valid when UpdateManager status kind = available.\n```\n\n```mdl\nop RelaunchApp\n desc: |\n Relaunches the Tauri app process to apply the installed update.\n input: void\n output: void\n effects: [process]\n```\n\n## Features\n\n```mdl\nfeat F-1: Spotlight Window Integration\n\n req F-1.1:\n when: the main Composer window receives a spotlight:invoke Tauri event with operation = 'open'\n then: the LayoutOperation.Open intent is dispatched with the provided payload\n\n req F-1.2:\n when: the main Composer window receives a spotlight:invoke event with operation = 'switch-workspace'\n then: the LayoutOperation.SwitchWorkspace intent is dispatched with the provided payload\n\n req F-1.3:\n when: a spotlight:invoke event is handled successfully\n then: the main Composer window is shown and brought to focus\n\n req F-1.4:\n when: a spotlight:invoke event carries an unrecognised operation\n then: a warning is logged and no intent is dispatched\n```\n\n```mdl\nfeat F-2: Over-the-Air Updates\n\n req F-2.1:\n when: the Updater module activates on a supported platform (macOS, Linux, Windows) in production\n then: a background Effect fiber is started that checks for updates immediately and repeats hourly\n\n req F-2.2:\n when: an update is available and successfully downloaded\n then: a toast notification is shown with a Relaunch action; the status atom transitions to ready\n\n req F-2.3:\n when: the Tauri updater check throws\n then: the status atom transitions to failed with a human-readable error string\n\n req F-2.4:\n when: the app is running in a dev-server build (port \u2260 TAURI_LOCALHOST_PORT)\n then: the updater is disabled and status remains unsupported\n\n req F-2.5:\n when: the Updater module is torn down\n then: the background update-check fiber is interrupted cleanly\n```\n\n```mdl\nfeat F-3: Ollama Sidecar\n\n req F-3.1:\n when: the AssistantEvents.SetupAiServiceProviders event fires\n then: the Ollama sidecar binary is spawned via Tauri shell on localhost port 21434\n\n req F-3.2:\n when: the Ollama sidecar is running\n then: it is registered as an AiModelResolver under AppCapabilities.AiModelResolver\n\n req F-3.3:\n when: the Ollama capability is torn down\n then: the sidecar process is killed and the managed runtime is disposed\n```\n\n## Acceptance\n\n```mdl\ntest T-1: Spotlight open dispatches LayoutOperation.Open\n given: Composer is running and SpotlightListener is active\n when: a spotlight:invoke Tauri event arrives with operation = 'open' and payload { spaceId: 'abc' }\n then:\n - LayoutOperation.Open is invoked with { spaceId: 'abc' }\n - main window is visible and focused\n```\n\n```mdl\ntest T-2: Unknown spotlight operation is silently dropped\n given: SpotlightListener is active\n when: a spotlight:invoke event arrives with operation = 'foobar'\n then:\n - no intent is dispatched\n - a warning log entry is emitted with the unknown operation name\n```\n\n```mdl\ntest T-3: Update check transitions status atom\n given: Updater module is active on a supported platform\n when: CheckForUpdate is called\n then:\n - status transitions to checking while the HTTP call is in-flight\n - status transitions to up-to-date if no update is available\n - status transitions to available with a version string if an update exists\n```\n\n```mdl\ntest T-4: Failed update check transitions to failed status\n given: Updater module is active\n when: the Tauri updater plugin throws an error during check\n then:\n - status transitions to failed\n - status.error contains a human-readable description\n```\n\n```mdl\ntest T-5: Dev-server build disables updater\n given: the app is served on a port other than TAURI_LOCALHOST_PORT\n when: the Updater module activates\n then:\n - status is set to unsupported immediately\n - no HTTP update check is performed\n```\n\n---\n\n## Appendix: Extension Definitions\n\nExtension block types used in this document are defined below using\nthe core `ext` primitive \u2014 the only construct the base language provides.\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap # name[?]: TypeExpr (# inline comment)\n literals?: UnionList # a | b | c\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self # feat blocks may contain feat blocks\n```\n\n```mdl\next test\n uri: org.dxos.mdl.test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap # external inputs (immutable inside component)\n state?: FieldMap # internal reactive state\n slots?: FieldMap # named ReactNode injection points\n actions?: ActionMap # methods the component exposes or handles\n emits?: EventMap # events the component raises to its parent\n layout?: CodeBlock # ASCII sketch of visual structure (non-normative)\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap # named input parameters\n output?: TypeExpr # return type\n errors?: ErrorMap # name: Prose (when this error occurs)\n effects?: EffectList # echo:read | echo:write | http | fs | ...\n requires?: ServiceList # injected service dependencies\n note?: Prose # implementation guidance (non-normative)\n```\n"],
5
+ "mappings": ";;;AAIA,SAASA,kBAAkBC,cAAc;AACzC,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAEhC,SAASC,gBAAgBC,QAAQC,cAAcC,mBAAmBC,eAAe;AACjF,SAASC,YAAY;AACrB,SAASC,oBAAoB;;;ACV7B;;;ADeO,IAAMC,eAAeC,OAAOC,OAAOC,IAAAA,EAAMC,KAC9CC,UAAUC,kBAAkB;EAAEC,UAAUC;AAAe,CAAA,GACvDH,UAAUI,iBAAiB;EAAEF,UAAUG;AAAa,CAAA,GACpDL,UAAUM,sBAAsB;EAAEC;AAAa,CAAA,GAC/CX,OAAOY,UAAU;EACfC,IAAI;EACJC,aAAaC,iBAAiBC;EAC9BV,UAAUW;AACZ,CAAA,GACAjB,OAAOY,UAAU;EACfC,IAAI;EACJC,aAAaC,iBAAiBC;EAC9BV,UAAUY;AACZ,CAAA,GACAlB,OAAOY,UAAU;EACfC,IAAI;EACJC,aAAaK,gBAAgBC;EAC7Bd,UAAUe;AACZ,CAAA,GACAjB,UAAUkB,qBAAqB;EAC7BC,OAAO;IAAEC,UAAUtB,KAAKW;IAAIY,MAAM;IAAcC,SAASC;IAAYC,UAAU;EAAoB;AACrG,CAAA,GACA5B,OAAO6B,IAAI;AAGb,IAAA,uBAAe9B;",
6
+ "names": ["ActivationEvents", "Plugin", "AppPlugin", "AssistantEvents", "NativeSettings", "Ollama", "ReactSurface", "SpotlightListener", "Updater", "meta", "translations", "NativePlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addSettingsModule", "activate", "NativeSettings", "addSurfaceModule", "ReactSurface", "addTranslationsModule", "translations", "addModule", "id", "activatesOn", "ActivationEvents", "ProcessManagerReady", "SpotlightListener", "Updater", "AssistantEvents", "SetupAiServiceProviders", "Ollama", "addPluginAssetModule", "asset", "pluginId", "path", "content", "pluginSpec", "mimeType", "make"]
7
+ }
@@ -0,0 +1,113 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/components/NativeSettings/NativeSettings.tsx
4
+ import { useAtomValue } from "@effect-atom/atom-react";
5
+ import { formatDistanceToNow } from "date-fns/formatDistanceToNow";
6
+ import * as Match from "effect/Match";
7
+ import React, { useState } from "react";
8
+ import { useCapability } from "@dxos/app-framework/ui";
9
+ import { Button, useTranslation } from "@dxos/react-ui";
10
+ import { Settings as SettingsForm } from "@dxos/react-ui-form";
11
+ import { meta } from "#meta";
12
+ import { NativeCapabilities } from "#types";
13
+ var NativeSettings = (_props) => {
14
+ const { t } = useTranslation(meta.id);
15
+ const manager = useCapability(NativeCapabilities.UpdateManager);
16
+ const status = useAtomValue(manager.status);
17
+ const [pending, setPending] = useState(null);
18
+ const runAction = (kind, action) => async () => {
19
+ setPending(kind);
20
+ try {
21
+ await action();
22
+ } finally {
23
+ setPending(null);
24
+ }
25
+ };
26
+ const { description, button } = renderUpdateRow(status, pending, t, {
27
+ onCheck: runAction("check", manager.check),
28
+ onInstall: runAction("install", manager.install),
29
+ onRelaunch: runAction("relaunch", manager.relaunch)
30
+ });
31
+ return /* @__PURE__ */ React.createElement(SettingsForm.Viewport, null, /* @__PURE__ */ React.createElement(SettingsForm.Section, {
32
+ title: t("settings.title")
33
+ }, /* @__PURE__ */ React.createElement(SettingsForm.Item, {
34
+ title: t("settings.updates.label"),
35
+ description
36
+ }, button)));
37
+ };
38
+ var renderUpdateRow = (status, pending, t, { onCheck, onInstall, onRelaunch }) => {
39
+ const isChecking = pending === "check" || status.kind === "checking";
40
+ const isInstalling = pending === "install" || status.kind === "downloading";
41
+ const checkButton = (disabled = false) => /* @__PURE__ */ React.createElement(Button, {
42
+ disabled: disabled || isChecking || isInstalling || pending === "relaunch",
43
+ onClick: () => void onCheck()
44
+ }, isChecking ? t("settings.updates.checking.label") : t("settings.updates.check.label"));
45
+ return Match.value(status).pipe(Match.withReturnType(), Match.when({
46
+ kind: "unsupported"
47
+ }, () => ({
48
+ description: t("settings.updates.unsupported.message"),
49
+ button: checkButton(true)
50
+ })), Match.when({
51
+ kind: "idle"
52
+ }, () => ({
53
+ description: isChecking ? t("settings.updates.checking.message") : t("settings.updates.idle.message"),
54
+ button: checkButton()
55
+ })), Match.when({
56
+ kind: "checking"
57
+ }, () => ({
58
+ description: t("settings.updates.checking.message"),
59
+ button: checkButton()
60
+ })), Match.when({
61
+ kind: "up-to-date"
62
+ }, (s) => ({
63
+ description: isChecking ? t("settings.updates.checking.message") : t("settings.updates.up-to-date.message", {
64
+ checkedAt: formatDistanceToNow(new Date(s.checkedAt), {
65
+ addSuffix: true
66
+ })
67
+ }),
68
+ button: checkButton()
69
+ })), Match.when({
70
+ kind: "available"
71
+ }, (s) => ({
72
+ description: t("settings.updates.available.message", {
73
+ version: s.version
74
+ }),
75
+ button: /* @__PURE__ */ React.createElement(Button, {
76
+ variant: "primary",
77
+ disabled: isInstalling,
78
+ onClick: () => void onInstall()
79
+ }, isInstalling ? t("settings.updates.downloading.label") : t("settings.updates.update-now.label"))
80
+ })), Match.when({
81
+ kind: "downloading"
82
+ }, (s) => {
83
+ const percent = s.contentLength > 0 ? Math.round(s.downloaded / s.contentLength * 100) : 0;
84
+ return {
85
+ description: t("settings.updates.downloading.message", {
86
+ percent
87
+ }),
88
+ button: /* @__PURE__ */ React.createElement(Button, {
89
+ disabled: true
90
+ }, t("settings.updates.downloading.label"))
91
+ };
92
+ }), Match.when({
93
+ kind: "ready"
94
+ }, () => ({
95
+ description: t("settings.updates.ready.message"),
96
+ button: /* @__PURE__ */ React.createElement(Button, {
97
+ variant: "primary",
98
+ disabled: pending === "relaunch",
99
+ onClick: () => void onRelaunch()
100
+ }, t("settings.updates.relaunch.label"))
101
+ })), Match.when({
102
+ kind: "failed"
103
+ }, (s) => ({
104
+ description: t("settings.updates.failed.message", {
105
+ error: s.error
106
+ }),
107
+ button: checkButton()
108
+ })), Match.exhaustive);
109
+ };
110
+ export {
111
+ NativeSettings as default
112
+ };
113
+ //# sourceMappingURL=NativeSettings-CLYG5TJH.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/NativeSettings/NativeSettings.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport { formatDistanceToNow } from 'date-fns/formatDistanceToNow';\nimport * as Match from 'effect/Match';\nimport React, { type ReactNode, useState } from 'react';\n\nimport { useCapability } from '@dxos/app-framework/ui';\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { Button, useTranslation } from '@dxos/react-ui';\nimport { Settings as SettingsForm } from '@dxos/react-ui-form';\n\nimport { meta } from '#meta';\nimport { NativeCapabilities, type Settings, type Update } from '#types';\n\nexport type NativeSettingsProps = AppSurface.SettingsArticleProps<Settings.Settings>;\n\ntype Pending = null | 'check' | 'install' | 'relaunch';\n\ntype UpdateActions = {\n onCheck: () => Promise<void>;\n onInstall: () => Promise<void>;\n onRelaunch: () => Promise<void>;\n};\n\ntype UpdateRow = { description: string; button: ReactNode };\n\nexport const NativeSettings = (_props: NativeSettingsProps) => {\n const { t } = useTranslation(meta.id);\n const manager = useCapability(NativeCapabilities.UpdateManager);\n const status = useAtomValue(manager.status);\n\n // UI-level pending flag. The status atom can flip between `checking` and `up-to-date` faster\n // than the user can perceive, so we also gate the button on the click handler's lifetime to\n // guarantee no duplicate triggers and a visible busy state.\n const [pending, setPending] = useState<Pending>(null);\n\n const runAction = (kind: Exclude<Pending, null>, action: () => Promise<void>) => async () => {\n setPending(kind);\n try {\n await action();\n } finally {\n setPending(null);\n }\n };\n\n const { description, button } = renderUpdateRow(status, pending, t, {\n onCheck: runAction('check', manager.check),\n onInstall: runAction('install', manager.install),\n onRelaunch: runAction('relaunch', manager.relaunch),\n });\n\n return (\n <SettingsForm.Viewport>\n <SettingsForm.Section title={t('settings.title')}>\n <SettingsForm.Item title={t('settings.updates.label')} description={description}>\n {button}\n </SettingsForm.Item>\n </SettingsForm.Section>\n </SettingsForm.Viewport>\n );\n};\n\nconst renderUpdateRow = (\n status: Update.Status,\n pending: Pending,\n t: (key: string, options?: Record<string, unknown>) => string,\n { onCheck, onInstall, onRelaunch }: UpdateActions,\n): UpdateRow => {\n const isChecking = pending === 'check' || status.kind === 'checking';\n const isInstalling = pending === 'install' || status.kind === 'downloading';\n\n const checkButton = (disabled = false) => (\n <Button disabled={disabled || isChecking || isInstalling || pending === 'relaunch'} onClick={() => void onCheck()}>\n {isChecking ? t('settings.updates.checking.label') : t('settings.updates.check.label')}\n </Button>\n );\n\n return Match.value(status).pipe(\n Match.withReturnType<UpdateRow>(),\n Match.when({ kind: 'unsupported' }, () => ({\n description: t('settings.updates.unsupported.message'),\n button: checkButton(true),\n })),\n Match.when({ kind: 'idle' }, () => ({\n description: isChecking ? t('settings.updates.checking.message') : t('settings.updates.idle.message'),\n button: checkButton(),\n })),\n Match.when({ kind: 'checking' }, () => ({\n description: t('settings.updates.checking.message'),\n button: checkButton(),\n })),\n Match.when({ kind: 'up-to-date' }, (s) => ({\n description: isChecking\n ? t('settings.updates.checking.message')\n : t('settings.updates.up-to-date.message', {\n checkedAt: formatDistanceToNow(new Date(s.checkedAt), { addSuffix: true }),\n }),\n button: checkButton(),\n })),\n Match.when({ kind: 'available' }, (s) => ({\n description: t('settings.updates.available.message', { version: s.version }),\n button: (\n <Button variant='primary' disabled={isInstalling} onClick={() => void onInstall()}>\n {isInstalling ? t('settings.updates.downloading.label') : t('settings.updates.update-now.label')}\n </Button>\n ),\n })),\n Match.when({ kind: 'downloading' }, (s) => {\n const percent = s.contentLength > 0 ? Math.round((s.downloaded / s.contentLength) * 100) : 0;\n return {\n description: t('settings.updates.downloading.message', { percent }),\n button: <Button disabled>{t('settings.updates.downloading.label')}</Button>,\n };\n }),\n Match.when({ kind: 'ready' }, () => ({\n description: t('settings.updates.ready.message'),\n button: (\n <Button variant='primary' disabled={pending === 'relaunch'} onClick={() => void onRelaunch()}>\n {t('settings.updates.relaunch.label')}\n </Button>\n ),\n })),\n Match.when({ kind: 'failed' }, (s) => ({\n description: t('settings.updates.failed.message', { error: s.error }),\n button: checkButton(),\n })),\n Match.exhaustive,\n );\n};\n"],
5
+ "mappings": "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",
6
+ "names": ["useAtomValue", "formatDistanceToNow", "Match", "React", "useState", "useCapability", "Button", "useTranslation", "Settings", "SettingsForm", "meta", "NativeCapabilities", "NativeSettings", "_props", "t", "id", "manager", "UpdateManager", "status", "pending", "setPending", "runAction", "kind", "action", "description", "button", "renderUpdateRow", "onCheck", "check", "onInstall", "install", "onRelaunch", "relaunch", "Viewport", "Section", "title", "Item", "isChecking", "isInstalling", "checkButton", "disabled", "onClick", "value", "pipe", "withReturnType", "when", "s", "checkedAt", "Date", "addSuffix", "version", "variant", "percent", "contentLength", "Math", "round", "downloaded", "error", "exhaustive"]
7
+ }
@@ -0,0 +1,17 @@
1
+ import "../chunk-J5LGTIGS.mjs";
2
+
3
+ // src/capabilities/index.ts
4
+ import { Capability } from "@dxos/app-framework";
5
+ var NativeSettings = Capability.lazy("NativeSettings", () => import("../settings-HF6TQNU4.mjs"));
6
+ var Ollama = Capability.lazy("Ollama", () => import("../ollama-BHWFTROM.mjs"));
7
+ var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-ETNGHN4X.mjs"));
8
+ var SpotlightListener = Capability.lazy("SpotlightListener", () => import("../spotlight-listener-K7S6LGL3.mjs"));
9
+ var Updater = Capability.lazy("Updater", () => import("../updater-JEBXWSSK.mjs"));
10
+ export {
11
+ NativeSettings,
12
+ Ollama,
13
+ ReactSurface,
14
+ SpotlightListener,
15
+ Updater
16
+ };
17
+ //# sourceMappingURL=index.mjs.map