@promptbook/cli 0.112.0-115 → 0.112.0-117

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 (57) hide show
  1. package/esm/index.es.js +35 -32
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/_packages/components.index.d.ts +2 -0
  4. package/esm/src/_packages/node.index.d.ts +10 -0
  5. package/esm/src/book-3.0/CliAgent.d.ts +8 -15
  6. package/esm/src/book-3.0/agentFolderPaths.d.ts +30 -0
  7. package/esm/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
  8. package/esm/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
  9. package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
  10. package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
  11. package/esm/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
  12. package/esm/src/version.d.ts +1 -1
  13. package/package.json +1 -1
  14. package/src/_packages/components.index.ts +2 -0
  15. package/src/_packages/node.index.ts +10 -0
  16. package/src/book-3.0/CliAgent.ts +23 -85
  17. package/src/book-3.0/agentFolderPaths.ts +38 -0
  18. package/src/book-components/BookEditor/BookEditor.tsx +1 -1
  19. package/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.tsx +2 -4
  20. package/src/book-components/BookEditor/BookEditorActionbar.tsx +32 -2
  21. package/src/book-components/BookEditor/BookEditorBrowserConfig.ts +11 -0
  22. package/src/book-components/BookEditor/BookEditorForClient.tsx +33 -0
  23. package/src/book-components/BookEditor/BookEditorMonaco.tsx +1 -1
  24. package/src/book-components/BookEditor/BookEditorMonacoTokenization.ts +83 -15
  25. package/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.ts +11 -0
  26. package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +32 -46
  27. package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +1 -1
  28. package/src/book-components/BookEditor/useBookEditorMonacoUploads.ts +1 -1
  29. package/src/book-components/Chat/utils/renderMarkdown.ts +3 -2
  30. package/src/cli/cli-commands/agent-folder/agentProjectPaths.ts +15 -35
  31. package/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.ts +2 -2
  32. package/src/commitments/_common/teamInternalAgentAccess.ts +2 -2
  33. package/src/formats/csv/CsvFormatParser.ts +4 -4
  34. package/src/formats/csv/utils/csvParse.ts +2 -2
  35. package/src/llm-providers/agent/AgentLlmExecutionTools.ts +2 -2
  36. package/src/llm-providers/agent/AgentLlmExecutionToolsAgentKitRunner.ts +2 -2
  37. package/src/llm-providers/agent/AgentLlmExecutionToolsOpenAiAssistantRunner.ts +2 -2
  38. package/src/other/templates/getTemplatesPipelineCollection.ts +695 -768
  39. package/src/scrapers/_common/utils/getScraperIntermediateSource.ts +2 -2
  40. package/src/scrapers/website/WebsiteScraper.ts +1 -1
  41. package/src/scrapers/website/utils/createShowdownConverter.ts +2 -2
  42. package/src/utils/misc/computeHash.ts +2 -2
  43. package/src/utils/random/$randomToken.ts +2 -2
  44. package/src/version.ts +2 -2
  45. package/src/versions.txt +2 -0
  46. package/umd/index.umd.js +37 -31
  47. package/umd/index.umd.js.map +1 -1
  48. package/umd/src/_packages/components.index.d.ts +2 -0
  49. package/umd/src/_packages/node.index.d.ts +10 -0
  50. package/umd/src/book-3.0/CliAgent.d.ts +8 -15
  51. package/umd/src/book-3.0/agentFolderPaths.d.ts +30 -0
  52. package/umd/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
  53. package/umd/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
  54. package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
  55. package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
  56. package/umd/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
  57. package/umd/src/version.d.ts +1 -1
@@ -1,7 +1,3 @@
1
- import type { string_book } from '../../book-2.0/agent-source/string_book';
2
- import { parseAgentSourceWithCommitments } from '../../book-2.0/agent-source/parseAgentSourceWithCommitments';
3
- import type { BookCommitment } from '../../commitments/_base/BookCommitment';
4
-
5
1
  /**
6
2
  * Regex source for absolute URL references inside TEAM/FROM/IMPORT commitments.
7
3
  *
@@ -28,12 +24,41 @@ const AGENT_REFERENCE_BRACED_PATTERN = '\\{[^{}\\r\\n]+\\}';
28
24
  *
29
25
  * @private function of BookEditorMonaco
30
26
  */
