@larkup/workspace-server 0.0.0-stage → 0.2.1

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 (180) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +2 -2
  3. package/dist-types/app/api/chat/feedback/route.d.ts +4 -0
  4. package/dist-types/app/api/chat/feedback/route.d.ts.map +1 -0
  5. package/dist-types/app/api/chat/route.d.ts +3 -0
  6. package/dist-types/app/api/chat/route.d.ts.map +1 -0
  7. package/dist-types/app/api/chat/tools.d.ts +67 -0
  8. package/dist-types/app/api/chat/tools.d.ts.map +1 -0
  9. package/dist-types/app/api/config/test-embedding/route.d.ts +3 -0
  10. package/dist-types/app/api/config/test-embedding/route.d.ts.map +1 -0
  11. package/dist-types/app/api/config/verify/route.d.ts +3 -0
  12. package/dist-types/app/api/config/verify/route.d.ts.map +1 -0
  13. package/dist-types/app/api/describe-image/route.d.ts +4 -0
  14. package/dist-types/app/api/describe-image/route.d.ts.map +1 -0
  15. package/dist-types/app/api/doc-editor/edit/route.d.ts +10 -0
  16. package/dist-types/app/api/doc-editor/edit/route.d.ts.map +1 -0
  17. package/dist-types/app/api/doc-editor/export/route.d.ts +9 -0
  18. package/dist-types/app/api/doc-editor/export/route.d.ts.map +1 -0
  19. package/dist-types/app/api/doc-editor/parse/route.d.ts +10 -0
  20. package/dist-types/app/api/doc-editor/parse/route.d.ts.map +1 -0
  21. package/dist-types/app/api/doc-editor/restore/route.d.ts +2 -0
  22. package/dist-types/app/api/doc-editor/restore/route.d.ts.map +1 -0
  23. package/dist-types/app/api/document/sign/route.d.ts +2 -0
  24. package/dist-types/app/api/document/sign/route.d.ts.map +1 -0
  25. package/dist-types/app/api/files/remote/route.d.ts +5 -0
  26. package/dist-types/app/api/files/remote/route.d.ts.map +1 -0
  27. package/dist-types/app/api/mcp/[connectionId]/route.d.ts +9 -0
  28. package/dist-types/app/api/mcp/[connectionId]/route.d.ts.map +1 -0
  29. package/dist-types/app/api/mcp/[connectionId]/test/route.d.ts +8 -0
  30. package/dist-types/app/api/mcp/[connectionId]/test/route.d.ts.map +1 -0
  31. package/dist-types/app/api/mcp/route.d.ts +4 -0
  32. package/dist-types/app/api/mcp/route.d.ts.map +1 -0
  33. package/dist-types/app/api/parse-file/route.d.ts +6 -0
  34. package/dist-types/app/api/parse-file/route.d.ts.map +1 -0
  35. package/dist-types/app/api/pdf-page/route.d.ts +4 -0
  36. package/dist-types/app/api/pdf-page/route.d.ts.map +1 -0
  37. package/dist-types/app/api/proxy/verify/route.d.ts +4 -0
  38. package/dist-types/app/api/proxy/verify/route.d.ts.map +1 -0
  39. package/dist-types/app/api/search/bing/route.d.ts +5 -0
  40. package/dist-types/app/api/search/bing/route.d.ts.map +1 -0
  41. package/dist-types/app/api/search/brave/route.d.ts +5 -0
  42. package/dist-types/app/api/search/brave/route.d.ts.map +1 -0
  43. package/dist-types/app/api/search/exa/route.d.ts +5 -0
  44. package/dist-types/app/api/search/exa/route.d.ts.map +1 -0
  45. package/dist-types/app/api/search/google/route.d.ts +30 -0
  46. package/dist-types/app/api/search/google/route.d.ts.map +1 -0
  47. package/dist-types/app/api/search/route.d.ts +7 -0
  48. package/dist-types/app/api/search/route.d.ts.map +1 -0
  49. package/dist-types/app/api/search/tavily/route.d.ts +5 -0
  50. package/dist-types/app/api/search/tavily/route.d.ts.map +1 -0
  51. package/dist-types/app/api/search/verify/route.d.ts +4 -0
  52. package/dist-types/app/api/search/verify/route.d.ts.map +1 -0
  53. package/dist-types/app/api/tabular/route.d.ts +9 -0
  54. package/dist-types/app/api/tabular/route.d.ts.map +1 -0
  55. package/dist-types/lib/chat/assistant-source-scope.d.ts +10 -0
  56. package/dist-types/lib/chat/assistant-source-scope.d.ts.map +1 -0
  57. package/dist-types/lib/chat/conversation-memory.d.ts +80 -0
  58. package/dist-types/lib/chat/conversation-memory.d.ts.map +1 -0
  59. package/dist-types/lib/chat/gateway-fallbacks.d.ts +7 -0
  60. package/dist-types/lib/chat/gateway-fallbacks.d.ts.map +1 -0
  61. package/dist-types/lib/chat/image-description.d.ts +10 -0
  62. package/dist-types/lib/chat/image-description.d.ts.map +1 -0
  63. package/dist-types/lib/chat/media-retrieval-routing.d.ts +14 -0
  64. package/dist-types/lib/chat/media-retrieval-routing.d.ts.map +1 -0
  65. package/dist-types/lib/chat/media-source-routing.d.ts +53 -0
  66. package/dist-types/lib/chat/media-source-routing.d.ts.map +1 -0
  67. package/dist-types/lib/chat/message-input.d.ts +8 -0
  68. package/dist-types/lib/chat/message-input.d.ts.map +1 -0
  69. package/dist-types/lib/chat/model-provider.d.ts +23 -0
  70. package/dist-types/lib/chat/model-provider.d.ts.map +1 -0
  71. package/dist-types/lib/chat/response-style.d.ts +2 -0
  72. package/dist-types/lib/chat/response-style.d.ts.map +1 -0
  73. package/dist-types/lib/chat/retrieval-ranking.d.ts +32 -0
  74. package/dist-types/lib/chat/retrieval-ranking.d.ts.map +1 -0
  75. package/dist-types/lib/chat/retrieval-routing.d.ts +39 -0
  76. package/dist-types/lib/chat/retrieval-routing.d.ts.map +1 -0
  77. package/dist-types/lib/chat/tabular-dataset-routing.d.ts +15 -0
  78. package/dist-types/lib/chat/tabular-dataset-routing.d.ts.map +1 -0
  79. package/dist-types/lib/chat/tabular-query-plan.d.ts +12 -0
  80. package/dist-types/lib/chat/tabular-query-plan.d.ts.map +1 -0
  81. package/dist-types/lib/chat/tabular-routing.d.ts +41 -0
  82. package/dist-types/lib/chat/tabular-routing.d.ts.map +1 -0
  83. package/dist-types/lib/chat/tabular-sandbox-files.d.ts +33 -0
  84. package/dist-types/lib/chat/tabular-sandbox-files.d.ts.map +1 -0
  85. package/dist-types/lib/chat/tabular-visualization.d.ts +31 -0
  86. package/dist-types/lib/chat/tabular-visualization.d.ts.map +1 -0
  87. package/dist-types/lib/chat/tool-call-repair.d.ts +11 -0
  88. package/dist-types/lib/chat/tool-call-repair.d.ts.map +1 -0
  89. package/dist-types/lib/chat/tool-context.d.ts +72 -0
  90. package/dist-types/lib/chat/tool-context.d.ts.map +1 -0
  91. package/dist-types/lib/chat/tool-registry.d.ts +3 -0
  92. package/dist-types/lib/chat/tool-registry.d.ts.map +1 -0
  93. package/dist-types/lib/chat/video-rag-routing.d.ts +33 -0
  94. package/dist-types/lib/chat/video-rag-routing.d.ts.map +1 -0
  95. package/dist-types/lib/chat/visual-routing.d.ts +53 -0
  96. package/dist-types/lib/chat/visual-routing.d.ts.map +1 -0
  97. package/dist-types/lib/enterprise-client.d.ts +31 -0
  98. package/dist-types/lib/enterprise-client.d.ts.map +1 -0
  99. package/dist-types/lib/marketplace/tool-runtime-config.d.ts +7 -0
  100. package/dist-types/lib/marketplace/tool-runtime-config.d.ts.map +1 -0
  101. package/dist-types/lib/media/knowledge.d.ts +47 -0
  102. package/dist-types/lib/media/knowledge.d.ts.map +1 -0
  103. package/dist-types/lib/media/pdf-inspection.d.ts +30 -0
  104. package/dist-types/lib/media/pdf-inspection.d.ts.map +1 -0
  105. package/dist-types/lib/media/source-identity.d.ts +12 -0
  106. package/dist-types/lib/media/source-identity.d.ts.map +1 -0
  107. package/dist-types/lib/media/source-utils.d.ts +157 -0
  108. package/dist-types/lib/media/source-utils.d.ts.map +1 -0
  109. package/dist-types/lib/media/video/quick-look.d.ts +60 -0
  110. package/dist-types/lib/media/video/quick-look.d.ts.map +1 -0
  111. package/dist-types/lib/media/video-intelligence-adapter.d.ts +521 -0
  112. package/dist-types/lib/media/video-intelligence-adapter.d.ts.map +1 -0
  113. package/dist-types/lib/media/video-intelligence-connection.d.ts +32 -0
  114. package/dist-types/lib/media/video-intelligence-connection.d.ts.map +1 -0
  115. package/dist-types/lib/remote-files.d.ts +12 -0
  116. package/dist-types/lib/remote-files.d.ts.map +1 -0
  117. package/dist-types/lib/search/provider-verification.d.ts +5 -0
  118. package/dist-types/lib/search/provider-verification.d.ts.map +1 -0
  119. package/dist-types/runtime-host.d.ts +20 -0
  120. package/dist-types/runtime-host.d.ts.map +1 -0
  121. package/package.json +338 -3
  122. package/src/app/api/chat/feedback/route.ts +77 -0
  123. package/src/app/api/chat/route.ts +2277 -0
  124. package/src/app/api/chat/tools.ts +3563 -0
  125. package/src/app/api/config/test-embedding/route.ts +39 -0
  126. package/src/app/api/config/verify/route.ts +309 -0
  127. package/src/app/api/describe-image/route.ts +108 -0
  128. package/src/app/api/doc-editor/edit/route.ts +87 -0
  129. package/src/app/api/doc-editor/export/route.ts +32 -0
  130. package/src/app/api/doc-editor/parse/route.ts +74 -0
  131. package/src/app/api/doc-editor/restore/route.ts +70 -0
  132. package/src/app/api/document/sign/route.ts +55 -0
  133. package/src/app/api/files/remote/route.ts +32 -0
  134. package/src/app/api/mcp/[connectionId]/route.ts +29 -0
  135. package/src/app/api/mcp/[connectionId]/test/route.ts +13 -0
  136. package/src/app/api/mcp/route.ts +22 -0
  137. package/src/app/api/parse-file/route.ts +86 -0
  138. package/src/app/api/pdf-page/route.ts +40 -0
  139. package/src/app/api/proxy/verify/route.ts +78 -0
  140. package/src/app/api/search/bing/route.ts +86 -0
  141. package/src/app/api/search/brave/route.ts +88 -0
  142. package/src/app/api/search/exa/route.ts +100 -0
  143. package/src/app/api/search/google/route.ts +147 -0
  144. package/src/app/api/search/route.ts +28 -0
  145. package/src/app/api/search/tavily/route.ts +93 -0
  146. package/src/app/api/search/verify/route.ts +27 -0
  147. package/src/app/api/tabular/route.ts +68 -0
  148. package/src/lib/chat/assistant-source-scope.ts +32 -0
  149. package/src/lib/chat/conversation-memory.ts +621 -0
  150. package/src/lib/chat/gateway-fallbacks.ts +12 -0
  151. package/src/lib/chat/image-description.ts +21 -0
  152. package/src/lib/chat/media-retrieval-routing.ts +37 -0
  153. package/src/lib/chat/media-source-routing.ts +100 -0
  154. package/src/lib/chat/message-input.ts +48 -0
  155. package/src/lib/chat/model-provider.ts +157 -0
  156. package/src/lib/chat/response-style.ts +3 -0
  157. package/src/lib/chat/retrieval-ranking.ts +126 -0
  158. package/src/lib/chat/retrieval-routing.ts +221 -0
  159. package/src/lib/chat/tabular-dataset-routing.ts +93 -0
  160. package/src/lib/chat/tabular-query-plan.ts +195 -0
  161. package/src/lib/chat/tabular-routing.ts +122 -0
  162. package/src/lib/chat/tabular-sandbox-files.ts +78 -0
  163. package/src/lib/chat/tabular-visualization.ts +165 -0
  164. package/src/lib/chat/tool-call-repair.ts +84 -0
  165. package/src/lib/chat/tool-context.ts +1222 -0
  166. package/src/lib/chat/tool-registry.ts +6 -0
  167. package/src/lib/chat/video-rag-routing.ts +149 -0
  168. package/src/lib/chat/visual-routing.ts +225 -0
  169. package/src/lib/enterprise-client.ts +96 -0
  170. package/src/lib/marketplace/tool-runtime-config.ts +155 -0
  171. package/src/lib/media/knowledge.ts +489 -0
  172. package/src/lib/media/pdf-inspection.ts +280 -0
  173. package/src/lib/media/source-identity.ts +50 -0
  174. package/src/lib/media/source-utils.ts +1156 -0
  175. package/src/lib/media/video/quick-look.ts +368 -0
  176. package/src/lib/media/video-intelligence-adapter.ts +1946 -0
  177. package/src/lib/media/video-intelligence-connection.ts +151 -0
  178. package/src/lib/remote-files.ts +182 -0
  179. package/src/lib/search/provider-verification.ts +95 -0
  180. package/src/runtime-host.ts +31 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-rag-routing.d.ts","sourceRoot":"","sources":["../../../src/lib/chat/video-rag-routing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,+BAA+B,GACzC,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAEnE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAKD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAKjD,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAEhD,kFAAkF;AAClF,wBAAsB,mCAAmC,CACvD,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EAC9F,KAAK,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAC9C,SAAS,EAAE,OAAO,EAClB,UAAU,EAAE,MAAM,oBAqEnB;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,kBAAkB,EAAE,+BAA+B,CAAC;IACpD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,wBAAwB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,WAqCA"}
