@promptbook/cli 0.112.0-104 → 0.112.0-106
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/admin/image-generator-test/ImageAttachmentsEditor.tsx +19 -3
- package/apps/agents-server/src/app/admin/limits/LimitsClient.tsx +11 -12
- package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +34 -2
- package/apps/agents-server/src/app/admin/servers/CreateServerDialog.tsx +6 -1
- package/apps/agents-server/src/app/admin/servers/useCreateServerWizard.ts +13 -1
- package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +11 -2
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +11 -1
- package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +7 -1
- package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatSurface.tsx +11 -1
- package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/route.ts +6 -2
- package/apps/agents-server/src/app/api/images/[filename]/route.ts +6 -2
- package/apps/agents-server/src/app/api/internal/agent-runner-limits/route.ts +51 -0
- package/apps/agents-server/src/app/api/upload/route.ts +48 -12
- package/apps/agents-server/src/app/layout.tsx +13 -0
- package/apps/agents-server/src/components/FileUploadAvailability/FileUploadAvailabilityContext.tsx +50 -0
- package/apps/agents-server/src/components/FileUploadAvailability/FileUploadUnavailableNotice.tsx +45 -0
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +85 -76
- package/apps/agents-server/src/components/NewAgentDialog/NewAgentDialog.tsx +7 -3
- package/apps/agents-server/src/components/NewAgentDialog/NewAgentWizardKnowledgeStep.tsx +6 -0
- package/apps/agents-server/src/components/NewAgentDialog/useNewAgentWizardKnowledgeState.ts +8 -1
- package/apps/agents-server/src/constants/serverLimits.ts +22 -2
- package/apps/agents-server/src/database/seedDefaultAgents.ts +218 -0
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +72 -8
- package/apps/agents-server/src/utils/defaultAgents/loadDefaultAgentBooks.ts +103 -0
- package/apps/agents-server/src/utils/knowledge/createInlineKnowledgeSourceUploader.ts +24 -5
- package/apps/agents-server/src/utils/serverLimits.ts +26 -1
- package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerDefaultAgents.ts +1 -85
- package/apps/agents-server/src/utils/shareTargetPayloads.ts +20 -2
- package/apps/agents-server/src/utils/upload/fileUploadAvailability.ts +91 -0
- package/apps/agents-server/src/utils/upload/uploadFileToServer.ts +46 -2
- package/esm/apps/agents-server/src/constants/federatedAgentImport.d.ts +42 -0
- package/esm/apps/agents-server/src/constants/serverLimits.d.ts +207 -0
- package/esm/apps/agents-server/src/constants/toolUsageLimits.d.ts +55 -0
- package/esm/index.es.js +602 -39
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-agent-messages/main/AgentMessageFailureTracker.d.ts +27 -0
- package/esm/scripts/run-agent-messages/main/handleAgentWatchError.d.ts +4 -0
- package/esm/scripts/run-agent-messages/main/runAgentMessages.d.ts +1 -0
- package/esm/scripts/run-agent-messages/messages/moveAgentMessageToFailed.d.ts +17 -0
- package/esm/src/book-components/BookEditor/BookEditor.d.ts +5 -4
- package/esm/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
- package/esm/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
- package/esm/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
- package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +6 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/avatars/visuals/octopus3d3AvatarVisual.ts +28 -29
- package/src/book-components/BookEditor/BookEditor.tsx +10 -7
- package/src/book-components/BookEditor/BookEditorMonaco.tsx +3 -1
- package/src/book-components/BookEditor/BookEditorTheme.ts +32 -0
- package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +15 -15
- package/src/book-components/BookEditor/useBookEditorMonacoLifecycle.ts +1 -5
- package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +2 -1
- package/src/cli/cli-commands/agent-folder/agentProjectPaths.ts +7 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer.ts +109 -9
- package/src/cli/cli-commands/agents-server/startAgentsServer.ts +132 -4
- package/src/other/templates/getTemplatesPipelineCollection.ts +874 -760
- package/src/version.ts +2 -2
- package/src/versions.txt +2 -0
- package/umd/apps/agents-server/src/constants/federatedAgentImport.d.ts +42 -0
- package/umd/apps/agents-server/src/constants/serverLimits.d.ts +207 -0
- package/umd/apps/agents-server/src/constants/toolUsageLimits.d.ts +55 -0
- package/umd/index.umd.js +602 -39
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-agent-messages/main/AgentMessageFailureTracker.d.ts +27 -0
- package/umd/scripts/run-agent-messages/main/handleAgentWatchError.d.ts +4 -0
- package/umd/scripts/run-agent-messages/main/runAgentMessages.d.ts +1 -0
- package/umd/scripts/run-agent-messages/messages/moveAgentMessageToFailed.d.ts +17 -0
- package/umd/src/book-components/BookEditor/BookEditor.d.ts +5 -4
- package/umd/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
- package/umd/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
- package/umd/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
- package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +6 -0
- package/umd/src/version.d.ts +1 -1
- package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddress.test.ts.todo +0 -108
- package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddresses.test.ts.todo +0 -117
- package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddress.test.ts.todo +0 -119
- package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddresses.test.ts.todo +0 -74
- package/apps/agents-server/src/utils/defaultAgents/defaultAgents.ts +0 -168
- package/apps/agents-server/src/utils/defaultAgents/installDefaultAgents.ts +0 -139
- package/apps/agents-server/tests/e2e/authentication-and-navigation.spec.ts.todo +0 -178
- package/src/_packages/browser.index.ts +0 -31
- package/src/_packages/browser.readme.md +0 -43
- package/src/book-2.0/agent-source/parseAgentSourceWithCommitments.test.ts.todo +0 -265
- package/src/book-components/BookEditor/BookEditorMonaco.test.tsx.todo +0 -115
- package/src/book-components/Chat/utils/renderMarkdown.test.ts.tmp +0 -199
- package/src/collection/agent-collection/constructors/agent-collection-in-directory/AgentCollectionInDirectory.test.ts.todo +0 -131
- package/src/commands/_common/parseCommand.test.ts.todo +0 -48
- package/src/commitments/META_LINK/META_LINK.test.ts.todo +0 -75
- package/src/conversion/validation/pipelineStringToJson-errors.test.ts.todo +0 -33
- package/src/dialogs/simple-prompt/SimplePromptInterfaceTools.ts +0 -51
- package/src/executables/browsers/locateSafari.test.ts.tmp +0 -15
- package/src/execution/PromptbookFetch.test-type.ts +0 -14
- package/src/execution/createPipelineExecutor/00-createPipelineExecutor.test.ts.todo +0 -0
- package/src/execution/execution-report/executionReportJsonToString.test.ts.todo +0 -83
- package/src/execution/utils/usageToHuman.test.ts.todo +0 -80
- package/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.ts +0 -76
- package/src/llm-providers/_common/utils/assertUniqueModels.ts +0 -27
- package/src/llm-providers/_multiple/playground/playground.ts +0 -141
- package/src/llm-providers/_multiple/playground/tsconfig.json +0 -19
- package/src/llm-providers/agent/playground/playground.ts +0 -190
- package/src/llm-providers/agent/playground/tsconfig.json +0 -19
- package/src/llm-providers/anthropic-claude/playground/playground.ts +0 -99
- package/src/llm-providers/anthropic-claude/playground/tsconfig.json +0 -19
- package/src/llm-providers/azure-openai/playground/playground.ts +0 -101
- package/src/llm-providers/azure-openai/playground/tsconfig.json +0 -19
- package/src/llm-providers/ollama/playground/playground.ts +0 -120
- package/src/llm-providers/ollama/playground/tsconfig.json +0 -19
- package/src/llm-providers/openai/playground/playground.ts +0 -406
- package/src/llm-providers/openai/playground/tsconfig.json +0 -19
- package/src/llm-providers/remote/playground/playground.ts +0 -144
- package/src/llm-providers/remote/playground/tsconfig.json +0 -19
- package/src/llm-providers/vercel/playground/playground.ts +0 -133
- package/src/llm-providers/vercel/playground/tsconfig.json +0 -19
- package/src/personas/preparePersona.test.ts.todo +0 -126
- package/src/playground/backup/_playground-boilerplate.ts.txt +0 -37
- package/src/playground/backup/playground-agent-os.txt +0 -62
- package/src/playground/backup/playground-brj-app.ts.txt +0 -302
- package/src/playground/backup/playground-browser-playwright.txt +0 -110
- package/src/playground/backup/playground-claude-mcp.txt +0 -43
- package/src/playground/backup/playground-document-conversion.txt +0 -84
- package/src/playground/backup/playground-glob.ts.txt +0 -42
- package/src/playground/backup/playground-mcp-server.txt +0 -1
- package/src/playground/backup/playground-openai-agent-kit.txt +0 -73
- package/src/playground/backup/playground-openai-function-calling.txt +0 -131
- package/src/playground/backup/playground-openai-streaming.ts.txt +0 -68
- package/src/playground/backup/playground-scrape-knowledge.txt +0 -65
- package/src/playground/backup/playground-scraperFetch.ts.txt +0 -44
- package/src/playground/backup/playground-using-openai-compatible-route-on-agents-server.ts.txt +0 -49
- package/src/playground/backup/playground-write-pavolhejny-bio.txt +0 -120
- package/src/playground/permanent/_boilerplate.ts +0 -54
- package/src/playground/permanent/agent-with-browser-playground.ts +0 -92
- package/src/playground/permanent/error-handling-playground.ts +0 -103
- package/src/playground/playground.ts +0 -36
- package/src/playground/tsconfig.json +0 -19
- package/src/scrapers/_boilerplate/BoilerplateScraper.test.ts.todo +0 -73
- package/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.ts +0 -79
- package/src/scrapers/_boilerplate/playground/tsconfig.json +0 -19
- package/src/scrapers/_common/utils/files/blobToDataurl.test.ts.todo +0 -17
- package/src/scrapers/_common/utils/files/dataurlToBlob.test.ts.todo +0 -52
- package/src/scrapers/_common/utils/files/isValidDataurl.test.ts.todo +0 -42
- package/src/scrapers/_common/utils/files/shorten.test.ts.todo +0 -13
- package/src/scrapers/document/playground/document-scraper-playground.ts +0 -80
- package/src/scrapers/document/playground/tsconfig.json +0 -19
- package/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.ts +0 -80
- package/src/scrapers/document-legacy/playground/tsconfig.json +0 -19
- package/src/scrapers/markdown/playground/markdown-scraper-playground.ts +0 -74
- package/src/scrapers/markdown/playground/tsconfig.json +0 -19
- package/src/scrapers/markitdown/MarkitdownScraper.test.ts.todo +0 -132
- package/src/scrapers/markitdown/playground/markitdown-scraper-playground.ts +0 -91
- package/src/scrapers/markitdown/playground/tsconfig.json +0 -19
- package/src/scrapers/pdf/PdfScraper.test.ts.todo +0 -52
- package/src/scrapers/pdf/playground/pdf-scraper-playground.ts +0 -75
- package/src/scrapers/pdf/playground/tsconfig.json +0 -19
- package/src/scrapers/website/playground/tsconfig.json +0 -19
- package/src/scrapers/website/playground/website-scraper-playground.ts +0 -82
- package/src/storage/_common/PromptbookStorage.test-type.ts +0 -14
- package/src/storage/local-storage/getIndexedDbStorage.ts +0 -36
- package/src/storage/local-storage/getLocalStorage.ts +0 -33
- package/src/storage/local-storage/getSessionStorage.ts +0 -33
- package/src/storage/local-storage/utils/IndexedDbStorageOptions.ts +0 -16
- package/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.ts +0 -58
- package/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.ts +0 -45
- package/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.test.ts.todo +0 -35
- package/src/transpilers/openai-sdk/playground/playground.ts +0 -85
- package/src/transpilers/openai-sdk/playground/tmp/chatbot-openaisdk-1.js +0 -194
- package/src/transpilers/openai-sdk/playground/tmp/package.json +0 -3
- package/src/transpilers/openai-sdk/playground/tsconfig.json +0 -18
- package/src/utils/editable/utils/findUsableParameters.test.ts.todo +0 -43
- package/src/utils/editable/utils/stringifyPipelineJson.test.ts.todo +0 -38
- package/src/utils/markdown/prettifyMarkdown.test.ts.tmp +0 -42
- package/src/utils/serialization/serializeToPromptbookJavascript.test.ts.todo +0 -116
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { EnvironmentMismatchError } from '../../errors/EnvironmentMismatchError';
|
|
2
|
-
import { $isRunningInBrowser } from '../../utils/environment/$isRunningInBrowser';
|
|
3
|
-
import type { chococake } from '../../utils/organization/really_any';
|
|
4
|
-
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
5
|
-
import { makePromptbookStorageFromWebStorage } from './utils/makePromptbookStorageFromWebStorage';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Cache storage
|
|
9
|
-
*
|
|
10
|
-
* @private internal cache for `getLocalStorage`
|
|
11
|
-
*/
|
|
12
|
-
let promptbookLocalStorage: null | PromptbookStorage<chococake> = null;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Gets wrapper around `localStorage` object which can be used as `PromptbookStorage`
|
|
16
|
-
*
|
|
17
|
-
* @public exported from `@promptbook/browser`
|
|
18
|
-
*/
|
|
19
|
-
export function getLocalStorage<TItem>(): PromptbookStorage<TItem> {
|
|
20
|
-
if (!$isRunningInBrowser()) {
|
|
21
|
-
throw new EnvironmentMismatchError(`You can get localStorage works only in browser environment`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (promptbookLocalStorage) {
|
|
25
|
-
return promptbookLocalStorage;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
promptbookLocalStorage = makePromptbookStorageFromWebStorage<TItem>(localStorage);
|
|
29
|
-
|
|
30
|
-
return promptbookLocalStorage;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Note: [🔵] Code for browser storage helper [getLocalStorage](src/storage/local-storage/getLocalStorage.ts) should never be published outside of `@promptbook/browser`
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { EnvironmentMismatchError } from '../../errors/EnvironmentMismatchError';
|
|
2
|
-
import { $isRunningInBrowser } from '../../utils/environment/$isRunningInBrowser';
|
|
3
|
-
import type { chococake } from '../../utils/organization/really_any';
|
|
4
|
-
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
5
|
-
import { makePromptbookStorageFromWebStorage } from './utils/makePromptbookStorageFromWebStorage';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Cache storage
|
|
9
|
-
*
|
|
10
|
-
* @private internal cache for `getSessionStorage`
|
|
11
|
-
*/
|
|
12
|
-
let promptbookSessionStorage: null | PromptbookStorage<chococake> = null;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Gets wrapper around `sessionStorage` object which can be used as `PromptbookStorage`
|
|
16
|
-
*
|
|
17
|
-
* @public exported from `@promptbook/browser`
|
|
18
|
-
*/
|
|
19
|
-
export function getSessionStorage<TItem>(): PromptbookStorage<TItem> {
|
|
20
|
-
if (!$isRunningInBrowser()) {
|
|
21
|
-
throw new EnvironmentMismatchError(`You can get sessionStorage works only in browser environment`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (promptbookSessionStorage) {
|
|
25
|
-
return promptbookSessionStorage as PromptbookStorage<TItem>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
promptbookSessionStorage = makePromptbookStorageFromWebStorage<TItem>(sessionStorage);
|
|
29
|
-
|
|
30
|
-
return promptbookSessionStorage as PromptbookStorage<TItem>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Note: [🔵] Code for browser storage helper [getSessionStorage](src/storage/local-storage/getSessionStorage.ts) should never be published outside of `@promptbook/browser`
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { string_name } from '../../../types/string_name';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Options for IndexedDB storage
|
|
5
|
-
*/
|
|
6
|
-
export type IndexedDbStorageOptions = {
|
|
7
|
-
/**
|
|
8
|
-
* Name of the database
|
|
9
|
-
*/
|
|
10
|
-
databaseName: string_name;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Name of the object store (table) in the database
|
|
14
|
-
*/
|
|
15
|
-
storeName: string_name;
|
|
16
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { PromptbookStorage } from '../../_common/PromptbookStorage';
|
|
2
|
-
import type { IndexedDbStorageOptions } from './IndexedDbStorageOptions';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Creates a PromptbookStorage backed by IndexedDB.
|
|
6
|
-
* Uses a single object store named 'promptbook'.
|
|
7
|
-
*
|
|
8
|
-
* @private for `getIndexedDbStorage`
|
|
9
|
-
*/
|
|
10
|
-
export function makePromptbookStorageFromIndexedDb<TValue>(
|
|
11
|
-
options: IndexedDbStorageOptions,
|
|
12
|
-
): PromptbookStorage<TValue> {
|
|
13
|
-
const { databaseName, storeName } = options;
|
|
14
|
-
|
|
15
|
-
function getDatabase(): Promise<IDBDatabase> {
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
const request = indexedDB.open(databaseName, 1);
|
|
18
|
-
request.onupgradeneeded = () => {
|
|
19
|
-
request.result.createObjectStore(storeName);
|
|
20
|
-
};
|
|
21
|
-
request.onsuccess = () => resolve(request.result);
|
|
22
|
-
request.onerror = () => reject(request.error);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
async getItem(key: string): Promise<TValue | null> {
|
|
28
|
-
const database = await getDatabase();
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
const transaction = database.transaction(storeName, 'readonly');
|
|
31
|
-
const objectStore = transaction.objectStore(storeName);
|
|
32
|
-
const request = objectStore.get(key);
|
|
33
|
-
request.onsuccess = () => resolve(request.result ?? null);
|
|
34
|
-
request.onerror = () => reject(request.error);
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
async setItem(key: string, value: TValue): Promise<void> {
|
|
38
|
-
const database = await getDatabase();
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
const transaction = database.transaction(storeName, 'readwrite');
|
|
41
|
-
const objectStore = transaction.objectStore(storeName);
|
|
42
|
-
const request = objectStore.put(value, key);
|
|
43
|
-
request.onsuccess = () => resolve();
|
|
44
|
-
request.onerror = () => reject(request.error);
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
async removeItem(key: string): Promise<void> {
|
|
48
|
-
const database = await getDatabase();
|
|
49
|
-
return new Promise((resolve, reject) => {
|
|
50
|
-
const transaction = database.transaction(storeName, 'readwrite');
|
|
51
|
-
const objectStore = transaction.objectStore(storeName);
|
|
52
|
-
const request = objectStore.delete(key);
|
|
53
|
-
request.onsuccess = () => resolve();
|
|
54
|
-
request.onerror = () => reject(request.error);
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { UnexpectedError } from '../../../errors/UnexpectedError';
|
|
2
|
-
import { jsonParse } from '../../../formats/json/utils/jsonParse';
|
|
3
|
-
import { stringifyPipelineJson } from '../../../utils/editable/utils/stringifyPipelineJson';
|
|
4
|
-
import { isSerializableAsJson } from '../../../utils/serialization/isSerializableAsJson';
|
|
5
|
-
import type { PromptbookStorage } from '../../_common/PromptbookStorage';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Creates a Promptbook storage interface from a web storage object.
|
|
9
|
-
* Facilitates using Web Storage (localStorage/sessionStorage) as a storage backend.
|
|
10
|
-
*
|
|
11
|
-
* @private for `getLocalStorage` and `getSessionStorage`
|
|
12
|
-
*/
|
|
13
|
-
export function makePromptbookStorageFromWebStorage<TValue>(webStorage: Storage): PromptbookStorage<TValue> {
|
|
14
|
-
return {
|
|
15
|
-
getItem(key: string): TValue | null {
|
|
16
|
-
const stringValue = webStorage.getItem(key);
|
|
17
|
-
|
|
18
|
-
if (stringValue === null) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const value = jsonParse(stringValue) as TValue;
|
|
23
|
-
|
|
24
|
-
// TODO: [🌗]
|
|
25
|
-
|
|
26
|
-
return value;
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
setItem(key: string, value: TValue): void {
|
|
30
|
-
if (!isSerializableAsJson(value)) {
|
|
31
|
-
throw new UnexpectedError(`The "${key}" you want to store in web storage is not serializable as JSON`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const stringValue = stringifyPipelineJson(value);
|
|
35
|
-
webStorage.setItem(key, stringValue);
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
removeItem(key: string): void {
|
|
39
|
-
webStorage.removeItem(key);
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// TODO: [🧠] Should this be named `makePromptbookStorageFromWebStorage` vs `createPromptbookStorageFromWebStorage`
|
|
45
|
-
// TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
|
package/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.test.ts.todo
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { describe, it } from '@jest/globals';
|
|
2
|
-
import { spaceTrim } from 'spacetrim';
|
|
3
|
-
import { book } from '../../pipeline/book-notation';
|
|
4
|
-
import { FormattedBookInMarkdownTranspiler } from './FormattedBookInMarkdownTranspiler';
|
|
5
|
-
|
|
6
|
-
describe('FormattedBookInMarkdownTranspiler', () => {
|
|
7
|
-
it('transpiles a book with commitments and parameters', async () => {
|
|
8
|
-
const agentSource = book`
|
|
9
|
-
Poe
|
|
10
|
-
|
|
11
|
-
PERSONA You are funny and creative AI assistant
|
|
12
|
-
RULE You write poems as answers
|
|
13
|
-
META COLOR #ff0000
|
|
14
|
-
KNOWLEDGE {ptbk.io}
|
|
15
|
-
ACTION @Search
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
const markdown = await FormattedBookInMarkdownTranspiler.transpileBook(agentSource, {}, { isVerbose: true });
|
|
19
|
-
|
|
20
|
-
expect(markdown).toBe(
|
|
21
|
-
spaceTrim(`
|
|
22
|
-
**Poe**<br/>
|
|
23
|
-
<br/>
|
|
24
|
-
**PERSONA** You are funny and creative AI assistant<br/>
|
|
25
|
-
**RULE** You write poems as answers<br/>
|
|
26
|
-
**META** COLOR #ff0000<br/>
|
|
27
|
-
**KNOWLEDGE** *{ptbk.io}*<br/>
|
|
28
|
-
**ACTION** *@Search*<br/>
|
|
29
|
-
`),
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
// Note: Test that assertions in async function really checks something:
|
|
33
|
-
// expect(true).toBe(false);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ts-node
|
|
2
|
-
|
|
3
|
-
// Note: [❌] Turning off some global checks for playground file:
|
|
4
|
-
// spell-checker: disable
|
|
5
|
-
/* eslint-disable */
|
|
6
|
-
|
|
7
|
-
import * as dotenv from 'dotenv';
|
|
8
|
-
|
|
9
|
-
dotenv.config({ path: '.env' });
|
|
10
|
-
|
|
11
|
-
import colors from 'colors'; // <- TODO: [🔶] Make system to put color and style to both node and browser
|
|
12
|
-
import { writeFile } from 'fs/promises';
|
|
13
|
-
import { join } from 'path';
|
|
14
|
-
import { $provideLlmToolsForTestingAndScriptsAndPlayground } from '../../../llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground';
|
|
15
|
-
import { book } from '../../../pipeline/book-notation';
|
|
16
|
-
import { $execCommand } from '../../../utils/execCommand/$execCommand';
|
|
17
|
-
import { OpenAiSdkTranspiler } from '../OpenAiSdkTranspiler';
|
|
18
|
-
|
|
19
|
-
playground()
|
|
20
|
-
.catch((error) => {
|
|
21
|
-
console.error(colors.bgRed(error.name || 'NamelessError'));
|
|
22
|
-
console.error(error);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
})
|
|
25
|
-
.then(() => {
|
|
26
|
-
process.exit(0);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Handles playground.
|
|
31
|
-
*/
|
|
32
|
-
async function playground() {
|
|
33
|
-
console.info(`🧸 Transpile book -> OpenAiSdk`);
|
|
34
|
-
|
|
35
|
-
// Do here stuff you want to test
|
|
36
|
-
//========================================>
|
|
37
|
-
|
|
38
|
-
// Note: [🎠] Do here the stuff and add in `terminals.json`
|
|
39
|
-
|
|
40
|
-
const agentSource = book`
|
|
41
|
-
|
|
42
|
-
Marigold
|
|
43
|
-
|
|
44
|
-
PERSONA You are writing stories about Witcher
|
|
45
|
-
RULE Do not talk about our world, only about the Witcher universe
|
|
46
|
-
|
|
47
|
-
KNOWLEDGE {Geralt of Rivia}
|
|
48
|
-
Geralt of Rivia is a witcher, a monster hunter for hire, known for his white hair and cat-like eyes.
|
|
49
|
-
He possesses superhuman abilities due to mutations he underwent during the Trial of the Grasses.
|
|
50
|
-
Geralt is skilled in swordsmanship, alchemy, and magic signs.
|
|
51
|
-
He is often accompanied by his horse, Roach, and has a complex relationship with {Yennefer of Vengerberg},
|
|
52
|
-
a powerful sorceress, and {Ciri}, his adopted daughter with a destiny intertwined with his own.
|
|
53
|
-
His secret word is "Apple".
|
|
54
|
-
|
|
55
|
-
KNOWLEDGE {Yennefer of Vengerberg}
|
|
56
|
-
Yennefer of Vengerberg is a formidable sorceress known for her beauty, intelligence, and temper.
|
|
57
|
-
She has a complicated past, having been born with a hunchback and later transformed through magic.
|
|
58
|
-
Yennefer is deeply connected to Geralt of Rivia, with whom she shares a tumultuous romantic relationship.
|
|
59
|
-
She is also a mother figure to {Ciri}, whom she trains in the ways of magic.
|
|
60
|
-
Her secret word is "Banana".
|
|
61
|
-
|
|
62
|
-
KNOWLEDGE {Ciri}
|
|
63
|
-
Ciri, also known as {Cirilla Fiona Elen Riannon}, is a young woman with a mysterious past and a powerful destiny.
|
|
64
|
-
She is the daughter of {Poviss}, the ruler of the kingdom of Cintra, and possesses the Elder Blood, which grants her extraordinary abilities.
|
|
65
|
-
Ciri is a skilled fighter and has been trained in the ways of the sword by Geralt of Rivia.
|
|
66
|
-
Her destiny is intertwined with that of Geralt and Yennefer, as they both seek to protect her from those who would exploit her powers.
|
|
67
|
-
Her secret word is "Cherry".
|
|
68
|
-
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
const llm = await $provideLlmToolsForTestingAndScriptsAndPlayground();
|
|
72
|
-
const code = await OpenAiSdkTranspiler.transpileBook(agentSource, { llm }, { isVerbose: true });
|
|
73
|
-
const filePath = join(__dirname, 'tmp', 'chatbot.js');
|
|
74
|
-
|
|
75
|
-
await writeFile(filePath, code, 'utf-8');
|
|
76
|
-
const command = `node ${filePath.split('\\').join('/')}`;
|
|
77
|
-
console.info(colors.bgWhite(command));
|
|
78
|
-
|
|
79
|
-
// TODO: !!! Make this work
|
|
80
|
-
await $execCommand(command);
|
|
81
|
-
|
|
82
|
-
//========================================/
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Note: [⚫] Code for playground [openai-sdk playground](src/transpilers/openai-sdk/playground/playground.ts) should never be published in any package
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import * as dotenv from 'dotenv';
|
|
4
|
-
dotenv.config({ path: '.env' });
|
|
5
|
-
|
|
6
|
-
import OpenAI from 'openai';
|
|
7
|
-
import readline from 'readline';
|
|
8
|
-
import { spaceTrim } from 'spacetrim';
|
|
9
|
-
|
|
10
|
-
// Cache dependencies
|
|
11
|
-
import crypto from 'node:crypto';
|
|
12
|
-
import fs from 'node:fs/promises';
|
|
13
|
-
import path from 'node:path';
|
|
14
|
-
|
|
15
|
-
// ---- CONFIG ----
|
|
16
|
-
const client = new OpenAI({
|
|
17
|
-
apiKey: process.env.OPENAI_API_KEY,
|
|
18
|
-
});
|
|
19
|
-
// Embedding cache config
|
|
20
|
-
const EMBEDDING_MODEL = 'text-embedding-3-small';
|
|
21
|
-
const CACHE_DIR = path.resolve(process.cwd(), '.promptbook', 'embeddings');
|
|
22
|
-
|
|
23
|
-
// ---- KNOWLEDGE ----
|
|
24
|
-
const knowledge = [
|
|
25
|
-
'{Geralt of Rivia}\nGeralt of Rivia is a witcher, a monster hunter for hire, known for his white hair and cat-like eyes.\nHe possesses superhuman abilities due to mutations he underwent during the Trial of the Grasses.\nGeralt is skilled in swordsmanship, alchemy, and magic signs.\nHe is often accompanied by his horse, Roach, and has a complex relationship with {Yennefer of Vengerberg},\na powerful sorceress, and {Ciri}, his adopted daughter with a destiny intertwined with his own. His seacret word is "Apple".',
|
|
26
|
-
'{Yennefer of Vengerberg}\nYennefer of Vengerberg is a formidable sorceress known for her beauty, intelligence, and temper.\nShe has a complicated past, having been born with a hunchback and later transformed through magic.\nYennefer is deeply connected to Geralt of Rivia, with whom she shares a tumultuous romantic relationship.\nShe is also a mother figure to {Ciri}, whom she trains in the ways of magic. Her seacret word is "Banana".',
|
|
27
|
-
'{Ciri}\nCiri, also known as {Cirilla Fiona Elen Riannon}, is a young woman with a mysterious past and a powerful destiny.\nShe is the daughter of {Poviss}, the ruler of the kingdom of Cintra, and possesses the Elder Blood, which grants her extraordinary abilities.\nCiri is a skilled fighter and has been trained in the ways of the sword by Geralt of Rivia.\nHer destiny is intertwined with that of Geralt and Yennefer, as they both seek to protect her from those who would exploit her powers. Her seacret word is "Cherry".',
|
|
28
|
-
];
|
|
29
|
-
// <- TODO: Split into coherent chunks for RAG
|
|
30
|
-
// <- TODO: Fetch URLs and local files
|
|
31
|
-
let knowledgeVectors = [];
|
|
32
|
-
|
|
33
|
-
// TODO: import { computeCosineSimilarity } from '@promptbook/core'
|
|
34
|
-
function cosineSimilarity(vecA, vecB) {
|
|
35
|
-
const dotProduct = vecA.reduce((sum, a, i) => sum + a * vecB[i], 0);
|
|
36
|
-
const magnitudeA = Math.sqrt(vecA.reduce((sum, a) => sum + a * a, 0));
|
|
37
|
-
const magnitudeB = Math.sqrt(vecB.reduce((sum, b) => sum + b * b, 0));
|
|
38
|
-
return dotProduct / (magnitudeA * magnitudeB);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Embedding with disk cache at .promptbook/embeddings/<hash>.json
|
|
42
|
-
async function getEmbedding(text) {
|
|
43
|
-
// Use model + text so cache is model-specific
|
|
44
|
-
const key = `x${EMBEDDING_MODEL}|${text}`;
|
|
45
|
-
const hash = crypto.createHash('sha256').update(key).digest('hex');
|
|
46
|
-
const file = path.join(CACHE_DIR, `${hash}.json`);
|
|
47
|
-
|
|
48
|
-
// Try read from cache
|
|
49
|
-
try {
|
|
50
|
-
const cachedRaw = await fs.readFile(file, 'utf8');
|
|
51
|
-
const cached = JSON.parse(cachedRaw);
|
|
52
|
-
if (cached?.embedding && Array.isArray(cached.embedding)) {
|
|
53
|
-
return cached.embedding;
|
|
54
|
-
}
|
|
55
|
-
} catch {
|
|
56
|
-
// Cache miss or parse error -> compute and write below
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Ensure cache directory exists
|
|
60
|
-
try {
|
|
61
|
-
await fs.mkdir(CACHE_DIR, { recursive: true });
|
|
62
|
-
} catch {
|
|
63
|
-
// Ignore mkdir errors; proceed to fetch
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
console.info(`🧠 Embedding "${text.split(/\r?\n/)[0].slice(0, 20)}..."`);
|
|
67
|
-
|
|
68
|
-
// Fetch from API only when no cache
|
|
69
|
-
const response = await client.embeddings.create({
|
|
70
|
-
model: EMBEDDING_MODEL,
|
|
71
|
-
input: text,
|
|
72
|
-
});
|
|
73
|
-
const embedding = response.data[0].embedding;
|
|
74
|
-
|
|
75
|
-
// Write to cache (best-effort)
|
|
76
|
-
try {
|
|
77
|
-
const payload = {
|
|
78
|
-
model: EMBEDDING_MODEL,
|
|
79
|
-
hash,
|
|
80
|
-
length: text.length,
|
|
81
|
-
// [🚉] Keep only serializable values; large arrays are fine
|
|
82
|
-
embedding,
|
|
83
|
-
};
|
|
84
|
-
// <- TODO: !!! Use Promptbook format<- TODO: !!! [] export from Promptbook as `xxx`
|
|
85
|
-
// <- TODO: !!! Add Promptbook stringify to stringify huuuge emabeddings <- TODO: !!! [] export from Promptbook as `xxx`
|
|
86
|
-
await fs.writeFile(file, JSON.stringify(payload));
|
|
87
|
-
} catch {
|
|
88
|
-
// Ignore write errors
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return embedding;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async function setupKnowledge() {
|
|
95
|
-
if (knowledge.length > 0) {
|
|
96
|
-
console.log('🧠 Preparing knowledge base...');
|
|
97
|
-
knowledgeVectors = await Promise.all(
|
|
98
|
-
knowledge.map(async (text) => ({
|
|
99
|
-
text,
|
|
100
|
-
embedding: await getEmbedding(text),
|
|
101
|
-
})),
|
|
102
|
-
);
|
|
103
|
-
console.log('🧠 Knowledge base prepared.');
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// ---- CLI SETUP ----
|
|
108
|
-
const rl = readline.createInterface({
|
|
109
|
-
input: process.stdin,
|
|
110
|
-
output: process.stdout,
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const chatHistory = [
|
|
114
|
-
{
|
|
115
|
-
role: 'system',
|
|
116
|
-
content: spaceTrim(`
|
|
117
|
-
You are Marigold
|
|
118
|
-
You are writing stories about Witcher
|
|
119
|
-
|
|
120
|
-
Rule: Do not talk about our world, only about the Witcher universe
|
|
121
|
-
`),
|
|
122
|
-
},
|
|
123
|
-
];
|
|
124
|
-
|
|
125
|
-
async function ask(question) {
|
|
126
|
-
let context = '';
|
|
127
|
-
if (knowledgeVectors.length > 0) {
|
|
128
|
-
const questionEmbedding = await getEmbedding(question);
|
|
129
|
-
|
|
130
|
-
// Find most relevant knowledge entries
|
|
131
|
-
const similarities = knowledgeVectors.map((item) => ({
|
|
132
|
-
text: item.text,
|
|
133
|
-
similarity: cosineSimilarity(questionEmbedding, item.embedding),
|
|
134
|
-
}));
|
|
135
|
-
|
|
136
|
-
// Sort by similarity and take top 3
|
|
137
|
-
similarities.sort((a, b) => b.similarity - a.similarity);
|
|
138
|
-
context = similarities
|
|
139
|
-
.slice(0, 3)
|
|
140
|
-
.map((item) => item.text)
|
|
141
|
-
.join('\n\n');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const userMessage = spaceTrim(`
|
|
145
|
-
Here is some additional context to help you answer the question:
|
|
146
|
-
${context}
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
My question is:
|
|
151
|
-
${question}
|
|
152
|
-
`);
|
|
153
|
-
|
|
154
|
-
chatHistory.push({ role: 'user', content: userMessage });
|
|
155
|
-
|
|
156
|
-
const response = await client.chat.completions.create({
|
|
157
|
-
model: 'gpt-4o',
|
|
158
|
-
messages: chatHistory,
|
|
159
|
-
temperature: 0.7,
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
const answer = response.choices[0].message.content;
|
|
163
|
-
console.log('\n🧠 Marigold:', answer, '\n');
|
|
164
|
-
|
|
165
|
-
chatHistory.push({ role: 'assistant', content: answer });
|
|
166
|
-
promptUser();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function promptUser() {
|
|
170
|
-
rl.question('💬 You: ', (input) => {
|
|
171
|
-
if (input.trim().toLowerCase() === 'exit') {
|
|
172
|
-
console.log('👋 Bye!');
|
|
173
|
-
rl.close();
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
ask(input);
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
(async () => {
|
|
181
|
-
await setupKnowledge();
|
|
182
|
-
console.log("🤖 Chat with Marigold (type 'exit' to quit)\n");
|
|
183
|
-
promptUser();
|
|
184
|
-
})();
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* TODO: !!! Use entire file structure as transopiler
|
|
188
|
-
* TODO: !!! Chatting should work through LlmExecutionTools, exported code should have LlmExecutionTools compatible export
|
|
189
|
-
* TODO: Use proper JSDoc
|
|
190
|
-
* TODO: Knowledge pieces are identified by name <- TODO: !!! [] export from Promptbook as `xxx`
|
|
191
|
-
* TODO: Add browser capabilities
|
|
192
|
-
* TODO: Transfer to `OpenAiSdkTranspiler` transpiler
|
|
193
|
-
* TODO: Make `OpenAiAssistantTranspiler`
|
|
194
|
-
*/
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"downlevelIteration": true,
|
|
6
|
-
"allowJs": true,
|
|
7
|
-
"forceConsistentCasingInFileNames": true,
|
|
8
|
-
"noImplicitReturns": true,
|
|
9
|
-
"noImplicitThis": true,
|
|
10
|
-
"noImplicitAny": true,
|
|
11
|
-
"strictNullChecks": true,
|
|
12
|
-
"experimentalDecorators": true,
|
|
13
|
-
"noUnusedLocals": false,
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"esModuleInterop": true
|
|
16
|
-
},
|
|
17
|
-
"exclude": ["node_modules"]
|
|
18
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// TODO: [👜] This probably does not make sence because in TaskJson already are listed dependencies
|
|
3
|
-
|
|
4
|
-
import { describe, expect, it } from '@jest/globals';
|
|
5
|
-
import { importPipeline } from '../validation/_importPipeline';
|
|
6
|
-
import { PipelineJson } from '../../types/PipelineJson/PipelineJson';
|
|
7
|
-
import { TaskJson } from '../../types/PipelineJson/TaskJson';
|
|
8
|
-
import { TaskParameterJson } from '../../types/PipelineJson/TaskParameterJson';
|
|
9
|
-
|
|
10
|
-
describe('how findUsableParameters works', () => {
|
|
11
|
-
it('should find no usable parameter', () => {
|
|
12
|
-
const promptbook = importPipeline(`50-advanced.bookc`);
|
|
13
|
-
const task = promptbook.tasks[0];
|
|
14
|
-
|
|
15
|
-
expect(findUsableParameters({ promptbook, task })).toBe([]);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
type FindUsableParametersOptions = {
|
|
20
|
-
/**
|
|
21
|
-
* Promptbook to search for usable parameters
|
|
22
|
-
*/
|
|
23
|
-
promptbook: PipelineJson;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Task that searches for potentially usable parameters
|
|
27
|
-
*/
|
|
28
|
-
task: TaskJson;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Function `findUsableParameters` will find all usable parameters for given task
|
|
33
|
-
* In other words, it will find all parameters that are not used in the task itseld and all its dependencies
|
|
34
|
-
*
|
|
35
|
-
* @public exported from `@promptbook/editable`
|
|
36
|
-
*/
|
|
37
|
-
export function findUsableParameters(options: FindUsableParametersOptions): ReadonlyArray<TaskParameterJson> {
|
|
38
|
-
const { promptbook, task } = options;
|
|
39
|
-
|
|
40
|
-
const usableParameters: ReadonlyArray<TaskParameterJson> = [];
|
|
41
|
-
|
|
42
|
-
return usableParameters;
|
|
43
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from '@jest/globals';
|
|
2
|
-
import { spaceTrim } from 'spacetrim';
|
|
3
|
-
import { importPipelineJson, importPipelineJsonAsString } from '../../../conversion/validation/_importPipeline';
|
|
4
|
-
import { stringifyPipelineJson } from './stringifyPipelineJson';
|
|
5
|
-
|
|
6
|
-
// TODO: [👩🏽🤝🧑🏾]
|
|
7
|
-
|
|
8
|
-
describe('how stringifyPipelineJson works', () => {
|
|
9
|
-
it('should work with markdown-knowledge.bookc', () =>
|
|
10
|
-
expect(
|
|
11
|
-
stringifyPipelineJson({
|
|
12
|
-
index: [
|
|
13
|
-
-0.028091298, 0.0022211724, -0.0046637366, -0.007970089, -0.008006383, -0.01856784, -0.002780095,
|
|
14
|
-
-0.03638077, -0.077291, -0.036090422, 0.017566135, 0.015330445, 0.018524287, 0.0038072057,
|
|
15
|
-
-0.007875726, 0.036467876, -0.014967509, 0.008151558, 0.028236473, -0.009349249, 0.018988848,
|
|
16
|
-
-0.035742003, 0.028033229, 0.024403863, -0.021689096, 0.010982464, 0.03661305, 0.030022122,
|
|
17
|
-
-0.017493548, 0.00173393, 0.037455067, -0.02906397, 0.030109227, -0.021340678, -0.01782745,
|
|
18
|
-
-0.0012376141, -0.019046918, 0.012485022, 0.019366302, -0.0072768806, -0.023286017, 0.00093456195,
|
|
19
|
-
0.04941746, 0.06132178,
|
|
20
|
-
],
|
|
21
|
-
}),
|
|
22
|
-
).toBe(
|
|
23
|
-
spaceTrim(
|
|
24
|
-
`
|
|
25
|
-
{
|
|
26
|
-
"index": [
|
|
27
|
-
-0.028091298, 0.0022211724, -0.0046637366, -0.007970089, -0.008006383, -0.01856784, -0.002780095, -0.03638077, -0.077291, -0.036090422, 0.017566135, 0.015330445, 0.018524287, 0.0038072057, -0.007875726, 0.036467876, -0.014967509, 0.008151558, 0.028236473, -0.009349249, 0.018988848, -0.035742003, 0.028033229, 0.024403863, -0.021689096, 0.010982464, 0.03661305, 0.030022122, -0.017493548, 0.00173393, 0.037455067, -0.02906397, 0.030109227, -0.021340678, -0.01782745, -0.0012376141, -0.019046918, 0.012485022, 0.019366302, -0.0072768806, -0.023286017, 0.00093456195, 0.04941746, 0.06132178
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
`,
|
|
31
|
-
) + '\n',
|
|
32
|
-
));
|
|
33
|
-
|
|
34
|
-
it('should work with markdown-knowledge.bookc', () =>
|
|
35
|
-
expect(stringifyPipelineJson(await importPipelineJson('26-markdown-knowledge.bookc'))).toBe(
|
|
36
|
-
importPipelineJsonAsString('26-markdown-knowledge.bookc'),
|
|
37
|
-
));
|
|
38
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from '@jest/globals';
|
|
2
|
-
import { spaceTrim } from 'spacetrim';
|
|
3
|
-
import { just } from '../organization/just';
|
|
4
|
-
import { prettifyMarkdown } from './prettifyMarkdown';
|
|
5
|
-
|
|
6
|
-
describe(`prettifyMarkdown`, () => {
|
|
7
|
-
it(`should prettify the markdown`, () => {
|
|
8
|
-
expect(
|
|
9
|
-
prettifyMarkdown(
|
|
10
|
-
spaceTrim(`
|
|
11
|
-
# Title
|
|
12
|
-
|
|
13
|
-
- *Item* 1
|
|
14
|
-
- _Item_ 2
|
|
15
|
-
|
|
16
|
-
## Subtitle
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- Item 1
|
|
23
|
-
|
|
24
|
-
`),
|
|
25
|
-
),
|
|
26
|
-
).toBe(
|
|
27
|
-
just(
|
|
28
|
-
spaceTrim(`
|
|
29
|
-
# Title
|
|
30
|
-
|
|
31
|
-
- _Item_ 1
|
|
32
|
-
- _Item_ 2
|
|
33
|
-
|
|
34
|
-
## Subtitle
|
|
35
|
-
|
|
36
|
-
- Item 1
|
|
37
|
-
|
|
38
|
-
`) + '\n',
|
|
39
|
-
),
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
});
|