@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
@@ -1,3 +1,5 @@
1
+ import { NEXUS_BASE_URL } from '../env'
2
+
1
3
  /**
2
4
  * Supported intelligence provider types.
3
5
  */
@@ -120,6 +122,10 @@ export interface IntelligenceVisionOcrResult {
120
122
  suggestions?: string[]
121
123
  /** Structured text blocks. */
122
124
  blocks?: IntelligenceVisionOcrBlock[]
125
+ /** OCR engine identifier. */
126
+ engine?: 'apple-vision' | 'windows-ocr' | 'cloud'
127
+ /** OCR execution latency in milliseconds. */
128
+ durationMs?: number
123
129
  /** Raw provider response. */
124
130
  raw?: any
125
131
  }
@@ -353,46 +359,6 @@ export interface IntelligenceSummarizePayload {
353
359
  style?: 'concise' | 'detailed' | 'bullet-points'
354
360
  }
355
361
 
356
- // Legacy aliases for backward compatibility
357
- /** @deprecated Use IntelligenceProviderType instead. */
358
- export type AiProviderType = IntelligenceProviderType
359
- /** @deprecated Use IntelligenceCapabilityType instead. */
360
- export type AiCapabilityType = IntelligenceCapabilityType
361
- /** @deprecated Use IntelligenceProviderRateLimit instead. */
362
- export type AiProviderRateLimit = IntelligenceProviderRateLimit
363
- /** @deprecated Use IntelligenceVisionImageSource instead. */
364
- export type AiVisionImageSource = IntelligenceVisionImageSource
365
- /** @deprecated Use IntelligenceVisionOcrBlock instead. */
366
- export type AiVisionOcrBlock = IntelligenceVisionOcrBlock
367
- /** @deprecated Use IntelligenceVisionOcrResult instead. */
368
- export type AiVisionOcrResult = IntelligenceVisionOcrResult
369
- /** @deprecated Use IntelligenceVisionOcrPayload instead. */
370
- export type AiVisionOcrPayload = IntelligenceVisionOcrPayload
371
- /** @deprecated Use IntelligenceProviderConfig instead. */
372
- export type AiProviderConfig = IntelligenceProviderConfig
373
- /** @deprecated Use IntelligenceMessage instead. */
374
- export type AiMessage = IntelligenceMessage
375
- /** @deprecated Use IntelligenceInvokeOptions instead. */
376
- export type AiInvokeOptions = IntelligenceInvokeOptions
377
- /** @deprecated Use IntelligenceInvokeContext instead. */
378
- export type AiInvokeContext = IntelligenceInvokeContext
379
- /** @deprecated Use IntelligenceUsageInfo instead. */
380
- export type AiUsageInfo = IntelligenceUsageInfo
381
- /** @deprecated Use IntelligenceInvokeResult instead. */
382
- export type AiInvokeResult<T = any> = IntelligenceInvokeResult<T>
383
- /** @deprecated Use IntelligenceStreamChunk instead. */
384
- export type AiStreamChunk = IntelligenceStreamChunk
385
- /** @deprecated Use IntelligenceCapabilityDescriptor instead. */
386
- export type AiCapabilityDescriptor = IntelligenceCapabilityDescriptor
387
- /** @deprecated Use IntelligenceChatPayload instead. */
388
- export type AiChatPayload = IntelligenceChatPayload
389
- /** @deprecated Use IntelligenceEmbeddingPayload instead. */
390
- export type AiEmbeddingPayload = IntelligenceEmbeddingPayload
391
- /** @deprecated Use IntelligenceTranslatePayload instead. */
392
- export type AiTranslatePayload = IntelligenceTranslatePayload
393
- /** @deprecated Use IntelligenceSummarizePayload instead. */
394
- export type AiSummarizePayload = IntelligenceSummarizePayload
395
-
396
362
  // ============================================================================
397
363
  // Extended Payload Types
398
364
  // ============================================================================
@@ -757,54 +723,6 @@ export interface IntelligenceClassificationResult {
757
723
  explanation?: string
758
724
  }
759
725
 
