@talex-touch/utils 1.0.42 → 1.0.44

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 (233) hide show
  1. package/.eslintcache +1 -0
  2. package/__tests__/cloud-sync-sdk.test.ts +442 -0
  3. package/__tests__/icons/icons.test.ts +84 -0
  4. package/__tests__/plugin-sdk-lifecycle.test.ts +130 -0
  5. package/__tests__/power-sdk.test.ts +143 -0
  6. package/__tests__/preset-export-types.test.ts +108 -0
  7. package/__tests__/search/fuzzy-match.test.ts +137 -0
  8. package/__tests__/transport/port-policy.test.ts +44 -0
  9. package/__tests__/transport-domain-sdks.test.ts +152 -0
  10. package/__tests__/types/update.test.ts +67 -0
  11. package/account/account-sdk.ts +915 -0
  12. package/account/index.ts +2 -0
  13. package/account/types.ts +321 -0
  14. package/analytics/client.ts +136 -0
  15. package/analytics/index.ts +2 -0
  16. package/analytics/types.ts +156 -0
  17. package/animation/auto-resize.ts +322 -0
  18. package/animation/window-node.ts +26 -19
  19. package/auth/clerk-types.ts +12 -30
  20. package/auth/index.ts +0 -2
  21. package/auth/useAuthState.ts +6 -14
  22. package/base/index.ts +2 -0
  23. package/base/log-level.ts +105 -0
  24. package/channel/index.ts +170 -69
  25. package/cloud-sync/cloud-sync-sdk.ts +450 -0
  26. package/cloud-sync/index.ts +1 -0
  27. package/common/file-scan-utils.ts +17 -9
  28. package/common/index.ts +4 -0
  29. package/common/logger/index.ts +46 -0
  30. package/common/logger/logger-manager.ts +303 -0
  31. package/common/logger/module-logger.ts +270 -0
  32. package/common/logger/transport-logger.ts +234 -0
  33. package/common/logger/types.ts +93 -0
  34. package/common/search/gather.ts +48 -6
  35. package/common/search/index.ts +8 -0
  36. package/common/storage/constants.ts +13 -0
  37. package/common/storage/entity/app-settings.ts +245 -0
  38. package/common/storage/entity/index.ts +3 -0
  39. package/common/storage/entity/layout-atom-types.ts +147 -0
  40. package/common/storage/entity/openers.ts +1 -0
  41. package/common/storage/entity/preset-cloud-api.ts +132 -0
  42. package/common/storage/entity/preset-export-types.ts +256 -0
  43. package/common/storage/entity/shortcut-settings.ts +1 -0
  44. package/common/storage/shortcut-storage.ts +11 -0
  45. package/common/utils/clone-diagnostics.ts +105 -0
  46. package/common/utils/file.ts +16 -8
  47. package/common/utils/index.ts +6 -2
  48. package/common/utils/payload-preview.ts +173 -0
  49. package/common/utils/polling.ts +167 -13
  50. package/common/utils/safe-path.ts +103 -0
  51. package/common/utils/safe-shell.ts +115 -0
  52. package/common/utils/task-queue.ts +4 -1
  53. package/core-box/builder/tuff-builder.ts +0 -1
  54. package/core-box/index.ts +1 -1
  55. package/core-box/recommendation.ts +38 -1
  56. package/core-box/tuff/tuff-dsl.ts +32 -0
  57. package/electron/download-manager.ts +10 -7
  58. package/electron/env-tool.ts +42 -40
  59. package/electron/index.ts +0 -1
  60. package/env/index.ts +156 -0
  61. package/eslint.config.js +55 -0
  62. package/i18n/index.ts +62 -0
  63. package/i18n/locales/en.json +226 -0
  64. package/i18n/locales/zh.json +226 -0
  65. package/i18n/message-keys.ts +236 -0
  66. package/i18n/resolver.ts +181 -0
  67. package/icons/index.ts +257 -0
  68. package/icons/svg.ts +69 -0
  69. package/index.ts +9 -1
  70. package/intelligence/client.ts +72 -42
  71. package/market/constants.ts +9 -5
  72. package/market/index.ts +1 -1
  73. package/market/types.ts +19 -4
  74. package/package.json +15 -5
  75. package/permission/index.ts +143 -46
  76. package/permission/legacy.ts +26 -0
  77. package/permission/registry.ts +304 -0
  78. package/permission/types.ts +164 -0
  79. package/plugin/channel.ts +68 -39
  80. package/plugin/index.ts +80 -7
  81. package/plugin/install.ts +3 -0
  82. package/plugin/log/types.ts +22 -5
  83. package/plugin/node/logger-manager.ts +11 -3
  84. package/plugin/node/logger.ts +24 -17
  85. package/plugin/preload.ts +25 -2
  86. package/plugin/providers/index.ts +4 -4
  87. package/plugin/providers/market-client.ts +6 -3
  88. package/plugin/providers/npm-provider.ts +22 -7
  89. package/plugin/providers/tpex-provider.ts +22 -8
  90. package/plugin/sdk/box-items.ts +14 -0
  91. package/plugin/sdk/box-sdk.ts +64 -0
  92. package/plugin/sdk/channel.ts +119 -4
  93. package/plugin/sdk/clipboard.ts +26 -12
  94. package/plugin/sdk/cloud-sync.ts +113 -0
  95. package/plugin/sdk/common.ts +19 -11
  96. package/plugin/sdk/core-box.ts +6 -15
  97. package/plugin/sdk/division-box.ts +160 -65
  98. package/plugin/sdk/examples/storage-onDidChange-example.js +5 -2
  99. package/plugin/sdk/feature-sdk.ts +111 -76
  100. package/plugin/sdk/flow.ts +146 -45
  101. package/plugin/sdk/hooks/bridge.ts +13 -6
  102. package/plugin/sdk/hooks/life-cycle.ts +35 -16
  103. package/plugin/sdk/index.ts +14 -3
  104. package/plugin/sdk/intelligence.ts +87 -0
  105. package/plugin/sdk/meta/README.md +179 -0
  106. package/plugin/sdk/meta-sdk.ts +244 -0
  107. package/plugin/sdk/notification.ts +9 -0
  108. package/plugin/sdk/plugin-info.ts +64 -0
  109. package/plugin/sdk/power.ts +155 -0
  110. package/plugin/sdk/recommend.ts +21 -0
  111. package/plugin/sdk/service/index.ts +12 -8
  112. package/plugin/sdk/sqlite.ts +141 -0
  113. package/plugin/sdk/storage.ts +2 -6
  114. package/plugin/sdk/system.ts +2 -9
  115. package/plugin/sdk/temp-files.ts +41 -0
  116. package/plugin/sdk/touch-sdk.ts +18 -0
  117. package/plugin/sdk/types.ts +44 -4
  118. package/plugin/sdk/window/index.ts +12 -9
  119. package/plugin/sdk-version.ts +231 -0
  120. package/preload/renderer.ts +3 -2
  121. package/renderer/hooks/arg-mapper.ts +16 -2
  122. package/renderer/hooks/index.ts +13 -0
  123. package/renderer/hooks/initialize.ts +2 -1
  124. package/renderer/hooks/use-agent-market-sdk.ts +7 -0
  125. package/renderer/hooks/use-agent-market.ts +106 -0
  126. package/renderer/hooks/use-agents-sdk.ts +7 -0
  127. package/renderer/hooks/use-app-sdk.ts +7 -0
  128. package/renderer/hooks/use-channel.ts +33 -4
  129. package/renderer/hooks/use-download-sdk.ts +21 -0
  130. package/renderer/hooks/use-intelligence-sdk.ts +7 -0
  131. package/renderer/hooks/use-intelligence-stats.ts +290 -0
  132. package/renderer/hooks/use-intelligence.ts +55 -214
  133. package/renderer/hooks/use-market-sdk.ts +16 -0
  134. package/renderer/hooks/use-notification-sdk.ts +7 -0
  135. package/renderer/hooks/use-permission-sdk.ts +7 -0
  136. package/renderer/hooks/use-permission.ts +325 -0
  137. package/renderer/hooks/use-platform-sdk.ts +7 -0
  138. package/renderer/hooks/use-plugin-sdk.ts +16 -0
  139. package/renderer/hooks/use-settings-sdk.ts +7 -0
  140. package/renderer/hooks/use-update-sdk.ts +21 -0
  141. package/renderer/index.ts +1 -0
  142. package/renderer/ref.ts +19 -10
  143. package/renderer/shared/components/SharedPluginDetailContent.vue +84 -0
  144. package/renderer/shared/components/SharedPluginDetailHeader.vue +116 -0
  145. package/renderer/shared/components/SharedPluginDetailMetaList.vue +39 -0
  146. package/renderer/shared/components/SharedPluginDetailReadme.vue +45 -0
  147. package/renderer/shared/components/SharedPluginDetailVersions.vue +98 -0
  148. package/renderer/shared/components/index.ts +5 -0
  149. package/renderer/shared/components/shims-vue.d.ts +5 -0
  150. package/renderer/shared/index.ts +2 -0
  151. package/renderer/shared/plugin-detail.ts +62 -0
  152. package/renderer/storage/app-settings.ts +3 -1
  153. package/renderer/storage/base-storage.ts +508 -82
  154. package/renderer/storage/intelligence-storage.ts +31 -40
  155. package/renderer/storage/openers.ts +3 -1
  156. package/renderer/storage/storage-subscription.ts +126 -42
  157. package/renderer/touch-sdk/env.ts +10 -10
  158. package/renderer/touch-sdk/index.ts +114 -18
  159. package/renderer/touch-sdk/terminal.ts +24 -13
  160. package/search/feature-matcher.ts +279 -0
  161. package/search/fuzzy-match.ts +64 -34
  162. package/search/index.ts +10 -0
  163. package/search/levenshtein-utils.ts +17 -11
  164. package/transport/errors.ts +310 -0
  165. package/transport/event/builder.ts +378 -0
  166. package/transport/event/index.ts +7 -0
  167. package/transport/event/types.ts +292 -0
  168. package/transport/events/index.ts +2670 -0
  169. package/transport/events/meta-overlay.ts +79 -0
  170. package/transport/events/types/agents.ts +177 -0
  171. package/transport/events/types/app-index.ts +9 -0
  172. package/transport/events/types/app.ts +475 -0
  173. package/transport/events/types/box-item.ts +222 -0
  174. package/transport/events/types/clipboard.ts +80 -0
  175. package/transport/events/types/core-box.ts +534 -0
  176. package/transport/events/types/device-idle.ts +7 -0
  177. package/transport/events/types/division-box.ts +99 -0
  178. package/transport/events/types/download.ts +115 -0
  179. package/transport/events/types/file-index.ts +73 -0
  180. package/transport/events/types/flow.ts +149 -0
  181. package/transport/events/types/index.ts +70 -0
  182. package/transport/events/types/market.ts +39 -0
  183. package/transport/events/types/meta-overlay.ts +184 -0
  184. package/transport/events/types/notification.ts +140 -0
  185. package/transport/events/types/permission.ts +90 -0
  186. package/transport/events/types/platform.ts +8 -0
  187. package/transport/events/types/plugin.ts +620 -0
  188. package/transport/events/types/sentry.ts +20 -0
  189. package/transport/events/types/storage.ts +208 -0
  190. package/transport/events/types/transport.ts +60 -0
  191. package/transport/events/types/tray.ts +16 -0
  192. package/transport/events/types/update.ts +78 -0
  193. package/transport/index.ts +139 -0
  194. package/transport/main.ts +2 -0
  195. package/transport/sdk/constants.ts +29 -0
  196. package/transport/sdk/domains/agents-market.ts +47 -0
  197. package/transport/sdk/domains/agents.ts +62 -0
  198. package/transport/sdk/domains/app.ts +48 -0
  199. package/transport/sdk/domains/disposable.ts +35 -0
  200. package/transport/sdk/domains/download.ts +139 -0
  201. package/transport/sdk/domains/index.ts +13 -0
  202. package/transport/sdk/domains/intelligence.ts +616 -0
  203. package/transport/sdk/domains/market.ts +35 -0
  204. package/transport/sdk/domains/notification.ts +62 -0
  205. package/transport/sdk/domains/permission.ts +85 -0
  206. package/transport/sdk/domains/platform.ts +19 -0
  207. package/transport/sdk/domains/plugin.ts +144 -0
  208. package/transport/sdk/domains/settings.ts +92 -0
  209. package/transport/sdk/domains/update.ts +64 -0
  210. package/transport/sdk/index.ts +60 -0
  211. package/transport/sdk/main-transport.ts +710 -0
  212. package/transport/sdk/main.ts +9 -0
  213. package/transport/sdk/plugin-transport.ts +654 -0
  214. package/transport/sdk/port-policy.ts +38 -0
  215. package/transport/sdk/renderer-transport.ts +1165 -0
  216. package/transport/types.ts +605 -0
  217. package/types/agent.ts +399 -0
  218. package/types/cloud-sync.ts +157 -0
  219. package/types/division-box.ts +31 -31
  220. package/types/download.ts +1 -0
  221. package/types/flow.ts +63 -12
  222. package/types/icon.ts +2 -1
  223. package/types/index.ts +5 -0
  224. package/types/intelligence.ts +166 -173
  225. package/types/modules/base.ts +2 -0
  226. package/types/path-browserify.d.ts +5 -0
  227. package/types/platform.ts +12 -0
  228. package/types/startup-info.ts +32 -0
  229. package/types/touch-app-core.ts +8 -8
  230. package/types/update.ts +94 -1
  231. package/vitest.config.ts +25 -0
  232. package/auth/useClerkConfig.ts +0 -40
  233. package/auth/useClerkProvider.ts +0 -52
