@talex-touch/utils 1.0.31 → 1.0.33

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 (116) hide show
  1. package/animation/window-node.ts +15 -12
  2. package/animation/window.ts +19 -15
  3. package/auth/clerk-types.ts +1 -1
  4. package/auth/index.ts +1 -1
  5. package/auth/useAuthState.ts +6 -5
  6. package/auth/useClerkConfig.ts +4 -4
  7. package/auth/useClerkProvider.ts +3 -2
  8. package/channel/index.ts +23 -22
  9. package/common/file-scan-constants.ts +137 -121
  10. package/common/file-scan-utils.ts +48 -27
  11. package/common/index.ts +3 -3
  12. package/common/search/gather.ts +1 -1
  13. package/common/search/index.ts +5 -6
  14. package/common/storage/constants.ts +3 -2
  15. package/common/storage/entity/app-settings.ts +5 -3
  16. package/common/storage/entity/shortcut-settings.ts +10 -10
  17. package/common/storage/shortcut-storage.ts +6 -4
  18. package/common/utils/file.ts +14 -6
  19. package/common/utils/index.ts +62 -52
  20. package/common/utils/polling.ts +88 -84
  21. package/common/utils/task-queue.ts +11 -10
  22. package/common/utils/time.ts +50 -47
  23. package/common/utils/timing.ts +41 -37
  24. package/core-box/builder/index.ts +1 -1
  25. package/core-box/builder/tuff-builder.ts +254 -229
  26. package/core-box/index.ts +4 -6
  27. package/core-box/preview/index.ts +1 -0
  28. package/core-box/preview/types.ts +43 -0
  29. package/core-box/recommendation.ts +77 -0
  30. package/core-box/tuff/index.ts +1 -1
  31. package/core-box/tuff/tuff-dsl.ts +328 -266
  32. package/electron/download-manager.ts +43 -42
  33. package/electron/env-tool.ts +19 -18
  34. package/electron/file-parsers/index.ts +2 -2
  35. package/electron/file-parsers/parsers/text-parser.ts +15 -14
  36. package/electron/file-parsers/registry.ts +9 -7
  37. package/electron/file-parsers/types.ts +4 -4
  38. package/electron/index.ts +2 -2
  39. package/eventbus/index.ts +11 -11
  40. package/index.ts +5 -4
  41. package/intelligence/client.ts +87 -0
  42. package/intelligence/index.ts +1 -0
  43. package/package.json +14 -14
  44. package/permission/index.ts +8 -8
  45. package/plugin/channel.ts +77 -68
  46. package/plugin/index.ts +96 -82
  47. package/plugin/install.ts +8 -8
  48. package/plugin/log/types.ts +5 -5
  49. package/plugin/node/index.ts +1 -1
  50. package/plugin/node/logger-manager.ts +14 -11
  51. package/plugin/node/logger.ts +8 -8
  52. package/plugin/plugin-source.ts +11 -11
  53. package/plugin/preload.ts +1 -1
  54. package/plugin/providers/registry.ts +8 -7
  55. package/plugin/providers/types.ts +6 -6
  56. package/plugin/sdk/README.md +216 -0
  57. package/plugin/sdk/box-sdk.ts +219 -0
  58. package/plugin/sdk/channel.ts +20 -20
  59. package/plugin/sdk/clipboard.ts +8 -6
  60. package/plugin/sdk/common.ts +10 -6
  61. package/plugin/sdk/core-box.ts +2 -3
  62. package/plugin/sdk/division-box.ts +266 -0
  63. package/plugin/sdk/enum/bridge-event.ts +1 -1
  64. package/plugin/sdk/examples/storage-onDidChange-example.js +1 -1
  65. package/plugin/sdk/feature-sdk.ts +235 -0
  66. package/plugin/sdk/features.ts +34 -26
  67. package/plugin/sdk/hooks/bridge.ts +3 -6
  68. package/plugin/sdk/hooks/index.ts +1 -1
  69. package/plugin/sdk/hooks/life-cycle.ts +4 -10
  70. package/plugin/sdk/index.ts +10 -7
  71. package/plugin/sdk/service/index.ts +3 -3
  72. package/plugin/sdk/storage.ts +4 -4
  73. package/plugin/sdk/system.ts +1 -1
  74. package/plugin/sdk/types.ts +165 -146
  75. package/plugin/sdk/window/index.ts +8 -5
  76. package/preload/loading.ts +6 -6
  77. package/preload/renderer.ts +4 -2
  78. package/renderer/hooks/arg-mapper.ts +1 -2
  79. package/renderer/hooks/index.ts +2 -0
  80. package/renderer/hooks/initialize.ts +10 -8
  81. package/renderer/hooks/performance.ts +4 -4
  82. package/renderer/hooks/use-channel.ts +150 -0
  83. package/renderer/hooks/use-intelligence.ts +236 -0
  84. package/renderer/index.ts +6 -2
  85. package/renderer/ref.ts +32 -36
  86. package/renderer/slots.ts +29 -26
  87. package/renderer/storage/app-settings.ts +16 -6
  88. package/renderer/storage/base-storage.ts +222 -114
  89. package/renderer/storage/index.ts +3 -0
  90. package/renderer/storage/intelligence-storage.ts +218 -0
  91. package/renderer/storage/openers.ts +13 -3
  92. package/renderer/touch-sdk/env.ts +41 -41
  93. package/renderer/touch-sdk/index.ts +1 -1
  94. package/renderer/touch-sdk/terminal.ts +5 -5
  95. package/renderer/touch-sdk/utils.ts +4 -3
  96. package/search/levenshtein-utils.ts +11 -11
  97. package/search/types.ts +102 -102
  98. package/service/index.ts +11 -11
  99. package/service/protocol/index.ts +217 -14
  100. package/types/division-box.ts +248 -0
  101. package/types/download.ts +72 -34
  102. package/types/index.ts +3 -1
  103. package/types/intelligence.ts +607 -0
  104. package/types/modules/base.ts +16 -16
  105. package/types/modules/index.ts +1 -1
  106. package/types/modules/module-lifecycle.ts +21 -21
  107. package/types/modules/module-manager.ts +11 -11
  108. package/types/modules/module.ts +16 -16
  109. package/types/storage.ts +0 -1
  110. package/types/touch-app-core.ts +32 -32
  111. package/types/update.ts +91 -21
  112. package/core-box/README.md +0 -218
  113. package/core-box/builder/tuff-builder.example.ts.bak +0 -258
  114. package/core-box/run-tests.sh +0 -7
  115. package/core-box/search.ts +0 -1
  116. package/electron/clipboard-helper.ts +0 -199