760
- // Legacy aliases for extended payload types
761
- /** @deprecated Use IntelligenceRewritePayload instead. */
762
- export type AiRewritePayload = IntelligenceRewritePayload
763
- /** @deprecated Use IntelligenceGrammarCheckPayload instead. */
764
- export type AiGrammarCheckPayload = IntelligenceGrammarCheckPayload
765
- /** @deprecated Use IntelligenceGrammarCheckResult instead. */
766
- export type AiGrammarCheckResult = IntelligenceGrammarCheckResult
767
- /** @deprecated Use IntelligenceCodeGeneratePayload instead. */
768
- export type AiCodeGeneratePayload = IntelligenceCodeGeneratePayload
769
- /** @deprecated Use IntelligenceCodeGenerateResult instead. */
770
- export type AiCodeGenerateResult = IntelligenceCodeGenerateResult
771
- /** @deprecated Use IntelligenceCodeExplainPayload instead. */
772
- export type AiCodeExplainPayload = IntelligenceCodeExplainPayload
773
- /** @deprecated Use IntelligenceCodeExplainResult instead. */
774
- export type AiCodeExplainResult = IntelligenceCodeExplainResult
775
- /** @deprecated Use IntelligenceCodeReviewPayload instead. */
776
- export type AiCodeReviewPayload = IntelligenceCodeReviewPayload
777
- /** @deprecated Use IntelligenceCodeReviewResult instead. */
778
- export type AiCodeReviewResult = IntelligenceCodeReviewResult
779
- /** @deprecated Use IntelligenceCodeRefactorPayload instead. */
780
- export type AiCodeRefactorPayload = IntelligenceCodeRefactorPayload
781
- /** @deprecated Use IntelligenceCodeRefactorResult instead. */
782
- export type AiCodeRefactorResult = IntelligenceCodeRefactorResult
783
- /** @deprecated Use IntelligenceCodeDebugPayload instead. */
784
- export type AiCodeDebugPayload = IntelligenceCodeDebugPayload
785
- /** @deprecated Use IntelligenceCodeDebugResult instead. */
786
- export type AiCodeDebugResult = IntelligenceCodeDebugResult
787
- /** @deprecated Use IntelligenceIntentDetectPayload instead. */
788
- export type AiIntentDetectPayload = IntelligenceIntentDetectPayload
789
- /** @deprecated Use IntelligenceIntentDetectResult instead. */
790
- export type AiIntentDetectResult = IntelligenceIntentDetectResult
791
- /** @deprecated Use IntelligenceSentimentAnalyzePayload instead. */
792
- export type AiSentimentAnalyzePayload = IntelligenceSentimentAnalyzePayload
793
- /** @deprecated Use IntelligenceSentimentAnalyzeResult instead. */
794
- export type AiSentimentAnalyzeResult = IntelligenceSentimentAnalyzeResult
795
- /** @deprecated Use IntelligenceContentExtractPayload instead. */
796
- export type AiContentExtractPayload = IntelligenceContentExtractPayload
797
- /** @deprecated Use IntelligenceContentExtractResult instead. */
798
- export type AiContentExtractResult = IntelligenceContentExtractResult
799
- /** @deprecated Use IntelligenceKeywordsExtractPayload instead. */
800
- export type AiKeywordsExtractPayload = IntelligenceKeywordsExtractPayload
801
- /** @deprecated Use IntelligenceKeywordsExtractResult instead. */
802
- export type AiKeywordsExtractResult = IntelligenceKeywordsExtractResult
803
- /** @deprecated Use IntelligenceClassificationPayload instead. */
804
- export type AiClassificationPayload = IntelligenceClassificationPayload
805
- /** @deprecated Use IntelligenceClassificationResult instead. */
806
- export type AiClassificationResult = IntelligenceClassificationResult
807
-
808
726
  // ============================================================================
809
727
  // Audio Payload Types
810
728
  // ============================================================================
@@ -917,20 +835,6 @@ export interface IntelligenceAudioTranscribeResult {
917
835
  }>
918
836
  }
919
837
 
