index.ts 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. export {
  2. MEMORY_SOFT_LIMIT_BYTES,
  3. MEMORY_HARD_LIMIT_BYTES,
  4. MEMORY_INJECTION_CAP_CHARS,
  5. MEMORY_SUMMARY_INJECTION_CAP_CHARS,
  6. MEMORY_TAIL_INJECTION_CAP_CHARS,
  7. DAILY_RECENT_CAP_CHARS,
  8. MEMORY_CLEANUP_TRIGGER_BYTES,
  9. MEMORY_CLEANUP_MIN_BYTES,
  10. MAX_TOPIC_FILES,
  11. MAX_TOPIC_FILE_BYTES,
  12. DAILY_DIGEST_TTL_DAYS,
  13. CLEANUP_DEDUP_WINDOW_MS,
  14. } from './memory-limits.js';
  15. export { loadBetterSqlite3 } from './sqlite-driver.js';
  16. export {
  17. normalizeProductBuildEnvironment,
  18. resolveProductBuildIdentity,
  19. } from './product-build-identity.js';
  20. export type {
  21. ProductBuildEnvironment,
  22. ProductBuildIdentity,
  23. ProductBuildVariant,
  24. ResolveProductBuildIdentityOptions,
  25. } from './product-build-identity.js';
  26. export { buildPluginSkillRuntimeName } from './plugin-skill-name.js';
  27. export { toNavigationPlainText } from './navigation-text.js';
  28. export { collectFetchedWebSources } from './fetched-web-sources.js';
  29. export { collectUsedWebEvidenceIds } from './web-source-evidence.js';
  30. export {
  31. collectWebSourceCitations,
  32. type ContextualWebCitation,
  33. } from './markdown-source-citation.js';
  34. export {
  35. buildToolCallCitationId,
  36. compactToolCallCitationKey,
  37. findUniqueSingleSubstitutionCitationAlias,
  38. resolveKnownCitationAlias,
  39. } from './source-citation-id.js';
  40. export { KeyedOperationLane } from './keyed-operation-lane.js';
  41. export { isSensitiveHandoffPath } from './session-handoff-sensitive-path.js';
  42. export {
  43. OPENROUTER_ATTRIBUTION_HEADERS,
  44. isOpenRouterApiUrl,
  45. withOpenRouterAttributionHeaders,
  46. } from './openrouter-attribution.js';
  47. export {
  48. retryWindowsFileSystemOperation,
  49. type WindowsFileSystemRetryOptions,
  50. } from './windows-file-system.js';
  51. export { SESSION_LLM_RETRY_EVENT_TYPE } from './llm-retry-event.js';
  52. export type {
  53. SessionLLMRetryEventPayload,
  54. SessionLLMRetryReason,
  55. SessionLLMRetryScope,
  56. SessionLLMRetryStatus,
  57. } from './llm-retry-event.js';
  58. export {
  59. MAVIS_BROWSER_EXTENSION_ID,
  60. getHostName,
  61. generateManifest,
  62. serializeManifest,
  63. getNativeHostDirs,
  64. getManifestFileName,
  65. getManifestPath,
  66. generateHostWrapper,
  67. getWindowsRegistryEntries,
  68. } from './browser-manifest.js';
  69. export type {
  70. NativeMessagingManifest,
  71. ManifestOptions,
  72. BrowserName,
  73. BrowserHostDir,
  74. WindowsRegistryEntry,
  75. } from './browser-manifest.js';
  76. // Owner `<mavis-thinking>` and `<mavis-progress>` block helpers — single
  77. // source of truth for daemon, IM forwarders, and UI. Keep both packages on
  78. // the same regex/strip semantics; do not redefine the regex elsewhere.
  79. export {
  80. MAVIS_THINKING_BLOCK_RE,
  81. MAVIS_PROGRESS_BLOCK_RE,
  82. MAVIS_INNERMOST_PAIRED_BLOCK_RE,
  83. stripMavisThinkingTags,
  84. stripMavisProgressTags,
  85. stripMavisTagsForIm,
  86. extractVisibleContent,
  87. isThinkingOrProgressOnly,
  88. isThinkingOnlyContent,
  89. containsMavisProgressBlock,
  90. containsMavisThinkingBlock,
  91. containsMavisPairedBlock,
  92. } from './mavis-tags.js';
  93. export {
  94. parseWatchInterval,
  95. parseSelfReminderTtl,
  96. appendTtlPromptSuffix,
  97. generateWatchCronName,
  98. DEFAULT_SELF_REMINDER_TTL_SECONDS,
  99. MAX_SELF_REMINDER_TTL_SECONDS,
  100. TTL_NEVER,
  101. } from './watch-interval.js';
  102. export type { ParsedInterval, ParsedTtl } from './watch-interval.js';
  103. // Mid-turn queued-user-message injection wrapper — shared by local-runtime
  104. // compatibility imports (Path A) and cloud-runtime (Path B) so the wire
  105. // format stays identical.
  106. export {
  107. QUEUED_USER_MESSAGE_TAG,
  108. escapeQueuedUserMessageTags,
  109. wrapQueuedMessageText,
  110. wrapQueuedMessageBatch,
  111. } from './queued-message-wrapper.js';
  112. export type { QueuedMessageMetadata } from './queued-message-wrapper.js';
  113. // Shared aggregator for drained queued user-message batches — local-runtime
  114. // and cloud-runtime both apply the same IM-priority rule: any IM wins,
  115. // multiple IMs → last IM in FIFO order.
  116. export { isChannelSource, aggregateQueuedSource } from './queued-message-source.js';
  117. export type { QueuedItemSourceLike, AggregatedQueuedSource } from './queued-message-source.js';
  118. export {
  119. CRON_SESSION_PURPOSE_PREFIX,
  120. MEMORY_CLEANUP_CRON_NAME,
  121. createCronSessionPurpose,
  122. formatCronRunTitle,
  123. isLegacyMemoryCleanupTitle,
  124. parseCronSessionPurpose,
  125. } from './cron-purpose.js';
  126. export {
  127. DESKTOP_METRICS_BATCH_PATH,
  128. MetricsClient,
  129. MetricsReporter,
  130. MetricsReportError,
  131. buildMetricKey,
  132. createDesktopReporter,
  133. createMetricsClient,
  134. } from './metrics-proxy.js';
  135. export {
  136. createStructuredLogger,
  137. wrapTraceContextLogger,
  138. createDiskLogTransport,
  139. formatHourKey,
  140. type StructuredLoggerOptions,
  141. type TraceContextLike,
  142. type DiskLogTransport,
  143. type DiskLogTransportOptions,
  144. } from './logging/index.js';
  145. export type {
  146. CreateDesktopReporterOptions,
  147. CreateMetricsClientOptions,
  148. MetricsBatchReporter,
  149. MetricLabels,
  150. MetricPoint,
  151. MetricType,
  152. MetricsClientOptions,
  153. MetricsClientRetryOptions,
  154. MetricsReporterOptions,
  155. ReportMetricsBatchRequest,
  156. ReportMetricsBatchResponse,
  157. } from './metrics-proxy.js';
  158. export type {
  159. ChannelPlatform,
  160. SessionStrategy,
  161. NormalizedSessionStrategy,
  162. ChannelRoutingMode,
  163. ChannelRouteMatch,
  164. ChannelRouteTarget,
  165. ChannelRouteRule,
  166. ChannelRouteDefaultTarget,
  167. ChannelRouteDefaults,
  168. ChannelRouteConfig,
  169. ChannelMessageContext,
  170. ResolvedRoute,
  171. AgentChannelSessionConfig,
  172. AgentChannelMessageFilter,
  173. AgentChannelPlatformConfig,
  174. AgentChannelConfig,
  175. ChannelSessionBinding,
  176. } from './channel-route.js';
  177. export { channelRoutingModeForStrategy, normalizeSessionStrategy } from './channel-route.js';
  178. export type {
  179. TraceContext,
  180. ChannelContext,
  181. ChatType,
  182. ChannelContextParams,
  183. InboundContext,
  184. } from './channel-context.js';
  185. export {
  186. AGENT_REQUEST_REF_DESCRIPTION,
  187. CANONICAL_SUBAGENT_ROLES,
  188. LOCAL_MAVIS_AGENT_NAME_DESCRIPTION,
  189. RESERVED_SUBAGENT_NAMES,
  190. SUBAGENT_ROLES,
  191. agentNameDescription,
  192. isCanonicalSubagentRole,
  193. isTrustedBuiltinCreationSource,
  194. resolveCanonicalSubagentRole,
  195. roleDirectoryText,
  196. toAgentRequestRef,
  197. } from './subagent-roles.js';
  198. export type { CanonicalSubagentRole, LocalSubagentRoleDefinition } from './subagent-roles.js';
  199. export type {
  200. AgentReferenceReadScope,
  201. AgentReferenceResolutionSource,
  202. AgentReferenceResolver,
  203. } from './agent-reference.js';
  204. export {
  205. createTraceContext,
  206. childSpan,
  207. createChannelContext,
  208. toRequestContext,
  209. traceToRequestContext,
  210. } from './channel-context.js';
  211. export type { ResponseFormatHint } from './channel-format-hints.js';
  212. export { getResponseFormatHint } from './channel-format-hints.js';
  213. // ---------------------------------------------------------------------------
  214. // Canonical media-asset metadata inferers (mime / kind) + the strict,
  215. // structured outbound-media tag parser. PORTED from the feat/im-genui-full
  216. // branch to give the IM outbound side a UI-free canonical implementation.
  217. // `inferAssetMimeType` infers a MIME type from type/extension (the agent never
  218. // emits one); `deriveMediaKind` maps onto the four IM send primitives
  219. // (image/file/audio/video); `parseMediaTags` extracts `<media>` / wrapper tags
  220. // from a reply. The UI's result-card-utils.ts still has a parallel copy;
  221. // deduping it to re-export from here is a tracked follow-up.
  222. // ---------------------------------------------------------------------------
  223. export {
  224. MIME_BY_EXTENSION,
  225. WORKSPACE_IMAGE_PREVIEW_MIME_TYPES,
  226. inferAssetMimeType,
  227. getWorkspaceImagePreviewMimeType,
  228. isImageAsset,
  229. isWebAsset,
  230. isWebsiteAsset,
  231. supportsCanvasImageAnnotation,
  232. supportsWorkspaceImagePreview,
  233. deriveMediaKind,
  234. } from './media-asset-meta.js';
  235. export type {
  236. MediaAssetMetaInput,
  237. OutboundMediaKind,
  238. WorkspaceImagePreviewMimeType,
  239. } from './media-asset-meta.js';
  240. export { parseMediaTags } from './outbound-media.js';
  241. export type { OutboundMediaNameSource, OutboundMediaRef } from './outbound-media.js';
  242. // IM-outbound text sanitizer: rewrites agent-emitted `<media>` /
  243. // `<deliver-assets>` XML to short placeholders so unrecognized media-ish tags
  244. // never leak as literal XML. Belt-and-suspenders fallback after `parseMediaTags`
  245. // (the structured extractor) on the local-runtime outbound path.
  246. export { placeholderMediaTags } from './im-text-sanitize.js';
  247. // ---------------------------------------------------------------------------
  248. // mavis-widget DSL types — shared contract between daemon (persistence) and
  249. // UI (parsing + rendering).
  250. // ---------------------------------------------------------------------------
  251. export type {
  252. MavisWidgetKind,
  253. MavisWidgetStreamingMode,
  254. MavisWidgetThemeMode,
  255. MavisWidgetCapability,
  256. MavisWidgetPolicy,
  257. MavisWidgetData,
  258. MavisWidgetEnvelope,
  259. WidgetContentSegment,
  260. } from './mavis-widget-types.js';
  261. // ---------------------------------------------------------------------------
  262. // V2 Multi-step questionnaire schema
  263. // ---------------------------------------------------------------------------
  264. export type {
  265. AskQuestionOption,
  266. AskQuestionImage,
  267. AskQuestionStep,
  268. AskQuestionnaireStatus,
  269. AskQuestionnaireToolCall,
  270. AskQuestionnaireRequester,
  271. AskQuestionnairePresentation,
  272. AskQuestionnairePurpose,
  273. AskQuestionnaireRequest,
  274. AskQuestionnaireDraftAnswer,
  275. AskQuestionnaireReplyAnswer,
  276. AskQuestionnaireReplyPayload,
  277. AskUserToolOptionInput,
  278. AskUserToolImageInput,
  279. AskUserToolStepInput,
  280. AskUserToolMode,
  281. AskUserToolModePayload,
  282. AskUserToolInput,
  283. } from './questionnaire.js';
  284. export { ASK_OTHER_PLACEHOLDER, ASK_USER_TOOL_NAME } from './questionnaire.js';
  285. export type {
  286. ChannelParsedEvent,
  287. ChannelAttachment,
  288. ChannelOutboundContext,
  289. ChannelSendResult,
  290. ChannelMediaPayload,
  291. ChannelToolStep,
  292. ChannelPermissionRequest,
  293. ChannelPermissionDecision,
  294. ChannelProbeResult,
  295. ChannelAccountConfig,
  296. ChannelCapabilities,
  297. ChannelMeta,
  298. ChannelConfigAdapter,
  299. ChannelGatewayAdapter,
  300. ChannelGatewayContext,
  301. ChannelInboundAdapter,
  302. ChannelInboundContext,
  303. ChannelOutboundAdapter,
  304. ChannelRichReplyAdapter,
  305. ChannelSessionErrorInfo,
  306. ChannelQueueInfo,
  307. ChannelAuthAdapter,
  308. ChannelActionsAdapter,
  309. ChannelApprovalAdapter,
  310. ChannelQuestionnaireAdapter,
  311. ChannelQuestionnaireSubmit,
  312. ChannelThreadingAdapter,
  313. ChannelDirectoryAdapter,
  314. ChannelDirectoryEntry,
  315. ChannelPlugin,
  316. } from './channel-plugin.js';
  317. // ===========================================================================
  318. // @deprecated aliases — backward compatibility with IM* naming convention
  319. // Will be removed in a future major version.
  320. // ===========================================================================
  321. // --- from channel-route.ts ---
  322. /** @deprecated Use ChannelPlatform */
  323. export type IMPlatform = import('./channel-route.js').ChannelPlatform;
  324. /** @deprecated Use ChannelRouteMatch */
  325. export type IMRouteMatch = import('./channel-route.js').ChannelRouteMatch;
  326. /** @deprecated Use ChannelRouteTarget */
  327. export type IMRouteTarget = import('./channel-route.js').ChannelRouteTarget;
  328. /** @deprecated Use ChannelRouteRule */
  329. export type IMRouteRule = import('./channel-route.js').ChannelRouteRule;
  330. /** @deprecated Use ChannelRouteDefaultTarget */
  331. export type IMRouteDefaultTarget = import('./channel-route.js').ChannelRouteDefaultTarget;
  332. /** @deprecated Use ChannelRouteDefaults */
  333. export type IMRouteDefaults = import('./channel-route.js').ChannelRouteDefaults;
  334. /** @deprecated Use ChannelRouteConfig */
  335. export type IMRouteConfig = import('./channel-route.js').ChannelRouteConfig;
  336. /** @deprecated Use ChannelMessageContext */
  337. export type IMMessageContext = import('./channel-route.js').ChannelMessageContext;
  338. /** @deprecated Use AgentChannelSessionConfig */
  339. export type AgentIMSessionConfig = import('./channel-route.js').AgentChannelSessionConfig;
  340. /** @deprecated Use AgentChannelMessageFilter */
  341. export type AgentIMMessageFilter = import('./channel-route.js').AgentChannelMessageFilter;
  342. /** @deprecated Use AgentChannelPlatformConfig */
  343. export type AgentIMPlatformConfig = import('./channel-route.js').AgentChannelPlatformConfig;
  344. /** @deprecated Use AgentChannelConfig */
  345. export type AgentIMConfig = import('./channel-route.js').AgentChannelConfig;
  346. /** @deprecated Use ChannelSessionBinding */
  347. export type IMSessionBinding = import('./channel-route.js').ChannelSessionBinding;
  348. // --- from channel-plugin.ts ---
  349. /** @deprecated Use ChannelParsedEvent */
  350. export type IMParsedEvent = import('./channel-plugin.js').ChannelParsedEvent;
  351. /** @deprecated Use ChannelAttachment */
  352. export type IMAttachment = import('./channel-plugin.js').ChannelAttachment;
  353. /** @deprecated Use ChannelOutboundContext */
  354. export type IMOutboundContext = import('./channel-plugin.js').ChannelOutboundContext;
  355. /** @deprecated Use ChannelSendResult */
  356. export type IMSendResult = import('./channel-plugin.js').ChannelSendResult;
  357. /** @deprecated Use ChannelMediaPayload */
  358. export type IMMediaPayload = import('./channel-plugin.js').ChannelMediaPayload;
  359. /** @deprecated Use ChannelToolStep */
  360. export type IMToolStep = import('./channel-plugin.js').ChannelToolStep;
  361. /** @deprecated Use ChannelPermissionRequest */
  362. export type IMPermissionRequest = import('./channel-plugin.js').ChannelPermissionRequest;
  363. /** @deprecated Use ChannelPermissionDecision */
  364. export type IMPermissionDecision = import('./channel-plugin.js').ChannelPermissionDecision;
  365. /** @deprecated Use ChannelProbeResult */
  366. export type IMProbeResult = import('./channel-plugin.js').ChannelProbeResult;
  367. /** @deprecated Use ChannelAccountConfig */
  368. export type IMAccountConfig = import('./channel-plugin.js').ChannelAccountConfig;
  369. /** @deprecated Use ChannelCapabilities */
  370. export type IMChannelCapabilities = import('./channel-plugin.js').ChannelCapabilities;
  371. /** @deprecated Use ChannelMeta */
  372. export type IMChannelMeta = import('./channel-plugin.js').ChannelMeta;
  373. /** @deprecated Use ChannelConfigAdapter */
  374. export type IMConfigAdapter = import('./channel-plugin.js').ChannelConfigAdapter;
  375. /** @deprecated Use ChannelGatewayAdapter */
  376. export type IMGatewayAdapter = import('./channel-plugin.js').ChannelGatewayAdapter;
  377. /** @deprecated Use ChannelGatewayContext */
  378. export type IMGatewayContext = import('./channel-plugin.js').ChannelGatewayContext;
  379. /** @deprecated Use ChannelInboundAdapter */
  380. export type IMInboundAdapter = import('./channel-plugin.js').ChannelInboundAdapter;
  381. /** @deprecated Use ChannelInboundContext */
  382. export type IMInboundContext = import('./channel-plugin.js').ChannelInboundContext;
  383. /** @deprecated Use ChannelOutboundAdapter */
  384. export type IMOutboundAdapter = import('./channel-plugin.js').ChannelOutboundAdapter;
  385. /** @deprecated Use ChannelRichReplyAdapter */
  386. export type IMRichReplyAdapter = import('./channel-plugin.js').ChannelRichReplyAdapter;
  387. /** @deprecated Use ChannelAuthAdapter */
  388. export type IMAuthAdapter = import('./channel-plugin.js').ChannelAuthAdapter;
  389. /** @deprecated Use ChannelActionsAdapter */
  390. export type IMActionsAdapter = import('./channel-plugin.js').ChannelActionsAdapter;
  391. /** @deprecated Use ChannelApprovalAdapter */
  392. export type IMApprovalAdapter = import('./channel-plugin.js').ChannelApprovalAdapter;
  393. /** @deprecated Use ChannelThreadingAdapter */
  394. export type IMThreadingAdapter = import('./channel-plugin.js').ChannelThreadingAdapter;
  395. /** @deprecated Use ChannelDirectoryAdapter */
  396. export type IMDirectoryAdapter = import('./channel-plugin.js').ChannelDirectoryAdapter;
  397. /** @deprecated Use ChannelDirectoryEntry */
  398. export type IMDirectoryEntry = import('./channel-plugin.js').ChannelDirectoryEntry;
  399. /** @deprecated Use ChannelPlugin */
  400. export type IMChannelPlugin = import('./channel-plugin.js').ChannelPlugin;
  401. export { withOpenCodeGoHeaders } from './opencode-go-headers.js';