31
- const AGENT_REFERENCE_COMMITMENT_TYPES: ReadonlySet<BookCommitment> = new Set<BookCommitment>([
27
+ const AGENT_REFERENCE_COMMITMENT_TYPES = ['FROM', 'IMPORT', 'IMPORTS', 'TEAM'] as const;
28
+
29
+ /**
30
+ * Commitment types known to the browser editor tokenizer.
31
+ *
32
+ * @private function of BookEditorMonaco
33
+ */
34
+ const BOOK_EDITOR_COMMITMENT_TYPES = [
35
+ 'PERSONA',
36
+ 'KNOWLEDGE',
37
+ 'TASK',
38
+ 'PROMPT',
39
+ 'EXPECT',
40
+ 'FORMAT',
41
+ 'MODEL',
42
+ 'SAMPLE',
32
43
  'FROM',
33
44
  'IMPORT',
34
45
  'IMPORTS',
35
46
  'TEAM',
36
- ]);
47
+ 'TODO',
48
+ 'NOTE',
49
+ 'NOTES',
50
+ 'NONCE',
51
+ ] as const;
52
+
53
+ /**
54
+ * Regex pattern to match horizontal lines.
55
+ *
56
+ * @private function of BookEditorMonaco
57
+ */
58
+ const HORIZONTAL_LINE_PATTERN = /^[\s]*[-_*][\s]*[-_*][\s]*[-_*][\s]*[-_*]*[\s]*$/;
59
+
60
+ const BOOK_EDITOR_COMMITMENT_LINE_REGEX = createCommitmentLineRegex(BOOK_EDITOR_COMMITMENT_TYPES);
61
+ const AGENT_REFERENCE_COMMITMENT_LINE_REGEX = createCommitmentLineRegex(AGENT_REFERENCE_COMMITMENT_TYPES);
37
62
 
38
63
  /**
39
64
  * Range descriptor for one commitment block in source coordinates.
@@ -249,31 +274,74 @@ function collectAgentReferenceCommitmentLineRanges(
249
274
  content: string,
250
275
  sourceLines: ReadonlyArray<string>,
251
276
  ): Array<CommitmentLineRange> {
252
- const parsed = parseAgentSourceWithCommitments(content as string_book);
253
277
  const ranges: Array<CommitmentLineRange> = [];
278
+ let activeRangeStartLineNumber: number | null = null;
279
+ let isInsideCodeBlock = false;
280
+ const startLineIndex = findBookBodyStartLineIndex(sourceLines);
281
+
282
+ for (let lineIndex = startLineIndex; lineIndex < sourceLines.length; lineIndex++) {
283
+ const line = sourceLines[lineIndex] || '';
284
+ const trimmedLine = line.trim();
254
285
 
255
- for (let index = 0; index < parsed.commitments.length; index++) {
256
- const commitment = parsed.commitments[index];
257
- if (!commitment || !AGENT_REFERENCE_COMMITMENT_TYPES.has(commitment.type)) {
286
+ if (trimmedLine.startsWith('```')) {
287
+ isInsideCodeBlock = !isInsideCodeBlock;
258
288
  continue;
259
289
  }
260
290
 
261
- const nextCommitmentStartLine = parsed.commitments[index + 1]?.lineNumber ?? sourceLines.length + 1;
262
- const endLineNumber = Math.min(nextCommitmentStartLine - 1, sourceLines.length);
291
+ if (isInsideCodeBlock) {
292
+ continue;
293
+ }
263
294
 
264
- if (commitment.lineNumber > endLineNumber) {
295
+ if (HORIZONTAL_LINE_PATTERN.test(line)) {
296
+ if (activeRangeStartLineNumber !== null) {
297
+ ranges.push({
298
+ startLineNumber: activeRangeStartLineNumber,
299
+ endLineNumber: lineIndex,
300
+ });
301
+ activeRangeStartLineNumber = null;
302
+ }
303
+ continue;
304
+ }
305
+
306
+ if (!BOOK_EDITOR_COMMITMENT_LINE_REGEX.test(trimmedLine)) {
265
307
  continue;
266
308
  }
267
309
 
310
+ if (activeRangeStartLineNumber !== null) {
311
+ ranges.push({
312
+ startLineNumber: activeRangeStartLineNumber,
313
+ endLineNumber: lineIndex,
314
+ });
315
+ }
316
+
317
+ activeRangeStartLineNumber = AGENT_REFERENCE_COMMITMENT_LINE_REGEX.test(trimmedLine) ? lineIndex + 1 : null;
318
+ }
319
+
320
+ if (activeRangeStartLineNumber !== null) {
268
321
  ranges.push({
269
- startLineNumber: commitment.lineNumber,
270
- endLineNumber,
322
+ startLineNumber: activeRangeStartLineNumber,
323
+ endLineNumber: sourceLines.length,
271
324
  });
272
325
  }
273
326
 
274
327
  return ranges;
275
328
  }
276
329
 
330
+ function createCommitmentLineRegex(commitmentTypes: ReadonlyArray<string>): RegExp {
331
+ const commitmentPattern = [...commitmentTypes]
332
+ .sort((a, b) => b.length - a.length)
333
+ .map((type) => type.replace(/\s+/, '\\s+'))
334
+ .join('|');
335
+
336
+ return new RegExp(`^\\s*(${commitmentPattern})(?=\\s|$)`, 'i');
337
+ }
338
+
339
+ function findBookBodyStartLineIndex(sourceLines: ReadonlyArray<string>): number {
340
+ const titleLineIndex = sourceLines.findIndex((line) => line.trim().length > 0);
341
+
342
+ return titleLineIndex === -1 ? 0 : titleLineIndex + 1;
343
+ }
344
+
277
345
  /**
278
346
  * Agent reference helpers for `BookEditorMonaco`.
279
347
  *
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Browser-compatible stub for `createDeprecatedCommitmentDiagnostics`.
3
+ *
4
+ * In the browser build the full Node.js implementation is not available,
5
+ * so this stub always returns an empty array to keep the editor functional.
6
+ *
7
+ * @private internal utility of `BookEditorMonaco`
8
+ */
9
+ export function createDeprecatedCommitmentDiagnostics(_agentSource?: string): [] {
10
+ return [];
11
+ }
@@ -1,11 +1,6 @@
1
1
  import type { editor, Position } from 'monaco-editor';