920
- // Legacy aliases for audio types
921
- /** @deprecated Use IntelligenceTTSPayload instead. */
922
- export type AiTTSPayload = IntelligenceTTSPayload
923
- /** @deprecated Use IntelligenceTTSResult instead. */
924
- export type AiTTSResult = IntelligenceTTSResult
925
- /** @deprecated Use IntelligenceSTTPayload instead. */
926
- export type AiSTTPayload = IntelligenceSTTPayload
927
- /** @deprecated Use IntelligenceSTTResult instead. */
928
- export type AiSTTResult = IntelligenceSTTResult
929
- /** @deprecated Use IntelligenceAudioTranscribePayload instead. */
930
- export type AiAudioTranscribePayload = IntelligenceAudioTranscribePayload
931
- /** @deprecated Use IntelligenceAudioTranscribeResult instead. */
932
- export type AiAudioTranscribeResult = IntelligenceAudioTranscribeResult
933
-
934
838
  // ============================================================================
935
839
  // Vision Extended Payload Types
936
840
  // ============================================================================
@@ -1077,24 +981,6 @@ export interface IntelligenceImageEditResult {
1077
981
  revisedPrompt?: string
1078
982
  }
1079
983
 
1080
- // Legacy aliases for vision types
1081
- /** @deprecated Use IntelligenceImageCaptionPayload instead. */
1082
- export type AiImageCaptionPayload = IntelligenceImageCaptionPayload
1083
- /** @deprecated Use IntelligenceImageCaptionResult instead. */
1084
- export type AiImageCaptionResult = IntelligenceImageCaptionResult
1085
- /** @deprecated Use IntelligenceImageAnalyzePayload instead. */
1086
- export type AiImageAnalyzePayload = IntelligenceImageAnalyzePayload
1087
- /** @deprecated Use IntelligenceImageAnalyzeResult instead. */
1088
- export type AiImageAnalyzeResult = IntelligenceImageAnalyzeResult
1089
- /** @deprecated Use IntelligenceImageGeneratePayload instead. */
1090
- export type AiImageGeneratePayload = IntelligenceImageGeneratePayload
1091
- /** @deprecated Use IntelligenceImageGenerateResult instead. */
1092
- export type AiImageGenerateResult = IntelligenceImageGenerateResult
1093
- /** @deprecated Use IntelligenceImageEditPayload instead. */
1094
- export type AiImageEditPayload = IntelligenceImageEditPayload
1095
- /** @deprecated Use IntelligenceImageEditResult instead. */
1096
- export type AiImageEditResult = IntelligenceImageEditResult
1097
-
1098
984
  // ============================================================================
1099
985
  // RAG & Search Payload Types
1100
986
  // ============================================================================
@@ -1200,20 +1086,6 @@ export interface IntelligenceRerankResult {
1200
1086
  }>
1201
1087
  }
1202
1088
 
1203
- // Legacy aliases for RAG types
1204
- /** @deprecated Use IntelligenceRAGQueryPayload instead. */
1205
- export type AiRAGQueryPayload = IntelligenceRAGQueryPayload
1206
- /** @deprecated Use IntelligenceRAGQueryResult instead. */
1207
- export type AiRAGQueryResult = IntelligenceRAGQueryResult
1208
- /** @deprecated Use IntelligenceSemanticSearchPayload instead. */
1209
- export type AiSemanticSearchPayload = IntelligenceSemanticSearchPayload
1210
- /** @deprecated Use IntelligenceSemanticSearchResult instead. */
1211
- export type AiSemanticSearchResult = IntelligenceSemanticSearchResult
1212
- /** @deprecated Use IntelligenceRerankPayload instead. */
1213
- export type AiRerankPayload = IntelligenceRerankPayload
1214
- /** @deprecated Use IntelligenceRerankResult instead. */
1215
- export type AiRerankResult = IntelligenceRerankResult
1216
-
1217
1089
  // ============================================================================
1218
1090
  // Prompt Workflow System
1219
1091
  // ============================================================================
@@ -1333,6 +1205,132 @@ export interface PromptWorkflowContext {
1333
1205
  currentStep?: string
1334
1206
  }
1335
1207
 
