@promptbook/remote-server 0.72.0-23 → 0.72.0-26

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.
package/esm/index.es.js CHANGED
@@ -7,7 +7,7 @@ import spaceTrim$1, { spaceTrim } from 'spacetrim';
7
7
  /**
8
8
  * The version of the Promptbook library
9
9
  */
10
- var PROMPTBOOK_VERSION = '0.72.0-22';
10
+ var PROMPTBOOK_VERSION = '0.72.0-25';
11
11
  // TODO: [main] !!!! List here all the versions and annotate + put into script
12
12
 
13
13
  /*! *****************************************************************************
@@ -16,6 +16,8 @@ import { _MarkdownScraperRegistration } from '../scrapers/markdown/register-cons
16
16
  import { _MarkdownScraperMetadataRegistration } from '../scrapers/markdown/register-metadata';
17
17
  import { _PdfScraperRegistration } from '../scrapers/pdf/register-constructor';
18
18
  import { _PdfScraperMetadataRegistration } from '../scrapers/pdf/register-metadata';
19
+ import { _WebsiteScraperRegistration } from '../scrapers/website/register-constructor';
20
+ import { _WebsiteScraperMetadataRegistration } from '../scrapers/website/register-metadata';
19
21
  export { PROMPTBOOK_VERSION };
20
22
  export { _CLI };
21
23
  export { _AnthropicClaudeMetadataRegistration };
@@ -34,3 +36,5 @@ export { _MarkdownScraperRegistration };
34
36
  export { _MarkdownScraperMetadataRegistration };
35
37
  export { _PdfScraperRegistration };
36
38
  export { _PdfScraperMetadataRegistration };
39
+ export { _WebsiteScraperRegistration };
40
+ export { _WebsiteScraperMetadataRegistration };
@@ -83,6 +83,7 @@ import { _LegacyDocumentScraperMetadataRegistration } from '../scrapers/document
83
83
  import { _DocumentScraperMetadataRegistration } from '../scrapers/document/register-metadata';
84
84
  import { _MarkdownScraperMetadataRegistration } from '../scrapers/markdown/register-metadata';
85
85
  import { _PdfScraperMetadataRegistration } from '../scrapers/pdf/register-metadata';
86
+ import { _WebsiteScraperMetadataRegistration } from '../scrapers/website/register-metadata';
86
87
  import { MemoryStorage } from '../storage/memory/MemoryStorage';
87
88
  import { PrefixStorage } from '../storage/memory/utils/PrefixStorage';
88
89
  import { executionReportJsonToString } from '../types/execution-report/executionReportJsonToString';
@@ -175,6 +176,7 @@ export { _LegacyDocumentScraperMetadataRegistration };
175
176
  export { _DocumentScraperMetadataRegistration };
176
177
  export { _MarkdownScraperMetadataRegistration };
177
178
  export { _PdfScraperMetadataRegistration };
179
+ export { _WebsiteScraperMetadataRegistration };
178
180
  export { MemoryStorage };
179
181
  export { PrefixStorage };
180
182
  export { executionReportJsonToString };
@@ -0,0 +1,8 @@
1
+ import { PROMPTBOOK_VERSION } from '../version';
2
+ import { createWebsiteScraper } from '../scrapers/website/createWebsiteScraper';
3
+ import { _WebsiteScraperRegistration } from '../scrapers/website/register-constructor';
4
+ import { WebsiteScraper } from '../scrapers/website/WebsiteScraper';
5
+ export { PROMPTBOOK_VERSION };
6
+ export { createWebsiteScraper };
7
+ export { _WebsiteScraperRegistration };
8
+ export { WebsiteScraper };
@@ -0,0 +1,46 @@
1
+ import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson';
2
+ import type { string_markdown } from '../../types/typeAliases';
3
+ import type { Converter } from '../_common/Converter';
4
+ import type { Scraper } from '../_common/Scraper';
5
+ import type { ScraperSourceHandler } from '../_common/Scraper';
6
+ import type { ExecutionTools } from '../../execution/ExecutionTools';
7
+ import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
8
+ import type { ScraperAndConverterMetadata } from '../_common/register/ScraperAndConverterMetadata';
9
+ import type { ScraperIntermediateSource } from '../_common/ScraperIntermediateSource';
10
+ /**
11
+ * Scraper for websites
12
+ *
13
+ * @see `documentationUrl` for more details
14
+ * @public exported from `@promptbook/website-crawler`
15
+ */
16
+ export declare class WebsiteScraper implements Converter, Scraper {
17
+ private readonly tools;
18
+ private readonly options;
19
+ /**
20
+ * Metadata of the scraper which includes title, mime types, etc.
21
+ */
22
+ get metadata(): ScraperAndConverterMetadata;
23
+ /**
24
+ * Markdown scraper is used internally
25
+ */
26
+ private readonly markdownScraper;
27
+ constructor(tools: Pick<ExecutionTools, 'fs' | 'llm'>, options: PrepareAndScrapeOptions);
28
+ /**
29
+ * Convert the website to `.md` file and returns intermediate source
30
+ *
31
+ * Note: `$` is used to indicate that this function is not a pure function - it leaves files on the disk and you are responsible for cleaning them by calling `destroy` method of returned object
32
+ */
33
+ $convert(source: ScraperSourceHandler): Promise<ScraperIntermediateSource & {
34
+ markdown: string_markdown;
35
+ }>;
36
+ /**
37
+ * Scrapes the website and returns the knowledge pieces or `null` if it can't scrape it
38
+ */
39
+ scrape(source: ScraperSourceHandler): Promise<ReadonlyArray<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>;
40
+ }
41
+ /**
42
+ * TODO: [👣] Scraped website in .md can act as cache item - there is no need to run conversion each time
43
+ * TODO: [🪂] Do it in parallel 11:11
44
+ * Note: No need to aggregate usage here, it is done by intercepting the llmTools
45
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
46
+ */
@@ -0,0 +1,20 @@
1
+ import type { ExecutionTools } from '../../execution/ExecutionTools';
2
+ import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
3
+ import { WebsiteScraper } from './WebsiteScraper';
4
+ /**
5
+ * @@@
6
+ *
7
+ * @public exported from `@promptbook/website-crawler`
8
+ */
9
+ export declare const createWebsiteScraper: ((tools: Pick<ExecutionTools, 'llm'>, options: PrepareAndScrapeOptions) => WebsiteScraper) & import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{
10
+ title: string;
11
+ packageName: string;
12
+ className: string;
13
+ mimeTypes: string[];
14
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
15
+ isAvilableInBrowser: false;
16
+ requiredExecutables: never[];
17
+ }>;
18
+ /**
19
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
20
+ */
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ts-node
2
+ export {};
3
+ /**
4
+ * Note: [⚫] Code in this file should never be published in any package
5
+ */
@@ -0,0 +1,13 @@
1
+ import type { Registration } from '../../utils/$Register';
2
+ /**
3
+ * Registration of known scraper
4
+ *
5
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
6
+ *
7
+ * @public exported from `@promptbook/website-crawler`
8
+ * @public exported from `@promptbook/cli`
9
+ */
10
+ export declare const _WebsiteScraperRegistration: Registration;
11
+ /**
12
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
13
+ */
@@ -0,0 +1,24 @@
1
+ import type { Registration } from '../../utils/$Register';
2
+ /**
3
+ * Metadata of the scraper
4
+ *
5
+ * @private within the scraper directory
6
+ */
7
+ export declare const websiteScraperMetadata: import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{
8
+ title: string;
9
+ packageName: string;
10
+ className: string;
11
+ mimeTypes: string[];
12
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
13
+ isAvilableInBrowser: false;
14
+ requiredExecutables: never[];
15
+ }>;
16
+ /**
17
+ * Registration of known scraper metadata
18
+ *
19
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
20
+ *
21
+ * @public exported from `@promptbook/core`
22
+ * @public exported from `@promptbook/cli`
23
+ */
24
+ export declare const _WebsiteScraperMetadataRegistration: Registration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-server",
3
- "version": "0.72.0-23",
3
+ "version": "0.72.0-26",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -52,7 +52,7 @@
52
52
  "module": "./esm/index.es.js",
53
53
  "typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
54
54
  "peerDependencies": {
55
- "@promptbook/core": "0.72.0-23"
55
+ "@promptbook/core": "0.72.0-26"
56
56
  },
57
57
  "dependencies": {
58
58
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -14,7 +14,7 @@
14
14
  /**
15
15
  * The version of the Promptbook library
16
16
  */
17
- var PROMPTBOOK_VERSION = '0.72.0-22';
17
+ var PROMPTBOOK_VERSION = '0.72.0-25';
18
18
  // TODO: [main] !!!! List here all the versions and annotate + put into script
19
19
 
20
20
  /*! *****************************************************************************