2
2
  import { useEffect } from 'react';
3
- import { getAllCommitmentDefinitions } from '../../commitments/_common/getAllCommitmentDefinitions';
4
- import {
5
- formatCommitmentReplacementText,
6
- getCommitmentNoticeMetadata,
7
- } from '../../commitments/_common/getCommitmentNoticeMetadata';
8
- import { PROMPTBOOK_SYNTAX_COLORS } from '../../config';
3
+ import { PROMPTBOOK_SYNTAX_COLORS } from './BookEditorBrowserConfig';
9
4
  import { BookEditorMonacoConstants } from './BookEditorMonacoConstants';
10
5
  import { BookEditorMonacoTokenization } from './BookEditorMonacoTokenization';
11
6
  import type { BookEditorTheme } from './BookEditorTheme';
@@ -303,23 +298,26 @@ export function ensureBookEditorMonacoLanguage(
303
298
 
304
299
  monaco.languages.register({ id: BookEditorMonacoConstants.BOOK_LANGUAGE_ID });
305
300
 
306
- const commitmentDefinitions = getAllCommitmentDefinitions();
307
- const commitmentTypes = [...new Set(commitmentDefinitions.map(({ type }) => type))];
308
- const commitmentDefinitionByType = new Map(
309
- commitmentDefinitions.map((definition) => [definition.type, definition]),
310
- );
311
- const completionCommitmentTypes = [...commitmentTypes].sort((leftType, rightType) => {
312
- const leftDefinition = commitmentDefinitionByType.get(leftType);
313
- const rightDefinition = commitmentDefinitionByType.get(rightType);
314
- const leftRank = leftDefinition?.isUnfinished ? 1 : 0;
315
- const rightRank = rightDefinition?.isUnfinished ? 1 : 0;
316
-
317
- if (leftRank !== rightRank) {
318
- return leftRank - rightRank;
319
- }
320
-
321
- return commitmentTypes.indexOf(leftType) - commitmentTypes.indexOf(rightType);
322
- });
301
+ const commitmentTypes = [
302
+ 'GOAL',
303
+ 'RULE',
304
+ 'PERSONA',
305
+ 'KNOWLEDGE',
306
+ 'TASK',
307
+ 'PROMPT',
308
+ 'EXPECT',
309
+ 'FORMAT',
310
+ 'MODEL',
311
+ 'SAMPLE',
312
+ 'FROM',
313
+ 'IMPORT',
314
+ 'IMPORTS',
315
+ 'TEAM',
316
+ ...TODO_COMMITMENT_TYPES,
317
+ ...NOTE_COMMITMENT_TYPES,
318
+ 'REMOVE',
319
+ ];
320
+ const completionCommitmentTypes = [...commitmentTypes];
323
321
  const noteLikeCommitmentTypeSet = new Set<string>([...TODO_COMMITMENT_TYPES, ...NOTE_COMMITMENT_TYPES]);
324
322
  const noteLikeCommitmentStates = createNoteLikeCommitmentStates(commitmentTypes);
325
323
  const executableCommitmentTypes = commitmentTypes.filter(
@@ -390,29 +388,17 @@ export function ensureBookEditorMonacoLanguage(
390
388
  endColumn: word.endColumn,
391
389
  };
392
390
 
393
- const suggestions = completionCommitmentTypes.map((type, index) => {
394
- const definition = commitmentDefinitionByType.get(type);
395
- const notice = definition ? getCommitmentNoticeMetadata(definition) : null;
396
- const completionDocumentation = notice
397
- ? `${notice.detailLabel}. ${notice.message}${
398
- notice.kind === 'deprecated'
399
- ? formatCommitmentReplacementText(definition?.deprecation?.replacedBy)
400
- : ''
401
- }`
402
- : definition?.description || 'Commitment';
403
-
404
- return {
405
- label: type,
406
- kind: monaco.languages.CompletionItemKind.Keyword,
407
- insertText: type,
408
- range,
409
- sortText: index.toString().padStart(4, '0'),
410
- detail: notice?.detailLabel || 'Commitment',
411
- documentation: {
412
- value: completionDocumentation,
413
- },
414
- };
415
- });
391
+ const suggestions = completionCommitmentTypes.map((type, index) => ({
392
+ label: type,
393
+ kind: monaco.languages.CompletionItemKind.Keyword,
394
+ insertText: type,
395
+ range,
396
+ sortText: index.toString().padStart(4, '0'),
397
+ detail: 'Commitment',
398
+ documentation: {
399
+ value: 'Book commitment',
400
+ },
401
+ }));
416
402
 
417
403
  return { suggestions };
418
404
  },
@@ -1,5 +1,5 @@
1
1
  import { useEffect } from 'react';
2
- import { PROMPTBOOK_SYNTAX_COLORS } from '../../config';
2
+ import { PROMPTBOOK_SYNTAX_COLORS } from './BookEditorBrowserConfig';
3
3
  import type { BookEditorTheme } from './BookEditorTheme';
4
4
 
5
5
  /**
@@ -3,7 +3,7 @@ import { type MutableRefObject, useCallback, useEffect, useMemo, useRef, useStat
3
3
  import type { Promisable } from 'type-fest';
4
4
  import { BookEditable } from '../../book-2.0/agent-source/BookEditable';
5
5
  import type { string_book } from '../../book-2.0/agent-source/string_book';
6
- import { DEFAULT_MAX_CONCURRENT_UPLOADS } from '../../config';
6
+ import { DEFAULT_MAX_CONCURRENT_UPLOADS } from './BookEditorBrowserConfig';
7
7
  import { BookEditorMonacoConstants } from './BookEditorMonacoConstants';
8
8
  import { BookEditorMonacoFormatting } from './BookEditorMonacoFormatting';
9
9
 
@@ -5,7 +5,8 @@ import createDOMPurify, {
5
5
  type WindowLike as DomPurifyWindowLike,
6
6
  } from 'dompurify';
7
7
  import katex from 'katex';
8
- import { Converter as ShowdownConverter } from 'showdown';
8
+ import type { Converter as ShowdownConverter } from 'showdown';
9
+ import showdown from 'showdown';
9
10
  import type { string_html, string_markdown } from '../../../types/string_markdown';
10
11
  import { TODO_USE } from '../../../utils/organization/TODO_USE';
11
12
  import { createCitationMarkerRegex, parseCitationMarker } from './parseCitationMarker';
@@ -507,7 +508,7 @@ function normalizeMarkdownSublists(markdown: string_markdown): string_markdown {
507
508
  function createChatMarkdownConverter(options?: RenderMarkdownOptions): ShowdownConverter {
508
509
  const citationReferenceClassName = options?.citationReferenceClassName ?? DEFAULT_CITATION_REFERENCE_CLASS_NAME;
509
510
 
510
- return new ShowdownConverter({
511
+ return new showdown.Converter({
511
512
  flavor: 'github',
512
513
  tables: true,
513
514
  strikethrough: true,
@@ -1,12 +1,20 @@
1
1
  import { join } from 'path';
2
2
  import { spaceTrim } from 'spacetrim';
3
-
4
- /**
5
- * Relative path to the local agent source initialized by `ptbk agent-folder init`.
6
- *
7
- * @private internal utility of `ptbk agent-folder`
8
- */
9
- export const AGENT_BOOK_FILE_PATH = 'agent.book';
3
+ import {
4
+ AGENT_BOOK_FILE_PATH,
5
+ AGENT_FAILED_MESSAGES_DIRECTORY_PATH,
6
+ AGENT_FINISHED_MESSAGES_DIRECTORY_PATH,
7
+ AGENT_MESSAGES_DIRECTORY_PATH,
8
+ AGENT_QUEUED_MESSAGES_DIRECTORY_PATH,
9
+ } from '../../../book-3.0/agentFolderPaths';
10
+
11
+ export {
12
+ AGENT_BOOK_FILE_PATH,
13
+ AGENT_FAILED_MESSAGES_DIRECTORY_PATH,
14
+ AGENT_FINISHED_MESSAGES_DIRECTORY_PATH,
15
+ AGENT_MESSAGES_DIRECTORY_PATH,
16
+ AGENT_QUEUED_MESSAGES_DIRECTORY_PATH,
17
+ };
10
18
 
11
19
  /**
12
20
  * Relative path to local knowledge files initialized by `ptbk agent-folder init`.
@@ -15,34 +23,6 @@ export const AGENT_BOOK_FILE_PATH = 'agent.book';
15
23
  */
16
24
  export const AGENT_KNOWLEDGE_DIRECTORY_PATH = 'knowledge';
17
25
 
18
- /**
19
- * Relative path to the message queue root initialized by `ptbk agent-folder init`.
20
- *
21
- * @private internal utility of `ptbk agent-folder`
22
- */
23
- export const AGENT_MESSAGES_DIRECTORY_PATH = 'messages';
24
-
25
- /**
26
- * Relative path to queued user messages consumed by `ptbk agent-folder run-once`.
27
- *
28
- * @private internal utility of `ptbk agent-folder`
29
- */
30
- export const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH = join(AGENT_MESSAGES_DIRECTORY_PATH, 'queued');
31
-
32
- /**
33
- * Relative path to answered messages written by `ptbk agent-folder run-once`.
34
- *
35
- * @private internal utility of `ptbk agent-folder`
36
- */
37
- export const AGENT_FINISHED_MESSAGES_DIRECTORY_PATH = join(AGENT_MESSAGES_DIRECTORY_PATH, 'finished');
38
-
39
- /**
40
- * Relative path to messages that the agent runner stopped retrying.
41
- *
42
- * @private internal utility of `ptbk agent-folder`
43
- */
44
- export const AGENT_FAILED_MESSAGES_DIRECTORY_PATH = join(AGENT_MESSAGES_DIRECTORY_PATH, 'failed');
45
-
46
26
  /**
47
27
  * Relative path to generated local agent documentation initialized by `ptbk agent-folder init`.
48
28
  *
@@ -1,4 +1,4 @@
1
- import { SHA256 as sha256 } from 'crypto-js';
1
+ import CryptoJS from 'crypto-js';
2
2
  import hexEncoder from 'crypto-js/enc-hex';
3
3
  import type { string_knowledge_source_content } from '../../../types/string_knowledge_source_content';
4
4
  import type { string_name } from '../../../types/string_name';
@@ -10,7 +10,7 @@ import { normalizeToKebabCase } from '../../../utils/normalization/normalize-to-
10
10
  * @public exported from `@promptbook/editable`
11
11
  */
12
12
  export function knowledgeSourceContentToName(knowledgeSourceContent: string_knowledge_source_content): string_name {
13
- const hash = sha256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
13
+ const hash = CryptoJS.SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
14
14
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
15
15
  .toString(/* hex */)
16
16
  .substring(0, 20);
@@ -1,4 +1,4 @@
1
- import { SHA256 as sha256 } from 'crypto-js';
1
+ import CryptoJS from 'crypto-js';
2
2
 
3
3
  /**
4
4
  * Header used for same-server TEAM calls that may access private teammate agents.
@@ -44,7 +44,7 @@ export function resolveTeamInternalAgentAccessToken(): string | null {
44
44
  return null;
45
45
  }
46
46
 
47
- return sha256(`promptbook-team-agent-access:${secret}`).toString();
47
+ return CryptoJS.SHA256(`promptbook-team-agent-access:${secret}`).toString();
48
48
  }
49
49
 
50
50
  /**
@@ -1,4 +1,4 @@
1
- import { unparse } from 'papaparse';
1
+ import papaparse from 'papaparse';
2
2
  import { spaceTrim } from 'spacetrim';
3
3
  import type { TODO_any } from '../../utils/organization/TODO_any';
4
4
  import { TODO_USE } from '../../utils/organization/TODO_USE';
@@ -102,11 +102,11 @@ export const CsvFormatParser: FormatParser<
102
102
  i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
103
103
  );
104
104
  */
105
- await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
105
+ await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
106
106
  }
107
107
  }