1208
+ // ============================================================================
1209
+ // TuffIntelligence Orchestration
1210
+ // ============================================================================
1211
+
1212
+ export type TuffIntelligenceSessionStatus
1213
+ = | 'idle'
1214
+ | 'planning'
1215
+ | 'planned'
1216
+ | 'executing'
1217
+ | 'reflecting'
1218
+ | 'waiting_approval'
1219
+ | 'paused_disconnect'
1220
+ | 'resuming'
1221
+ | 'completed'
1222
+ | 'failed'
1223
+ | 'cancelled'
1224
+
1225
+ export type TuffIntelligenceActionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled'
1226
+
1227
+ export interface TuffIntelligenceActionNode {
1228
+ id: string
1229
+ type: 'intent' | 'plan' | 'tool' | 'agent' | 'capability' | 'reflect' | 'result'
1230
+ title: string
1231
+ status: TuffIntelligenceActionStatus
1232
+ capabilityId?: string
1233
+ toolId?: string
1234
+ input?: unknown
1235
+ output?: unknown
1236
+ error?: string
1237
+ parentId?: string
1238
+ metadata?: Record<string, any>
1239
+ createdAt: number
1240
+ updatedAt?: number
1241
+ }
1242
+
1243
+ export interface TuffIntelligenceActionGraph {
1244
+ sessionId: string
1245
+ nodes: TuffIntelligenceActionNode[]
1246
+ edges: Array<{ from: string, to: string, kind?: 'sequence' | 'dependency' | 'reflection' }>
1247
+ version: number
1248
+ updatedAt: number
1249
+ }
1250
+
1251
+ export interface TuffIntelligenceTurn {
1252
+ id: string
1253
+ sessionId: string
1254
+ status: TuffIntelligenceSessionStatus
1255
+ objective?: string
1256
+ userInput?: string
1257
+ plannerModel?: string
1258
+ executionModel?: string
1259
+ actionIds: string[]
1260
+ reflection?: string
1261
+ error?: string
1262
+ metadata?: Record<string, any>
1263
+ startedAt: number
1264
+ completedAt?: number
1265
+ }
1266
+
1267
+ export interface TuffIntelligenceSession {
1268
+ id: string
1269
+ status: TuffIntelligenceSessionStatus
1270
+ pauseReason?: 'client_disconnect' | 'heartbeat_timeout' | 'manual_pause' | 'system_preempted'
1271
+ lastEventSeq?: number
1272
+ lastCheckpointAt?: number
1273
+ resumeHint?: string
1274
+ objective?: string
1275
+ context?: Record<string, any>
1276
+ metadata?: Record<string, any>
1277
+ currentTurnId?: string
1278
+ createdAt: number
1279
+ updatedAt: number
1280
+ }
1281
+
1282
+ export interface TuffIntelligenceTraceEvent {
1283
+ id: string
1284
+ sessionId: string
1285
+ turnId?: string
1286
+ type:
1287
+ | 'session.started'
1288
+ | 'session.resumed'
1289
+ | 'session.paused'
1290
+ | 'session.cancelled'
1291
+ | 'plan.created'
1292
+ | 'plan.updated'
1293
+ | 'execution.started'
1294
+ | 'execution.completed'
1295
+ | 'execution.failed'
1296
+ | 'tool.called'
1297
+ | 'tool.completed'
1298
+ | 'tool.approval_required'
1299
+ | 'tool.approved'
1300
+ | 'tool.rejected'
1301
+ | 'reflection.completed'
1302
+ | 'state.snapshot'
1303
+ level: 'debug' | 'info' | 'warn' | 'error'
1304
+ message: string
1305
+ payload?: Record<string, any>
1306
+ timestamp: number
1307
+ }
1308
+
1309
+ export interface TuffIntelligenceApprovalTicket {
1310
+ id: string
1311
+ sessionId: string
1312
+ turnId?: string
1313
+ actionId?: string
1314
+ toolId: string
1315
+ riskLevel: 'low' | 'medium' | 'high' | 'critical'
1316
+ reason: string
1317
+ status: 'pending' | 'approved' | 'rejected'
1318
+ requestedAt: number
1319
+ resolvedAt?: number
1320
+ resolvedBy?: string
1321
+ metadata?: Record<string, any>
1322
+ }
1323
+
1324
+ export interface TuffIntelligenceStateSnapshot {
1325
+ sessionId: string
1326
+ status: TuffIntelligenceSessionStatus
1327
+ currentTurn?: TuffIntelligenceTurn
1328
+ actionGraph: TuffIntelligenceActionGraph
1329
+ pendingApprovals: TuffIntelligenceApprovalTicket[]
1330
+ lastTraceEvent?: TuffIntelligenceTraceEvent
1331
+ updatedAt: number
1332
+ }
1333
+
1336
1334
  // ============================================================================
