@promptbook/legacy-documents 0.105.0-31 → 0.105.0-32

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.
@@ -47,6 +47,7 @@ import { PENDING_VALUE_PLACEHOLDER } from '../config';
47
47
  import { MAX_FILENAME_LENGTH } from '../config';
48
48
  import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
49
49
  import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
50
+ import { DEFAULT_MAX_CONCURRENT_UPLOADS } from '../config';
50
51
  import { DEFAULT_MAX_RECURSION } from '../config';
51
52
  import { DEFAULT_MAX_EXECUTION_ATTEMPTS } from '../config';
52
53
  import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH } from '../config';
@@ -250,6 +251,7 @@ export { PENDING_VALUE_PLACEHOLDER };
250
251
  export { MAX_FILENAME_LENGTH };
251
252
  export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
252
253
  export { DEFAULT_MAX_PARALLEL_COUNT };
254
+ export { DEFAULT_MAX_CONCURRENT_UPLOADS };
253
255
  export { DEFAULT_MAX_RECURSION };
254
256
  export { DEFAULT_MAX_EXECUTION_ATTEMPTS };
255
257
  export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH };
@@ -108,6 +108,15 @@ export type AgentBasicInformation = {
108
108
  question: string | null;
109
109
  answer: string;
110
110
  }>;
111
+ /**
112
+ * Knowledge sources (documents, URLs) used by the agent
113
+ * This is parsed from KNOWLEDGE commitments
114
+ * Used for resolving document citations when the agent references sources
115
+ */
116
+ knowledgeSources: Array<{
117
+ url: string;
118
+ filename: string;
119
+ }>;
111
120
  };
112
121
  /**
113
122
  * TODO: [🐱‍🚀] Make all properties of `AgentBasicInformation` readonly
@@ -55,7 +55,7 @@ export type BookEditorProps = {
55
55
  /**
56
56
  * returns the URL of the uploaded file on CDN or storage
57
57
  */
58
- onFileUpload?(file: File): Promisable<string_knowledge_source_content>;
58
+ onFileUpload?(file: File, onProgress?: (progress: number_percent) => void): Promisable<string_knowledge_source_content>;
59
59
  /**
60
60
  * If true, logs verbose debug info to the console and shows additional visual cues
61
61
  */
@@ -31,6 +31,14 @@ export type ChatParticipant = {
31
31
  * Agent source for avatar profile
32
32
  */
33
33
  agentSource?: string_book;
34
+ /**
35
+ * Knowledge sources (documents, URLs) used by the agent
36
+ * Used for resolving document citations when the agent references sources
37
+ */
38
+ knowledgeSources?: Array<{
39
+ url: string;
40
+ filename: string;
41
+ }>;
34
42
  };
35
43
  /**
36
44
  * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
@@ -214,6 +214,12 @@ export declare const DEFAULT_INTERMEDIATE_FILES_STRATEGY: IntermediateFilesStrat
214
214
  * @public exported from `@promptbook/core`
215
215
  */
216
216
  export declare const DEFAULT_MAX_PARALLEL_COUNT = 5;
217
+ /**
218
+ * The maximum number of concurrent uploads
219
+ *
220
+ * @public exported from `@promptbook/core`
221
+ */
222
+ export declare const DEFAULT_MAX_CONCURRENT_UPLOADS = 5;
217
223
  /**
218
224
  * The maximum depth to which recursion can occur
219
225
  *
@@ -117,8 +117,8 @@ export declare const LIMITS: {
117
117
  */
