nolo-cli 0.1.45 → 0.1.46

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 (615) hide show
  1. package/README.md +272 -118
  2. package/index.js +73433 -0
  3. package/package.json +10 -635
  4. package/LICENSE +0 -21
  5. package/agent-runtime/agentConfigOptions.ts +0 -12
  6. package/agent-runtime/agentRecordConfig.ts +0 -101
  7. package/agent-runtime/agentRecordKeys.ts +0 -14
  8. package/agent-runtime/agentThread.ts +0 -222
  9. package/agent-runtime/agentThreadAdmission.ts +0 -74
  10. package/agent-runtime/dialogMessageRecord.ts +0 -16
  11. package/agent-runtime/dialogWritePlan.ts +0 -211
  12. package/agent-runtime/hostAdapter.ts +0 -81
  13. package/agent-runtime/hybridRecordStore.ts +0 -170
  14. package/agent-runtime/index.ts +0 -184
  15. package/agent-runtime/localDialogRead.ts +0 -23
  16. package/agent-runtime/localLoop.ts +0 -334
  17. package/agent-runtime/localToolPolicy.ts +0 -179
  18. package/agent-runtime/localWorkspaceTools.ts +0 -2310
  19. package/agent-runtime/noloWorkspaceTools.ts +0 -390
  20. package/agent-runtime/openAiCompatibleProvider.ts +0 -74
  21. package/agent-runtime/openAiCompatibleProviderConfig.ts +0 -27
  22. package/agent-runtime/platformChatProvider.ts +0 -229
  23. package/agent-runtime/providerResolution.ts +0 -302
  24. package/agent-runtime/runtimeDecision.ts +0 -70
  25. package/agent-runtime/runtimeFacts.ts +0 -40
  26. package/agent-runtime/runtimeToolPolicy.ts +0 -191
  27. package/agent-runtime/runtimeToolSurface.ts +0 -199
  28. package/agent-runtime/shellCommandPolicy.ts +0 -120
  29. package/agent-runtime/types.ts +0 -137
  30. package/agentAliases.ts +0 -40
  31. package/agentCommandSupport.ts +0 -81
  32. package/agentInternalCommandEntries.ts +0 -44
  33. package/agentListCommands.ts +0 -185
  34. package/agentListHelpers.ts +0 -242
  35. package/agentMachineCommands.ts +0 -426
  36. package/agentNameResolver.ts +0 -164
  37. package/agentPullCommand.ts +0 -142
  38. package/agentRecordCommands.ts +0 -224
  39. package/agentRecordHelpers.ts +0 -592
  40. package/agentRunCommand.ts +0 -568
  41. package/agentRuntimeCommands.ts +0 -7
  42. package/agentRuntimeLocal.ts +0 -45
  43. package/ai/agent/_executeModel.ts +0 -146
  44. package/ai/agent/agentSlice.ts +0 -557
  45. package/ai/agent/appWorkingMemory.ts +0 -126
  46. package/ai/agent/buildEditingContext.ts +0 -378
  47. package/ai/agent/buildSystemPrompt.ts +0 -599
  48. package/ai/agent/canvasEditingContext.ts +0 -49
  49. package/ai/agent/cleanAgentMessages.ts +0 -140
  50. package/ai/agent/cliChatClient.ts +0 -153
  51. package/ai/agent/cliExecutor.ts +0 -1465
  52. package/ai/agent/cliPrompt.ts +0 -10
  53. package/ai/agent/contextCompiler.ts +0 -107
  54. package/ai/agent/contextLayerContract.ts +0 -44
  55. package/ai/agent/createAgentSchema.ts +0 -272
  56. package/ai/agent/currentTimeContext.ts +0 -65
  57. package/ai/agent/executeToolCall.ts +0 -58
  58. package/ai/agent/fetchAgentContexts.ts +0 -42
  59. package/ai/agent/generatePrompt.ts +0 -3
  60. package/ai/agent/getFullChatContextKeys.ts +0 -168
  61. package/ai/agent/guidedCreation/capabilities.ts +0 -84
  62. package/ai/agent/guidedCreation/types.ts +0 -38
  63. package/ai/agent/isLiveAudioOnlyAgent.ts +0 -26
  64. package/ai/agent/liveAudioModel.ts +0 -2
  65. package/ai/agent/machineRunPermissions.ts +0 -113
  66. package/ai/agent/pageBuilderHandoffRules.ts +0 -75
  67. package/ai/agent/persistMessageWithFixedId.ts +0 -37
  68. package/ai/agent/planSlice.ts +0 -259
  69. package/ai/agent/referenceUtils.ts +0 -229
  70. package/ai/agent/runAgentBackground.ts +0 -310
  71. package/ai/agent/runAgentClientLoop.ts +0 -164
  72. package/ai/agent/runtimeGuidance.ts +0 -116
  73. package/ai/agent/serverOrigin.ts +0 -7
  74. package/ai/agent/startParallelAgentStreams.ts +0 -424
  75. package/ai/agent/startupProtocol.ts +0 -53
  76. package/ai/agent/streamAgentChatTurn.ts +0 -2135
  77. package/ai/agent/streamAgentChatTurnUtils.ts +0 -923
  78. package/ai/agent/toolFailureGuard.ts +0 -99
  79. package/ai/agent/types.ts +0 -73
  80. package/ai/agent/utils/imageOutput.ts +0 -37
  81. package/ai/agent/utils/publicImageAgentMode.ts +0 -26
  82. package/ai/agent.ts +0 -2
  83. package/ai/ai.locale.ts +0 -1165
  84. package/ai/chat/accumulateToolCallChunks.ts +0 -126
  85. package/ai/chat/fetchUtils.ts +0 -143
  86. package/ai/chat/inlineImageUrlsForCustomProvider.ts +0 -122
  87. package/ai/chat/parseApiError.ts +0 -67
  88. package/ai/chat/parseMultilineSSE.ts +0 -95
  89. package/ai/chat/sendOpenAICompletionsRequest.ts +0 -921
  90. package/ai/chat/sendOpenAIResponseRequest.ts +0 -720
  91. package/ai/chat/serverProxyRetry.ts +0 -102
  92. package/ai/chat/shouldUseServerProxy.ts +0 -18
  93. package/ai/chat/streamRetry.ts +0 -46
  94. package/ai/chat/updateTotalUsage.ts +0 -89
  95. package/ai/context/buildReferenceContext.ts +0 -437
  96. package/ai/context/retention.ts +0 -165
  97. package/ai/context/tokenUtils.ts +0 -78
  98. package/ai/index.ts +0 -1
  99. package/ai/llm/agentCapabilities.ts +0 -74
  100. package/ai/llm/deepinfra.ts +0 -79
  101. package/ai/llm/fireworks.ts +0 -68
  102. package/ai/llm/generateRequestBody.ts +0 -165
  103. package/ai/llm/getModelContextWindow.ts +0 -93
  104. package/ai/llm/getPricing.ts +0 -252
  105. package/ai/llm/imagePricing.ts +0 -66
  106. package/ai/llm/isResponseAPIModel.ts +0 -13
  107. package/ai/llm/kimi.ts +0 -22
  108. package/ai/llm/mimo.ts +0 -99
  109. package/ai/llm/mistral.ts +0 -21
  110. package/ai/llm/models.ts +0 -45
  111. package/ai/llm/openrouterModels.ts +0 -31
  112. package/ai/llm/providers.ts +0 -313
  113. package/ai/llm/reasoningModels.ts +0 -27
  114. package/ai/llm/types.ts +0 -82
  115. package/ai/llm/usageRequestOptions.ts +0 -59
  116. package/ai/memory/policy.ts +0 -49
  117. package/ai/memory/queryShared.ts +0 -167
  118. package/ai/memory/recentRelationshipRecap.ts +0 -251
  119. package/ai/memory/remember.ts +0 -111
  120. package/ai/memory/scope.ts +0 -74
  121. package/ai/memory/store.ts +0 -20
  122. package/ai/memory/storeShared.ts +0 -76
  123. package/ai/memory/types.ts +0 -52
  124. package/ai/memory/understanding.ts +0 -341
  125. package/ai/memory/understandingGreeting.ts +0 -264
  126. package/ai/policy/personalizationDialog.ts +0 -333
  127. package/ai/policy/runtimePolicy.ts +0 -526
  128. package/ai/policy/selfUpdateFields.ts +0 -48
  129. package/ai/policy/types.ts +0 -64
  130. package/ai/skills/referenceRuntime.ts +0 -274
  131. package/ai/skills/skillDiagnostics.ts +0 -251
  132. package/ai/skills/skillDocBuilder.ts +0 -139
  133. package/ai/skills/skillDocProtocol.ts +0 -526
  134. package/ai/skills/skillSummaryMarker.ts +0 -26
  135. package/ai/token/calculatePrice.ts +0 -576
  136. package/ai/token/missingUsageEstimate.ts +0 -42
  137. package/ai/token/normalizeUsage.ts +0 -124
  138. package/ai/token/openaiImageGenerationUsage.ts +0 -56
  139. package/ai/token/prepareTokenUsageData.ts +0 -93
  140. package/ai/token/resolveBillingTarget.ts +0 -52
  141. package/ai/token/saveTokenRecord.ts +0 -53
  142. package/ai/token/types.ts +0 -103
  143. package/ai/tools/agent/agentTools.ts +0 -214
  144. package/ai/tools/agent/agentUpdateShared.ts +0 -311
  145. package/ai/tools/agent/callAgentTool.ts +0 -139
  146. package/ai/tools/agent/createAgentTool.ts +0 -512
  147. package/ai/tools/agent/createDialogTool.ts +0 -69
  148. package/ai/tools/agent/createSkillAgentTool.ts +0 -62
  149. package/ai/tools/agent/parallelBudget.ts +0 -221
  150. package/ai/tools/agent/prepareAgentDraftTool.ts +0 -159
  151. package/ai/tools/agent/presets/appBuilderPreset.ts +0 -154
  152. package/ai/tools/agent/runLlmTool.ts +0 -96
  153. package/ai/tools/agent/runStreamingAgentTool.ts +0 -73
  154. package/ai/tools/agent/skillAgentArgs.ts +0 -106
  155. package/ai/tools/agent/startAgentDialogTool.ts +0 -54
  156. package/ai/tools/agent/streamParallelAgentsTool.ts +0 -123
  157. package/ai/tools/agent/updateAgentTool.ts +0 -96
  158. package/ai/tools/agent/updateSelfTool.ts +0 -113
  159. package/ai/tools/amazonProductScraperTool.ts +0 -86
  160. package/ai/tools/apifyActorClient.ts +0 -45
  161. package/ai/tools/appEditGuard.ts +0 -372
  162. package/ai/tools/appReadSnapshot.ts +0 -153
  163. package/ai/tools/appTools.ts +0 -1549
  164. package/ai/tools/applyEditTool.ts +0 -259
  165. package/ai/tools/applyLineEditsTool.ts +0 -315
  166. package/ai/tools/browserTools/click.ts +0 -33
  167. package/ai/tools/browserTools/closeSession.ts +0 -29
  168. package/ai/tools/browserTools/common.ts +0 -27
  169. package/ai/tools/browserTools/openSession.ts +0 -48
  170. package/ai/tools/browserTools/readContent.ts +0 -38
  171. package/ai/tools/browserTools/selectOption.ts +0 -46
  172. package/ai/tools/browserTools/typeText.ts +0 -42
  173. package/ai/tools/category/createCategoryTool.ts +0 -66
  174. package/ai/tools/category/queryContentsByCategoryTool.ts +0 -69
  175. package/ai/tools/category/updateContentCategoryTool.ts +0 -75
  176. package/ai/tools/cfBrowserTools.ts +0 -319
  177. package/ai/tools/cfSpeechToTextTool.ts +0 -49
  178. package/ai/tools/checkEnvTool.ts +0 -102
  179. package/ai/tools/cloudflareCrawlTool.ts +0 -289
  180. package/ai/tools/codeSearchTool.ts +0 -123
  181. package/ai/tools/codeTools.ts +0 -101
  182. package/ai/tools/convertMarxistsBookTool.ts +0 -103
  183. package/ai/tools/createDocTool.ts +0 -132
  184. package/ai/tools/createSkillDocTool.ts +0 -155
  185. package/ai/tools/createWorkflowTool.ts +0 -154
  186. package/ai/tools/delayTool.ts +0 -31
  187. package/ai/tools/deleteSpacesTool.ts +0 -325
  188. package/ai/tools/deleteSpacesToolModel.ts +0 -159
  189. package/ai/tools/devReloadUtils.ts +0 -29
  190. package/ai/tools/dialogMessageSearch.ts +0 -137
  191. package/ai/tools/doctorSkillTool.ts +0 -72
  192. package/ai/tools/ecommerceScraperTool.ts +0 -86
  193. package/ai/tools/emailTools.ts +0 -549
  194. package/ai/tools/evalSkillTool.ts +0 -92
  195. package/ai/tools/exaSearchTool.ts +0 -63
  196. package/ai/tools/execShellTool.ts +0 -266
  197. package/ai/tools/executeSqlTool.ts +0 -192
  198. package/ai/tools/fetchWebpageSupport.ts +0 -333
  199. package/ai/tools/fetchWebpageTool.ts +0 -97
  200. package/ai/tools/geminiImagePreviewTool.ts +0 -386
  201. package/ai/tools/generateDocxTool.ts +0 -215
  202. package/ai/tools/googleSearchScraperTool.ts +0 -106
  203. package/ai/tools/importDataTool.ts +0 -133
  204. package/ai/tools/importSkillTool.ts +0 -162
  205. package/ai/tools/index.ts +0 -2290
  206. package/ai/tools/jdProductScraperTool.ts +0 -821
  207. package/ai/tools/listUserSpacesTool.ts +0 -113
  208. package/ai/tools/localFilesTool.ts +0 -276
  209. package/ai/tools/marxistsOfflineBook.ts +0 -253
  210. package/ai/tools/modelUsageTools.ts +0 -206
  211. package/ai/tools/noloWorkspaceReadTools.ts +0 -467
  212. package/ai/tools/olmOcrTool.ts +0 -33
  213. package/ai/tools/openaiImageTool.ts +0 -267
  214. package/ai/tools/prepareTools.ts +0 -193
  215. package/ai/tools/readDocTool.ts +0 -88
  216. package/ai/tools/readFileTool.ts +0 -214
  217. package/ai/tools/readTool.ts +0 -194
  218. package/ai/tools/readXPostTool.ts +0 -229
  219. package/ai/tools/readXhsProfileTool.ts +0 -638
  220. package/ai/tools/rememberMemoryTool.ts +0 -84
  221. package/ai/tools/remotionVideoTool.ts +0 -151
  222. package/ai/tools/searchDialogMessagesTool.ts +0 -222
  223. package/ai/tools/searchWorkspaceTool.ts +0 -259
  224. package/ai/tools/skillFollowup.ts +0 -86
  225. package/ai/tools/surfWeatherTool.ts +0 -169
  226. package/ai/tools/table/addTableRowTool.ts +0 -217
  227. package/ai/tools/table/createTableTool.ts +0 -326
  228. package/ai/tools/table/rowTools.ts +0 -386
  229. package/ai/tools/table/schemaTools.ts +0 -244
  230. package/ai/tools/table/shareTableTool.ts +0 -148
  231. package/ai/tools/table/toolShared.ts +0 -129
  232. package/ai/tools/taobaoTmallProductScraperTool.ts +0 -49
  233. package/ai/tools/toolApiClient.ts +0 -279
  234. package/ai/tools/toolNameAliases.ts +0 -70
  235. package/ai/tools/toolPacks.ts +0 -19
  236. package/ai/tools/toolResultError.ts +0 -42
  237. package/ai/tools/toolRunSlice.ts +0 -303
  238. package/ai/tools/toolSchemaCompatibility.ts +0 -53
  239. package/ai/tools/uiAskChoiceTool.ts +0 -104
  240. package/ai/tools/updateContentTitleTool.ts +0 -84
  241. package/ai/tools/updateDocTool.ts +0 -105
  242. package/ai/tools/updateUserPreferenceProfileTool.ts +0 -153
  243. package/ai/tools/wereadGatewayTool.ts +0 -152
  244. package/ai/tools/whisperTool.ts +0 -76
  245. package/ai/tools/writeFileTool.ts +0 -213
  246. package/ai/tools/youtubeScraperTool.ts +0 -116
  247. package/ai/tools/ziweiChartTool.ts +0 -678
  248. package/ai/types.ts +0 -58
  249. package/ai/workflow/workflowExecutor.ts +0 -323
  250. package/ai/workflow/workflowSlice.ts +0 -73
  251. package/ai/workflow/workflowTypes.ts +0 -106
  252. package/app/actions/syncAppRecord.ts +0 -73
  253. package/app/constants/animationSets.ts +0 -21
  254. package/app/constants/appEditor.ts +0 -99
  255. package/app/favorite/deletedFavoriteProjection.ts +0 -31
  256. package/app/favorite/favoriteSlice.ts +0 -690
  257. package/app/favorite/type.ts +0 -43
  258. package/app/hooks/deleteDbKey.ts +0 -254
  259. package/app/i18n/client.ts +0 -13
  260. package/app/i18n/i18n.base.ts +0 -14
  261. package/app/i18n/i18n.config.ts +0 -77
  262. package/app/i18n/index.ts +0 -15
  263. package/app/i18n/mapLanguage.ts +0 -11
  264. package/app/i18n/translations/appBuilder.locale.ts +0 -453
  265. package/app/i18n/translations/error.locale.ts +0 -246
  266. package/app/i18n/translations/interface.locale.ts +0 -2206
  267. package/app/i18n/translations/pricing.locale.ts +0 -397
  268. package/app/i18n/translations/privacy.locale.ts +0 -168
  269. package/app/i18n/translations/seo.locale.ts +0 -129
  270. package/app/i18n/translations/terms.locale.ts +0 -124
  271. package/app/i18n/types.ts +0 -6
  272. package/app/notifications/model.ts +0 -77
  273. package/app/notifications/notificationSlice.ts +0 -141
  274. package/app/reducer.ts +0 -36
  275. package/app/settings/dbActionThunks.ts +0 -34
  276. package/app/settings/defaultSpacePreference.ts +0 -87
  277. package/app/settings/settingSlice.tsx +0 -1212
  278. package/app/settings/settingsRecord.ts +0 -8
  279. package/app/stateViews/runtime.ts +0 -90
  280. package/app/store.ts +0 -55
  281. package/app/theme/colors.ts +0 -280
  282. package/app/theme/fontPreference.ts +0 -77
  283. package/app/theme/theme.config.ts +0 -120
  284. package/app/theme/themeModeBootstrap.ts +0 -123
  285. package/app/types/appSummary.ts +0 -118
  286. package/app/types.ts +0 -358
  287. package/app/utils/appKeys.ts +0 -55
  288. package/app/utils/async.ts +0 -28
  289. package/app/utils/desktopAgentRuntimeTurnClient.ts +0 -75
  290. package/app/utils/env.ts +0 -17
  291. package/app/utils/fileUtils.ts +0 -229
  292. package/app/utils/imageUtils.ts +0 -274
  293. package/app/utils/myContentItems.ts +0 -317
  294. package/app/utils/retryAfter.ts +0 -36
  295. package/app/utils/retryFetch.ts +0 -61
  296. package/app/utils/toast.ts +0 -3
  297. package/auth/action/signUpAction.ts +0 -227
  298. package/auth/adminPermissions.ts +0 -78
  299. package/auth/authSlice.ts +0 -531
  300. package/auth/client/loginRequest.ts +0 -14
  301. package/auth/resetAuthScopedClientState.ts +0 -27
  302. package/auth/routes.ts +0 -183
  303. package/auth/token.ts +0 -63
  304. package/auth/types.ts +0 -40
  305. package/authCommands.ts +0 -230
  306. package/chat/chat.locale.ts +0 -817
  307. package/chat/dialog/actions/addCybotAction.ts +0 -52
  308. package/chat/dialog/actions/addReferenceKeysAction.ts +0 -62
  309. package/chat/dialog/actions/builtinDialogLlm.ts +0 -35
  310. package/chat/dialog/actions/cleanupCliSession.ts +0 -40
  311. package/chat/dialog/actions/createDialogAction.ts +0 -379
  312. package/chat/dialog/actions/createScheduledTaskAction.ts +0 -78
  313. package/chat/dialog/actions/handleSendMessageAction.ts +0 -202
  314. package/chat/dialog/actions/handleSendMessageResolver.ts +0 -27
  315. package/chat/dialog/actions/removeCybotAction.ts +0 -6
  316. package/chat/dialog/actions/removeDialogAgentAction.ts +0 -44
  317. package/chat/dialog/actions/replacePrimaryCybotAction.ts +0 -6
  318. package/chat/dialog/actions/setPrimaryDialogAgentAction.ts +0 -52
  319. package/chat/dialog/actions/updateDialogSummaryAction.ts +0 -430
  320. package/chat/dialog/actions/updateDialogTitleAction.ts +0 -151
  321. package/chat/dialog/actions/updateDialogTitlePolicy.ts +0 -30
  322. package/chat/dialog/actions/updateTokensAction.ts +0 -233
  323. package/chat/dialog/dialogAgents.ts +0 -72
  324. package/chat/dialog/dialogAttachmentCleanup.ts +0 -135
  325. package/chat/dialog/dialogSlice.ts +0 -985
  326. package/chat/dialog/dialogTitle.ts +0 -81
  327. package/chat/dialog/dialogTokenStats.ts +0 -12
  328. package/chat/dialog/dialogUrl.ts +0 -6
  329. package/chat/dialog/goal.ts +0 -108
  330. package/chat/dialog/objectAssistantRegistry.ts +0 -286
  331. package/chat/dialog/schedule.ts +0 -17
  332. package/chat/messages/activityCompletion.ts +0 -97
  333. package/chat/messages/fetchAndCacheMessages.ts +0 -119
  334. package/chat/messages/fetchConvMsgs.ts +0 -51
  335. package/chat/messages/fetchMessages.ts +0 -84
  336. package/chat/messages/fileUrl.ts +0 -13
  337. package/chat/messages/imagePayloadPersistence.ts +0 -22
  338. package/chat/messages/messageAgent.ts +0 -8
  339. package/chat/messages/messageContent.ts +0 -203
  340. package/chat/messages/messageContract.ts +0 -88
  341. package/chat/messages/messageSlice.ts +0 -1386
  342. package/chat/messages/toolThunks.ts +0 -646
  343. package/chat/messages/types.ts +0 -192
  344. package/chat/messages/web/toolDisplayName.ts +0 -686
  345. package/cli/agentAliases.ts +0 -40
  346. package/cli/agentCommandSupport.ts +0 -81
  347. package/cli/agentInternalCommandEntries.ts +0 -44
  348. package/cli/agentListCommands.ts +0 -185
  349. package/cli/agentListHelpers.ts +0 -242
  350. package/cli/agentMachineCommands.ts +0 -426
  351. package/cli/agentNameResolver.ts +0 -164
  352. package/cli/agentPullCommand.ts +0 -142
  353. package/cli/agentRecordCommands.ts +0 -224
  354. package/cli/agentRecordHelpers.ts +0 -592
  355. package/cli/agentRunCommand.ts +0 -568
  356. package/cli/agentRuntimeLocal.ts +0 -45
  357. package/cli/authCommands.ts +0 -230
  358. package/cli/cliCommandAdapters.ts +0 -28
  359. package/cli/cliCommandDispatch.ts +0 -66
  360. package/cli/cliCommandFactories.ts +0 -66
  361. package/cli/cliCommandTypes.ts +0 -49
  362. package/cli/cliEnvHelpers.ts +0 -116
  363. package/cli/cliSpaceHelpers.ts +0 -39
  364. package/cli/client/agentConfigResolver.ts +0 -1
  365. package/cli/client/agentRun.ts +0 -735
  366. package/cli/client/compactDialog.ts +0 -222
  367. package/cli/client/hybridRecordStore.ts +0 -52
  368. package/cli/client/localAgentRecords.ts +0 -7
  369. package/cli/client/localDialogRecords.ts +0 -30
  370. package/cli/client/localProviderResolver.ts +0 -1
  371. package/cli/client/localRuntimeAdapter.ts +0 -1098
  372. package/cli/client/localToolPolicy.ts +0 -8
  373. package/cli/client/profileConfig.ts +0 -101
  374. package/cli/client/streamingOutput.ts +0 -38
  375. package/cli/commandRegistry.ts +0 -98
  376. package/cli/connectorRunArtifact.ts +0 -120
  377. package/cli/connectorWebSocketTarget.ts +0 -112
  378. package/cli/defaultServer.ts +0 -1
  379. package/cli/dialogAttachmentCleanup.ts +0 -151
  380. package/cli/dialogCommands.ts +0 -1120
  381. package/cli/dialogInternalCommandEntries.ts +0 -17
  382. package/cli/docCreateCommands.ts +0 -345
  383. package/cli/docInternalCommandEntries.ts +0 -11
  384. package/cli/docPageHelpers.ts +0 -80
  385. package/cli/docSkillHelpers.ts +0 -67
  386. package/cli/docSpaceHelpers.ts +0 -46
  387. package/cli/globalRecordOperations.ts +0 -258
  388. package/cli/internalCommandEntries.ts +0 -18
  389. package/cli/localRuntimeAuthority.ts +0 -182
  390. package/cli/localRuntimeDb.ts +0 -26
  391. package/cli/machineCommands.ts +0 -312
  392. package/cli/machineDaemonCommands.ts +0 -185
  393. package/cli/machineHeartbeatCommands.ts +0 -30
  394. package/cli/machineStatusCommands.ts +0 -95
  395. package/cli/machineWatchCommands.ts +0 -41
  396. package/cli/machineWsPromptMaterialization.ts +0 -89
  397. package/cli/machineWsRunDispatch.ts +0 -695
  398. package/cli/machineWsSession.ts +0 -213
  399. package/cli/memoryCommands.ts +0 -253
  400. package/cli/memoryInternalCommandEntries.ts +0 -9
  401. package/cli/offlineMarxistsAgentCommand.ts +0 -315
  402. package/cli/qoderUsageProbe.ts +0 -252
  403. package/cli/runtimeDoctorCommands.ts +0 -174
  404. package/cli/runtimeModeArgs.ts +0 -33
  405. package/cli/scriptCommandEntries.ts +0 -66
  406. package/cli/secretScan.ts +0 -31
  407. package/cli/systemInternalCommandEntries.ts +0 -65
  408. package/cli/tableCommands.ts +0 -453
  409. package/cli/tui/readlineWorkspace.ts +0 -210
  410. package/cli/tui/session.ts +0 -554
  411. package/cli/updateCommands.ts +0 -134
  412. package/cli/workflowInternalCommandEntries.ts +0 -10
  413. package/cliCommandAdapters.ts +0 -28
  414. package/cliCommandDispatch.ts +0 -66
  415. package/cliCommandFactories.ts +0 -66
  416. package/cliCommandTypes.ts +0 -49
  417. package/cliEnvHelpers.ts +0 -116
  418. package/cliSpaceHelpers.ts +0 -39
  419. package/client/agentConfigResolver.test.ts +0 -69
  420. package/client/agentConfigResolver.ts +0 -1
  421. package/client/agentRun.test.ts +0 -1346
  422. package/client/agentRun.ts +0 -735
  423. package/client/compactDialog.test.ts +0 -238
  424. package/client/compactDialog.ts +0 -222
  425. package/client/hybridRecordStore.test.ts +0 -157
  426. package/client/hybridRecordStore.ts +0 -52
  427. package/client/localAgentRecords.test.ts +0 -27
  428. package/client/localAgentRecords.ts +0 -7
  429. package/client/localDialogRecords.test.ts +0 -124
  430. package/client/localDialogRecords.ts +0 -30
  431. package/client/localProviderResolver.test.ts +0 -102
  432. package/client/localProviderResolver.ts +0 -1
  433. package/client/localRuntimeAdapter.test.ts +0 -2809
  434. package/client/localRuntimeAdapter.ts +0 -1098
  435. package/client/localRuntimeDryRun.test.ts +0 -135
  436. package/client/localToolPolicy.test.ts +0 -48
  437. package/client/localToolPolicy.ts +0 -8
  438. package/client/profileConfig.test.ts +0 -106
  439. package/client/profileConfig.ts +0 -101
  440. package/client/streamingOutput.test.ts +0 -22
  441. package/client/streamingOutput.ts +0 -38
  442. package/commandRegistry.ts +0 -98
  443. package/connector-experimental/capabilities.ts +0 -75
  444. package/connector-experimental/codexBinary.ts +0 -41
  445. package/connector-experimental/heartbeatLoop.ts +0 -22
  446. package/connector-experimental/machineInfo.ts +0 -46
  447. package/connector-experimental/protocol.ts +0 -54
  448. package/connectorRunArtifact.ts +0 -120
  449. package/connectorWebSocketTarget.ts +0 -112
  450. package/core/builtinAgents.ts +0 -209
  451. package/core/config.ts +0 -15
  452. package/core/crypto.ts +0 -51
  453. package/core/generateKeyPairFromSeedV1.ts +0 -15
  454. package/core/generateMainKey.ts +0 -22
  455. package/core/init.ts +0 -41
  456. package/core/localOrigins.ts +0 -8
  457. package/core/password.ts +0 -13
  458. package/core/prefix.ts +0 -23
  459. package/create/editor/transforms/fromMarkdown/index.ts +0 -260
  460. package/create/editor/transforms/fromMarkdown/inline.ts +0 -285
  461. package/create/editor/transforms/fromMarkdown/table.ts +0 -130
  462. package/create/editor/transforms/markdownToSlate.ts +0 -24
  463. package/create/editor/transforms/slateToRenderMarkdown.ts +0 -218
  464. package/create/editor/transforms/slateToSimplifiedMarkdown.ts +0 -224
  465. package/create/editor/transforms/slateToText.ts +0 -33
  466. package/create/editor/utils/slateUtils.ts +0 -233
  467. package/create/space/addSpaceAction.ts +0 -193
  468. package/create/space/category/categoryActions.ts +0 -427
  469. package/create/space/changeSpaceAction.ts +0 -36
  470. package/create/space/constants.ts +0 -8
  471. package/create/space/content/addContentAction.ts +0 -116
  472. package/create/space/content/contentThunks.ts +0 -90
  473. package/create/space/content/deleteContentFromSpaceAction.ts +0 -187
  474. package/create/space/content/deleteMultipleContentAction.ts +0 -112
  475. package/create/space/content/moveContentAction.ts +0 -285
  476. package/create/space/content/updateContentCategoryAction.ts +0 -154
  477. package/create/space/content/updateContentTitleAction.ts +0 -151
  478. package/create/space/content/uploadAndAddFileToSpaceAction.ts +0 -98
  479. package/create/space/contentKeyUtils.ts +0 -117
  480. package/create/space/deleteSpaceAction.ts +0 -276
  481. package/create/space/fetchSpaceAction.ts +0 -70
  482. package/create/space/fetchSpaceSidebarStateAction.ts +0 -26
  483. package/create/space/loadDefaultSpaceAction.ts +0 -57
  484. package/create/space/member/addMemberAction.ts +0 -79
  485. package/create/space/member/fetchUserSpaceMembershipsAction.ts +0 -386
  486. package/create/space/member/memberThunks.ts +0 -47
  487. package/create/space/member/removeMemberAction.ts +0 -67
  488. package/create/space/resolvePreferredSpaceId.ts +0 -113
  489. package/create/space/sidebarVisibleTypes.ts +0 -260
  490. package/create/space/space.locale.ts +0 -1087
  491. package/create/space/spaceAccess.ts +0 -182
  492. package/create/space/spaceCollapsedState.ts +0 -54
  493. package/create/space/spaceKeys.ts +0 -65
  494. package/create/space/spaceSlice.ts +0 -328
  495. package/create/space/spaceThunks.ts +0 -410
  496. package/create/space/types.ts +0 -27
  497. package/create/space/updateSpaceAction.ts +0 -107
  498. package/create/space/utils/permissions.ts +0 -47
  499. package/create/types.ts +0 -21
  500. package/database/actions/agentReadResolution.ts +0 -33
  501. package/database/actions/common.ts +0 -243
  502. package/database/actions/deleteFile.ts +0 -40
  503. package/database/actions/fileContent.ts +0 -125
  504. package/database/actions/patch.ts +0 -155
  505. package/database/actions/read.ts +0 -358
  506. package/database/actions/readAndWait.ts +0 -260
  507. package/database/actions/readRequestManager.ts +0 -120
  508. package/database/actions/readResolution.ts +0 -125
  509. package/database/actions/remove.ts +0 -94
  510. package/database/actions/replication.ts +0 -477
  511. package/database/actions/upload.ts +0 -186
  512. package/database/actions/upsert.ts +0 -56
  513. package/database/actions/write.ts +0 -146
  514. package/database/authority/ownerKey.ts +0 -80
  515. package/database/authority/recordAuthority.ts +0 -67
  516. package/database/authority/userAuthorityRegistry.ts +0 -54
  517. package/database/client/fetchUserData.ts +0 -61
  518. package/database/config.ts +0 -40
  519. package/database/dbActionThunks.ts +0 -1
  520. package/database/dbSlice.ts +0 -149
  521. package/database/fileRing.ts +0 -51
  522. package/database/fileStorage.ts +0 -232
  523. package/database/fileUrl.ts +0 -34
  524. package/database/keys.ts +0 -767
  525. package/database/queryPrefixes.ts +0 -14
  526. package/database/requests.ts +0 -443
  527. package/database/runtimeServerContext.ts +0 -54
  528. package/database/server/authorityStoreTypes.ts +0 -31
  529. package/database/server/cliAuthorityBrokerClient.ts +0 -227
  530. package/database/server/cliAuthorityBrokerServer.ts +0 -283
  531. package/database/server/cliAuthorityBrokerTypes.ts +0 -43
  532. package/database/server/cliAuthorityStoreDriver.ts +0 -98
  533. package/database/server/db.ts +0 -99
  534. package/database/server/dbPath.ts +0 -20
  535. package/database/server/ensureDbOpen.ts +0 -12
  536. package/database/server/legacyServerDb.ts +0 -58
  537. package/database/server/levelAuthorityStore.ts +0 -114
  538. package/database/server/memoryAuthorityStore.ts +0 -133
  539. package/database/server/serverStoreFactory.ts +0 -118
  540. package/database/tenantPlacement.ts +0 -57
  541. package/database/tombstones.ts +0 -52
  542. package/database/userDataMerge.ts +0 -95
  543. package/database/userPreferenceRegister.ts +0 -131
  544. package/database/utils/ulid.ts +0 -1
  545. package/defaultServer.ts +0 -1
  546. package/dialogAttachmentCleanup.ts +0 -151
  547. package/dialogCommands.ts +0 -1120
  548. package/dialogInternalCommandEntries.ts +0 -17
  549. package/docCreateCommands.ts +0 -345
  550. package/docInternalCommandEntries.ts +0 -11
  551. package/docPageHelpers.ts +0 -80
  552. package/docSkillHelpers.ts +0 -67
  553. package/docSpaceHelpers.ts +0 -46
  554. package/globalRecordOperations.ts +0 -258
  555. package/index.ts +0 -78
  556. package/integrations/anthropic/anthropicModels.ts +0 -47
  557. package/integrations/deepseek/models.ts +0 -37
  558. package/integrations/google/models.ts +0 -341
  559. package/integrations/openai/chatCompletionStreamMode.ts +0 -10
  560. package/integrations/openai/filterAndCleanMessages.ts +0 -284
  561. package/integrations/openai/flexTier.ts +0 -102
  562. package/integrations/openai/generateOpenAIRequestBody.ts +0 -271
  563. package/integrations/openai/generateResponseRequestBody.ts +0 -77
  564. package/integrations/openai/models.ts +0 -271
  565. package/integrations/openai/providerBodyCompatibility.ts +0 -23
  566. package/integrations/openai/responsesHelpers.ts +0 -297
  567. package/integrations/x-reader/types.ts +0 -109
  568. package/integrations/xai/models.ts +0 -13
  569. package/integrations/xhs-reader/redaction.ts +0 -68
  570. package/integrations/xhs-reader/types.ts +0 -277
  571. package/integrations/xhs-reader/url.ts +0 -80
  572. package/internalCommandEntries.ts +0 -18
  573. package/localRuntimeAuthority.ts +0 -182
  574. package/localRuntimeDb.ts +0 -26
  575. package/machineCommands.ts +0 -312
  576. package/machineDaemonCommands.ts +0 -185
  577. package/machineHeartbeatCommands.ts +0 -30
  578. package/machineStatusCommands.ts +0 -95
  579. package/machineWatchCommands.ts +0 -41
  580. package/machineWsPromptMaterialization.ts +0 -89
  581. package/machineWsRunDispatch.ts +0 -695
  582. package/machineWsSession.ts +0 -213
  583. package/memoryCommands.ts +0 -253
  584. package/memoryInternalCommandEntries.ts +0 -9
  585. package/offlineMarxistsAgentCommand.ts +0 -315
  586. package/qoderUsageProbe.ts +0 -252
  587. package/render/contentIcon/types.ts +0 -167
  588. package/render/page/createPageAction.ts +0 -183
  589. package/render/page/docSlice.ts +0 -495
  590. package/render/page/types.ts +0 -19
  591. package/render/table/activityColumns.ts +0 -6
  592. package/render/table/createTableAction.ts +0 -274
  593. package/render/table/deleteTableAction.ts +0 -193
  594. package/render/table/fetchAndCacheTableRows.ts +0 -174
  595. package/render/table/tableSlice.ts +0 -1167
  596. package/render/table/toolValueUtils.ts +0 -363
  597. package/render/table/types.ts +0 -262
  598. package/render/table/utils/tableSerialization.ts +0 -50
  599. package/runtimeDoctorCommands.ts +0 -174
  600. package/runtimeModeArgs.ts +0 -33
  601. package/scriptCommandEntries.ts +0 -66
  602. package/secretScan.ts +0 -31
  603. package/server/handlers/agentRun/types.ts +0 -105
  604. package/share/action.ts +0 -225
  605. package/share/helpers.ts +0 -302
  606. package/share/keys.ts +0 -243
  607. package/share/publicSharePolicy.ts +0 -27
  608. package/share/shareSlice.ts +0 -53
  609. package/share/types.ts +0 -100
  610. package/systemInternalCommandEntries.ts +0 -65
  611. package/tableCommands.ts +0 -453
  612. package/tui/readlineWorkspace.ts +0 -210
  613. package/tui/session.ts +0 -554
  614. package/updateCommands.ts +0 -134
  615. package/workflowInternalCommandEntries.ts +0 -10