package/core-box/index.ts CHANGED
@@ -1,10 +1,8 @@
1
+ export * from './builder/index'
2
+ export * from './preview/index'
1
3
  /**
2
4
  * Core Box Package
3
5
  * Search box core functionality package
4
6
  */
5
-
6
- // 导出 TUFF DSL 相关内容
7
- export * from './tuff/index.js';
8
-
9
- // 导出 TUFF Builder 相关内容
10
- export * from './builder/index.js';
7
+ export * from './tuff/index'
8
+ export * from './recommendation'
@@ -0,0 +1 @@
1
+ export * from './types'
@@ -0,0 +1,43 @@
1
+ export interface PreviewCardRow {
2
+ label: string
3
+ value: string
4
+ description?: string
5
+ copyable?: boolean
6
+ emphasize?: boolean
7
+ }
8
+
9
+ export interface PreviewCardSection {
10
+ title?: string
11
+ rows: PreviewCardRow[]
12
+ }
13
+
14
+ export interface PreviewCardChip {
15
+ label: string
16
+ value: string
17
+ }
18
+
19
+ export interface PreviewCardPayload {
20
+ abilityId: string
21
+ title: string
22
+ subtitle?: string
23
+ primaryValue: string
24
+ primaryLabel?: string
25
+ primaryUnit?: string
26
+ secondaryValue?: string
27
+ secondaryLabel?: string
28
+ description?: string
29
+ accentColor?: string
30
+ badges?: string[]
31
+ chips?: PreviewCardChip[]
32
+ sections?: PreviewCardSection[]
33
+ warnings?: string[]
34
+ meta?: Record<string, any>
35
+ confidence?: number
36
+ }
37
+
38
+ export interface PreviewAbilityResult {
39
+ abilityId: string
40
+ confidence: number
41
+ payload: PreviewCardPayload
42
+ durationMs?: number
43
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Time-based usage pattern context for recommendation matching.
3
+ */
4
+ export interface TimePattern {
5
+ /** Hour of day (0-23) */
6
+ hourOfDay: number
7
+ /** Day of week (0-6, 0=Sunday) */
8
+ dayOfWeek: number
9
+ /** Whether current time falls within working hours (9-18, weekdays) */
10
+ isWorkingHours: boolean
11
+ /** Broad time categorization */
12
+ timeSlot: 'morning' | 'afternoon' | 'evening' | 'night'
13
+ }
14
+
15
+ /**
16
+ * Complete contextual signal for recommendation matching.
17
+ * Gathered from system state, clipboard, and active applications.
18
+ */
19
+ export interface ContextSignal {
20
+ time: TimePattern
21
+ clipboard?: {
22
+ type: string
23
+ /** Hashed content for privacy (not original text) */
24
+ content: string
25
+ timestamp: number
26
+ contentType?: 'url' | 'text' | 'code' | 'file'
27
+ meta?: {
28
+ isUrl?: boolean
29
+ urlDomain?: string
30
+ textLength?: number
31
+ fileExtension?: string
32
+ fileType?: 'code' | 'text' | 'image' | 'document' | 'other'
33
+ language?: string
34
+ }
35
+ }
36
+ foregroundApp?: {
37
+ bundleId: string
38
+ name: string
39
+ }
40
+ systemState?: {
41
+ isOnline: boolean
42
+ batteryLevel: number
43
+ isDNDEnabled: boolean
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Scored recommendation item from recommendation engine.
49
+ */
50
+ export interface ScoredItem {
51
+ sourceId: string
52
+ itemId: string
53
+ score: number
54
+ source: 'frequent' | 'time-based' | 'recent' | 'trending' | 'context'
55
+ reason?: string
56
+ }
57
+
58
+ /**
59
+ * Recommendation badge display configuration for UI rendering.
60
+ */
61
+ export interface RecommendationBadge {
62
+ text: string
63
+ icon: string
64
+ variant: 'frequent' | 'intelligent' | 'recent' | 'trending'
65
+ }
66
+
67
+ /**
68
+ * Enhanced item metadata for intelligent recommendations.
69
+ * Attached to TuffItem.meta for rendering and filtering.
70
+ */
71
+ export interface RecommendationMetadata {
72
+ score: number
73
+ source: ScoredItem['source']
74
+ reason: string
75
+ isIntelligent: boolean
76
+ badge: RecommendationBadge
77
+ }
@@ -3,4 +3,4 @@
3
3
  * Typed Unified Flex Format 数据结构定义
4
4
  */
5
5
 
6
- export * from './tuff-dsl';
6
+ export * from './tuff-dsl'