1337
1335
  // Agent System
1338
1336
  // ============================================================================
@@ -1401,14 +1399,6 @@ export interface IntelligenceAgentResult {
1401
1399
  iterations: number
1402
1400
  }
1403
1401
 
1404
- // Legacy aliases for agent types
1405
- /** @deprecated Use IntelligenceAgentTool instead. */
1406
- export type AiAgentTool = IntelligenceAgentTool
1407
- /** @deprecated Use IntelligenceAgentPayload instead. */
1408
- export type AiAgentPayload = IntelligenceAgentPayload
1409
- /** @deprecated Use IntelligenceAgentResult instead. */
1410
- export type AiAgentResult = IntelligenceAgentResult
1411
-
1412
1402
  /**
1413
1403
  * SDK configuration.
1414
1404
  */
@@ -1421,6 +1411,8 @@ export interface IntelligenceSDKConfig {
1421
1411
  enableAudit: boolean
1422
1412
  /** Enable result caching. */
1423
1413
  enableCache: boolean
1414
+ /** Enable quota management. */
1415
+ enableQuota?: boolean
1424
1416
  /** Cache expiration in seconds. */
1425
1417
  cacheExpiration?: number
1426
1418
  /** Capability routing configurations. */
@@ -1524,20 +1516,6 @@ export interface IntelligenceSDKPersistedConfig {
1524
1516
  version: number
1525
1517
  }
1526
1518
 
1527
- // Legacy aliases for SDK types
1528
- /** @deprecated Use IntelligenceSDKConfig instead. */
1529
- export type AiSDKConfig = IntelligenceSDKConfig
1530
- /** @deprecated Use IntelligenceStrategyConfig instead. */
1531
- export type AiStrategyConfig = IntelligenceStrategyConfig
1532
- /** @deprecated Use IntelligenceAuditLog instead. */
1533
- export type AiAuditLog = IntelligenceAuditLog
1534
- /** @deprecated Use IntelligenceCapabilityProviderBinding instead. */
1535
- export type AiCapabilityProviderBinding = IntelligenceCapabilityProviderBinding
1536
- /** @deprecated Use IntelligenceCapabilityRoutingConfig instead. */
1537
- export type AiCapabilityRoutingConfig = IntelligenceCapabilityRoutingConfig
1538
- /** @deprecated Use IntelligenceSDKPersistedConfig instead. */
1539
- export type AiSDKPersistedConfig = IntelligenceSDKPersistedConfig
1540
-
1541
1519
  /**
1542
1520
  * Provider adapter interface.
1543
1521
  */
@@ -1595,9 +1573,6 @@ export interface IntelligenceProviderAdapter {
1595
1573
  agent?: (payload: IntelligenceAgentPayload, options: IntelligenceInvokeOptions) => Promise<IntelligenceInvokeResult<IntelligenceAgentResult>>
1596
1574
  }
1597
1575
 
1598
- /** @deprecated Use IntelligenceProviderAdapter instead. */
1599
- export type AiProviderAdapter = IntelligenceProviderAdapter
1600
-
1601
1576
  /**
1602
1577
  * Provider manager adapter interface.
1603
1578
  */
@@ -1614,7 +1589,6 @@ export interface IntelligenceProviderManagerAdapter {
1614
1589
  createProviderInstance: (config: IntelligenceProviderConfig) => IntelligenceProviderAdapter
1615
1590
  }
1616
1591
 
1617
- /** @deprecated Use IntelligenceProviderManagerAdapter instead. */
1618
1592
  export type ProviderManagerAdapter = IntelligenceProviderManagerAdapter
1619
1593
 
1620
1594
  /**
@@ -1647,9 +1621,6 @@ export interface IntelligenceGlobalConfig {
1647
1621
  parallelRequests?: boolean
1648
1622
  }
1649
1623
 
1650
- /** @deprecated Use IntelligenceGlobalConfig instead. */
1651
- export type AISDKGlobalConfig = IntelligenceGlobalConfig
1652
-
1653
1624
  /**
1654
1625
  * Test result structure.
1655
1626
  */
@@ -1664,7 +1635,6 @@ export interface IntelligenceTestResult {
1664
1635
  timestamp: number
1665
1636
  }
1666
1637
 
1667
- /** @deprecated Use IntelligenceTestResult instead. */
1668
1638
  export type TestResult = IntelligenceTestResult
1669
1639
 
1670
1640
  /**
@@ -1687,9 +1657,6 @@ export interface IntelligenceCapabilityConfig {
1687
1657
  metadata?: Record<string, any>
1688
1658
  }
1689
1659
 
1690
- /** @deprecated Use IntelligenceCapabilityConfig instead. */
1691
- export type AISDKCapabilityConfig = IntelligenceCapabilityConfig
1692
-
1693
1660
  /**
1694
1661
  * Storage data structure for SDK.
1695
1662
  */
@@ -1704,9 +1671,6 @@ export interface IntelligenceStorageData {
1704
1671
  version: number
1705
1672
  }
1706
1673
 
1707
- /** @deprecated Use IntelligenceStorageData instead. */
1708
- export type AISDKStorageData = IntelligenceStorageData
1709
-
1710
1674
  /**
1711
1675
  * Default provider configurations.
1712
1676
  */
@@ -1766,6 +1730,21 @@ export const DEFAULT_PROVIDERS: IntelligenceProviderConfig[] = [
1766
1730
  timeout: 30000,
1767
1731
  rateLimit: {},
1768
1732
  },
1733
+ {
1734
+ id: 'tuff-nexus-default',
1735
+ type: IntelligenceProviderType.CUSTOM,
1736
+ name: 'Tuff Nexus',
1737
+ enabled: false,
1738
+ priority: 1,
1739
+ baseUrl: `${NEXUS_BASE_URL}/v1`,
1740
+ models: ['gpt-4o', 'gpt-4o-mini'],
1741
+ defaultModel: 'gpt-4o-mini',
1742
+ timeout: 30000,
1743
+ rateLimit: {},
1744
+ metadata: {
1745
+ origin: 'tuff-nexus',
1746
+ },
1747
+ },
1769
1748
  {
1770
1749
  id: 'local-default',
1771
1750
  type: IntelligenceProviderType.LOCAL,
@@ -1779,18 +1758,18 @@ export const DEFAULT_PROVIDERS: IntelligenceProviderConfig[] = [
1779
1758
  },
1780
1759
  ]
1781
1760
 
1782
- export const DEFAULT_GLOBAL_CONFIG: AISDKGlobalConfig = {
1761
+ export const DEFAULT_GLOBAL_CONFIG: IntelligenceGlobalConfig = {
1783
1762
  defaultStrategy: 'adaptive-default',
1784
1763
  enableAudit: false,
1785
1764
  enableCache: true,
1786
1765
  cacheExpiration: 3600,
1787
1766
  }
1788
1767
 
1789
- export const DEFAULT_CAPABILITIES: Record<string, AISDKCapabilityConfig> = {
1768
+ export const DEFAULT_CAPABILITIES: Record<string, IntelligenceCapabilityConfig> = {
1790
1769
  'text.chat': {
1791
1770
  id: 'text.chat',
1792
1771
  label: '对话 / Chat',
1793
- description: '默认用于系统对话、翻译、总结等文本任务的模型集合',
1772
+ description: '通用对话、问答、助理类能力',
1794
1773
  providers: [
1795
1774
  { providerId: 'openai-default', priority: 1, enabled: true },
1796
1775
  { providerId: 'anthropic-default', priority: 2, enabled: true },
@@ -2023,3 +2002,17 @@ export const DEFAULT_CAPABILITIES: Record<string, AISDKCapabilityConfig> = {
2023
2002
  ],
2024
2003
  },
2025
2004
  }
2005
+
2006
+ export interface CapabilityTestResult {
2007
+ success: boolean
2008
+ message?: string
2009
+ latency?: number
2010
+ provider?: string
2011
+ model?: string
2012
+ textPreview?: string
2013
+ timestamp: number
2014
+ }
2015
+
2016
+ export interface CapabilityBinding extends IntelligenceCapabilityProviderBinding {
2017
+ provider?: IntelligenceProviderConfig
2018
+ }
@@ -1,3 +1,5 @@
1
+ import type { Buffer } from 'node:buffer'
2
+
1
3
  /**
2
4
  * Unique key for a module.
3
5
  * @public
@@ -0,0 +1,5 @@
1
+ declare module 'path-browserify' {
2
+ import type * as path from 'path'
3
+ const pathBrowserify: typeof path
4
+ export = pathBrowserify
5
+ }
@@ -0,0 +1,12 @@
1
+ export type PlatformCapabilityScope = 'system' | 'plugin' | 'ai'
2
+
3
+ export type PlatformCapabilityStatus = 'alpha' | 'beta' | 'stable'
4
+
5
+ export interface PlatformCapability {
6
+ id: string
7
+ name: string
8
+ description: string
9
+ scope: PlatformCapabilityScope
10
+ status: PlatformCapabilityStatus
11
+ sensitive?: boolean
12
+ }
@@ -0,0 +1,32 @@
1
+ export interface StartupPaths {
2
+ appDataPath: string
3
+ appPath: string
4
+ configPath: string
5
+ exePath: string
6
+ homePath: string
7
+ modulePath: string
8
+ pluginPath: string
9
+ rootPath: string
10
+ tempPath: string
11
+ userDataPath: string
12
+ }
13
+
14
+ export interface StartupInfo {
15
+ id: number
16
+ version: string
17
+ path: StartupPaths
18
+ isPackaged: boolean
19
+ isDev: boolean
20
+ isRelease: boolean
21
+ platform: string
22
+ arch: string
23
+ platformWarning?: string
24
+ t: {
25
+ _s: number
26
+ s: number
27
+ e: number
28
+ p: number
29
+ h: number[]
30
+ }
31
+ appUpdate?: boolean
32
+ }
@@ -26,13 +26,13 @@ export namespace TalexTouch {
26
26
  * the close button of the window. The web page may cancel the close though. See
27
27
  * the close event.
28
28
  */
29
- close(): void
29
+ close: () => void
30
30
 
31
31
  /**
32
32
  * Minimizes the window. On some platforms the minimized window will be shown in
33
33
  * the Dock.
34
34
  */
35
- minimize(): void
35
+ minimize: () => void
36
36
 
37
37
  /**
38
38
  * Opens the devtools.
@@ -43,16 +43,16 @@ export namespace TalexTouch {
43
43
  * On Windows, if Windows Control Overlay is enabled, Devtools will be opened with
44
44
  * `mode: 'detach'`.
45
45
  */
46
- openDevTools(options?: OpenDevToolsOptions): void
46
+ openDevTools: (options?: OpenDevToolsOptions) => void
47
47
 
48
- loadURL(
48
+ loadURL: (
49
49
  url: string,
50
50
  options?: LoadURLOptions | undefined,
51
- ): Promise<Electron.WebContents>
52
- loadFile(
51
+ ) => Promise<Electron.WebContents>
52
+ loadFile: (
53
53
  filePath: string,
54
54
  options?: LoadFileOptions | undefined,
55
- ): Promise<Electron.WebContents>
55
+ ) => Promise<Electron.WebContents>
56
56
  }
57
57
 
58
58
  export type TouchWindowConstructorOptions
@@ -76,7 +76,7 @@ export namespace TalexTouch {
76
76
  export interface IConfiguration {
77
77
  configPath: string
78
78
  data: TouchAppConfig
79
- triggerSave: Function
79
+ triggerSave: () => void
80
80
  }
81
81
 
82
82
  export interface TouchAppConfig {