@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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AgentMessageFile } from '../messages/AgentMessageFile';
|
|
2
|
+
/**
|
|
3
|
+
* Result of recording one failed queued-message attempt.
|
|
4
|
+
*/
|
|
5
|
+
export type AgentMessageFailureTrackingResult = {
|
|
6
|
+
readonly failureCount: number;
|
|
7
|
+
readonly maxMessageProcessingFailures: number;
|
|
8
|
+
readonly isMessageMovedToFailed: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Tracks repeated watch-level failures for queued message files and stops retrying them after a configured cap.
|
|
12
|
+
*/
|
|
13
|
+
export declare class AgentMessageFailureTracker {
|
|
14
|
+
private readonly failuresByMessageKey;
|
|
15
|
+
private readonly maxMessageProcessingFailures;
|
|
16
|
+
constructor(options?: {
|
|
17
|
+
readonly maxMessageProcessingFailures?: number;
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Clears the failure counter after a queued message is processed successfully.
|
|
21
|
+
*/
|
|
22
|
+
clearMessageFailure(projectPath: string, messageFile: AgentMessageFile | undefined): void;
|
|
23
|
+
/**
|
|
24
|
+
* Records one queued-message failure and moves the message into `messages/failed` when the retry cap is reached.
|
|
25
|
+
*/
|
|
26
|
+
recordFailure(error: unknown): Promise<AgentMessageFailureTrackingResult | null>;
|
|
27
|
+
}
|
|
@@ -19,3 +19,7 @@ export declare function handleAgentWatchError(options: {
|
|
|
19
19
|
readonly logDirectoryPath: string;
|
|
20
20
|
readonly error: unknown;
|
|
21
21
|
}): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Recovers previously attached watch-loop context from an error-like value.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getAgentWatchErrorContext(error: unknown): AgentWatchErrorContext | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AgentMessageFile } from './AgentMessageFile';
|
|
2
|
+
/**
|
|
3
|
+
* Result of moving one abandoned queued message into the failed queue.
|
|
4
|
+
*/
|
|
5
|
+
export type FailedAgentMessageFile = {
|
|
6
|
+
readonly absolutePath: string;
|
|
7
|
+
readonly relativePath: string;
|
|
8
|
+
readonly fileName: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Moves one repeatedly failing queued message to `messages/failed` with a visible agent failure reply.
|
|
12
|
+
*/
|
|
13
|
+
export declare function moveAgentMessageToFailed(options: {
|
|
14
|
+
readonly projectPath: string;
|
|
15
|
+
readonly messageFile: AgentMessageFile;
|
|
16
|
+
readonly failureReason: string;
|
|
17
|
+
}): Promise<FailedAgentMessageFile>;
|
|
@@ -6,6 +6,7 @@ import type { number_positive } from '../../types/number_positive';
|
|
|
6
6
|
import type { string_knowledge_source_content } from '../../types/string_knowledge_source_content';
|
|
7
7
|
import type { string_css_value } from '../../types/string_markdown';
|
|
8
8
|
import type { HoistedMenuItem } from '../_common/MenuHoisting/MenuHoistingContext';
|
|
9
|
+
import type { BookEditorTheme } from './BookEditorTheme';
|
|
9
10
|
/**
|
|
10
11
|
* Monaco diagnostic shown inside `BookEditor`.
|
|
11
12
|
*
|
|
@@ -94,14 +95,14 @@ export type BookEditorProps = {
|
|
|
94
95
|
*/
|
|
95
96
|
readonly style?: CSSProperties;
|
|
96
97
|
/**
|
|
97
|
-
* Resolved
|
|
98
|
+
* Resolved host application theme.
|
|
98
99
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
100
|
+
* `<BookEditor/>` accepts this for integration compatibility, but the notebook
|
|
101
|
+
* editor itself is intentionally rendered as light paper in every app theme.
|
|
101
102
|
*
|
|
102
103
|
* @default 'LIGHT'
|
|
103
104
|
*/
|
|
104
|
-
readonly theme?:
|
|
105
|
+
readonly theme?: BookEditorTheme;
|
|
105
106
|
/**
|
|
106
107
|
* Height of the `BookEditor` component
|
|
107
108
|
*
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual theme accepted by `<BookEditor/>` integrations.
|
|
3
|
+
*
|
|
4
|
+
* @private internal type of `BookEditor`
|
|
5
|
+
*/
|
|
6
|
+
export type BookEditorTheme = 'LIGHT' | 'DARK';
|
|
7
|
+
/**
|
|
8
|
+
* Theme used for the actual notebook editor surface.
|
|
9
|
+
*
|
|
10
|
+
* The host application can still pass its resolved app theme, but book sources
|
|
11
|
+
* are intentionally rendered as light paper in both light and dark app modes.
|
|
12
|
+
*
|
|
13
|
+
* @private internal constant of `BookEditor`
|
|
14
|
+
*/
|
|
15
|
+
export declare const BOOK_EDITOR_RENDER_THEME = "LIGHT";
|
|
16
|
+
/**
|
|
17
|
+
* Resolves an app-level theme into the visual theme used by `<BookEditor/>`.
|
|
18
|
+
*
|
|
19
|
+
* @param hostTheme - Resolved theme from the embedding application.
|
|
20
|
+
* @returns Light theme used by the Book editor surface.
|
|
21
|
+
*
|
|
22
|
+
* @private internal utility of `BookEditor`
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveBookEditorRenderTheme(hostTheme?: BookEditorTheme): BookEditorTheme;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { editor } from 'monaco-editor';
|
|
2
|
+
import type { BookEditorTheme } from './BookEditorTheme';
|
|
2
3
|
/**
|
|
3
4
|
* Type describing monaco editor.
|
|
4
5
|
*/
|
|
5
6
|
type MonacoEditor = typeof import('monaco-editor');
|
|
6
|
-
/**
|
|
7
|
-
* Resolved visual theme supported by the Book editor.
|
|
8
|
-
*
|
|
9
|
-
* @private function of BookEditorMonaco
|
|
10
|
-
*/
|
|
11
|
-
type BookEditorTheme = 'LIGHT' | 'DARK';
|
|
12
7
|
/**
|
|
13
8
|
* Props for use book editor monaco language.
|
|
14
9
|
*/
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import type { editor } from 'monaco-editor';
|
|
2
|
+
import type { BookEditorTheme } from './BookEditorTheme';
|
|
2
3
|
/**
|
|
3
4
|
* Type describing monaco editor.
|
|
4
5
|
*/
|
|
5
6
|
type MonacoEditor = typeof import('monaco-editor');
|
|
6
|
-
/**
|
|
7
|
-
* Resolved visual theme supported by the Book editor.
|
|
8
|
-
*/
|
|
9
|
-
type BookEditorTheme = 'LIGHT' | 'DARK';
|
|
10
7
|
/**
|
|
11
8
|
* Props for use book editor monaco lifecycle.
|
|
12
9
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BookEditorTheme } from './BookEditorTheme';
|
|
1
2
|
/**
|
|
2
3
|
* Props for use book editor monaco styles.
|
|
3
4
|
*/
|
|
@@ -7,7 +8,7 @@ type UseBookEditorMonacoStylesProps = {
|
|
|
7
8
|
readonly scaledContentPaddingLeft: number;
|
|
8
9
|
readonly scaledVerticalLineLeft: number;
|
|
9
10
|
readonly zoomLevel: number;
|
|
10
|
-
readonly theme:
|
|
11
|
+
readonly theme: BookEditorTheme;
|
|
11
12
|
};
|
|
12
13
|
/**
|
|
13
14
|
* Injects notebook-inspired styling that is unique per `BookEditorMonaco` instance.
|
|
@@ -28,6 +28,12 @@ export declare const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH: string;
|
|
|
28
28
|
* @private internal utility of `ptbk agent-folder`
|
|
29
29
|
*/
|
|
30
30
|
export declare const AGENT_FINISHED_MESSAGES_DIRECTORY_PATH: string;
|
|
31
|
+
/**
|
|
32
|
+
* Relative path to messages that the agent runner stopped retrying.
|
|
33
|
+
*
|
|
34
|
+
* @private internal utility of `ptbk agent-folder`
|
|
35
|
+
*/
|
|
36
|
+
export declare const AGENT_FAILED_MESSAGES_DIRECTORY_PATH: string;
|
|
31
37
|
/**
|
|
32
38
|
* Relative path to generated local agent documentation initialized by `ptbk agent-folder init`.
|
|
33
39
|
*
|
package/esm/src/version.d.ts
CHANGED
|
@@ -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.112.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.112.0-105`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -153,11 +153,7 @@ export const octopus3d3AvatarVisual: AvatarVisualDefinition = {
|
|
|
153
153
|
});
|
|
154
154
|
const eyeLatitude = clampNumber(morphologyProfile.face.eyeCenterYOffsetRatio * 4.2 - 0.03, -0.22, 0.08);
|
|
155
155
|
const eyeLongitude = clampNumber(morphologyProfile.face.eyeSpacingRatio * 3.1, 0.18, 0.32);
|
|
156
|
-
const mouthLatitude = clampNumber(
|
|
157
|
-
eyeLatitude + 0.2 + morphologyProfile.face.mouthYOffsetRatio,
|
|
158
|
-
0.08,
|
|
159
|
-
0.34,
|
|
160
|
-
);
|
|
156
|
+
const mouthLatitude = clampNumber(eyeLatitude + 0.2 + morphologyProfile.face.mouthYOffsetRatio, 0.08, 0.34);
|
|
161
157
|
const mouthCenterLongitude = clampNumber(morphologyProfile.face.mouthCenterOffsetRatio * 5.6, -0.08, 0.08);
|
|
162
158
|
const mouthHalfLongitude = clampNumber(eyeLongitude * 0.78, 0.15, 0.28);
|
|
163
159
|
const mouthCurveLatitude = clampNumber(
|
|
@@ -377,15 +373,17 @@ function drawContinuousOctopusShadow(
|
|
|
377
373
|
*
|
|
378
374
|
* @private helper of `octopus3d3AvatarVisual`
|
|
379
375
|
*/
|
|
380
|
-
function resolveVisibleContinuousOctopusPatches(
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
376
|
+
function resolveVisibleContinuousOctopusPatches(
|
|
377
|
+
options: ContinuousOctopusSurfaceOptions & {
|
|
378
|
+
readonly center: Point3D;
|
|
379
|
+
readonly rotationX: number;
|
|
380
|
+
readonly rotationY: number;
|
|
381
|
+
readonly sceneCenterX: number;
|
|
382
|
+
readonly sceneCenterY: number;
|
|
383
|
+
readonly size: number;
|
|
384
|
+
readonly palette: AvatarPalette;
|
|
385
|
+
},
|
|
386
|
+
): Array<ContinuousOctopusSurfacePatch> {
|
|
389
387
|
const { center, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette } = options;
|
|
390
388
|
const latitudePatchCount = 16;
|
|
391
389
|
const longitudePatchCount = 40;
|
|
@@ -469,8 +467,7 @@ function sampleContinuousOctopusSurfacePoint(
|
|
|
469
467
|
const tipBlend = smoothStep(0.68, 1, verticalProgress);
|
|
470
468
|
const tentacleInfluence = resolveContinuousTentacleInfluence(options, longitude);
|
|
471
469
|
const centerPull = resolveSignedAngularDistance(longitude, tentacleInfluence.centerLongitude);
|
|
472
|
-
const effectiveLongitude =
|
|
473
|
-
longitude + centerPull * lowerBlend * tentacleInfluence.core * (0.24 + tipBlend * 0.2);
|
|
470
|
+
const effectiveLongitude = longitude + centerPull * lowerBlend * tentacleInfluence.core * (0.24 + tipBlend * 0.2);
|
|
474
471
|
const lowerLobeWave = resolveContinuousLobeWave(options, longitude);
|
|
475
472
|
const mantleRipple =
|
|
476
473
|
Math.sin(
|
|
@@ -498,10 +495,7 @@ function sampleContinuousOctopusSurfacePoint(
|
|
|
498
495
|
lowerBlend * tentacleInfluence.core * (0.1 + tentacleInfluence.depthScale * 0.06) -
|
|
499
496
|
Math.max(0, -Math.cos(effectiveLongitude)) * 0.05;
|
|
500
497
|
const tentacleTubeRadius =
|
|
501
|
-
lowerBlend *
|
|
502
|
-
tentacleInfluence.core *
|
|
503
|
-
(0.11 + tipBlend * 0.06 + tentacleInfluence.widthScale * 0.025) *
|
|
504
|
-
radiusX;
|
|
498
|
+
lowerBlend * tentacleInfluence.core * (0.11 + tipBlend * 0.06 + tentacleInfluence.widthScale * 0.025) * radiusX;
|
|
505
499
|
const planarRadiusX = cosineLatitude * radiusX * horizontalScale + tentacleTubeRadius;
|
|
506
500
|
const planarRadiusZ = cosineLatitude * radiusZ * depthScale + tentacleTubeRadius * 0.72;
|
|
507
501
|
const lowerDrop =
|
|
@@ -514,9 +508,7 @@ function sampleContinuousOctopusSurfacePoint(
|
|
|
514
508
|
(morphologyProfile.tentacles.flowLengthScale - 1) * 0.08));
|
|
515
509
|
|
|
516
510
|
return {
|
|
517
|
-
x:
|
|
518
|
-
Math.sin(effectiveLongitude) * planarRadiusX +
|
|
519
|
-
tentacleWave * radiusX * (0.052 + tipBlend * 0.05),
|
|
511
|
+
x: Math.sin(effectiveLongitude) * planarRadiusX + tentacleWave * radiusX * (0.052 + tipBlend * 0.05),
|
|
520
512
|
y:
|
|
521
513
|
Math.sin(latitude) * radiusY * (1 + upperBlend * 0.12) -
|
|
522
514
|
upperBlend * radiusY * 0.1 +
|
|
@@ -603,9 +595,14 @@ function resolveContinuousLobeWave(options: ContinuousOctopusSurfaceOptions, lon
|
|
|
603
595
|
const { morphologyProfile, animationPhase, timeMs } = options;
|
|
604
596
|
|
|
605
597
|
return (
|
|
606
|
-
Math.cos(
|
|
607
|
-
|
|
608
|
-
|
|
598
|
+
(Math.cos(
|
|
599
|
+
longitude * OCTOPUS_TENTACLE_COUNT +
|
|
600
|
+
animationPhase +
|
|
601
|
+
timeMs / (980 + morphologyProfile.body.lobeCount * 18),
|
|
602
|
+
) +
|
|
603
|
+
1) /
|
|
604
|
+
2
|
|
605
|
+
);
|
|
609
606
|
}
|
|
610
607
|
|
|
611
608
|
/**
|
|
@@ -722,8 +719,7 @@ function drawProjectedSurfaceCurrents(options: {
|
|
|
722
719
|
const progress = sampleIndex / 7;
|
|
723
720
|
const latitude = -0.46 + progress * 0.74;
|
|
724
721
|
const longitude =
|
|
725
|
-
baseLongitude +
|
|
726
|
-
Math.sin(timeMs / 1160 + animationPhase + currentIndex * 0.7 + progress * 2) * 0.035;
|
|
722
|
+
baseLongitude + Math.sin(timeMs / 1160 + animationPhase + currentIndex * 0.7 + progress * 2) * 0.035;
|
|
727
723
|
const scenePoint = transformScenePoint(
|
|
728
724
|
sampleContinuousOctopusSurfacePoint(surfaceOptions, latitude, longitude),
|
|
729
725
|
center,
|
|
@@ -858,7 +854,10 @@ function drawProjectedSurfaceSpot(options: {
|
|
|
858
854
|
size * 0.018,
|
|
859
855
|
);
|
|
860
856
|
const verticalRadius = clampNumber(
|
|
861
|
-
Math.hypot(
|
|
857
|
+
Math.hypot(
|
|
858
|
+
projectedVerticalPoint.x - projectedCenterPoint.x,
|
|
859
|
+
projectedVerticalPoint.y - projectedCenterPoint.y,
|
|
860
|
+
) *
|
|
862
861
|
radiusScale *
|
|
863
862
|
0.52,
|
|
864
863
|
size * 0.0024,
|
|
@@ -17,6 +17,8 @@ import type { HoistedMenuItem } from '../_common/MenuHoisting/MenuHoistingContex
|
|
|
17
17
|
import { classNames } from '../_common/react-utils/classNames';
|
|
18
18
|
import styles from './BookEditor.module.css';
|
|
19
19
|
import { BookEditorMonaco } from './BookEditorMonaco';
|
|
20
|
+
import type { BookEditorTheme } from './BookEditorTheme';
|
|
21
|
+
import { BOOK_EDITOR_RENDER_THEME, resolveBookEditorRenderTheme } from './BookEditorTheme';
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* Monaco diagnostic shown inside `BookEditor`.
|
|
@@ -123,14 +125,14 @@ export type BookEditorProps = {
|
|
|
123
125
|
readonly style?: CSSProperties;
|
|
124
126
|
|
|
125
127
|
/**
|
|
126
|
-
* Resolved
|
|
128
|
+
* Resolved host application theme.
|
|
127
129
|
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
+
* `<BookEditor/>` accepts this for integration compatibility, but the notebook
|
|
131
|
+
* editor itself is intentionally rendered as light paper in every app theme.
|
|
130
132
|
*
|
|
131
133
|
* @default 'LIGHT'
|
|
132
134
|
*/
|
|
133
|
-
readonly theme?:
|
|
135
|
+
readonly theme?: BookEditorTheme;
|
|
134
136
|
|
|
135
137
|
/**
|
|
136
138
|
* Height of the `BookEditor` component
|
|
@@ -288,7 +290,7 @@ export function BookEditor(props: BookEditorProps) {
|
|
|
288
290
|
agentSource,
|
|
289
291
|
className,
|
|
290
292
|
style,
|
|
291
|
-
theme =
|
|
293
|
+
theme: hostTheme = BOOK_EDITOR_RENDER_THEME,
|
|
292
294
|
zoom = 1,
|
|
293
295
|
value,
|
|
294
296
|
onChange,
|
|
@@ -309,6 +311,7 @@ export function BookEditor(props: BookEditorProps) {
|
|
|
309
311
|
} = props;
|
|
310
312
|
|
|
311
313
|
const [isFullscreen, setIsFullscreen] = useState(false);
|
|
314
|
+
const renderedTheme = resolveBookEditorRenderTheme(hostTheme);
|
|
312
315
|
|
|
313
316
|
/**
|
|
314
317
|
* Toggles fullscreen mode for the editor.
|
|
@@ -320,7 +323,7 @@ export function BookEditor(props: BookEditorProps) {
|
|
|
320
323
|
const editorContent = (
|
|
321
324
|
<div
|
|
322
325
|
data-book-component="BookEditor"
|
|
323
|
-
data-book-editor-theme={
|
|
326
|
+
data-book-editor-theme={renderedTheme.toLowerCase()}
|
|
324
327
|
className={classNames(
|
|
325
328
|
styles.BookEditor,
|
|
326
329
|
isVerbose && styles.isVerbose,
|
|
@@ -365,7 +368,7 @@ export function BookEditor(props: BookEditorProps) {
|
|
|
365
368
|
zoom={zoom}
|
|
366
369
|
monacoModelPath={monacoModelPath}
|
|
367
370
|
hoistedMenuItems={hoistedMenuItems}
|
|
368
|
-
theme={
|
|
371
|
+
theme={renderedTheme}
|
|
369
372
|
/>
|
|
370
373
|
</div>
|
|
371
374
|
);
|
|
@@ -12,6 +12,7 @@ import type { BookEditorProps } from './BookEditor';
|
|
|
12
12
|
import styles from './BookEditor.module.css';
|
|
13
13
|
import { BookEditorActionbar } from './BookEditorActionbar';
|
|
14
14
|
import { BookEditorMonacoConstants } from './BookEditorMonacoConstants';
|
|
15
|
+
import { BOOK_EDITOR_RENDER_THEME, resolveBookEditorRenderTheme } from './BookEditorTheme';
|
|
15
16
|
import { createDeprecatedCommitmentDiagnostics } from './createDeprecatedCommitmentDiagnostics';
|
|
16
17
|
import { useBookEditorMonacoDecorations } from './useBookEditorMonacoDecorations';
|
|
17
18
|
import { useBookEditorMonacoDiagnostics } from './useBookEditorMonacoDiagnostics';
|
|
@@ -204,7 +205,7 @@ export function BookEditorMonaco(props: BookEditorProps) {
|
|
|
204
205
|
onChange,
|
|
205
206
|
diagnostics,
|
|
206
207
|
isReadonly,
|
|
207
|
-
theme =
|
|
208
|
+
theme: hostTheme = BOOK_EDITOR_RENDER_THEME,
|
|
208
209
|
translations,
|
|
209
210
|
onFileUpload,
|
|
210
211
|
isUploadButtonShown,
|
|
@@ -219,6 +220,7 @@ export function BookEditorMonaco(props: BookEditorProps) {
|
|
|
219
220
|
hoistedMenuItems,
|
|
220
221
|
} = props;
|
|
221
222
|
|
|
223
|
+
const theme = resolveBookEditorRenderTheme(hostTheme);
|
|
222
224
|
const zoomLevel = zoom;
|
|
223
225
|
const { scaledLineHeight, scaledContentPaddingLeft, scaledVerticalLineLeft, scaledFontSize, scaledScrollbarSize } =
|
|
224
226
|
createBookEditorMonacoScale(zoomLevel);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual theme accepted by `<BookEditor/>` integrations.
|
|
3
|
+
*
|
|
4
|
+
* @private internal type of `BookEditor`
|
|
5
|
+
*/
|
|
6
|
+
export type BookEditorTheme = 'LIGHT' | 'DARK';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Theme used for the actual notebook editor surface.
|
|
10
|
+
*
|
|
11
|
+
* The host application can still pass its resolved app theme, but book sources
|
|
12
|
+
* are intentionally rendered as light paper in both light and dark app modes.
|
|
13
|
+
*
|
|
14
|
+
* @private internal constant of `BookEditor`
|
|
15
|
+
*/
|
|
16
|
+
export const BOOK_EDITOR_RENDER_THEME = 'LIGHT' satisfies BookEditorTheme;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Resolves an app-level theme into the visual theme used by `<BookEditor/>`.
|
|
20
|
+
*
|
|
21
|
+
* @param hostTheme - Resolved theme from the embedding application.
|
|
22
|
+
* @returns Light theme used by the Book editor surface.
|
|
23
|
+
*
|
|
24
|
+
* @private internal utility of `BookEditor`
|
|
25
|
+
*/
|
|
26
|
+
export function resolveBookEditorRenderTheme(hostTheme: BookEditorTheme = BOOK_EDITOR_RENDER_THEME): BookEditorTheme {
|
|
27
|
+
if (hostTheme === 'DARK') {
|
|
28
|
+
return BOOK_EDITOR_RENDER_THEME;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return hostTheme;
|
|
32
|
+
}
|
|
@@ -8,19 +8,14 @@ import {
|
|
|
8
8
|
import { PROMPTBOOK_SYNTAX_COLORS } from '../../config';
|
|
9
9
|
import { BookEditorMonacoConstants } from './BookEditorMonacoConstants';
|
|
10
10
|
import { BookEditorMonacoTokenization } from './BookEditorMonacoTokenization';
|
|
11
|
+
import type { BookEditorTheme } from './BookEditorTheme';
|
|
12
|
+
import { BOOK_EDITOR_RENDER_THEME, resolveBookEditorRenderTheme } from './BookEditorTheme';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Type describing monaco editor.
|
|
14
16
|
*/
|
|
15
17
|
type MonacoEditor = typeof import('monaco-editor');
|
|
16
18
|
|
|
17
|
-
/**
|
|
18
|
-
* Resolved visual theme supported by the Book editor.
|
|
19
|
-
*
|
|
20
|
-
* @private function of BookEditorMonaco
|
|
21
|
-
*/
|
|
22
|
-
type BookEditorTheme = 'LIGHT' | 'DARK';
|
|
23
|
-
|
|
24
19
|
/**
|
|
25
20
|
* Props for use book editor monaco language.
|
|
26
21
|
*/
|
|
@@ -286,12 +281,16 @@ function createNoteLikeBodyRules(
|
|
|
286
281
|
*
|
|
287
282
|
* @private function of BookEditorMonaco
|
|
288
283
|
*/
|
|
289
|
-
export function ensureBookEditorMonacoLanguage(
|
|
284
|
+
export function ensureBookEditorMonacoLanguage(
|
|
285
|
+
monaco: MonacoEditor,
|
|
286
|
+
theme: BookEditorTheme = BOOK_EDITOR_RENDER_THEME,
|
|
287
|
+
): void {
|
|
288
|
+
const renderedTheme = resolveBookEditorRenderTheme(theme);
|
|
290
289
|
const monacoWithLanguageState = monaco as MonacoEditorWithBookEditorLanguageState;
|
|
291
290
|
if (monacoWithLanguageState[BOOK_EDITOR_LANGUAGE_INITIALIZED_FLAG]) {
|
|
292
|
-
if (monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] !==
|
|
293
|
-
applyBookEditorMonacoTheme(monaco,
|
|
294
|
-
monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] =
|
|
291
|
+
if (monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] !== renderedTheme) {
|
|
292
|
+
applyBookEditorMonacoTheme(monaco, renderedTheme);
|
|
293
|
+
monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] = renderedTheme;
|
|
295
294
|
return;
|
|
296
295
|
}
|
|
297
296
|
|
|
@@ -300,7 +299,7 @@ export function ensureBookEditorMonacoLanguage(monaco: MonacoEditor, theme: Book
|
|
|
300
299
|
}
|
|
301
300
|
|
|
302
301
|
monacoWithLanguageState[BOOK_EDITOR_LANGUAGE_INITIALIZED_FLAG] = true;
|
|
303
|
-
monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] =
|
|
302
|
+
monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] = renderedTheme;
|
|
304
303
|
|
|
305
304
|
monaco.languages.register({ id: BookEditorMonacoConstants.BOOK_LANGUAGE_ID });
|
|
306
305
|
|
|
@@ -437,7 +436,7 @@ export function ensureBookEditorMonacoLanguage(monaco: MonacoEditor, theme: Book
|
|
|
437
436
|
},
|
|
438
437
|
});
|
|
439
438
|
|
|
440
|
-
applyBookEditorMonacoTheme(monaco,
|
|
439
|
+
applyBookEditorMonacoTheme(monaco, renderedTheme);
|
|
441
440
|
}
|
|
442
441
|
|
|
443
442
|
/**
|
|
@@ -462,8 +461,9 @@ type EnsureBookEditorMonacoLanguageForEditorProps = {
|
|
|
462
461
|
* @private function of BookEditorMonaco
|
|
463
462
|
*/
|
|
464
463
|
export function ensureBookEditorMonacoLanguageForEditor(props: EnsureBookEditorMonacoLanguageForEditorProps): void {
|
|
465
|
-
const { monaco, monacoEditor, theme =
|
|
466
|
-
|
|
464
|
+
const { monaco, monacoEditor, theme = BOOK_EDITOR_RENDER_THEME } = props;
|
|
465
|
+
const renderedTheme = resolveBookEditorRenderTheme(theme);
|
|
466
|
+
ensureBookEditorMonacoLanguage(monaco, renderedTheme);
|
|
467
467
|
|
|
468
468
|
const model = monacoEditor.getModel();
|
|
469
469
|
if (!model) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { editor } from 'monaco-editor';
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import type { BookEditorTheme } from './BookEditorTheme';
|
|
3
4
|
import { ensureBookEditorMonacoLanguage, ensureBookEditorMonacoLanguageForEditor } from './useBookEditorMonacoLanguage';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -7,11 +8,6 @@ import { ensureBookEditorMonacoLanguage, ensureBookEditorMonacoLanguageForEditor
|
|
|
7
8
|
*/
|
|
8
9
|
type MonacoEditor = typeof import('monaco-editor');
|
|
9
10
|
|
|
10
|
-
/**
|
|
11
|
-
* Resolved visual theme supported by the Book editor.
|
|
12
|
-
*/
|
|
13
|
-
type BookEditorTheme = 'LIGHT' | 'DARK';
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* Props for use book editor monaco lifecycle.
|
|
17
13
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { PROMPTBOOK_SYNTAX_COLORS } from '../../config';
|
|
3
|
+
import type { BookEditorTheme } from './BookEditorTheme';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Relative Y offset multiplier for aligning line background with Monaco rendering.
|
|
@@ -17,7 +18,7 @@ type UseBookEditorMonacoStylesProps = {
|
|
|
17
18
|
readonly scaledContentPaddingLeft: number;
|
|
18
19
|
readonly scaledVerticalLineLeft: number;
|
|
19
20
|
readonly zoomLevel: number;
|
|
20
|
-
readonly theme:
|
|
21
|
+
readonly theme: BookEditorTheme;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -36,6 +36,13 @@ export const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH = join(AGENT_MESSAGES_DIRECTOR
|
|
|
36
36
|
*/
|
|
37
37
|
export const AGENT_FINISHED_MESSAGES_DIRECTORY_PATH = join(AGENT_MESSAGES_DIRECTORY_PATH, 'finished');
|
|
38
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
|
+
|
|
39
46
|
/**
|
|
40
47
|
* Relative path to generated local agent documentation initialized by `ptbk agent-folder init`.
|
|
41
48
|
*
|