@@ -0,0 +1,475 @@
1
+ import type { AnalyticsWindowType } from '../../../analytics'
2
+ import type { StartupInfo } from '../../../types'
3
+ /**
4
+ * @fileoverview Type definitions for App domain events
5
+ * @module @talex-touch/utils/transport/events/types/app
6
+ */
7
+
8
+ // ============================================================================
9
+ // App Window Types
10
+ // ============================================================================
11
+
12
+ /**
13
+ * Options for opening developer tools.
14
+ */
15
+ export interface DevToolsOptions {
16
+ /**
17
+ * DevTools display mode.
18
+ * @defaultValue 'undocked'
19
+ */
20
+ mode?: 'undocked' | 'detach' | 'right' | 'bottom'
21
+ }
22
+
23
+ // ============================================================================
24
+ // System Types
25
+ // ============================================================================
26
+
27
+ /**
28
+ * Operating system information.
29
+ */
30
+ export interface OSInfo {
31
+ /**
32
+ * Operating system platform.
33
+ * @example 'darwin', 'win32', 'linux'
34
+ */
35
+ platform: NodeJS.Platform
36
+
37
+ /**
38
+ * CPU architecture.
39
+ * @example 'x64', 'arm64'
40
+ */
41
+ arch: string
42
+
43
+ /**
44
+ * OS version string.
45
+ */
46
+ version: string
47
+
48
+ /**
49
+ * OS release string.
50
+ */
51
+ release: string
52
+
53
+ /**
54
+ * OS type.
55
+ * @example 'Darwin', 'Windows_NT', 'Linux'
56
+ */
57
+ type: string
58
+
59
+ /**
60
+ * Home directory path.
61
+ */
62
+ homedir: string
63
+
64
+ /**
65
+ * Hostname.
66
+ */
67
+ hostname: string
68
+
69
+ /**
70
+ * Total system memory in bytes.
71
+ */
72
+ totalmem: number
73
+
74
+ /**
75
+ * Free system memory in bytes.
76
+ */
77
+ freemem: number
78
+
79
+ /**
80
+ * System uptime in seconds.
81
+ */
82
+ uptime: number
83
+
84
+ /**
85
+ * CPU information.
86
+ */
87
+ cpus: Array<{
88
+ model: string
89
+ speed: number
90
+ }>
91
+ }
92
+
93
+ /**
94
+ * Application package information.
95
+ */
96
+ export interface PackageInfo {
97
+ /**
98
+ * Package name.
99
+ */
100
+ name: string
101
+
102
+ /**
103
+ * Package version.
104
+ */
105
+ version: string
106
+
107
+ /**
108
+ * Package description.
109
+ */
110
+ description?: string
111
+
112
+ /**
113
+ * Package author.
114
+ */
115
+ author?: string | { name: string, email?: string }
116
+
117
+ /**
118
+ * Package license.
119
+ */
120
+ license?: string
121
+
122
+ /**
123
+ * Build timestamp (if available).
124
+ */
125
+ buildTime?: string
126
+
127
+ /**
128
+ * Git commit hash (if available).
129
+ */
130
+ commit?: string
131
+ }
132
+
133
+ /**
134
+ * Request to open an external URL.
135
+ */
136
+ export interface OpenExternalRequest {
137
+ /**
138
+ * URL to open in the default browser.
139
+ */
140
+ url: string
141
+ }
142
+
143
+ /**
144
+ * Request to show item in folder.
145
+ */
146
+ export interface ShowInFolderRequest {
147
+ /**
148
+ * Path to the file or folder.
149
+ */
150
+ path: string
151
+ }
152
+
153
+ /**
154
+ * Request to open an application.
155
+ */
156
+ export interface OpenAppRequest {
157
+ /**
158
+ * Application name or path.
159
+ */
160
+ appName?: string
161
+
162
+ /**
163
+ * Application path (alternative to appName).
164
+ */
165
+ path?: string
166
+ }
167
+
168
+ /**
169
+ * Request to execute a command/open a path.
170
+ */
171
+ export interface ExecuteCommandRequest {
172
+ /**
173
+ * Command or path to execute.
174
+ */
175
+ command: string
176
+ }
177
+
178
+ /**
179
+ * Response from execute command.
180
+ */
181
+ export interface ExecuteCommandResponse {
182
+ /**
183
+ * Whether the command executed successfully.
184
+ */
185
+ success: boolean
186
+
187
+ /**
188
+ * Error message if failed.
189
+ */
190
+ error?: string
191
+ }
192
+
193
+ /**
194
+ * Request to read a local file as text.
195
+ */
196
+ export interface ReadFileRequest {
197
+ /**
198
+ * File path or local file URL (file://, tfile://).
199
+ */
200
+ source: string
201
+
202
+ /**
203
+ * If true, ENOENT returns an empty string instead of throwing.
204
+ */
205
+ allowMissing?: boolean
206
+ }
207
+
208
+ /**
209
+ * Request to resolve an app path.
210
+ */
211
+ export interface GetPathRequest {
212
+ /**
213
+ * Electron app.getPath key.
214
+ */
215
+ name: string
216
+ }
217
+
218
+ /**
219
+ * Request to read a value from secure local storage.
220
+ */
221
+ export interface SecureValueGetRequest {
222
+ /**
223
+ * Storage key.
224
+ */
225
+ key: string
226
+ }
227
+
228
+ /**
229
+ * Request to write a value into secure local storage.
230
+ */
231
+ export interface SecureValueSetRequest {
232
+ /**
233
+ * Storage key.
234
+ */
235
+ key: string
236
+
237
+ /**
238
+ * Plain value before encryption. Null removes the key.
239
+ */
240
+ value: string | null
241
+ }
242
+
243
+ /**
244
+ * Startup handshake payload.
245
+ */
246
+ export interface StartupRequest {
247
+ rendererStartTime: number
248
+ }
249
+
250
+ /**
251
+ * Startup handshake response.
252
+ */
253
+ export type StartupResponse = StartupInfo
254
+
255
+ // =========================================================================
256
+ // UI / Navigation Types
257
+ // =========================================================================
258
+
259
+ export interface NavigateRequest {
260
+ path: string
261
+ }
262
+
263
+ // =========================================================================
264
+ // Locale / I18n Types
265
+ // =========================================================================
266
+
267
+ export type Locale = 'zh-CN' | 'en-US'
268
+
269
+ export interface SetLocaleRequest {
270
+ locale: Locale
271
+ }
272
+
273
+ // =========================================================================
274
+ // Renderer Perf Report Types
275
+ // =========================================================================
276
+
277
+ export type RendererPerfReportKind
278
+ = | 'channel.sendSync.slow'
279
+ | 'channel.send.slow'
280
+ | 'channel.send.timeout'
281
+ | 'channel.send.errorReply'
282
+ | 'ui.route.navigate'
283
+ | 'ui.route.render'
284
+ | 'ui.route.transition'
285
+ | 'ui.details.fetch'
286
+ | 'ui.details.render'
287
+ | 'ui.details.total'
288
+ | 'ui.component.load'
289
+
290
+ export interface RendererPerfReport {
291
+ kind: RendererPerfReportKind
292
+ eventName: string
293
+ durationMs: number
294
+ at: number
295
+ payloadPreview?: string
296
+ stack?: string
297
+ meta?: Record<string, unknown>
298
+ }
299
+
300
+ // ============================================================================
301
+ // Build Verification Types
302
+ // ============================================================================
303
+
304
+ /**
305
+ * Build verification status.
306
+ */
307
+ export interface BuildVerificationStatus {
308
+ /**
309
+ * Whether this is an official build.
310
+ */
311
+ isOfficialBuild: boolean
312
+
313
+ /**
314
+ * Whether verification failed.
315
+ */
316
+ verificationFailed: boolean
317
+
318
+ /**
319
+ * Whether the build has an official key.
320
+ */
321
+ hasOfficialKey: boolean
322
+ }
323
+
324
+ export interface BatteryStatusPayload {
325
+ /**
326
+ * Whether the device is on battery power.
327
+ */
328
+ onBattery?: boolean
329
+
330
+ /**
331
+ * Battery percentage (null if unavailable).
332
+ */
333
+ percent?: number | null
334
+ }
335
+
336
+ // ============================================================================
337
+ // Analytics Types
338
+ // ============================================================================
339
+
340
+ /**
341
+ * Current performance metrics.
342
+ *
343
+ * @deprecated Use AnalyticsSnapshot/CoreMetrics from @talex-touch/utils/analytics instead.
344
+ */
345
+ export interface CurrentMetrics {
346
+ startupTime?: number
347
+ memoryUsage?: number
348
+ cpuUsage?: number
349
+ [key: string]: unknown
350
+ }
351
+
352
+ /**
353
+ * Toggle request for analytics reporting.
354
+ */
355
+ export interface AnalyticsToggleRequest {
356
+ enabled: boolean
357
+ }
358
+
359
+ /**
360
+ * Snapshot request by window type.
361
+ */
362
+ export interface AnalyticsSnapshotRequest {
363
+ windowType: AnalyticsWindowType
364
+ }
365
+
366
+ export type {
367
+ AnalyticsExportPayload,
368
+ AnalyticsExportResult,
369
+ AnalyticsMessage,
370
+ AnalyticsMessageListRequest,
371
+ AnalyticsMessageUpdateRequest,
372
+ AnalyticsRangeRequest,
373
+ AnalyticsSnapshot,
374
+ AnalyticsWindowType,
375
+ CounterPayload,
376
+ FeatureStats,
377
+ GaugePayload,
378
+ HistogramPayload,
379
+ PluginStats,
380
+ TrackDurationPayload,
381
+ TrackEventPayload,
382
+ } from '../../../analytics'
383
+
384
+ /**
385
+ * Performance history entry.
386
+ */
387
+ export interface PerformanceHistoryEntry {
388
+ /**
389
+ * Timestamp of the entry.
390
+ */
391
+ timestamp: number
392
+
393
+ /**
394
+ * Metrics at this point in time.
395
+ */
396
+ metrics: CurrentMetrics
397
+ }
398
+
399
+ /**
400
+ * Performance summary statistics.
401
+ */
402
+ export interface PerformanceSummary {
403
+ /**
404
+ * Average startup time.
405
+ */
406
+ avgStartupTime?: number
407
+
408
+ /**
409
+ * Average memory usage.
410
+ */
411
+ avgMemoryUsage?: number
412
+
413
+ /**
414
+ * Number of samples.
415
+ */
416
+ sampleCount: number
417
+
418
+ /**
419
+ * Time range covered.
420
+ */
421
+ timeRange?: {
422
+ start: number
423
+ end: number
424
+ }
425
+ }
426
+
427
+ /**
428
+ * Exported metrics data.
429
+ */
430
+ export interface ExportedMetrics {
431
+ /**
432
+ * Export timestamp.
433
+ */
434
+ exportedAt: number
435
+
436
+ /**
437
+ * Application version.
438
+ */
439
+ appVersion: string
440
+
441
+ /**
442
+ * Current metrics.
443
+ */
444
+ current: CurrentMetrics
445
+
446
+ /**
447
+ * Historical data.
448
+ */
449
+ history: PerformanceHistoryEntry[]
450
+
451
+ /**
452
+ * Summary statistics.
453
+ */
454
+ summary: PerformanceSummary
455
+ }
456
+
457
+ /**
458
+ * Request to report metrics.
459
+ */
460
+ export interface ReportMetricsRequest {
461
+ /**
462
+ * Optional endpoint to report to.
463
+ */
464
+ endpoint?: string
465
+ }
466
+
467
+ /**
468
+ * Response from report metrics.
469
+ */
470
+ export interface ReportMetricsResponse {
471
+ /**
472
+ * Whether reporting succeeded.
473
+ */
474
+ success: boolean
475
+ }
@@ -0,0 +1,222 @@
1
+ /**
2
+ * @fileoverview Type definitions for BoxItem domain events
3
+ * @module @talex-touch/utils/transport/events/types/box-item
4
+ */
5
+
6
+ import type { TuffAction, TuffIcon, TuffMeta } from './core-box'
7
+
8
+ // ============================================================================
9
+ // BoxItem Core Types
10
+ // ============================================================================
11
+
12
+ /**
13
+ * BoxItem represents a searchable item in the CoreBox.
14
+ */
15
+ export interface BoxItem {
16
+ /**
17
+ * Unique item ID (must be unique per source).
18
+ */
19
+ id: string
20
+
21
+ /**
22
+ * Display title.
23
+ */
24
+ title: string
25
+
26
+ /**
27
+ * Optional subtitle/description.
28
+ */
29
+ subtitle?: string
30
+
31
+ /**
32
+ * Item icon.
33
+ */
34
+ icon?: string | TuffIcon
35
+
36
+ /**
37
+ * Source identifier (usually plugin name).
38
+ */
39
+ source: string
40
+
41
+ /**
42
+ * Keywords for search matching.
43
+ */
44
+ keywords?: string[]
45
+
46
+ /**
47
+ * Relevance score hint (0-1).
48
+ */
49
+ score?: number
50
+
51
+ /**
52
+ * Item metadata.
53
+ */
54
+ meta?: TuffMeta
55
+
56
+ /**
57
+ * Available actions.
58
+ */
59
+ actions?: TuffAction[]
60
+
61
+ /**
62
+ * Custom data attached to this item.
63
+ */
64
+ data?: Record<string, unknown>
65
+
66
+ /**
67
+ * Creation timestamp.
68
+ */
69
+ createdAt?: number
70
+
71
+ /**
72
+ * Last update timestamp.
73
+ */
74
+ updatedAt?: number
75
+ }
76
+
77
+ // ============================================================================
78
+ // CRUD Types
79
+ // ============================================================================
80
+
81
+ /**
82
+ * Request to create a BoxItem.
83
+ */
84
+ export interface BoxItemCreateRequest {
85
+ /**
86
+ * Item to create (id may be auto-generated).
87
+ */
88
+ item: Omit<BoxItem, 'createdAt' | 'updatedAt'> & { id?: string }
89
+ }
90
+
91
+ /**
92
+ * Request to update a BoxItem.
93
+ */
94
+ export interface BoxItemUpdateRequest {
95
+ /**
96
+ * Item ID to update.
97
+ */
98
+ id: string
99
+
100
+ /**
101
+ * Fields to update.
102
+ */
103
+ updates: Partial<Omit<BoxItem, 'id' | 'source' | 'createdAt' | 'updatedAt'>>
104
+ }
105
+
106
+ /**
107
+ * Request to upsert (create or update) a BoxItem.
108
+ */
109
+ export interface BoxItemUpsertRequest {
110
+ /**
111
+ * Item to upsert.
112
+ */
113
+ item: BoxItem
114
+ }
115
+
116
+ /**
117
+ * Request to delete a BoxItem.
118
+ */
119
+ export interface BoxItemDeleteRequest {
120
+ /**
121
+ * Item ID to delete.
122
+ */
123
+ id: string
124
+ }
125
+
126
+ // ============================================================================
127
+ // Batch Types
128
+ // ============================================================================
129
+
130
+ /**
131
+ * Request to batch upsert BoxItems.
132
+ */
133
+ export interface BoxItemBatchUpsertRequest {
134
+ /**
135
+ * Items to upsert.
136
+ */
137
+ items: BoxItem[]
138
+ }
139
+
140
+ /**
141
+ * Response from batch upsert.
142
+ */
143
+ export interface BoxItemBatchUpsertResponse {
144
+ /**
145
+ * Successfully upserted items.
146
+ */
147
+ items: BoxItem[]
148
+
149
+ /**
150
+ * Number of items created.
151
+ */
152
+ created: number
153
+
154
+ /**
155
+ * Number of items updated.
156
+ */
157
+ updated: number
158
+ }
159
+
160
+ /**
161
+ * Request to batch delete BoxItems.
162
+ */
163
+ export interface BoxItemBatchDeleteRequest {
164
+ /**
165
+ * Item IDs to delete.
166
+ */
167
+ ids: string[]
168
+ }
169
+
170
+ /**
171
+ * Response from batch delete.
172
+ */
173
+ export interface BoxItemBatchDeleteResponse {
174
+ /**
175
+ * Number of items deleted.
176
+ */
177
+ deleted: number
178
+ }
179
+
180
+ /**
181
+ * Request to clear BoxItems.
182
+ */
183
+ export interface BoxItemClearRequest {
184
+ /**
185
+ * Source to clear (if not specified, clears all).
186
+ */
187
+ source?: string
188
+ }
189
+
190
+ /**
191
+ * Response from clear operation.
192
+ */
193
+ export interface BoxItemClearResponse {
194
+ /**
195
+ * Number of items cleared.
196
+ */
197
+ cleared: number
198
+ }
199
+
200
+ // ============================================================================
201
+ // Sync Types
202
+ // ============================================================================
203
+
204
+ /**
205
+ * Response from sync request (stream of items).
206
+ */
207
+ export interface BoxItemSyncResponse {
208
+ /**
209
+ * Items being synced.
210
+ */
211
+ items: BoxItem[]
212
+
213
+ /**
214
+ * Total count of items.
215
+ */
216
+ total: number
217
+
218
+ /**
219
+ * Whether this is the last batch.
220
+ */
221
+ done: boolean
222
+ }