108
108
 
109
- return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
109
+ return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
110
110
  },
111
111
  },
112
112
  {
@@ -149,7 +149,7 @@ export const CsvFormatParser: FormatParser<
149
149
  }),
150
150
  );
151
151
 
152
- return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
152
+ return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
153
153
  },
154
154
  },
155
155
  ],
@@ -1,5 +1,5 @@
1
1
  import type { ParseResult } from 'papaparse';
2
- import { parse } from 'papaparse';
2
+ import papaparse from 'papaparse';
3
3
  import type { Parameters } from '../../../types/Parameters';
4
4
  import type { TODO_any } from '../../../utils/organization/TODO_any';
5
5
  import { TODO_USE } from '../../../utils/organization/TODO_USE';
@@ -31,6 +31,6 @@ export function csvParse(
31
31
  value = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
32
32
  }
33
33
 
34
- const csv = parse<Parameters>(value, settings);
34
+ const csv = papaparse.parse<Parameters>(value, settings);
35
35
  return csv;
36
36
  }
@@ -1,4 +1,4 @@
1
- import { SHA256 as sha256 } from 'crypto-js';
1
+ import CryptoJS from 'crypto-js';
2
2
  import hexEncoder from 'crypto-js/enc-hex';
3
3
  import type { Promisable } from 'type-fest';