package/ai/tools/index.ts DELETED
@@ -1,2290 +0,0 @@
1
- // 文件路径: ai/tools/index.ts
2
-
3
- /* ==================================================================
4
- * 所有 Tool 的统一注册与描述 (最终版:单一事实来源)
5
- * ==================================================================
6
- *
7
- * 如何使用:
8
- * 1. 为你的工具创建一个新文件 (例如 `myNewTool.ts`)。
9
- * 2. 在该文件中,导出函数的 schema 和 executor 函数。
10
- * 3. 在下面的 `toolDefinitions` 数组中,添加一个新的对象来定义你的工具
11
- * (或在对应分组文件中添加,然后在此汇总)。
12
- *
13
- * 此文件会自动生成 toolRegistry, toolExecutors, toolDescriptions,
14
- * 以及 toolDefinitionsByName。
15
- *
16
- * ================================================================== */
17
-
18
- // ---------- 1. 导入所有工具的 Schema 和 Executor ----------
19
- // 计划与编排
20
- import {
21
- createWorkflowFunctionSchema,
22
- createWorkflowFunc,
23
- } from "./createWorkflowTool";
24
- import { delayFunctionSchema, delayFunc } from "./delayTool";
25
- import { canonicalizeToolName } from "./toolNameAliases";
26
- import {
27
- completeDialogGoalFunc,
28
- completeDialogGoalFunctionSchema,
29
- createDialogGoalFunc,
30
- createDialogGoalFunctionSchema,
31
- createScheduledTaskFunc,
32
- createScheduledTaskFunctionSchema,
33
- getDialogGoalFunc,
34
- getDialogGoalFunctionSchema,
35
- notifyUserFunc,
36
- notifyUserFunctionSchema,
37
- queryModelUsageFunc,
38
- queryModelUsageFunctionSchema,
39
- } from "./modelUsageTools";
40
-
41
- // Agent 相关工具的 schema(用于 patch enum),具体定义移到 agentTools.ts
42
- import { createAgentToolFunctionSchema } from "./agent/createAgentTool";
43
- import { updateAgentToolFunctionSchema } from "./agent/updateAgentTool";
44
-
45
- // 内容管理
46
- import { createDocFunctionSchema, createDocFunc } from "./createDocTool";
47
- import {
48
- createSkillDocFunctionSchema,
49
- createSkillDocFunc,
50
- } from "./createSkillDocTool";
51
- import { doctorSkillFunctionSchema, doctorSkillFunc } from "./doctorSkillTool";
52
- import { evalSkillFunctionSchema, evalSkillFunc } from "./evalSkillTool";
53
- import { importSkillFunctionSchema, importSkillFunc } from "./importSkillTool";
54
- import {
55
- readDocFunctionSchema,
56
- readDocFunc,
57
- readPageFunctionSchema,
58
- readPageFunc,
59
- } from "./readDocTool";
60
-
61
- // 分类相关工具集中在 ./category 文件夹
62
- import {
63
- createCategoryFunctionSchema,
64
- createCategoryFunc,
65
- } from "./category/createCategoryTool";
66
- import {
67
- updateContentCategoryFunctionSchema,
68
- updateContentCategoryFunc,
69
- } from "./category/updateContentCategoryTool";
70
- import {
71
- queryContentsByCategoryFunctionSchema,
72
- queryContentsByCategoryFunc,
73
- } from "./category/queryContentsByCategoryTool";
74
-
75
- // 数据操作
76
- import { importDataFunctionSchema, importDataFunc } from "./importDataTool";
77
- import { executeSqlFunctionSchema, executeSqlFunc } from "./executeSqlTool";
78
- import { readFunctionSchema, readFunc } from "./readTool";
79
- import {
80
- listUserSpacesFunctionSchema,
81
- listUserSpacesFunc,
82
- } from "./listUserSpacesTool";
83
- import {
84
- cliDoctorFunc,
85
- cliDoctorFunctionSchema,
86
- cliWhoamiFunc,
87
- cliWhoamiFunctionSchema,
88
- listAgentsFunc,
89
- listAgentsFunctionSchema,
90
- listDialogsFunc,
91
- listDialogsFunctionSchema,
92
- listSpacesFunc,
93
- listSpacesFunctionSchema,
94
- readAgentFunc,
95
- readAgentFunctionSchema,
96
- readDialogFunc,
97
- readDialogFunctionSchema,
98
- readSkillDocFunc,
99
- readSkillDocFunctionSchema,
100
- readSpaceFunc,
101
- readSpaceFunctionSchema,
102
- } from "./noloWorkspaceReadTools";
103
- import {
104
- deleteSpacesFunctionSchema,
105
- deleteSpacesFunc,
106
- deleteSpacesPreviewFunc,
107
- } from "./deleteSpacesTool";
108
- import {
109
- executeApprovedLocalFileChangesFunc,
110
- executeApprovedLocalFileChangesFunctionSchema,
111
- listLocalRootsFunc,
112
- listLocalRootsFunctionSchema,
113
- listLocalFilesFunc,
114
- listLocalFilesFunctionSchema,
115
- proposeLocalFileChangesFunc,
116
- proposeLocalFileChangesFunctionSchema,
117
- proposeLocalFileChangesPreviewFunc,
118
- readLocalFileFunc,
119
- readLocalFileFunctionSchema,
120
- requestLocalFolderAccessFunc,
121
- requestLocalFolderAccessFunctionSchema,
122
- undoLocalFileChangeBatchFunc,
123
- undoLocalFileChangeBatchFunctionSchema,
124
- } from "./localFilesTool";
125
- import {
126
- emailArchiveFunc,
127
- emailArchiveFunctionSchema,
128
- emailExtractVerificationFunc,
129
- emailExtractVerificationFunctionSchema,
130
- emailProvisionIdentityFunc,
131
- emailProvisionIdentityFunctionSchema,
132
- emailReadFunc,
133
- emailReadFunctionSchema,
134
- emailSearchFunc,
135
- emailSearchFunctionSchema,
136
- emailSendFunc,
137
- emailSendFunctionSchema,
138
- emailUpdateTagsFunc,
139
- emailUpdateTagsFunctionSchema,
140
- emailWaitForFunc,
141
- emailWaitForFunctionSchema,
142
- } from "./emailTools";
143
- // ✅ 在当前表中新增一行的工具
144
- import {
145
- addTableRowFunctionSchema,
146
- addTableRowFunc,
147
- } from "./table/addTableRowTool";
148
- import {
149
- createTableFunctionSchema,
150
- createTableFunc,
151
- } from "./table/createTableTool";
152
- import {
153
- shareTableFunctionSchema,
154
- shareTableFunc,
155
- } from "./table/shareTableTool";
156
- import {
157
- addTableRowsFunctionSchema,
158
- addTableRowsFunc,
159
- deleteTableRowFunctionSchema,
160
- deleteTableRowFunc,
161
- deleteTableRowsFunctionSchema,
162
- deleteTableRowsFunc,
163
- queryTableRowsFunctionSchema,
164
- queryTableRowsFunc,
165
- updateTableRowFunctionSchema,
166
- updateTableRowFunc,
167
- updateTableRowsFunctionSchema,
168
- updateTableRowsFunc,
169
- } from "./table/rowTools";
170
- import {
171
- addTableColumnFunctionSchema,
172
- addTableColumnFunc,
173
- deleteTableColumnFunctionSchema,
174
- deleteTableColumnFunc,
175
- renameTableColumnFunctionSchema,
176
- renameTableColumnFunc,
177
- renameTableColumnLabelFunctionSchema,
178
- renameTableColumnLabelFunc,
179
- renameTableFunctionSchema,
180
- renameTableFunc,
181
- } from "./table/schemaTools";
182
-
183
- // 网络与智能
184
- import {
185
- fetchWebpageFunctionSchema,
186
- fetchWebpageFunc,
187
- } from "./fetchWebpageTool";
188
- import {
189
- convertMarxistsBookToOfflineHtmlFunctionSchema,
190
- convertMarxistsBookToOfflineHtmlFunc,
191
- } from "./convertMarxistsBookTool";
192
- import {
193
- readXPostFunctionSchema,
194
- readXPostFunc,
195
- } from "./readXPostTool";
196
- import {
197
- readXhsProfileFunctionSchema,
198
- readXhsProfileFunc,
199
- } from "./readXhsProfileTool";
200
- export { TOOL_PACKS } from "./toolPacks";
201
- import { TOOL_PACKS } from "./toolPacks";
202
- import {
203
- surfWeatherFunctionSchema,
204
- surfWeatherFunc,
205
- } from "./surfWeatherTool";
206
- import {
207
- wereadGatewayFunctionSchema,
208
- wereadGatewayFunc,
209
- } from "./wereadGatewayTool";
210
-
211
- import {
212
- browser_closeSession_Schema,
213
- browser_closeSession_Func,
214
- } from "./browserTools/closeSession";
215
- import {
216
- browser_openSession_Schema,
217
- browser_openSession_Func,
218
- } from "./browserTools/openSession";
219
- import {
220
- browser_selectOption_Schema,
221
- browser_selectOption_Func,
222
- } from "./browserTools/selectOption";
223
- import {
224
- browser_click_Schema,
225
- browser_click_Func,
226
- } from "./browserTools/click";
227
- import {
228
- browser_typeText_Schema,
229
- browser_typeText_Func,
230
- } from "./browserTools/typeText";
231
- import {
232
- browser_readContent_Schema,
233
- browser_readContent_Func,
234
- } from "./browserTools/readContent";
235
- import {
236
- exaSearchSchema,
237
- exaSearchFunc,
238
- } from "./exaSearchTool";
239
- import {
240
- olmOcrSchema,
241
- olmOcrFunc,
242
- } from "./olmOcrTool";
243
- import {
244
- whisperTurboSchema,
245
- whisperTurboFunc,
246
- whisperV3Schema,
247
- whisperV3Func,
248
- } from "./whisperTool";
249
-
250
-
251
-
252
-
253
- // ✅ generateDocx 工具(前端生成并下载 DOCX)
254
- import {
255
- generateDocxFunctionSchema,
256
- generateDocxFunc,
257
- } from "./generateDocxTool";
258
-
259
- // ✅ Google Search Scraper (Apify)
260
- import {
261
- googleSearchScraperFunctionSchema,
262
- googleSearchScraperFunc,
263
- } from "./googleSearchScraperTool";
264
-
265
- // ✅ Cloudflare Browser Rendering 爬取工具
266
- import {
267
- cloudflareCrawlFunctionSchema,
268
- cloudflareCrawlFunc,
269
- cloudflareCrawlStatusFunctionSchema,
270
- cloudflareCrawlStatusFunc,
271
- } from "./cloudflareCrawlTool";
272
-
273
- // ✅ Apify / 抓取相关工具
274
- import {
275
- youtubeScraperFunctionSchema,
276
- youtubeScraperFunc,
277
- } from "./youtubeScraperTool";
278
- import {
279
- ecommerceScraperFunctionSchema,
280
- ecommerceScraperFunc,
281
- } from "./ecommerceScraperTool";
282
- import {
283
- amazonProductScraperFunctionSchema,
284
- amazonProductScraperFunc,
285
- } from "./amazonProductScraperTool";
286
- import {
287
- taobaoTmallProductScraperFunctionSchema,
288
- taobaoTmallProductScraperFunc,
289
- } from "./taobaoTmallProductScraperTool";
290
- import {
291
- jdProductScraperFunctionSchema,
292
- jdProductScraperFunc,
293
- } from "./jdProductScraperTool";
294
-
295
- // ✅ 多模态:Gemini 图片(2.5 Flash 文生图 / 3 Pro 编辑)
296
- import {
297
- geminiFlashImageFunctionSchema,
298
- geminiFlashImageFunc,
299
- geminiProImagePreviewFunctionSchema,
300
- geminiProImagePreviewFunc,
301
- } from "./geminiImagePreviewTool";
302
- import {
303
- openAIGptImageEditFunctionSchema,
304
- openAIGptImageEditFunc,
305
- openAIGptImageFunctionSchema,
306
- openAIGptImageGenerateFunctionSchema,
307
- openAIGptImageGenerateFunc,
308
- openAIGptImageFunc,
309
- } from "./openaiImageTool";
310
- import {
311
- remotionRenderVideoFunctionSchema,
312
- remotionRenderVideoFunc,
313
- } from "./remotionVideoTool";
314
- import { uiAskChoiceFunc, uiAskChoiceFunctionSchema } from "./uiAskChoiceTool";
315
- import {
316
- rememberMemoryFunc,
317
- rememberMemoryFunctionSchema,
318
- } from "./rememberMemoryTool";
319
- import { execShellFunctionSchema, execShellFunc } from "./execShellTool";
320
- import { checkEnvFunctionSchema, checkEnvFunc } from "./checkEnvTool";
321
-
322
- import { agentToolDefinitions } from "./agent/agentTools";
323
- import { codeToolDefinitions } from "./codeTools";
324
- import {
325
- cfScreenshotFunctionSchema,
326
- cfScreenshotFunc,
327
- cfGetMarkdownFunctionSchema,
328
- cfGetMarkdownFunc,
329
- cfGeneratePDFFunctionSchema,
330
- cfGeneratePDFFunc,
331
- cfExtractJSONFunctionSchema,
332
- cfExtractJSONFunc,
333
- } from "./cfBrowserTools";
334
- import {
335
- appPreflightFunctionSchema,
336
- appPreflightFunc,
337
- appDeployFunctionSchema,
338
- appDeployFunc,
339
- appListFunctionSchema,
340
- appListFunc,
341
- appDeleteFunctionSchema,
342
- appDeleteFunc,
343
- appReadFunctionSchema,
344
- appReadFunc,
345
- } from "./appTools";
346
- import {
347
- cfSpeechToTextFunctionSchema,
348
- cfSpeechToTextFunc,
349
- } from "./cfSpeechToTextTool";
350
- import {
351
- updateContentTitleTool,
352
- updateContentTitleFunc,
353
- } from "./updateContentTitleTool";
354
- import {
355
- searchAllSpacesFunc,
356
- searchAllSpacesFunctionSchema,
357
- searchWorkspaceFunctionSchema,
358
- searchWorkspaceFunc,
359
- } from "./searchWorkspaceTool";
360
- import {
361
- searchDialogMessagesFunc,
362
- searchDialogMessagesFunctionSchema,
363
- } from "./searchDialogMessagesTool";
364
- import {
365
- updateDocFunctionSchema,
366
- updateDocFunc,
367
- } from "./updateDocTool";
368
- import {
369
- updateUserPreferenceProfileFunctionSchema,
370
- updateUserPreferenceProfileFunc,
371
- } from "./updateUserPreferenceProfileTool";
372
- import {
373
- ziweiChartFunctionSchema,
374
- ziweiChartFunc,
375
- } from "./ziweiChartTool";
376
-
377
-
378
- // ---------- 2. 定义工具规范接口 ----------
379
-
380
- export type ToolBehavior = "orchestrator" | "data" | "action" | "answer";
381
- export type ToolCapability =
382
- | "knowledge_capture"
383
- | "space_context"
384
- | "self_evolution"
385
- | "web_access"
386
- | "browser_automation"
387
- | "code_edit"
388
- | "app_deploy"
389
- | "general";
390
- export type ToolRiskLevel = "low" | "medium" | "high";
391
- export type ToolCostLevel = "low" | "medium" | "high";
392
- export type ToolConsentMode = "auto" | "ask" | "blocked";
393
-
394
- // 交互模式:
395
- // - auto: 直接执行
396
- // - confirm: 需要用户确认后才执行(危险操作)
397
- // - authorize: 需要用户授权后才执行(权限/敏感资源)
398
- export type ToolInteraction = "auto" | "confirm" | "authorize";
399
-
400
- /**
401
- * 前端分组用:
402
- * - general: 普通
403
- * - agent : Agent / 应用相关
404
- * - content: 内容与页面
405
- * - media : 多媒体(生成图片 / 生成视频等)
406
- * - data : 数据操作
407
- */
408
- export type ToolUiGroup = "general" | "agent" | "content" | "media" | "data";
409
-
410
- /**
411
- * 分组元信息:
412
- * - id: 分组 ID(与 ToolUiGroup 一致)
413
- * - label: 默认中文标题(前端可直接用,也可以自己做 i18n 映射)
414
- * - order: 分组显示顺序(从小到大)
415
- * - fallbackCategories:
416
- * 当某个工具没有显式指定 uiGroup 时,可以根据工具的 category 使用兜底分组。
417
- */
418
- export interface ToolGroupMeta {
419
- id: ToolUiGroup;
420
- label: string;
421
- order: number;
422
- fallbackCategories?: string[];
423
- }
424
-
425
- /**
426
- * 单一事实来源:所有分组配置
427
- * 以后增加 / 修改分组,只需要改这里一处。
428
- */
429
- export const TOOL_GROUP_META: ToolGroupMeta[] = [
430
- {
431
- id: "general",
432
- label: "普通",
433
- order: 0,
434
- },
435
- {
436
- id: "agent",
437
- label: "Agent / 应用",
438
- order: 1,
439
- },
440
- {
441
- id: "content",
442
- label: "内容与页面",
443
- order: 2,
444
- fallbackCategories: ["内容管理"],
445
- },
446
- {
447
- id: "media",
448
- label: "多媒体生成",
449
- order: 3,
450
- fallbackCategories: ["多媒体生成"],
451
- },
452
- {
453
- id: "data",
454
- label: "数据操作",
455
- order: 4,
456
- fallbackCategories: ["数据操作"],
457
- },
458
- ];
459
-
460
- export interface ToolDefinition {
461
- id: string; // 唯一ID (camelCase)
462
- schema: any; // 提供给 LLM 的函数 Schema
463
-
464
- executor: (
465
- args: any,
466
- thunkApi: any,
467
- context?: { parentMessageId: string; signal?: AbortSignal; toolRunId?: string }
468
- ) => Promise<any>;
469
-
470
- /**
471
- * ✅ 新增:预览执行(无副作用)
472
- * - 仅当 interaction 为 confirm/authorize 时会被调用
473
- * - 用于生成 “待确认/待授权” 阶段的 tool message content(预览输出)
474
- */
475
- previewExecutor?: (
476
- args: any,
477
- thunkApi: any,
478
- context?: { parentMessageId: string; signal?: AbortSignal; toolRunId?: string }
479
- ) => Promise<any>;
480
-
481
- description: {
482
- name: string;
483
- description: string;
484
- category: string;
485
- };
486
-
487
- behavior?: ToolBehavior; // 工具在系统中的角色
488
- capability?: ToolCapability; // 用户策略与预算主要按 capability 生效
489
- interaction?: ToolInteraction; // 不写默认 "auto"
490
- uiGroup?: ToolUiGroup; // 前端展示分组,不写默认 "general"
491
- riskLevel?: ToolRiskLevel;
492
- costLevel?: ToolCostLevel;
493
- defaultConsent?: ToolConsentMode;
494
-
495
- /**
496
- * ✅ 新增:是否支持取消(未来 executeToolRun 传 signal 后即可实现)
497
- * - 现在先作为 UI/能力标记预留,不影响 DB 结构
498
- */
499
- cancelable?: boolean;
500
-
501
- /**
502
- * ✅ 新增:授权相关元信息预留(未来可扩展,不强制使用)
503
- * - 现在不实现授权策略,仅留接口,避免未来改 DB/大改代码
504
- */
505
- auth?: {
506
- kind: "domain" | "resource" | "scopes";
507
- scopeHint?: string; // 给 UI/日志的提示
508
- };
509
- }
510
-
511
- /* ==================================================================
512
- * 2.1 toolquery 工具:帮助模型发现可用工具
513
- * ================================================================== */
514
-
515
- export const toolQueryFunctionSchema = {
516
- name: "toolquery",
517
- description:
518
- "根据当前任务描述,列出系统中可能有用的工具。适合在不确定可用工具时先调用本函数。",
519
- parameters: {
520
- type: "object",
521
- properties: {
522
- task: {
523
- type: "string",
524
- description: "用户当前的任务或需求描述。",
525
- },
526
- top_k: {
527
- type: "number",
528
- description: "最多返回多少个候选工具(默认 5)。",
529
- default: 5,
530
- },
531
- },
532
- required: ["task"],
533
- },
534
- };
535
-
536
- export async function toolQueryFunc(args: any): Promise<{
537
- rawData: any;
538
- displayData: string;
539
- }> {
540
- const { task, top_k } = args || {};
541
- const query = String(task || "").trim();
542
- const topK = typeof top_k === "number" && top_k > 0 && top_k < 50 ? top_k : 5;
543
-
544
- if (!query) {
545
- const msg = "toolquery 需要提供 task 描述,比如:'分析数据库相关的工具'。";
546
- return { rawData: [], displayData: msg };
547
- }
548
-
549
- const lowered = query.toLowerCase();
550
-
551
- const candidates = toolDefinitions
552
- .filter((tool) => tool.id !== "toolquery")
553
- .map((tool) => {
554
- const { description, behavior } = tool;
555
- const haystack =
556
- `${description.name} ${description.description} ${description.category} ${behavior || ""}`.toLowerCase();
557
- const score = haystack.includes(lowered) ? 1 : 0;
558
- return { tool, score };
559
- })
560
- .filter((item) => item.score > 0)
561
- .slice(0, topK);
562
-
563
- const rawData = candidates.map(({ tool }) => ({
564
- name: tool.schema.name,
565
- id: tool.id,
566
- description: tool.description.description,
567
- category: tool.description.category,
568
- behavior: tool.behavior ?? null,
569
- }));
570
-
571
- let displayData: string;
572
-
573
- if (rawData.length === 0) {
574
- displayData =
575
- `根据当前描述暂时没有找到明显匹配的工具。\n` +
576
- `你可以尝试:\n` +
577
- `- 换一种更具体的说法描述任务\n` +
578
- `- 直接选择你认为合适的工具调用`;
579
- } else {
580
- displayData =
581
- `根据你的任务描述,我找到了 ${rawData.length} 个可能有用的工具:\n\n` +
582
- rawData
583
- .map((t: any, idx: number) => {
584
- const behaviorLabel = t.behavior ? `,类型:${t.behavior}` : "";
585
- return `${idx + 1}. \`${t.name}\`(${t.category}${behaviorLabel})\n - ${t.description}`;
586
- })
587
- .join("\n");
588
- }
589
-
590
- return { rawData, displayData };
591
- }
592
-
593
- /* ==================================================================
594
- * 3. [核心] 单一事实来源:在此处定义所有工具
595
- * ================================================================== */
596
-
597
- // 这里保留“非 Agent / 非代码”的工具定义,
598
- // Agent 工具在 agentTools.ts,代码相关工具在 codeTools.ts。
599
- const baseToolDefinitions: ToolDefinition[] = [
600
- {
601
- id: "uiAskChoice",
602
- schema: uiAskChoiceFunctionSchema,
603
- executor: uiAskChoiceFunc,
604
- description: {
605
- name: "ui_ask_choice",
606
- description:
607
- "向用户提出一个带多个选项的问题,让界面展示按钮供用户选择。",
608
- category: "交互 / UI",
609
- },
610
- behavior: "answer",
611
- },
612
- {
613
- id: "rememberMemory",
614
- schema: rememberMemoryFunctionSchema,
615
- executor: rememberMemoryFunc,
616
- description: {
617
- name: "rememberMemory",
618
- description: "将值得长期保留的用户偏好或空间共识写入一条 episodic memory。",
619
- category: "记忆 / 长期上下文",
620
- },
621
- behavior: "action",
622
- },
623
- {
624
- id: "updateUserPreferenceProfile",
625
- schema: updateUserPreferenceProfileFunctionSchema,
626
- executor: updateUserPreferenceProfileFunc,
627
- description: {
628
- name: "updateUserPreferenceProfile",
629
- description: "保存用户的语气、知识沉淀、空间读取等个性化偏好设置。",
630
- category: "用户设置 / 个性化",
631
- },
632
- behavior: "action",
633
- },
634
- {
635
- id: "ziweiChart",
636
- schema: ziweiChartFunctionSchema,
637
- executor: ziweiChartFunc,
638
- description: {
639
- name: "ziweiChart",
640
- description: "生成紫微斗数本命盘,并输出可读的十二宫文字盘。",
641
- category: "命理 / 排盘",
642
- },
643
- behavior: "answer",
644
- capability: "general",
645
- uiGroup: "general",
646
- riskLevel: "low",
647
- costLevel: "low",
648
- defaultConsent: "auto",
649
- },
650
-
651
- // --- 计划与编排(不含 Agent 专用) ---
652
- {
653
- id: "createWorkflow",
654
- schema: createWorkflowFunctionSchema,
655
- executor: createWorkflowFunc,
656
- description: {
657
- name: "createWorkflow",
658
- description:
659
- "当执行路径已知时,定义并执行一个多步骤 workflow。引擎自动运行,无需每步调用 LLM,大幅节省 token。",
660
- category: "计划与编排",
661
- },
662
- behavior: "orchestrator",
663
- },
664
- {
665
- id: "toolquery",
666
- schema: toolQueryFunctionSchema,
667
- executor: toolQueryFunc,
668
- description: {
669
- name: "toolquery",
670
- description:
671
- "根据任务描述列出可能有用的工具,帮助你选择合适的工具链。",
672
- category: "计划与编排",
673
- },
674
- behavior: "answer",
675
- },
676
- {
677
- id: "delay",
678
- schema: delayFunctionSchema,
679
- executor: delayFunc,
680
- description: {
681
- name: "delay",
682
- description:
683
- "让计划暂停一小段时间(毫秒),用于节流批量操作(例如连续下载多个文件)。",
684
- category: "计划与编排",
685
- },
686
- behavior: "action",
687
- },
688
- {
689
- id: "queryModelUsage",
690
- schema: queryModelUsageFunctionSchema,
691
- executor: queryModelUsageFunc,
692
- description: {
693
- name: "queryModelUsage",
694
- description:
695
- "查询模型/API 用量与费用,带用户/管理员权限限制,可用于每日用量告警。",
696
- category: "计费 / 用量",
697
- },
698
- behavior: "answer",
699
- uiGroup: "general",
700
- capability: "general",
701
- riskLevel: "low",
702
- costLevel: "low",
703
- defaultConsent: "auto",
704
- },
705
- {
706
- id: "createDialogGoal",
707
- schema: createDialogGoalFunctionSchema,
708
- executor: createDialogGoalFunc,
709
- description: {
710
- name: "createDialogGoal",
711
- description: "为当前对话创建或替换一个目标,并可选设置 token 预算。",
712
- category: "计划与编排",
713
- },
714
- behavior: "action",
715
- uiGroup: "general",
716
- capability: "general",
717
- riskLevel: "low",
718
- costLevel: "low",
719
- defaultConsent: "auto",
720
- },
721
- {
722
- id: "getDialogGoal",
723
- schema: getDialogGoalFunctionSchema,
724
- executor: getDialogGoalFunc,
725
- description: {
726
- name: "getDialogGoal",
727
- description: "读取当前对话目标、完成状态和 token 预算报告。",
728
- category: "计划与编排",
729
- },
730
- behavior: "answer",
731
- uiGroup: "general",
732
- capability: "general",
733
- riskLevel: "low",
734
- costLevel: "low",
735
- defaultConsent: "auto",
736
- },
737
- {
738
- id: "completeDialogGoal",
739
- schema: completeDialogGoalFunctionSchema,
740
- executor: completeDialogGoalFunc,
741
- description: {
742
- name: "completeDialogGoal",
743
- description: "将当前对话目标标记为完成并持久化。",
744
- category: "计划与编排",
745
- },
746
- behavior: "action",
747
- uiGroup: "general",
748
- capability: "general",
749
- riskLevel: "low",
750
- costLevel: "low",
751
- defaultConsent: "auto",
752
- },
753
- {
754
- id: "createScheduledTask",
755
- schema: createScheduledTaskFunctionSchema,
756
- executor: createScheduledTaskFunc,
757
- description: {
758
- name: "createScheduledTask",
759
- description:
760
- "创建由 agent 执行的 cron 定时任务,可选择创建后立即试运行一次。",
761
- category: "计划与编排",
762
- },
763
- behavior: "action",
764
- uiGroup: "general",
765
- capability: "general",
766
- riskLevel: "medium",
767
- costLevel: "low",
768
- defaultConsent: "ask",
769
- },
770
- {
771
- id: "notifyUser",
772
- schema: notifyUserFunctionSchema,
773
- executor: notifyUserFunc,
774
- description: {
775
- name: "notifyUser",
776
- description: "发送站内通知给当前用户,用于告警和任务结果提醒。",
777
- category: "通知",
778
- },
779
- behavior: "action",
780
- uiGroup: "general",
781
- capability: "general",
782
- riskLevel: "low",
783
- costLevel: "low",
784
- defaultConsent: "auto",
785
- },
786
-
787
- // --- 内容管理 ---
788
- {
789
- id: "createDoc",
790
- schema: createDocFunctionSchema,
791
- executor: createDocFunc,
792
- description: {
793
- name: "createDoc",
794
- description: "在当前空间中创建新页面",
795
- category: "内容管理",
796
- },
797
- behavior: "action",
798
- uiGroup: "content",
799
- capability: "knowledge_capture",
800
- riskLevel: "medium",
801
- costLevel: "medium",
802
- defaultConsent: "ask",
803
- },
804
- {
805
- id: "createSkillDoc",
806
- schema: createSkillDocFunctionSchema,
807
- executor: createSkillDocFunc,
808
- description: {
809
- name: "createSkillDoc",
810
- description: "创建带 skill-config / eval-config 协议块的本地 skill 文档。",
811
- category: "内容管理",
812
- },
813
- behavior: "action",
814
- uiGroup: "content",
815
- capability: "knowledge_capture",
816
- riskLevel: "medium",
817
- costLevel: "medium",
818
- defaultConsent: "ask",
819
- },
820
- {
821
- id: "doctorSkill",
822
- schema: doctorSkillFunctionSchema,
823
- executor: doctorSkillFunc,
824
- description: {
825
- name: "doctorSkill",
826
- description: "诊断 skill 文档协议、工具绑定和常见问题。",
827
- category: "内容管理",
828
- },
829
- behavior: "answer",
830
- uiGroup: "content",
831
- capability: "knowledge_capture",
832
- riskLevel: "low",
833
- costLevel: "low",
834
- },
835
- {
836
- id: "evalSkill",
837
- schema: evalSkillFunctionSchema,
838
- executor: evalSkillFunc,
839
- description: {
840
- name: "evalSkill",
841
- description: "根据 eval-config 评估一个 skill 文档是否满足预期。",
842
- category: "内容管理",
843
- },
844
- behavior: "answer",
845
- uiGroup: "content",
846
- capability: "knowledge_capture",
847
- riskLevel: "low",
848
- costLevel: "low",
849
- },
850
- {
851
- id: "importSkill",
852
- schema: importSkillFunctionSchema,
853
- executor: importSkillFunc,
854
- description: {
855
- name: "importSkill",
856
- description: "导入外部 SKILL.md 或 Markdown skill 文档到当前空间。",
857
- category: "内容管理",
858
- },
859
- behavior: "action",
860
- uiGroup: "content",
861
- capability: "knowledge_capture",
862
- riskLevel: "medium",
863
- costLevel: "medium",
864
- defaultConsent: "ask",
865
- },
866
- {
867
- id: "wereadGateway",
868
- schema: wereadGatewayFunctionSchema,
869
- executor: wereadGatewayFunc,
870
- description: {
871
- name: "wereadGateway",
872
- description: "调用微信读书接口,支持书架、搜索、阅读统计、笔记划线、书评和推荐。",
873
- category: "网络",
874
- },
875
- behavior: "data",
876
- uiGroup: "external",
877
- capability: "web_search",
878
- riskLevel: "low",
879
- costLevel: "low",
880
- },
881
- {
882
- id: "readDoc",
883
- schema: readDocFunctionSchema,
884
- executor: readDocFunc,
885
- description: {
886
- name: "readDoc",
887
- description: "读取指定文档/页面的内容(Markdown 格式)",
888
- category: "内容管理",
889
- },
890
- behavior: "data",
891
- uiGroup: "content",
892
- capability: "space_context",
893
- riskLevel: "low",
894
- costLevel: "medium",
895
- },
896
- {
897
- id: "readSkillDoc",
898
- schema: readSkillDocFunctionSchema,
899
- executor: readSkillDocFunc,
900
- description: {
901
- name: "readSkillDoc",
902
- description: "Read a Nolo skill doc/page.",
903
- category: "Nolo workspace",
904
- },
905
- behavior: "data",
906
- uiGroup: "content",
907
- capability: "space_context",
908
- riskLevel: "low",
909
- costLevel: "medium",
910
- },
911
- {
912
- id: "readPage",
913
- schema: readPageFunctionSchema,
914
- executor: readPageFunc,
915
- description: {
916
- name: "readPage",
917
- description: "读取指定页面的内容(Markdown 格式,兼容旧名称)",
918
- category: "内容管理",
919
- },
920
- behavior: "data",
921
- uiGroup: "content",
922
- capability: "space_context",
923
- riskLevel: "low",
924
- costLevel: "medium",
925
- },
926
- {
927
- id: "updateDoc",
928
- schema: updateDocFunctionSchema,
929
- executor: updateDocFunc,
930
- description: {
931
- name: "updateDoc",
932
- description: "更新指定页面/文档的内容。支持全量覆盖或在末尾追加内容。",
933
- category: "内容管理",
934
- },
935
- behavior: "action",
936
- uiGroup: "content",
937
- capability: "knowledge_capture",
938
- riskLevel: "medium",
939
- costLevel: "medium",
940
- defaultConsent: "ask",
941
- },
942
- {
943
- id: "searchWorkspace",
944
- schema: searchWorkspaceFunctionSchema,
945
- executor: searchWorkspaceFunc,
946
- description: {
947
- name: "search_workspace",
948
- description: "在当前空间(Workspace)中搜索页面、表格等内容。",
949
- category: "内容管理",
950
- },
951
- behavior: "data",
952
- uiGroup: "content",
953
- capability: "space_context",
954
- riskLevel: "low",
955
- costLevel: "low",
956
- },
957
- {
958
- id: "searchAllSpaces",
959
- schema: searchAllSpacesFunctionSchema,
960
- executor: searchAllSpacesFunc,
961
- description: {
962
- name: "search_all_spaces",
963
- description: "在你可访问的全部空间中搜索页面、表格等内容,并返回所属空间。",
964
- category: "内容管理",
965
- },
966
- behavior: "data",
967
- uiGroup: "content",
968
- capability: "space_context",
969
- riskLevel: "low",
970
- costLevel: "medium",
971
- },
972
- {
973
- id: "searchDialogMessages",
974
- schema: searchDialogMessagesFunctionSchema,
975
- executor: searchDialogMessagesFunc,
976
- description: {
977
- name: "searchDialogMessages",
978
- description: "在指定对话的原始消息中搜索文本,并返回命中的 messageId、角色、原文片段和邻近上下文。",
979
- category: "内容管理",
980
- },
981
- behavior: "data",
982
- uiGroup: "content",
983
- capability: "space_context",
984
- riskLevel: "low",
985
- costLevel: "low",
986
- },
987
- {
988
- id: "createCategory",
989
- schema: createCategoryFunctionSchema,
990
- executor: createCategoryFunc,
991
- description: {
992
- name: "createCategory",
993
- description: "在当前空间中创建新分类",
994
- category: "内容管理",
995
- },
996
- behavior: "action",
997
- uiGroup: "content",
998
- },
999
- {
1000
- id: "updateContentCategory",
1001
- schema: updateContentCategoryFunctionSchema,
1002
- executor: updateContentCategoryFunc,
1003
- description: {
1004
- name: "updateContentCategory",
1005
- description: "更新内容的分类",
1006
- category: "内容管理",
1007
- },
1008
- behavior: "action",
1009
- uiGroup: "content",
1010
- },
1011
- {
1012
- id: "queryContentsByCategory",
1013
- schema: queryContentsByCategoryFunctionSchema,
1014
- executor: queryContentsByCategoryFunc,
1015
- description: {
1016
- name: "queryContentsByCategory",
1017
- description: "查询分类下的所有内容",
1018
- category: "内容管理",
1019
- },
1020
- behavior: "data",
1021
- uiGroup: "content",
1022
- },
1023
-
1024
- // --- 数据操作 ---
1025
- {
1026
- id: "createTable",
1027
- schema: createTableFunctionSchema,
1028
- executor: createTableFunc,
1029
- description: {
1030
- name: "createTable",
1031
- description: "在当前租户下创建一张新的数据表,并定义字段结构。",
1032
- category: "数据操作",
1033
- },
1034
- behavior: "action",
1035
- uiGroup: "data",
1036
- capability: "knowledge_capture",
1037
- riskLevel: "medium",
1038
- costLevel: "medium",
1039
- defaultConsent: "ask",
1040
- },
1041
- {
1042
- id: "shareTable",
1043
- schema: shareTableFunctionSchema,
1044
- executor: shareTableFunc,
1045
- description: {
1046
- name: "shareTable",
1047
- description: "把表发布为可分享链接,可用于社区分享。",
1048
- category: "数据操作",
1049
- },
1050
- behavior: "action",
1051
- uiGroup: "data",
1052
- riskLevel: "medium",
1053
- costLevel: "low",
1054
- defaultConsent: "ask",
1055
- },
1056
- {
1057
- id: "importData",
1058
- schema: importDataFunctionSchema,
1059
- executor: importDataFunc,
1060
- description: {
1061
- name: "importData",
1062
- description: "将用户上传的文件数据导入数据库表",
1063
- category: "数据操作",
1064
- },
1065
- behavior: "data",
1066
- uiGroup: "data",
1067
- capability: "space_context",
1068
- riskLevel: "low",
1069
- costLevel: "medium",
1070
- },
1071
- {
1072
- id: "executeSql",
1073
- schema: executeSqlFunctionSchema,
1074
- executor: executeSqlFunc,
1075
- description: {
1076
- name: "executeSql",
1077
- description: "直接执行 SQL 语句",
1078
- category: "数据操作",
1079
- },
1080
- behavior: "data",
1081
- uiGroup: "data",
1082
- },
1083
- {
1084
- id: "read",
1085
- schema: readFunctionSchema,
1086
- executor: readFunc,
1087
- description: {
1088
- name: "read",
1089
- description:
1090
- "根据指定的 dbKey 从本地/远程数据库读取一条记录,可选择本地优先或等待远程结果。",
1091
- category: "数据操作",
1092
- },
1093
- behavior: "data",
1094
- uiGroup: "data",
1095
- },
1096
- {
1097
- id: "email_provision_identity",
1098
- schema: emailProvisionIdentityFunctionSchema,
1099
- executor: emailProvisionIdentityFunc,
1100
- description: {
1101
- name: "email_provision_identity",
1102
- description: "为 agent 生成并绑定受控域名邮箱身份。",
1103
- category: "数据操作",
1104
- },
1105
- behavior: "action",
1106
- uiGroup: "data",
1107
- riskLevel: "medium",
1108
- costLevel: "low",
1109
- defaultConsent: "ask",
1110
- },
1111
- {
1112
- id: "email_send",
1113
- schema: emailSendFunctionSchema,
1114
- executor: emailSendFunc,
1115
- description: {
1116
- name: "email_send",
1117
- description: "以 agent 已绑定邮箱身份发送邮件。",
1118
- category: "数据操作",
1119
- },
1120
- behavior: "action",
1121
- uiGroup: "data",
1122
- riskLevel: "medium",
1123
- costLevel: "low",
1124
- defaultConsent: "ask",
1125
- },
1126
- {
1127
- id: "email_wait_for",
1128
- schema: emailWaitForFunctionSchema,
1129
- executor: emailWaitForFunc,
1130
- description: {
1131
- name: "email_wait_for",
1132
- description: "等待符合条件的邮件到达。",
1133
- category: "数据操作",
1134
- },
1135
- behavior: "data",
1136
- uiGroup: "data",
1137
- riskLevel: "low",
1138
- costLevel: "low",
1139
- },
1140
- {
1141
- id: "email_extract_verification",
1142
- schema: emailExtractVerificationFunctionSchema,
1143
- executor: emailExtractVerificationFunc,
1144
- description: {
1145
- name: "email_extract_verification",
1146
- description: "从邮件中提取验证码和验证链接。",
1147
- category: "数据操作",
1148
- },
1149
- behavior: "data",
1150
- uiGroup: "data",
1151
- riskLevel: "low",
1152
- costLevel: "low",
1153
- },
1154
- {
1155
- id: "email_search",
1156
- schema: emailSearchFunctionSchema,
1157
- executor: emailSearchFunc,
1158
- description: {
1159
- name: "email_search",
1160
- description: "查询当前主体可访问的邮件列表。",
1161
- category: "数据操作",
1162
- },
1163
- behavior: "data",
1164
- uiGroup: "data",
1165
- riskLevel: "low",
1166
- costLevel: "low",
1167
- },
1168
- {
1169
- id: "email_read",
1170
- schema: emailReadFunctionSchema,
1171
- executor: emailReadFunc,
1172
- description: {
1173
- name: "email_read",
1174
- description: "读取一封邮件的完整内容。",
1175
- category: "数据操作",
1176
- },
1177
- behavior: "data",
1178
- uiGroup: "data",
1179
- riskLevel: "low",
1180
- costLevel: "low",
1181
- },
1182
- {
1183
- id: "email_update_tags",
1184
- schema: emailUpdateTagsFunctionSchema,
1185
- executor: emailUpdateTagsFunc,
1186
- description: {
1187
- name: "email_update_tags",
1188
- description: "替换一封邮件的 tags。",
1189
- category: "数据操作",
1190
- },
1191
- behavior: "action",
1192
- uiGroup: "data",
1193
- riskLevel: "medium",
1194
- costLevel: "low",
1195
- },
1196
- {
1197
- id: "email_archive",
1198
- schema: emailArchiveFunctionSchema,
1199
- executor: emailArchiveFunc,
1200
- description: {
1201
- name: "email_archive",
1202
- description: "把一封邮件移动到 archive mailbox。",
1203
- category: "数据操作",
1204
- },
1205
- behavior: "action",
1206
- uiGroup: "data",
1207
- riskLevel: "medium",
1208
- costLevel: "low",
1209
- },
1210
- {
1211
- id: "addTableRow",
1212
- schema: addTableRowFunctionSchema,
1213
- executor: addTableRowFunc,
1214
- description: {
1215
- name: "addTableRow",
1216
- description:
1217
- "在当前已打开的表中新增一行数据,通常由 AI 根据分析结果自动填充各列。",
1218
- category: "数据操作",
1219
- },
1220
- behavior: "action",
1221
- uiGroup: "data",
1222
- },
1223
- {
1224
- id: "queryTableRows",
1225
- schema: queryTableRowsFunctionSchema,
1226
- executor: queryTableRowsFunc,
1227
- description: {
1228
- name: "queryTableRows",
1229
- description: "查询指定表中的行,支持过滤、排序和分页。",
1230
- category: "数据操作",
1231
- },
1232
- behavior: "data",
1233
- uiGroup: "data",
1234
- },
1235
- {
1236
- id: "updateTableRow",
1237
- schema: updateTableRowFunctionSchema,
1238
- executor: updateTableRowFunc,
1239
- description: {
1240
- name: "updateTableRow",
1241
- description: "更新表中的单行数据。",
1242
- category: "数据操作",
1243
- },
1244
- behavior: "action",
1245
- uiGroup: "data",
1246
- },
1247
- {
1248
- id: "deleteTableRow",
1249
- schema: deleteTableRowFunctionSchema,
1250
- executor: deleteTableRowFunc,
1251
- description: {
1252
- name: "deleteTableRow",
1253
- description: "删除表中的单行数据。",
1254
- category: "数据操作",
1255
- },
1256
- behavior: "action",
1257
- uiGroup: "data",
1258
- },
1259
- {
1260
- id: "addTableRows",
1261
- schema: addTableRowsFunctionSchema,
1262
- executor: addTableRowsFunc,
1263
- description: {
1264
- name: "addTableRows",
1265
- description: "批量向表中新增多行数据。",
1266
- category: "数据操作",
1267
- },
1268
- behavior: "action",
1269
- uiGroup: "data",
1270
- },
1271
- {
1272
- id: "updateTableRows",
1273
- schema: updateTableRowsFunctionSchema,
1274
- executor: updateTableRowsFunc,
1275
- description: {
1276
- name: "updateTableRows",
1277
- description: "批量更新表中的多行数据。",
1278
- category: "数据操作",
1279
- },
1280
- behavior: "action",
1281
- uiGroup: "data",
1282
- },
1283
- {
1284
- id: "deleteTableRows",
1285
- schema: deleteTableRowsFunctionSchema,
1286
- executor: deleteTableRowsFunc,
1287
- description: {
1288
- name: "deleteTableRows",
1289
- description: "批量删除表中的多行数据。",
1290
- category: "数据操作",
1291
- },
1292
- behavior: "action",
1293
- uiGroup: "data",
1294
- },
1295
- {
1296
- id: "addTableColumn",
1297
- schema: addTableColumnFunctionSchema,
1298
- executor: addTableColumnFunc,
1299
- description: {
1300
- name: "addTableColumn",
1301
- description: "向表中新增字段。",
1302
- category: "数据操作",
1303
- },
1304
- behavior: "action",
1305
- uiGroup: "data",
1306
- },
1307
- {
1308
- id: "deleteTableColumn",
1309
- schema: deleteTableColumnFunctionSchema,
1310
- executor: deleteTableColumnFunc,
1311
- description: {
1312
- name: "deleteTableColumn",
1313
- description: "删除表中的字段,并同步清理现有行数据。",
1314
- category: "数据操作",
1315
- },
1316
- behavior: "action",
1317
- uiGroup: "data",
1318
- },
1319
- {
1320
- id: "renameTableColumn",
1321
- schema: renameTableColumnFunctionSchema,
1322
- executor: renameTableColumnFunc,
1323
- description: {
1324
- name: "renameTableColumn",
1325
- description: "修改表字段的 machine name,并迁移已有行数据。",
1326
- category: "数据操作",
1327
- },
1328
- behavior: "action",
1329
- uiGroup: "data",
1330
- },
1331
- {
1332
- id: "renameTableColumnLabel",
1333
- schema: renameTableColumnLabelFunctionSchema,
1334
- executor: renameTableColumnLabelFunc,
1335
- description: {
1336
- name: "renameTableColumnLabel",
1337
- description: "修改表字段的显示名。",
1338
- category: "数据操作",
1339
- },
1340
- behavior: "action",
1341
- uiGroup: "data",
1342
- },
1343
- {
1344
- id: "renameTable",
1345
- schema: renameTableFunctionSchema,
1346
- executor: renameTableFunc,
1347
- description: {
1348
- name: "renameTable",
1349
- description: "更新表的显示名称。",
1350
- category: "数据操作",
1351
- },
1352
- behavior: "action",
1353
- uiGroup: "data",
1354
- },
1355
- {
1356
- id: "updateContentTitle",
1357
- schema: updateContentTitleTool.function,
1358
- executor: updateContentTitleFunc as any,
1359
- description: {
1360
- name: "update_content_title",
1361
- description: "更新当前空间中某个内容的标题",
1362
- category: "内容管理",
1363
- },
1364
- behavior: "action",
1365
- uiGroup: "content",
1366
- },
1367
- // === Space 导航工具 ===
1368
- {
1369
- id: "listUserSpaces",
1370
- schema: listUserSpacesFunctionSchema,
1371
- executor: listUserSpacesFunc,
1372
- description: {
1373
- name: "listUserSpaces",
1374
- description:
1375
- "获取当前用户可访问的所有 Space 列表(概览),只返回 ID 和名称。",
1376
- category: "数据操作",
1377
- },
1378
- behavior: "data",
1379
- uiGroup: "data",
1380
- },
1381
- {
1382
- id: "listDialogs",
1383
- schema: listDialogsFunctionSchema,
1384
- executor: listDialogsFunc,
1385
- description: {
1386
- name: "listDialogs",
1387
- description: "List the current user's Nolo dialogs.",
1388
- category: "Nolo workspace",
1389
- },
1390
- behavior: "data",
1391
- uiGroup: "content",
1392
- capability: "space_context",
1393
- riskLevel: "low",
1394
- costLevel: "low",
1395
- },
1396
- {
1397
- id: "readDialog",
1398
- schema: readDialogFunctionSchema,
1399
- executor: readDialogFunc,
1400
- description: {
1401
- name: "readDialog",
1402
- description: "Read a Nolo dialog and recent messages.",
1403
- category: "Nolo workspace",
1404
- },
1405
- behavior: "data",
1406
- uiGroup: "content",
1407
- capability: "space_context",
1408
- riskLevel: "low",
1409
- costLevel: "medium",
1410
- },
1411
- {
1412
- id: "listAgents",
1413
- schema: listAgentsFunctionSchema,
1414
- executor: listAgentsFunc,
1415
- description: {
1416
- name: "listAgents",
1417
- description: "List the current user's Nolo agents.",
1418
- category: "Nolo workspace",
1419
- },
1420
- behavior: "data",
1421
- uiGroup: "content",
1422
- capability: "space_context",
1423
- riskLevel: "low",
1424
- costLevel: "low",
1425
- },
1426
- {
1427
- id: "readAgent",
1428
- schema: readAgentFunctionSchema,
1429
- executor: readAgentFunc,
1430
- description: {
1431
- name: "readAgent",
1432
- description: "Read a Nolo agent config.",
1433
- category: "Nolo workspace",
1434
- },
1435
- behavior: "data",
1436
- uiGroup: "content",
1437
- capability: "space_context",
1438
- riskLevel: "low",
1439
- costLevel: "low",
1440
- },
1441
- {
1442
- id: "listSpaces",
1443
- schema: listSpacesFunctionSchema,
1444
- executor: listSpacesFunc,
1445
- description: {
1446
- name: "listSpaces",
1447
- description: "List joined Nolo spaces.",
1448
- category: "Nolo workspace",
1449
- },
1450
- behavior: "data",
1451
- uiGroup: "content",
1452
- capability: "space_context",
1453
- riskLevel: "low",
1454
- costLevel: "low",
1455
- },
1456
- {
1457
- id: "readSpace",
1458
- schema: readSpaceFunctionSchema,
1459
- executor: readSpaceFunc,
1460
- description: {
1461
- name: "readSpace",
1462
- description: "Read a Nolo space and its contents.",
1463
- category: "Nolo workspace",
1464
- },
1465
- behavior: "data",
1466
- uiGroup: "content",
1467
- capability: "space_context",
1468
- riskLevel: "low",
1469
- costLevel: "medium",
1470
- },
1471
- {
1472
- id: "cliWhoami",
1473
- schema: cliWhoamiFunctionSchema,
1474
- executor: cliWhoamiFunc,
1475
- description: {
1476
- name: "cliWhoami",
1477
- description: "Show current Nolo runtime identity.",
1478
- category: "Nolo workspace",
1479
- },
1480
- behavior: "data",
1481
- uiGroup: "content",
1482
- capability: "space_context",
1483
- riskLevel: "low",
1484
- costLevel: "low",
1485
- },
1486
- {
1487
- id: "cliDoctor",
1488
- schema: cliDoctorFunctionSchema,
1489
- executor: cliDoctorFunc,
1490
- description: {
1491
- name: "cliDoctor",
1492
- description: "Show current Nolo runtime diagnostics.",
1493
- category: "Nolo workspace",
1494
- },
1495
- behavior: "data",
1496
- uiGroup: "content",
1497
- capability: "space_context",
1498
- riskLevel: "low",
1499
- costLevel: "low",
1500
- },
1501
- {
1502
- id: "deleteSpaces",
1503
- schema: deleteSpacesFunctionSchema,
1504
- executor: deleteSpacesFunc,
1505
- previewExecutor: deleteSpacesPreviewFunc,
1506
- description: {
1507
- name: "deleteSpaces",
1508
- description:
1509
- "按名称或 ID 删除当前用户拥有的 Space;先列出候选,用户确认后才删除 Space 壳和成员关系。",
1510
- category: "数据操作",
1511
- },
1512
- behavior: "action",
1513
- uiGroup: "data",
1514
- capability: "space_context",
1515
- interaction: "confirm",
1516
- riskLevel: "high",
1517
- costLevel: "low",
1518
- defaultConsent: "ask",
1519
- },
1520
- {
1521
- id: "listLocalRoots",
1522
- schema: listLocalRootsFunctionSchema,
1523
- executor: listLocalRootsFunc,
1524
- description: {
1525
- name: "listLocalRoots",
1526
- description: "列出当前桌面客户端里已经授权的本地文件夹 roots。",
1527
- category: "本地文件",
1528
- },
1529
- behavior: "data",
1530
- uiGroup: "data",
1531
- capability: "general",
1532
- riskLevel: "low",
1533
- costLevel: "low",
1534
- defaultConsent: "ask",
1535
- },
1536
- {
1537
- id: "requestLocalFolderAccess",
1538
- schema: requestLocalFolderAccessFunctionSchema,
1539
- executor: requestLocalFolderAccessFunc,
1540
- description: {
1541
- name: "requestLocalFolderAccess",
1542
- description: "为桌面客户端请求授权一个本地文件夹,并返回可复用的 rootId。",
1543
- category: "本地文件",
1544
- },
1545
- behavior: "action",
1546
- uiGroup: "data",
1547
- capability: "general",
1548
- interaction: "confirm",
1549
- riskLevel: "medium",
1550
- costLevel: "low",
1551
- defaultConsent: "ask",
1552
- },
1553
- {
1554
- id: "listLocalFiles",
1555
- schema: listLocalFilesFunctionSchema,
1556
- executor: listLocalFilesFunc,
1557
- description: {
1558
- name: "listLocalFiles",
1559
- description: "列出 Windows 桌面客户端中用户已授权本地文件夹内的文件和目录。",
1560
- category: "本地文件",
1561
- },
1562
- behavior: "data",
1563
- uiGroup: "data",
1564
- capability: "general",
1565
- riskLevel: "low",
1566
- costLevel: "low",
1567
- defaultConsent: "ask",
1568
- },
1569
- {
1570
- id: "readLocalFile",
1571
- schema: readLocalFileFunctionSchema,
1572
- executor: readLocalFileFunc,
1573
- description: {
1574
- name: "readLocalFile",
1575
- description: "读取 Windows 桌面客户端中用户已授权本地文件夹内的文本文件。",
1576
- category: "本地文件",
1577
- },
1578
- behavior: "data",
1579
- uiGroup: "data",
1580
- capability: "general",
1581
- riskLevel: "medium",
1582
- costLevel: "low",
1583
- defaultConsent: "ask",
1584
- },
1585
- {
1586
- id: "proposeLocalFileChanges",
1587
- schema: proposeLocalFileChangesFunctionSchema,
1588
- executor: proposeLocalFileChangesFunc,
1589
- previewExecutor: proposeLocalFileChangesPreviewFunc,
1590
- description: {
1591
- name: "proposeLocalFileChanges",
1592
- description: "为用户已授权的本地文件夹创建待确认整理计划,不会直接修改本地文件。",
1593
- category: "本地文件",
1594
- },
1595
- behavior: "action",
1596
- uiGroup: "data",
1597
- capability: "general",
1598
- interaction: "confirm",
1599
- riskLevel: "high",
1600
- costLevel: "low",
1601
- defaultConsent: "ask",
1602
- },
1603
- {
1604
- id: "executeApprovedLocalFileChanges",
1605
- schema: executeApprovedLocalFileChangesFunctionSchema,
1606
- executor: executeApprovedLocalFileChangesFunc,
1607
- description: {
1608
- name: "executeApprovedLocalFileChanges",
1609
- description: "执行用户已经确认的本地文件整理计划。",
1610
- category: "本地文件",
1611
- },
1612
- behavior: "action",
1613
- uiGroup: "data",
1614
- capability: "general",
1615
- interaction: "confirm",
1616
- riskLevel: "high",
1617
- costLevel: "low",
1618
- defaultConsent: "ask",
1619
- },
1620
- {
1621
- id: "undoLocalFileChangeBatch",
1622
- schema: undoLocalFileChangeBatchFunctionSchema,
1623
- executor: undoLocalFileChangeBatchFunc,
1624
- description: {
1625
- name: "undoLocalFileChangeBatch",
1626
- description: "撤销一个本地文件整理批次中可撤销的移动或重命名操作。",
1627
- category: "本地文件",
1628
- },
1629
- behavior: "action",
1630
- uiGroup: "data",
1631
- capability: "general",
1632
- interaction: "confirm",
1633
- riskLevel: "medium",
1634
- costLevel: "low",
1635
- defaultConsent: "ask",
1636
- },
1637
-
1638
- // --- 网络与智能 ---
1639
- {
1640
- id: "fetchWebpage",
1641
- schema: fetchWebpageFunctionSchema,
1642
- executor: fetchWebpageFunc,
1643
- description: {
1644
- name: "fetchWebpage",
1645
- description: "访问网页并获取其内容",
1646
- category: "网络与智能",
1647
- },
1648
- behavior: "data",
1649
- },
1650
- {
1651
- id: "convertMarxistsBookToOfflineHtml",
1652
- schema: convertMarxistsBookToOfflineHtmlFunctionSchema,
1653
- executor: convertMarxistsBookToOfflineHtmlFunc,
1654
- description: {
1655
- name: "convertMarxistsBookToOfflineHtml",
1656
- description:
1657
- "将 Marxists.org 中文旧式书籍页面转换成保留原 CSS、背景和排版的离线单 HTML。",
1658
- category: "网络与智能",
1659
- },
1660
- behavior: "data",
1661
- capability: "web_access",
1662
- riskLevel: "low",
1663
- costLevel: "medium",
1664
- defaultConsent: "auto",
1665
- cancelable: true,
1666
- },
1667
- {
1668
- id: "readXPost",
1669
- schema: readXPostFunctionSchema,
1670
- executor: readXPostFunc,
1671
- description: {
1672
- name: "read_x_post",
1673
- description:
1674
- "读取 X/Twitter status 链接的可见帖子正文和结构化数据,适合总结、解释或抽取用户给出的 X 帖子。",
1675
- category: "网络与智能",
1676
- },
1677
- behavior: "data",
1678
- capability: "web_access",
1679
- riskLevel: "low",
1680
- costLevel: "low",
1681
- defaultConsent: "auto",
1682
- cancelable: true,
1683
- },
1684
- {
1685
- id: "readXhsProfile",
1686
- schema: readXhsProfileFunctionSchema,
1687
- executor: readXhsProfileFunc,
1688
- description: {
1689
- name: "read_xhs_profile",
1690
- description:
1691
- "读取小红书用户主页的公开信息:用户资料、笔记列表、笔记详情指标和评论摘要。适合分析小红书账号内容和互动数据。",
1692
- category: "网络与智能",
1693
- },
1694
- behavior: "data",
1695
- capability: "web_access",
1696
- riskLevel: "low",
1697
- costLevel: "low",
1698
- defaultConsent: "auto",
1699
- cancelable: true,
1700
- },
1701
-
1702
- {
1703
- id: "surfWeather",
1704
- schema: surfWeatherFunctionSchema,
1705
- executor: surfWeatherFunc,
1706
- description: {
1707
- name: "surfWeather",
1708
- description:
1709
- "获取指定海岸位置的冲浪天气预报(浪高、涌浪、周期、浪向),判断是否适合冲浪。",
1710
- category: "网络与智能",
1711
- },
1712
- behavior: "data",
1713
- },
1714
-
1715
- // === Cloudflare Browser Rendering 爬取工具 ===
1716
- {
1717
- id: "cloudflareCrawl",
1718
- schema: cloudflareCrawlFunctionSchema,
1719
- executor: cloudflareCrawlFunc,
1720
- description: {
1721
- name: "cloudflareCrawl",
1722
- description:
1723
- "使用 Cloudflare Browser Rendering 爬取整个网站(支持 JS 渲染),一次调用可获取多页 Markdown 内容,适合站点级内容抓取。",
1724
- category: "网络与智能",
1725
- },
1726
- behavior: "data",
1727
- },
1728
- {
1729
- id: "cloudflareCrawlStatus",
1730
- schema: cloudflareCrawlStatusFunctionSchema,
1731
- executor: cloudflareCrawlStatusFunc,
1732
- description: {
1733
- name: "cloudflareCrawlStatus",
1734
- description: "查询 Cloudflare 爬取任务的当前状态和结果(配合 cloudflareCrawl wait=false 使用)。",
1735
- category: "网络与智能",
1736
- },
1737
- behavior: "data",
1738
- },
1739
-
1740
- // === Apify 抓取工具 ===
1741
- {
1742
- id: "googleSearchScraper",
1743
- schema: googleSearchScraperFunctionSchema,
1744
- executor: googleSearchScraperFunc,
1745
- description: {
1746
- name: "googleSearchScraper",
1747
- description: "抓取 Google 搜索结果(SERP),返回自然结果、广告、People Also Ask 等结构化数据。",
1748
- category: "网络与智能",
1749
- },
1750
- behavior: "data",
1751
- },
1752
- {
1753
- id: "youtubeScraper",
1754
- schema: youtubeScraperFunctionSchema,
1755
- executor: youtubeScraperFunc,
1756
- description: {
1757
- name: "youtubeScraper",
1758
- description:
1759
- "使用 Apify YouTube Scraper 抓取指定视频、频道或搜索结果的详细数据(支持字幕)。",
1760
- category: "网络与智能",
1761
- },
1762
- behavior: "data",
1763
- },
1764
- {
1765
- id: "ecommerceScraper",
1766
- schema: ecommerceScraperFunctionSchema,
1767
- executor: ecommerceScraperFunc,
1768
- description: {
1769
- name: "ecommerceScraper",
1770
- description:
1771
- "使用 Apify E-commerce Scraping Tool 抓取电商产品、评论和卖家信息。",
1772
- category: "网络与智能",
1773
- },
1774
- behavior: "data",
1775
- },
1776
- {
1777
- id: "taobaoTmallProductScraper",
1778
- schema: taobaoTmallProductScraperFunctionSchema,
1779
- executor: taobaoTmallProductScraperFunc,
1780
- description: {
1781
- name: "taobaoTmallProductScraper",
1782
- description:
1783
- "使用 Apify Taobao/Tmall Product Scraper 抓取淘宝/天猫商品真实详情、SKU、价格、库存和规格参数。",
1784
- category: "网络与智能",
1785
- },
1786
- behavior: "data",
1787
- capability: "web_access",
1788
- riskLevel: "low",
1789
- costLevel: "low",
1790
- defaultConsent: "auto",
1791
- cancelable: true,
1792
- },
1793
- {
1794
- id: "jdProductScraper",
1795
- schema: jdProductScraperFunctionSchema,
1796
- executor: jdProductScraperFunc,
1797
- description: {
1798
- name: "jdProductScraper",
1799
- description:
1800
- "抓取京东商品页内嵌真实商品参数,返回标题、品牌、型号、店铺、尺寸重量、价格、图片、变体和库存状态。",
1801
- category: "网络与智能",
1802
- },
1803
- behavior: "data",
1804
- capability: "web_access",
1805
- riskLevel: "low",
1806
- costLevel: "low",
1807
- defaultConsent: "auto",
1808
- cancelable: true,
1809
- },
1810
- {
1811
- id: "amazonProductScraper",
1812
- schema: amazonProductScraperFunctionSchema,
1813
- executor: amazonProductScraperFunc,
1814
- description: {
1815
- name: "amazonProductScraper",
1816
- description:
1817
- "使用 Apify Amazon Product Scraper 抓取亚马逊商品和类目数据。",
1818
- category: "网络与智能",
1819
- },
1820
- behavior: "data",
1821
- },
1822
-
1823
- // 浏览器会话工具
1824
- {
1825
- id: "browserCloseSession",
1826
- schema: browser_closeSession_Schema,
1827
- executor: browser_closeSession_Func,
1828
- description: {
1829
- name: "browser_closeSession",
1830
- description: "关闭浏览器会话并释放服务器槽位。",
1831
- category: "网络与智能",
1832
- },
1833
- behavior: "action",
1834
- },
1835
- {
1836
- id: "browserOpenSession",
1837
- schema: browser_openSession_Schema,
1838
- executor: browser_openSession_Func,
1839
- description: {
1840
- name: "browser_openSession",
1841
- description: "打开一个新的浏览器会话并导航到 URL,返回会话ID",
1842
- category: "网络与智能",
1843
- },
1844
- behavior: "action",
1845
- },
1846
- {
1847
- id: "browserSelectOption",
1848
- schema: browser_selectOption_Schema,
1849
- executor: browser_selectOption_Func,
1850
- description: {
1851
- name: "browser_selectOption",
1852
- description: "在浏览器会话中选择一个下拉框选项",
1853
- category: "网络与智能",
1854
- },
1855
- behavior: "action",
1856
- },
1857
- {
1858
- id: "browserClick",
1859
- schema: browser_click_Schema,
1860
- executor: browser_click_Func,
1861
- description: {
1862
- name: "browser_click",
1863
- description: "在浏览器会话中点击指定元素 (例如按钮、链接)。",
1864
- category: "网络与智能",
1865
- },
1866
- behavior: "action",
1867
- },
1868
- {
1869
- id: "browserTypeText",
1870
- schema: browser_typeText_Schema,
1871
- executor: browser_typeText_Func,
1872
- description: {
1873
- name: "browser_typeText",
1874
- description: "在浏览器会话中向输入框填写文本 (可选回车)。",
1875
- category: "网络与智能",
1876
- },
1877
- behavior: "action",
1878
- },
1879
- {
1880
- id: "browserReadContent",
1881
- schema: browser_readContent_Schema,
1882
- executor: browser_readContent_Func,
1883
- description: {
1884
- name: "browser_readContent",
1885
- description: "读取当前浏览器页面或指定元素的可见文本内容。",
1886
- category: "网络与智能",
1887
- },
1888
- behavior: "data",
1889
- },
1890
- {
1891
- id: "exaSearch",
1892
- schema: exaSearchSchema,
1893
- executor: exaSearchFunc,
1894
- description: {
1895
- name: "exa_search",
1896
- description: "使用 Exa 神经网络搜索引擎获取高质量、结构化的网络信息(包含正文)。",
1897
- category: "网络与智能",
1898
- },
1899
- behavior: "data",
1900
- },
1901
- {
1902
- id: "olmOcr",
1903
- schema: olmOcrSchema,
1904
- executor: olmOcrFunc,
1905
- description: {
1906
- name: "olm_ocr",
1907
- description: "使用 olmOCR-2-7B-1025 进行图片文字识别,适合文档、论文等结构化文本的高质量识别。",
1908
- category: "网络与智能",
1909
- },
1910
- behavior: "data",
1911
- },
1912
- {
1913
- id: "whisperTurbo",
1914
- schema: whisperTurboSchema,
1915
- executor: whisperTurboFunc,
1916
- description: {
1917
- name: "whisper_turbo",
1918
- description: "使用 whisper-large-v3-turbo 快速转录音频为文字,支持多语言,速度快价格低。",
1919
- category: "音频与媒体",
1920
- },
1921
- behavior: "data",
1922
- },
1923
- {
1924
- id: "whisperV3",
1925
- schema: whisperV3Schema,
1926
- executor: whisperV3Func,
1927
- description: {
1928
- name: "whisper_v3",
1929
- description: "使用 whisper-large-v3 高精度转录音频,中文/多语言准确率更高,适合对质量要求严格的场景。",
1930
- category: "音频与媒体",
1931
- },
1932
- behavior: "data",
1933
- },
1934
-
1935
- // --- Cloudflare Browser Rendering ---
1936
-
1937
- {
1938
- id: "cfScreenshot",
1939
- schema: cfScreenshotFunctionSchema,
1940
- executor: cfScreenshotFunc,
1941
- description: {
1942
- name: "cfScreenshot",
1943
- description: "使用 Cloudflare Browser Rendering 对网页或 HTML 截图,支持全页截图和自定义视口。",
1944
- category: "网络与智能",
1945
- },
1946
- behavior: "data",
1947
- uiGroup: "general",
1948
- },
1949
- {
1950
- id: "cfGetMarkdown",
1951
- schema: cfGetMarkdownFunctionSchema,
1952
- executor: cfGetMarkdownFunc,
1953
- description: {
1954
- name: "cfGetMarkdown",
1955
- description: "使用 Cloudflare Browser Rendering 将网页转为 Markdown,支持 JS 渲染,速度快于多页爬取。",
1956
- category: "网络与智能",
1957
- },
1958
- behavior: "data",
1959
- uiGroup: "general",
1960
- },
1961
- {
1962
- id: "cfGeneratePDF",
1963
- schema: cfGeneratePDFFunctionSchema,
1964
- executor: cfGeneratePDFFunc,
1965
- description: {
1966
- name: "cfGeneratePDF",
1967
- description: "使用 Cloudflare Browser Rendering 将网页或 HTML 渲染为 PDF 文件,适合文档导出。",
1968
- category: "文档生成",
1969
- },
1970
- behavior: "action",
1971
- uiGroup: "general",
1972
- },
1973
- {
1974
- id: "cfExtractJSON",
1975
- schema: cfExtractJSONFunctionSchema,
1976
- executor: cfExtractJSONFunc,
1977
- description: {
1978
- name: "cfExtractJSON",
1979
- description: "使用 Cloudflare Browser Rendering + AI 从网页提取结构化 JSON 数据,用自然语言描述需要的字段。",
1980
- category: "网络与智能",
1981
- },
1982
- behavior: "data",
1983
- uiGroup: "general",
1984
- },
1985
- {
1986
- id: "appPreflight",
1987
- schema: appPreflightFunctionSchema,
1988
- executor: appPreflightFunc,
1989
- description: {
1990
- name: "appPreflight",
1991
- description: "在部署前检查应用结构、依赖、图标与常见构建问题。",
1992
- category: "应用部署",
1993
- },
1994
- behavior: "data",
1995
- uiGroup: "general",
1996
- },
1997
- {
1998
- id: "appDeploy",
1999
- schema: appDeployFunctionSchema,
2000
- executor: appDeployFunc,
2001
- description: {
2002
- name: "appDeploy",
2003
- description: "将 JavaScript/TypeScript 代码部署为平台托管的 Web 应用。",
2004
- category: "应用部署",
2005
- },
2006
- behavior: "data",
2007
- uiGroup: "general",
2008
- },
2009
- {
2010
- id: "appList",
2011
- schema: appListFunctionSchema,
2012
- executor: appListFunc,
2013
- description: {
2014
- name: "appList",
2015
- description: "列出当前用户已部署的所有应用,包括名称、appId 和访问 URL。",
2016
- category: "应用部署",
2017
- },
2018
- behavior: "data",
2019
- uiGroup: "general",
2020
- },
2021
- {
2022
- id: "appDelete",
2023
- schema: appDeleteFunctionSchema,
2024
- executor: appDeleteFunc,
2025
- description: {
2026
- name: "appDelete",
2027
- description: "删除一个已部署的应用,删除后 URL 立即失效。",
2028
- category: "应用部署",
2029
- },
2030
- behavior: "data",
2031
- uiGroup: "general",
2032
- },
2033
- {
2034
- id: "appRead",
2035
- schema: appReadFunctionSchema,
2036
- executor: appReadFunc,
2037
- description: {
2038
- name: "appRead",
2039
- description: "读取已部署应用的当前代码,修改应用前必须先调用此工具获取现有代码。",
2040
- category: "应用部署",
2041
- },
2042
- behavior: "data",
2043
- uiGroup: "general",
2044
- },
2045
- {
2046
- id: "cfSpeechToText",
2047
- schema: cfSpeechToTextFunctionSchema,
2048
- executor: cfSpeechToTextFunc,
2049
- description: {
2050
- name: "cfSpeechToText",
2051
- description: "使用 Cloudflare Workers AI (@cf/openai/whisper) 将音频文件转换为文字,支持多语言自动识别。",
2052
- category: "媒体处理",
2053
- },
2054
- behavior: "data",
2055
- uiGroup: "general",
2056
- },
2057
- {
2058
- id: "execShell",
2059
- schema: execShellFunctionSchema,
2060
- executor: execShellFunc,
2061
- description: {
2062
- name: "exec_shell",
2063
- description:
2064
- "通过后端 shell 执行接口运行跨平台命令:Windows 优先 PowerShell,Linux/macOS 使用 bash,仅用于本地开发调试。",
2065
- category: "网络与智能",
2066
- },
2067
- behavior: "action",
2068
- },
2069
- {
2070
- id: "checkEnv",
2071
- schema: checkEnvFunctionSchema,
2072
- executor: checkEnvFunc,
2073
- description: {
2074
- name: "checkEnv",
2075
- description:
2076
- "执行环境检查(当前默认并支持 build),用于代码变更后的快速生效前验证。",
2077
- category: "网络与智能",
2078
- },
2079
- behavior: "action",
2080
- uiGroup: "data",
2081
- },
2082
-
2083
- // --- 多媒体生成 / 文档生成 ---
2084
-
2085
- {
2086
- id: "geminiFlashImage",
2087
- schema: geminiFlashImageFunctionSchema,
2088
- executor: geminiFlashImageFunc,
2089
- description: {
2090
- name: "geminiFlashImage",
2091
- description:
2092
- "使用 Gemini 2.5 Flash 模型,根据文字说明和可选输入图片生成图像,适合文生图和轻量编辑。",
2093
- category: "多媒体生成",
2094
- },
2095
- behavior: "action",
2096
- uiGroup: "media",
2097
- },
2098
- {
2099
- id: "geminiProImagePreview",
2100
- schema: geminiProImagePreviewFunctionSchema,
2101
- executor: geminiProImagePreviewFunc,
2102
- description: {
2103
- name: "geminiProImagePreview",
2104
- description:
2105
- "使用 Gemini 3 Pro Image Preview 模型,基于一张或多张输入图片进行复杂编辑和多图合成。",
2106
- category: "多媒体生成",
2107
- },
2108
- behavior: "action",
2109
- uiGroup: "media",
2110
- },
2111
- {
2112
- id: "openAIGptImageGenerate",
2113
- schema: openAIGptImageGenerateFunctionSchema,
2114
- executor: openAIGptImageGenerateFunc,
2115
- description: {
2116
- name: "openAIGptImageGenerate",
2117
- description:
2118
- "使用 OpenAI GPT Image 2 生成新图片,适合文本出图与基于参考图的单次新图生成。",
2119
- category: "多媒体生成",
2120
- },
2121
- behavior: "action",
2122
- uiGroup: "media",
2123
- },
2124
- {
2125
- id: "openAIGptImageEdit",
2126
- schema: openAIGptImageEditFunctionSchema,
2127
- executor: openAIGptImageEditFunc,
2128
- description: {
2129
- name: "openAIGptImageEdit",
2130
- description:
2131
- "使用 OpenAI GPT Image 2 编辑现有图片,适合多图参考、局部修改与连续改图。",
2132
- category: "多媒体生成",
2133
- },
2134
- behavior: "action",
2135
- uiGroup: "media",
2136
- },
2137
- {
2138
- id: "openAIGptImage",
2139
- schema: openAIGptImageFunctionSchema,
2140
- executor: openAIGptImageFunc,
2141
- description: {
2142
- name: "openAIGptImage",
2143
- description:
2144
- "使用 OpenAI GPT Image 1.5 生成或编辑图片,适合项目页素材、海报、插画和改图。",
2145
- category: "多媒体生成",
2146
- },
2147
- behavior: "action",
2148
- uiGroup: "media",
2149
- },
2150
- {
2151
- id: "remotionRenderVideo",
2152
- schema: remotionRenderVideoFunctionSchema,
2153
- executor: remotionRenderVideoFunc,
2154
- description: {
2155
- name: "remotionRenderVideo",
2156
- description:
2157
- "使用平台内 Remotion 模板渲染手机传播视频或产品介绍视频,并保存为 MP4。",
2158
- category: "多媒体生成",
2159
- },
2160
- behavior: "action",
2161
- uiGroup: "media",
2162
- capability: "general",
2163
- riskLevel: "medium",
2164
- costLevel: "medium",
2165
- defaultConsent: "ask",
2166
- cancelable: true,
2167
- },
2168
- {
2169
- id: "generateDocx",
2170
- schema: generateDocxFunctionSchema,
2171
- executor: generateDocxFunc,
2172
- description: {
2173
- name: "generateDocx",
2174
- description:
2175
- "在浏览器端根据指定 DOCX 模板 URL 和变量生成文档,并触发下载。",
2176
- category: "文档生成",
2177
- },
2178
- behavior: "action",
2179
- },
2180
- ];
2181
-
2182
- // 汇总所有工具定义:基础工具 + Agent 分组 + 代码分组
2183
- const toolDefinitions: ToolDefinition[] = [
2184
- ...baseToolDefinitions,
2185
- ...agentToolDefinitions,
2186
- ...codeToolDefinitions,
2187
- ];
2188
-
2189
- /* ==================================================================
2190
- * 3.1 动态为 createAgent / updateAgent 的 tools 字段补 enum
2191
- * ================================================================== */
2192
-
2193
- // 所有函数工具的 schema.name 列表
2194
- const ALL_TOOL_FUNCTION_NAMES: string[] = toolDefinitions
2195
- .map((tool) => tool.schema?.name)
2196
- .filter((name): name is string => Boolean(name));
2197
-
2198
- // Agent 可用的工具名:保留 ui_ask_choice,排除 toolquery 和默认开启的浏览器/搜索工具
2199
- const AGENT_AVAILABLE_TOOL_NAMES = ALL_TOOL_FUNCTION_NAMES.filter(
2200
- (name) =>
2201
- name !== "toolquery" &&
2202
- !name.startsWith("browser_") &&
2203
- name !== "exa_search"
2204
- );
2205
-
2206
- // 给 createAgent / updateAgent 的 tools 参数 items 动态挂 enum
2207
- export const patchAgentToolSchemas = () => {
2208
- try {
2209
- const createAgentToolsProp =
2210
- createAgentToolFunctionSchema?.parameters?.properties?.tools;
2211
- if (createAgentToolsProp?.items && !(createAgentToolsProp.items as any).enum) {
2212
- (createAgentToolsProp.items as any).enum = AGENT_AVAILABLE_TOOL_NAMES;
2213
- }
2214
-
2215
- const updateAgentToolsProp =
2216
- updateAgentToolFunctionSchema?.parameters?.properties?.tools;
2217
- if (updateAgentToolsProp?.items && !(updateAgentToolsProp.items as any).enum) {
2218
- (updateAgentToolsProp.items as any).enum = AGENT_AVAILABLE_TOOL_NAMES;
2219
- }
2220
- } catch {
2221
- // 静默失败即可,不影响其他工具
2222
- }
2223
- };
2224
-
2225
- patchAgentToolSchemas();
2226
-
2227
- /* ==================================================================
2228
- * 4. 程序化生成所需的各个对象
2229
- * ================================================================== */
2230
-
2231
- export const toolRegistry: Record<string, any> = toolDefinitions.reduce(
2232
- (acc, tool) => {
2233
- acc[tool.schema.name] = { type: "function", function: tool.schema };
2234
- return acc;
2235
- },
2236
- {} as Record<string, any>
2237
- );
2238
-
2239
- export const toolExecutors: Record<string, ToolDefinition["executor"]> =
2240
- toolDefinitions.reduce(
2241
- (acc, tool) => {
2242
- acc[tool.schema.name] = tool.executor;
2243
- return acc;
2244
- },
2245
- {} as Record<string, ToolDefinition["executor"]>
2246
- );
2247
-
2248
- export const toolDescriptions: Record<string, ToolDefinition["description"]> =
2249
- toolDefinitions.reduce(
2250
- (acc, tool) => {
2251
- acc[tool.schema.name] = tool.description;
2252
- return acc;
2253
- },
2254
- {} as Record<string, ToolDefinition["description"]>
2255
- );
2256
-
2257
- export const toolDefinitionsByName: Record<string, ToolDefinition> =
2258
- toolDefinitions.reduce(
2259
- (acc, tool) => {
2260
- acc[tool.schema.name] = tool;
2261
- return acc;
2262
- },
2263
- {} as Record<string, ToolDefinition>
2264
- );
2265
-
2266
- /* ==================================================================
2267
- * 5. 工具查找辅助函数
2268
- * ================================================================== */
2269
- const normalizeToolName = (name: string): string =>
2270
- name.replace(/[-_]/g, "").toLowerCase();
2271
-
2272
- export const findToolExecutor = (
2273
- rawName: string
2274
- ): {
2275
- executor: ToolDefinition["executor"];
2276
- canonicalName: string;
2277
- } => {
2278
- const normalizedRawName = normalizeToolName(canonicalizeToolName(rawName));
2279
- const canonicalName = Object.keys(toolExecutors).find(
2280
- (key) => normalizeToolName(key) === normalizedRawName
2281
- );
2282
-
2283
- if (canonicalName && toolExecutors[canonicalName]) {
2284
- return {
2285
- executor: toolExecutors[canonicalName],
2286
- canonicalName,
2287
- };
2288
- }
2289
- throw new Error(`执行器未找到:未知工具 "${rawName}"`);
2290
- };