@@ -0,0 +1,53 @@
1
+ type ImageDocument = {
2
+ metadata?: {
3
+ images?: any[];
4
+ imageUrl?: unknown;
5
+ index?: unknown;
6
+ pageNumber?: unknown;
7
+ };
8
+ };
9
+ export type RetrievedPdfSource = {
10
+ documentId: string;
11
+ pageNumber?: number;
12
+ title?: string;
13
+ };
14
+ /** Resolve both current parent-document images and legacy standalone image records. */
15
+ export declare function findIndexedImageSource<T extends ImageDocument>(documents: T[], imageUrl: string): {
16
+ source: T | undefined;
17
+ image: any;
18
+ } | undefined;
19
+ /** Recognizes image-bearing retrieval results, including compact JSON envelopes. */
20
+ export declare function hasRetrievedImageEvidence(value: unknown): boolean;
21
+ /** Finds a PDF source returned by retrieval, even when it has no pre-indexed images. */
22
+ export declare function hasRetrievedPdfEvidence(value: unknown): boolean;
23
+ /** Whether the request names a stable, numbered object inside a document. */
24
+ export declare function hasNumberedDocumentReference(text: string): boolean;
25
+ /** Return the nearest named document object from a chronological text history. */
26
+ export declare function latestNumberedDocumentReferenceText(texts: readonly string[]): string | undefined;
27
+ /**
28
+ * An explicit document reference must be ranked against the original PDF.
29
+ * Otherwise, a page attached to the retrieval hit is an efficient exact hint.
30
+ */
31
+ export declare function preferredPdfPagesForInspection(retrievedPageNumber: number | undefined, question: string): number[] | undefined;
32
+ /**
33
+ * Select the leading PDF source returned by retrieval. A direct visual chunk
34
+ * carries its page number, so it is preferred over a document-level text
35
+ * chunk that would otherwise make a preview fall back to page one.
36
+ */
37
+ export declare function findRetrievedPdfSource(value: unknown): RetrievedPdfSource | undefined;
38
+ /**
39
+ * Reuse relevant descriptions produced during image indexing, and reserve a
40
+ * fresh vision pass for details those descriptions do not cover.
41
+ */
42
+ export declare function shouldInspectRetrievedImage(text: string, evidence: unknown): boolean;
43
+ /** Generic presentation intent, shared by PDFs, screenshots, scans, and media frames. */
44
+ export declare function requestsImagePresentation(text: string): boolean;
45
+ /**
46
+ * Page text is enough for ordinary prose. These requests explicitly depend on
47
+ * page layout, notation, or a visual object, so a rendered-page read is the
48
+ * higher-fidelity source of truth. The language is document-generic rather
49
+ * than tied to any particular paper or diagram format.
50
+ */
51
+ export declare function requiresPdfVisualAnalysis(text: string): boolean;
52
+ export {};
53
+ //# sourceMappingURL=visual-routing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visual-routing.d.ts","sourceRoot":"","sources":["../../../src/lib/chat/visual-routing.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,GAAG;IACnB,QAAQ,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC1F,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AASF,uFAAuF;AACvF,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,aAAa,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM;;;cAiB/F;AAuBD,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAajE;AAED,wFAAwF;AACxF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA0B/D;AAMD,6EAA6E;AAC7E,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElE;AAED,kFAAkF;AAClF,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAKhG;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,QAAQ,EAAE,MAAM,GACf,MAAM,EAAE,GAAG,SAAS,CAGtB;AAsBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAarF;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CA2BpF;AAED,yFAAyF;AACzF,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI/D;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI/D"}
@@ -0,0 +1,31 @@
1
+ export type EnterpriseToolDescriptor = {
2
+ id: string;
3
+ name: string;
4
+ description: string;
5
+ ui: 'notice' | 'table' | 'card';
6
+ };
7
+ export declare function getEnterpriseTools(config: any): Promise<EnterpriseToolDescriptor[]>;
8
+ export declare function executeEnterpriseTool(config: any, id: string, input: {
9
+ query?: string;
10
+ }): Promise<any>;
11
+ /** Do this before model invocation so a paused or exhausted client cannot spend more. */
12
+ export declare function authorizeEnterpriseAiRequest(config: any): Promise<void>;
13
+ export declare function trackEnterpriseAiUsage(config: any, event: {
14
+ modelId: string;
15
+ inputTokens: number;
16
+ outputTokens: number;
17
+ costUsd: number;
18
+ }): void;
19
+ /**
20
+ * Reports one meter's usage for an installed Marketplace catalog tool. This
21
+ * is the `trackUsage` sink wired into every dynamically-loaded ToolExtension
22
+ * client for an EE-enrolled installation — generic across tools, since the
23
+ * meter id and quantity always come from the tool itself, never hardcoded
24
+ * here. A no-op when the workspace isn't enrolled with Enterprise.
25
+ */
26
+ export declare function trackEnterpriseToolUsage(config: any, toolId: string, event: {
27
+ meter: string;
28
+ quantity: number;
29
+ unit: string;
30
+ }): void;
31
+ //# sourceMappingURL=enterprise-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enterprise-client.d.ts","sourceRoot":"","sources":["../../src/lib/enterprise-client.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;CACjC,CAAC;AAyBF,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAYzF;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,gBAK7F;AAED,yFAAyF;AACzF,wBAAsB,4BAA4B,CAAC,MAAM,EAAE,GAAG,iBAG7D;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,GAAG,EACX,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,QAMvF;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,QAYzD"}
@@ -0,0 +1,7 @@
1
+ import type { RagConfig } from '@larkup/core/types';
2
+ /**
3
+ * Supplies a marketplace runtime with the user's selected AI Models settings
4
+ * without making the installed package import the host application's source.
5
+ */
6
+ export declare function withGlobalVisionGatewayConfig(toolConfig: Record<string, unknown>, config: Pick<RagConfig, 'visionProvider' | 'visionApiKey' | 'visionModelId' | 'chatProvider' | 'chatApiKey' | 'chatModelId' | 'embeddingProvider' | 'embeddingApiKey'>): Record<string, unknown>;
7
+ //# sourceMappingURL=tool-runtime-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-runtime-config.d.ts","sourceRoot":"","sources":["../../../src/lib/marketplace/tool-runtime-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,EAAE,IAAI,CACV,SAAS,EACP,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,cAAc,GACd,YAAY,GACZ,aAAa,GACb,mBAAmB,GACnB,iBAAiB,CACpB,GACA,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyEzB"}
@@ -0,0 +1,47 @@
1
+ import type { NewDocumentInput } from '@larkup/core/documents-store';
2
+ import type { RagConfig } from '@larkup/core/types';
3
+ export interface MediaEvidenceSegment {
4
+ text: string;
5
+ transcript?: string;
6
+ visualContext?: string;
7
+ startSecs: number;
8
+ endSecs: number;
9
+ sequence: number;
10
+ }
11
+ interface SummaryOptions {
12
+ title: string;
13
+ mediaType: 'video' | 'audio';
14
+ durationSecs: number;
15
+ segments: MediaEvidenceSegment[];
16
+ config: RagConfig;
17
+ onProgress?: (completed: number, total: number, message: string) => void | Promise<void>;
18
+ }
19
+ interface MediaDocumentOptions {
20
+ assetId: string;
21
+ title: string;
22
+ mediaType: 'video' | 'audio';
23
+ localUrl: string;
24
+ originalUrl?: string;
25
+ durationSecs: number;
26
+ summary: string;
27
+ segments: MediaEvidenceSegment[];
28
+ fileName: string;
29
+ mimeType: string;
30
+ transcriptSource: string;
31
+ transcriptProvider?: string;
32
+ transcriptLanguage?: string;
33
+ knowledgeRevisionId?: string;
34
+ videoRuntimeScope?: 'local' | 'cloud';
35
+ }
36
+ export declare function createMediaKnowledgeSummary(options: SummaryOptions): Promise<string>;
37
+ export declare function createFallbackMediaSummary(_title: string, _mediaType: 'video' | 'audio', segments: MediaEvidenceSegment[]): string;
38
+ export declare function buildMediaDocumentInputs(options: MediaDocumentOptions): NewDocumentInput[];
39
+ export declare function timestampMediaUrl(url: string, startSecs: number): string;
40
+ export declare function normalizeMediaCitationRange(mediaType: 'image' | 'video' | 'audio', durationSecs?: number, startSecs?: number, endSecs?: number): {
41
+ startSecs?: number;
42
+ endSecs?: number;
43
+ };
44
+ export declare function formatTime(seconds: number): string;
45
+ export declare function queryAwareExcerpt(text: string, query: string, maxChars: number, preferEnd?: boolean): string;
46
+ export {};
47
+ //# sourceMappingURL=knowledge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge.d.ts","sourceRoot":"","sources":["../../../src/lib/media/knowledge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIpD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,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,oBAAoB,EAAE,GAC/B,MAAM,CAaR;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,gBAAgB,EAAE,CAwD1F;AA2DD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAaxE;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,EACtC,YAAY,CAAC,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACf;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAgB1C;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,SAAS,UAAQ,GAChB,MAAM,CAmBR"}
@@ -0,0 +1,30 @@
1
+ export type PdfSource = {
2
+ id: string;
3
+ title: string;
4
+ url?: string;
5
+ };
6
+ export type PdfPageInspection = {
7
+ pageNumber: number;
8
+ text: string;
9
+ tables: unknown[];
10
+ previewUrl?: string;
11
+ };
12
+ export declare function readStoredPdfBytes(source: PdfSource): Promise<Buffer>;
13
+ /** Rank pages only from their own extracted text; no document-specific assumptions. */
14
+ export declare function selectRelevantPdfPages(pages: Array<{
15
+ num: number;
16
+ text: string;
17
+ }>, question: string, limit?: number): number[];
18
+ /** Preserve the ranked page order when a full extraction supplied the source text. */
19
+ export declare function selectInspectedPdfPages<T extends {
20
+ num: number;
21
+ }>(pages: T[], selected: number[]): T[];
22
+ export declare function inspectStoredPdf(source: PdfSource, question: string, pageNumbers?: number[], previewUrlForPage?: (pageNumber: number) => string): Promise<{
23
+ totalPages: number;
24
+ pages: PdfPageInspection[];
25
+ }>;
26
+ export declare function renderStoredPdfPage(source: PdfSource, pageNumber: number, width?: number): Promise<{
27
+ data: Buffer;
28
+ contentType: string;
29
+ }>;
30
+ //# sourceMappingURL=pdf-inspection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-inspection.d.ts","sourceRoot":"","sources":["../../../src/lib/media/pdf-inspection.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AA4BF,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAU3E;AA0FD,uFAAuF;AACvF,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAC3C,QAAQ,EAAE,MAAM,EAChB,KAAK,SAAY,GAChB,MAAM,EAAE,CAkCV;AAYD,sFAAsF;AACtF,wBAAgB,uBAAuB,CAAC,CAAC,SAAS;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EAC/D,KAAK,EAAE,CAAC,EAAE,EACV,QAAQ,EAAE,MAAM,EAAE,GACjB,CAAC,EAAE,CAML;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,EAAE,EACtB,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GACjD,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAAC,CAwC7D;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,MAAM,EAClB,KAAK,SAAQ,GACZ,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAoBhD"}
@@ -0,0 +1,12 @@
1
+ /** Identity for one remote media source, independent of seek/tracking parameters. */
2
+ export declare function canonicalMediaSourceUrl(value: string): string;
3
+ type EquivalentMediaAsset = {
4
+ id: string;
5
+ originalUrl?: string;
6
+ updatedAt?: string;
7
+ createdAt?: string;
8
+ };
9
+ /** Resolve duplicate imports of one remote source to the newest indexed asset. */
10
+ export declare function newestEquivalentMediaAsset<T extends EquivalentMediaAsset>(asset: T, assets: readonly T[]): T;
11
+ export {};
12
+ //# sourceMappingURL=source-identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-identity.d.ts","sourceRoot":"","sources":["../../../src/lib/media/source-identity.ts"],"names":[],"mappings":"AAGA,qFAAqF;AACrF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAoB7D;AAED,KAAK,oBAAoB,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,kFAAkF;AAClF,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,oBAAoB,EACvE,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,SAAS,CAAC,EAAE,GACnB,CAAC,CAYH"}
@@ -0,0 +1,157 @@
1
+ export type RemoteMediaType = 'audio' | 'video' | 'unknown';
2
+ export interface ImportedMedia {
3
+ path: string;
4
+ originalUrl: string;
5
+ title: string;
6
+ mimeType?: string;
7
+ mediaType: RemoteMediaType;
8
+ sourceTranscript?: {
9
+ chunks: Array<{
10
+ text: string;
11
+ startSecs: number;
12
+ endSecs: number;
13
+ }>;
14
+ fullText: string;
15
+ durationSecs: number;
16
+ language?: string;
17
+ origin: {
18
+ kind: 'youtube-caption';
19
+ provider: 'youtube';
20
+ language?: string;
21
+ };
22
+ };
23
+ }
24
+ export interface UrlInspection {
25
+ originalUrl: string;
26
+ title?: string;
27
+ mimeType?: string;
28
+ mediaType: RemoteMediaType;
29
+ contentLength?: number;
30
+ durationSecs?: number;
31
+ singleItemDurationSecs?: number;
32
+ singleItemUrl?: string;
33
+ entryCount?: number;
34
+ isYouTube: boolean;
35
+ }
36
+ /** Download a public URL after applying the same DNS and redirect checks as media imports. */
37
+ export declare function readPublicUrl(url: string, maxBytes?: number): Promise<{
38
+ bytes: Uint8Array;
39
+ mimeType?: string;
40
+ finalUrl: string;
41
+ }>;
42
+ /** Checking a pasted non-YouTube URL must stay interactive, not block on a slow origin. */
43
+ export declare const MEDIA_URL_INSPECTION_TIMEOUT_MS = 7000;
44
+ interface YouTubeInspectionData {
45
+ title?: string;
46
+ duration?: number;
47
+ language?: string;
48
+ ext?: string;
49
+ vcodec?: string;
50
+ acodec?: string;
51
+ subtitles?: Record<string, unknown>;
52
+ automatic_captions?: Record<string, unknown>;
53
+ entries?: Array<{
54
+ id?: string;
55
+ url?: string;
56
+ webpage_url?: string;
57
+ duration?: number;
58
+ }>;
59
+ }
60
+ export declare function inspectYouTubeMetadata(url: string, data: YouTubeInspectionData): UrlInspection;
61
+ /**
62
+ * A public watch URL is enough to stage one video even when an interactive
63
+ * serverless IP is temporarily challenged by YouTube. The durable worker will
64
+ * still perform the real download and media probe before indexing, so this
65
+ * fallback does not claim a title, duration, or byte size it could not verify.
66
+ */
67
+ export declare function inspectYouTubeWatchUrl(url: string): UrlInspection | undefined;
68
+ export interface MediaProbe {
69
+ durationSecs: number;
70
+ containerDurationSecs: number;
71
+ videoDurationSecs?: number;
72
+ audioDurationSecs?: number;
73
+ hasVideo: boolean;
74
+ hasAudio: boolean;
75
+ hasCorruptionSignals: boolean;
76
+ }
77
+ export interface MediaImportProgress {
78
+ percent?: number;
79
+ current?: number;
80
+ total?: number;
81
+ unit?: string;
82
+ elapsedSeconds?: number;
83
+ estimatedRemainingSeconds?: number;
84
+ message: string;
85
+ }
86
+ export declare function createArtifactCacheKey(input: {
87
+ contentHash: string;
88
+ operation: string;
89
+ provider?: string;
90
+ model?: string;
91
+ promptVersion?: string;
92
+ schemaVersion?: string;
93
+ configuration?: Record<string, string | number | boolean | undefined>;
94
+ }): string;
95
+ export declare function extractRunningState(text: string): string;
96
+ export declare function deriveAudioSignals(chunks: Array<{
97
+ text: string;
98
+ startSecs: number;
99
+ endSecs: number;
100
+ }>, silenceGapSecs?: number): {
101
+ timestampSecs: number;
102
+ transcriptChange: number;
103
+ silenceBoundary: boolean;
104
+ }[];
105
+ /**
106
+ * The desktop/CLI process does not necessarily inherit a terminal's PATH.
107
+ * Keep probing self-contained, while allowing managed deployments to override it.
108
+ */
109
+ export declare function ffprobeExecutable(): string;
110
+ /** Read local media metadata with a bundled ffprobe binary. */
111
+ export declare function probeMedia(mediaPath: string): Promise<MediaProbe>;
112
+ /** Whether a browser-visible container clock is materially longer than its video. */
113
+ export declare function hasInflatedPlaybackTimeline(probe: MediaProbe): boolean;
114
+ export declare function inspectMediaUrl(url: string): Promise<UrlInspection>;
115
+ export declare function importMediaUrl(url: string, options: {
116
+ outputDir: string;
117
+ maxBytes?: number;
118
+ playlistMax?: number;
119
+ onProgress?: (progress: MediaImportProgress) => void;
120
+ }): Promise<ImportedMedia[]>;
121
+ /**
122
+ * Serialize the selected downloader fields as one object. Per-field templates
123
+ * use yt-dlp's bare `NA` placeholder for missing values, which is not JSON.
124
+ */
125
+ export declare function ytDlpImportPrintTemplate(): string;
126
+ export declare function selectYoutubeCaptionLanguage(data: YouTubeInspectionData): string | undefined;
127
+ interface YoutubeJson3 {
128
+ events?: Array<{
129
+ tStartMs?: number;
130
+ dDurationMs?: number;
131
+ segs?: Array<{
132
+ utf8?: string;
133
+ }>;
134
+ }>;
135
+ }
136
+ export declare function parseYoutubeJson3Transcript(data: YoutubeJson3): {
137
+ text: string;
138
+ startSecs: number;
139
+ endSecs: number;
140
+ }[];
141
+ /**
142
+ * Prefer a browser-safe H.264 MP4 video plus M4A audio stream. `best` can
143
+ * otherwise select an adaptive video-only representation on some YouTube
144
+ * responses, leaving the browser with a volume control but no audio track.
145
+ * The combined-format fallbacks keep older and audio-less public videos usable.
146
+ */
147
+ export declare function youtubeDownloadFormat(): string;
148
+ /**
149
+ * `after_move:filepath` normally names yt-dlp's final file, but some releases
150
+ * can print a path that no longer exists after a format merge. The import
151
+ * directory is newly created for this one download, so a media file bearing the
152
+ * reported video id is a safe fallback without accepting paths outside it.
153
+ */
154
+ export declare function resolveYtDlpMediaPath(reportedPath: string, outputDir: string): Promise<string>;
155
+ export declare function parseYtDlpProgress(line: string, elapsedSeconds?: number): MediaImportProgress | null;
156
+ export {};
157
+ //# sourceMappingURL=source-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/media/source-utils.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,eAAe,CAAC;IAC3B,gBAAgB,CAAC,EAAE;QACjB,MAAM,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACpE,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,CA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ACJ;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,YAAY;;;;IAa7D;AA8CD;;;;;GAKG;AACH,wBAAgB,qBAAqB,WAWpC;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAgClF;AAmKD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,SAAI,GAAG,mBAAmB,GAAG,IAAI,CA2B/F"}
@@ -0,0 +1,60 @@
1
+ export interface QuickLookRange {
2
+ startSecs: number;
3
+ endSecs: number;
4
+ /** What this particular window is expected to settle. */
5
+ lookingFor?: string;
6
+ }
7
+ export interface QuickLookFinding {
8
+ range: {
9
+ startSecs: number;
10
+ endSecs: number;
11
+ };
12
+ at: string;
13
+ /** What the re-watch established, in the reader's own words. */
14
+ found: string;
15
+ /** Whether this bounded reading actually answers the question, not merely relates to it. */
16
+ settlesQuestion: boolean;
17
+ /** For requests about every visible subject, whether each one was individually covered. */
18
+ coverageComplete?: boolean;
19
+ /** Exact short strings actually read off the frames. */
20
+ read: string[];
21
+ confidence: 'high' | 'medium' | 'low';
22
+ frameCount: number;
23
+ elapsedMs: number;
24
+ error?: string;
25
+ }
26
+ export declare function parseFinding(raw: string): {
27
+ found?: string;
28
+ read?: unknown;
29
+ confidence?: unknown;
30
+ settlesQuestion?: unknown;
31
+ coverageComplete?: unknown;
32
+ };
33
+ /**
34
+ * Re-watches each range and returns what it established. Ranges are independent,
35
+ * so they run together: a question needing three separate moments checked costs
36
+ * about the same wall time as one.
37
+ */
38
+ export declare function quickLook(input: {
39
+ mediaPath: string;
40
+ question: string;
41
+ ranges: QuickLookRange[];
42
+ /** Speech aligned to each range, when the caller already holds it. */
43
+ transcriptFor?: (range: QuickLookRange) => string | undefined;
44
+ signal?: AbortSignal;
45
+ }): Promise<QuickLookFinding[]>;
46
+ /** True when a re-watch produced something an answer can actually rest on. */
47
+ export declare function isUsableFinding(finding: QuickLookFinding): boolean;
48
+ /**
49
+ * What ffmpeg should open for this asset.
50
+ *
51
+ * A presigned URL is preferred over downloading: with `-ss` ahead of `-i`,
52
+ * ffmpeg range-requests only the bytes around the window, so re-watching thirty
53
+ * seconds of a long recording never transfers the whole file. Falling back to a
54
+ * full retrieve keeps assets on storage backends without presigning usable.
55
+ */
56
+ export declare function resolveQuickLookSource(storageUri: string, fileName: string): Promise<{
57
+ mediaPath: string;
58
+ cleanup: () => Promise<void>;
59
+ }>;
60
+ //# sourceMappingURL=quick-look.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quick-look.d.ts","sourceRoot":"","sources":["../../../../src/lib/media/video/quick-look.ts"],"names":[],"mappings":"AAyCA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,4FAA4F;IAC5F,eAAe,EAAE,OAAO,CAAC;IACzB,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,wDAAwD;IACxD,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAwED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC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