4
4
  import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
@@ -230,7 +230,7 @@ export class AgentLlmExecutionTools implements LlmExecutionTools {
230
230
  * Returns a virtual model name representing the agent behavior.
231
231
  */
232
232
  public get modelName(): string_model_name {
233
- const hash = sha256(hexEncoder.parse(this.options.agentSource)).toString(/* hex */);
233
+ const hash = CryptoJS.SHA256(hexEncoder.parse(this.options.agentSource)).toString(/* hex */);
234
234
  const agentId = hash.substring(0, 10);
235
235
 
236
236
  return (normalizeToKebabCase(this.title) + '-' + agentId) as string_model_name;
@@ -1,4 +1,4 @@
1
- import { SHA256 as sha256 } from 'crypto-js';
1
+ import CryptoJS from 'crypto-js';
2
2
  import type { CallChatModelStreamOptions } from '../../execution/LlmExecutionTools';
3
3
  import type { ChatPromptResult, CommonPromptResult } from '../../execution/PromptResult';
4
4
  import type { Prompt } from '../../types/Prompt';
@@ -29,7 +29,7 @@ type AgentKitCacheState = {
29
29
  * Computes one stable hash from a JSON-serializable value.
30
30
  */
31
31
  function computeJsonHash(value: unknown): string {
32
- return sha256(JSON.stringify(value)).toString();
32
+ return CryptoJS.SHA256(JSON.stringify(value)).toString();
33
33
  }
34
34
 
35
35
  /**
@@ -1,4 +1,4 @@
1
- import { SHA256 as sha256 } from 'crypto-js';
1
+ import CryptoJS from 'crypto-js';
2
2
  import type { CallChatModelStreamOptions } from '../../execution/LlmExecutionTools';
3
3
  import type { ChatPromptResult, CommonPromptResult } from '../../execution/PromptResult';
4
4
  import type { ChatPrompt, Prompt } from '../../types/Prompt';
@@ -12,7 +12,7 @@ import { emitAgentLlmExecutionToolsAssistantPreparationProgress } from './emitAg
12
12
  * Computes one stable hash from a JSON-serializable value.
13
13
  */
14
14
  function computeJsonHash(value: unknown): string {
15
- return sha256(JSON.stringify(value)).toString();
15
+ return CryptoJS.SHA256(JSON.stringify(value)).toString();
16
16
  }
17
17
 
18
18
  /**