118
118
  export declare const TIME_INTERVALS: {
119
119
  /**
120
- * Hundred milliseconds
121
- */
120
+ * Hundred milliseconds
121
+ */
122
122
  readonly HUNDRED_MILLISECONDS: 100;
123
123
  /**
124
124
  * One second in milliseconds
@@ -1,8 +1,8 @@
1
1
  import type { PartialDeep, Promisable, ReadonlyDeep } from 'type-fest';
2
2
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
3
+ import type { LlmCall } from '../../types/LlmCall';
3
4
  import type { InputParameters } from '../../types/typeAliases';
4
5
  import type { PipelineExecutorResult } from '../PipelineExecutorResult';
5
- import type { LlmCall } from '../../types/LlmCall';
6
6
  import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
7
7
  /**
8
8
  * Options for executing an entire pipeline, including input parameters, pipeline context, and progress callbacks.
@@ -51,6 +51,15 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
51
51
  question: string | null;
52
52
  answer: string;
53
53
  }>;
54
+ /**
55
+ * Knowledge sources (documents, URLs) used by the agent
56
+ * This is parsed from KNOWLEDGE commitments
57
+ * Used for resolving document citations when the agent references sources
58
+ */
59
+ knowledgeSources: Array<{
60
+ url: string;
61
+ filename: string;
62
+ }>;
54
63
  /**
55
64
  * Computed hash of the agent source for integrity verification
56
65
  */
@@ -25,6 +25,10 @@ export declare class RemoteAgent extends Agent {
25
25
  private _remoteAgentHash;
26
26
  toolTitles: Record<string, string>;
27
27
  private _isVoiceCallingEnabled;
28
+ knowledgeSources: Array<{
29
+ url: string;
30
+ filename: string;
31
+ }>;
28
32
  private constructor();
29
33
  get agentName(): string_agent_name;
30
34
  get agentHash(): string_agent_hash;
@@ -1,5 +1,4 @@
1
- import type { string_markdown } from '../../types/typeAliases';
2
- import type { string_markdown_text } from '../../types/typeAliases';
1
+ import type { string_markdown, string_markdown_text } from '../../types/typeAliases';
3
2
  /**
4
3
  * Utility function to extract all list items from markdown
5
4
  *
@@ -1,6 +1,4 @@
1
- import type { string_markdown_section } from '../../types/typeAliases';
2
- import type { string_markdown_section_content } from '../../types/typeAliases';
3
- import type { string_markdown_text } from '../../types/typeAliases';
1
+ import type { string_markdown_section, string_markdown_section_content, string_markdown_text } from '../../types/typeAliases';
4
2
  /**
5
3
  * Parsed markdown section
6
4
  *
@@ -1,5 +1,4 @@
1
- import type { string_markdown } from '../../types/typeAliases';
2
- import type { string_markdown_section } from '../../types/typeAliases';
1
+ import type { string_markdown, string_markdown_section } from '../../types/typeAliases';
3
2
  /**
4
3
  * Splits the markdown into sections by headings
5
4
  *
@@ -1,5 +1,4 @@
1
- import type { string_parameter_name } from '../../types/typeAliases';
2
- import type { string_template } from '../../types/typeAliases';
1
+ import type { string_parameter_name, string_template } from '../../types/typeAliases';
3
2
  import type { really_unknown } from '../organization/really_unknown';
4
3
  /**
5
4
  * Replaces parameters in template with values from parameters object
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.105.0-30`).
18
+ * It follows semantic versioning (e.g., `0.105.0-31`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/legacy-documents",
3
- "version": "0.105.0-31",
3
+ "version": "0.105.0-32",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -95,7 +95,7 @@
95
95
  "module": "./esm/index.es.js",
96
96
  "typings": "./esm/typings/src/_packages/legacy-documents.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.105.0-31"
98
+ "@promptbook/core": "0.105.0-32"
99
99
  },
100
100
  "dependencies": {
101
101
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -25,7 +25,7 @@
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.105.0-31';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-32';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1834,7 +1834,7 @@
1834
1834
  if (typeof filename !== 'string') {
1835
1835
  return false;
1836
1836
  }
1837
- if (filename.split('\n').length > 1) {
1837
+ if (filename.split(/\r?\n/).length > 1) {
1838
1838
  return false;
1839
1839
  }
1840
1840
  // Normalize slashes early so heuristics can detect path-like inputs
@@ -2036,7 +2036,7 @@
2036
2036
  if (typeof email !== 'string') {
2037
2037
  return false;
2038
2038
  }
2039
- if (email.split('\n').length > 1) {
2039
+ if (email.split(/\r?\n/).length > 1) {
2040
2040
  return false;
2041
2041
  }
2042
2042
  return /^.+@.+\..+$/.test(email);
@@ -4985,7 +4985,7 @@
4985
4985
 
4986
4986
  The source:
4987
4987
  ${block(knowledgeSource.knowledgeSourceContent
4988
- .split('\n')
4988
+ .split(/\r?\n/)
4989
4989
  .map((line) => `> ${line}`)
4990
4990
  .join('\n'))}
4991
4991
 
@@ -5001,7 +5001,7 @@
5001
5001
 
5002
5002
  The source:
5003
5003
  > ${block(knowledgeSource.knowledgeSourceContent
5004
- .split('\n')
5004
+ .split(/\r?\n/)
5005
5005
  .map((line) => `> ${line}`)
5006
5006
  .join('\n'))}
5007
5007
 
@@ -5702,7 +5702,7 @@
5702
5702
  subvalueName: 'LINE',
5703
5703
  async mapValues(options) {
5704
5704
  const { value, mapCallback, onProgress } = options;
5705
- const lines = value.split('\n');
5705
+ const lines = value.split(/\r?\n/);
5706
5706
  const mappedLines = await Promise.all(lines.map((lineContent, lineNumber, array) =>
5707
5707
  // TODO: [🧠] Maybe option to skip empty line
5708
5708
  /* not await */ mapCallback({
@@ -5907,7 +5907,7 @@
5907
5907
  parameterValue = parameterValue.replace(/[{}]/g, '\\$&');
5908
5908
  if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
5909
5909
  parameterValue = parameterValue
5910
- .split('\n')
5910
+ .split(/\r?\n/)
5911
5911
  .map((line, index) => (index === 0 ? line : `${precol}${line}`))
5912
5912
  .join('\n');
5913
5913
  }
@@ -5943,7 +5943,7 @@
5943
5943
  */
5944
5944
  function extractAllBlocksFromMarkdown(markdown) {
5945
5945
  const codeBlocks = [];
5946
- const lines = markdown.split('\n');
5946
+ const lines = markdown.split(/\r?\n/);
5947
5947
  // Note: [0] Ensure that the last block notated by gt > will be closed
5948
5948
  lines.push('');
5949
5949
  let currentCodeBlock = null;
@@ -6078,7 +6078,7 @@
6078
6078
  }
6079
6079
  text = text.replace('\r\n', '\n');
6080
6080
  text = text.replace('\r', '\n');
6081
- const lines = text.split('\n');
6081
+ const lines = text.split(/\r?\n/);
6082
6082
  return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
6083
6083
  }
6084
6084
  /**
@@ -6553,13 +6553,13 @@
6553
6553
  return `
6554
6554
  Attempt ${failure.attemptIndex + 1}:
6555
6555
  Error ${((_a = failure.error) === null || _a === void 0 ? void 0 : _a.name) || ''}:
6556
- ${block((_b = failure.error) === null || _b === void 0 ? void 0 : _b.message.split('\n').map((line) => `> ${line}`).join('\n'))}
6556
+ ${block((_b = failure.error) === null || _b === void 0 ? void 0 : _b.message.split(/\r?\n/).map((line) => `> ${line}`).join('\n'))}
6557
6557
 
6558
6558
  Result:
6559
6559
  ${block(failure.result === null
6560
6560
  ? 'null'
6561
6561
  : spaceTrim$1.spaceTrim(failure.result)
6562
- .split('\n')
6562
+ .split(/\r?\n/)
6563
6563
  .map((line) => `> ${line}`)
6564
6564
  .join('\n'))}
6565
6565
  `;
@@ -6574,7 +6574,7 @@
6574
6574
 
6575
6575
  The Prompt:
6576
6576
  ${block((((_a = $ongoingTaskResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || '')
6577
- .split('\n')
6577
+ .split(/\r?\n/)
6578
6578
  .map((line) => `> ${line}`)
6579
6579
  .join('\n'))}
6580
6580
 
@@ -7245,7 +7245,7 @@
7245
7245
  ${block(pipelineIdentification)}
7246
7246
 
7247
7247
  ${block(JSON.stringify(newOngoingResult, null, 4)
7248
- .split('\n')
7248
+ .split(/\r?\n/)
7249
7249
  .map((line) => `> ${line}`)
7250
7250
  .join('\n'))}
7251
7251
  `));