@promptbook/cli 0.112.0-115 → 0.112.0-118
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/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatSidebarDefault.tsx +5 -6
- package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +17 -7
- package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +17 -7
- package/apps/agents-server/src/utils/userChat/createImmediateUserChatAnswerModelRequirements.ts +11 -0
- package/apps/agents-server/src/utils/userChat/listUserChats.ts +5 -7
- package/esm/index.es.js +451 -95
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/parseDuration.d.ts +19 -0
- package/esm/src/_packages/components.index.d.ts +2 -0
- package/esm/src/_packages/node.index.d.ts +20 -0
- package/esm/src/book-3.0/BookNodeAgentSource.d.ts +1 -1
- package/esm/src/book-3.0/CliAgent.d.ts +15 -17
- package/esm/src/book-3.0/agentFolderPaths.d.ts +30 -0
- package/esm/src/book-3.0/cliAgentEnv.d.ts +33 -0
- package/esm/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
- package/esm/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
- package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
- package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +2 -18
- package/esm/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/_packages/components.index.ts +2 -0
- package/src/_packages/node.index.ts +20 -0
- package/src/avatars/avatarAnimationScheduler.ts +33 -2
- package/src/avatars/visuals/fractalAvatarVisual.ts +5 -4
- package/src/avatars/visuals/minecraft2AvatarVisual.ts +16 -11
- package/src/avatars/visuals/minecraftAvatarVisual.ts +21 -7
- package/src/avatars/visuals/octopus3d2AvatarVisual.ts +69 -17
- package/src/avatars/visuals/octopus3d3AvatarVisual.ts +81 -18
- package/src/avatars/visuals/octopus3dAvatarVisual.ts +69 -17
- package/src/book-3.0/Book.ts +3 -1
- package/src/book-3.0/BookNodeAgentSource.ts +2 -2
- package/src/book-3.0/CliAgent.ts +87 -71
- package/src/book-3.0/agentFolderPaths.ts +38 -0
- package/src/book-3.0/cliAgentEnv.ts +46 -0
- package/src/book-components/BookEditor/BookEditor.tsx +1 -1
- package/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.tsx +2 -4
- package/src/book-components/BookEditor/BookEditorActionbar.tsx +32 -2
- package/src/book-components/BookEditor/BookEditorBrowserConfig.ts +11 -0
- package/src/book-components/BookEditor/BookEditorForClient.tsx +33 -0
- package/src/book-components/BookEditor/BookEditorMonaco.tsx +1 -1
- package/src/book-components/BookEditor/BookEditorMonacoTokenization.ts +83 -15
- package/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.ts +11 -0
- package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +32 -46
- package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +1 -1
- package/src/book-components/BookEditor/useBookEditorMonacoUploads.ts +1 -1
- package/src/book-components/Chat/utils/renderMarkdown.ts +3 -2
- package/src/cli/cli-commands/agent-folder/agentProjectPaths.ts +15 -35
- package/src/cli/cli-commands/coder/run.ts +28 -3
- package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +9 -29
- package/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.ts +2 -2
- package/src/commitments/_common/teamInternalAgentAccess.ts +2 -2
- package/src/formats/csv/CsvFormatParser.ts +4 -4
- package/src/formats/csv/utils/csvParse.ts +2 -2
- package/src/llm-providers/agent/AgentLlmExecutionTools.ts +2 -2
- package/src/llm-providers/agent/AgentLlmExecutionToolsAgentKitRunner.ts +2 -2
- package/src/llm-providers/agent/AgentLlmExecutionToolsOpenAiAssistantRunner.ts +2 -2
- package/src/other/templates/getTemplatesPipelineCollection.ts +712 -807
- package/src/scrapers/_common/utils/getScraperIntermediateSource.ts +2 -2
- package/src/scrapers/website/WebsiteScraper.ts +1 -1
- package/src/scrapers/website/utils/createShowdownConverter.ts +2 -2
- package/src/utils/misc/computeHash.ts +2 -2
- package/src/utils/random/$randomToken.ts +2 -2
- package/src/version.ts +2 -2
- package/src/versions.txt +3 -0
- package/umd/index.umd.js +453 -94
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/parseDuration.d.ts +19 -0
- package/umd/src/_packages/components.index.d.ts +2 -0
- package/umd/src/_packages/node.index.d.ts +20 -0
- package/umd/src/book-3.0/BookNodeAgentSource.d.ts +1 -1
- package/umd/src/book-3.0/CliAgent.d.ts +15 -17
- package/umd/src/book-3.0/agentFolderPaths.d.ts +30 -0
- package/umd/src/book-3.0/cliAgentEnv.d.ts +33 -0
- package/umd/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
- package/umd/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
- package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
- package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +2 -18
- package/umd/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
- package/umd/src/version.d.ts +1 -1
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { editor, Position } from 'monaco-editor';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import {
|
|
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
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
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
|
},
|
|
@@ -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 '
|
|
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
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
*
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
normalizePromptRunnerCliOptions,
|
|
12
12
|
PROMPT_RUNNER_DESCRIPTION,
|
|
13
13
|
} from '../common/promptRunnerCliOptions';
|
|
14
|
+
import { parseDuration } from '../../../../scripts/run-codex-prompts/common/parseDuration';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Initializes `coder run` command for Promptbook CLI utilities
|
|
@@ -57,7 +58,17 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
|
|
|
57
58
|
);
|
|
58
59
|
addPromptRunnerExecutionOptions(command);
|
|
59
60
|
command.option('--priority <minimum-priority>', 'Filter prompts by minimum priority level', parseIntOption, 0);
|
|
60
|
-
command.option(
|
|
61
|
+
command.option(
|
|
62
|
+
'--wait [duration]',
|
|
63
|
+
spaceTrim(`
|
|
64
|
+
Wait between prompt rounds.
|
|
65
|
+
Without a value (default): waits for user confirmation before each prompt (interactive mode).
|
|
66
|
+
With a duration like 1h, 30m, 5s: waits that long between prompts to avoid hitting rate limits of the harness.
|
|
67
|
+
`),
|
|
68
|
+
true,
|
|
69
|
+
);
|
|
70
|
+
// Note: --no-wait disables the default interactive wait-for-user behaviour
|
|
71
|
+
command.option('--no-wait', 'Skip all waiting between prompts and run non-interactively');
|
|
61
72
|
command.option(
|
|
62
73
|
'--auto-migrate',
|
|
63
74
|
'Run testing-server database migrations automatically after each successfully processed prompt',
|
|
@@ -76,7 +87,7 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
|
|
|
76
87
|
readonly test?: string | string[];
|
|
77
88
|
readonly preserveLogs: boolean;
|
|
78
89
|
readonly priority: number;
|
|
79
|
-
readonly wait: boolean;
|
|
90
|
+
readonly wait: boolean | string;
|
|
80
91
|
readonly autoMigrate: boolean;
|
|
81
92
|
readonly allowDestructiveAutoMigrate: boolean;
|
|
82
93
|
} & PromptRunnerCliOptions;
|
|
@@ -86,10 +97,24 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
|
|
|
86
97
|
isAgentRequired: !dryRun,
|
|
87
98
|
});
|
|
88
99
|
|
|
100
|
+
// [1] Parse the --wait option:
|
|
101
|
+
// true (default or --wait without value): wait for user confirmation
|
|
102
|
+
// false (--no-wait): no waiting at all
|
|
103
|
+
// string (--wait 1h): wait that long between prompt rounds
|
|
104
|
+
let waitForUser = false;
|
|
105
|
+
let waitBetweenPrompts = 0;
|
|
106
|
+
|
|
107
|
+
if (wait === true) {
|
|
108
|
+
waitForUser = true;
|
|
109
|
+
} else if (typeof wait === 'string' && wait !== '') {
|
|
110
|
+
waitBetweenPrompts = parseDuration(wait);
|
|
111
|
+
}
|
|
112
|
+
|
|
89
113
|
// Convert commander options to RunOptions format
|
|
90
114
|
const runOptions = {
|
|
91
115
|
dryRun,
|
|
92
|
-
waitForUser
|
|
116
|
+
waitForUser,
|
|
117
|
+
waitBetweenPrompts,
|
|
93
118
|
noCommit: runnerOptions.noCommit,
|
|
94
119
|
ignoreGitChanges: runnerOptions.ignoreGitChanges,
|
|
95
120
|
agentName: runnerOptions.agentName,
|
|
@@ -6,41 +6,21 @@ import {
|
|
|
6
6
|
import { spaceTrim } from 'spacetrim';
|
|
7
7
|
import type { ThinkingLevel } from '../coder/ThinkingLevel';
|
|
8
8
|
import { THINKING_LEVEL_VALUES } from '../coder/ThinkingLevel';
|
|
9
|
+
import {
|
|
10
|
+
CLI_AGENT_HARNESS_NAMES,
|
|
11
|
+
PTBK_HARNESS_ENV,
|
|
12
|
+
PTBK_MODEL_ENV,
|
|
13
|
+
PTBK_THINKING_LEVEL_ENV,
|
|
14
|
+
} from '../../../book-3.0/cliAgentEnv';
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
* Runner identifiers supported by Promptbook CLI agent orchestration commands.
|
|
12
|
-
*
|
|
13
|
-
* @private internal utility of `promptbookCli`
|
|
14
|
-
*/
|
|
15
|
-
export const PROMPT_RUNNER_HARNESS_NAMES = [
|
|
16
|
-
'openai-codex',
|
|
17
|
-
'github-copilot',
|
|
18
|
-
'cline',
|
|
19
|
-
'claude-code',
|
|
20
|
-
'opencode',
|
|
21
|
-
'gemini',
|
|
22
|
-
] as const;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Environment variable used as the default runner identifier when `--harness` is omitted.
|
|
26
|
-
*
|
|
27
|
-
* @private internal utility of `promptbookCli`
|
|
28
|
-
*/
|
|
29
|
-
export const PTBK_HARNESS_ENV = 'PTBK_HARNESS';
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Environment variable used as the default runner model when `--model` is omitted.
|
|
33
|
-
*
|
|
34
|
-
* @private internal utility of `promptbookCli`
|
|
35
|
-
*/
|
|
36
|
-
export const PTBK_MODEL_ENV = 'PTBK_MODEL';
|
|
16
|
+
export { PTBK_HARNESS_ENV, PTBK_MODEL_ENV, PTBK_THINKING_LEVEL_ENV };
|
|
37
17
|
|
|
38
18
|
/**
|
|
39
|
-
*
|
|
19
|
+
* Runner identifiers supported by Promptbook CLI agent orchestration commands.
|
|
40
20
|
*
|
|
41
21
|
* @private internal utility of `promptbookCli`
|
|
42
22
|
*/
|
|
43
|
-
export const
|
|
23
|
+
export const PROMPT_RUNNER_HARNESS_NAMES = CLI_AGENT_HARNESS_NAMES;
|
|
44
24
|
|
|
45
25
|
/**
|
|
46
26
|
* Runner identifier supported by Promptbook CLI agent orchestration commands.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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 =
|
|
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
|
|
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
|
|
47
|
+
return CryptoJS.SHA256(`promptbook-team-agent-access:${secret}`).toString();
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
|
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
|
|
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 =
|
|
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
|
|
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
|
|
32
|
+
return CryptoJS.SHA256(JSON.stringify(value)).toString();
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
|
15
|
+
return CryptoJS.SHA256(JSON.stringify(value)).toString();
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|