@promptbook/cli 0.113.0-4 → 0.113.0-8
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/update/AdvancedOriginRepositoryPanel.tsx +76 -0
- package/apps/agents-server/src/app/admin/update/CurrentDeploymentCard.tsx +160 -0
- package/apps/agents-server/src/app/admin/update/PendingCommitsCard.tsx +86 -0
- package/apps/agents-server/src/app/admin/update/TargetEnvironmentCard.tsx +331 -0
- package/apps/agents-server/src/app/admin/update/UpdateClient.tsx +20 -873
- package/apps/agents-server/src/app/admin/update/UpdateJobCard.tsx +329 -0
- package/apps/agents-server/src/app/admin/update/UpdateOverview.ts +74 -0
- package/apps/agents-server/src/app/admin/update/buildDeploymentTimeBehindLabel.ts +29 -0
- package/apps/agents-server/src/app/admin/update/formatHumanReadableTimestamp.ts +18 -0
- package/apps/agents-server/src/app/admin/update/getUpdateJobFailureMessage.ts +13 -0
- package/apps/agents-server/src/app/admin/update/getUpdateJobSuccessMessage.ts +13 -0
- package/apps/agents-server/src/app/admin/update/useUpdateClientState.ts +441 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +13 -1
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageClient.tsx +14 -559
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageHeader.tsx +84 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageSection.tsx +52 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/GeneratedCodePreview.tsx +138 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/GeneratedHarnessSection.tsx +98 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/SourceBookSection.tsx +66 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/TranspiledCodeErrorBanner.tsx +30 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/TranspiledCodeExportWarningBanner.tsx +62 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/Transpiler.ts +9 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/useAgentCodeExportState.ts +478 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/cloneMockedChatPreset.ts +17 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/confirmDeleteMockedChat.ts +16 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedMessage.ts +81 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedParticipant.ts +146 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedSettings.ts +19 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDuplicatedDraft.ts +66 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/findMockedChatById.ts +51 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/persistMockedChats.ts +51 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/useMockedChatsEditorState.ts +16 -426
- package/apps/agents-server/src/components/Homepage/buildFreeGraphBoxLayout.ts +446 -0
- package/apps/agents-server/src/components/Homepage/buildGraphLayoutNodes.ts +415 -157
- package/apps/agents-server/src/components/Homepage/useAgentsGraphCanvasState.ts +2 -1
- package/apps/agents-server/src/database/sqlite/$provideLocalSqliteSupabase.ts +3 -1541
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/LocalSqliteQueryBuilder.ts +623 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/LocalSqliteSupabaseClient.ts +64 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/ensureTable.ts +93 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteFilters.ts +202 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteMutationPayload.ts +131 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteRowOperations.ts +102 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteSql.ts +59 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.ts +329 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTypes.ts +84 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteValueCodec.ts +63 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/normalizeSqliteError.ts +22 -0
- package/apps/agents-server/src/search/createDefaultServerSearchProviders/loadLocalOrganizationSearchDataset.ts +12 -1
- package/apps/agents-server/src/tools/send_email.ts +1 -2
- package/apps/agents-server/src/utils/agentOrganization/loadAgentOrganizationState.ts +13 -1
- package/apps/agents-server/src/utils/backup/createServerBackupZipStream.ts +7 -1382
- package/apps/agents-server/src/utils/backup/serverBackup/appendAgentBackupEntriesToZip.ts +27 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendConversationBackupEntriesToZip.ts +140 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendFileBackupEntriesToZip.ts +147 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendMessageBackupEntriesToZip.ts +65 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendMetadataBackupEntriesToZip.ts +39 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendSectionEntriesToZip.ts +92 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendUserBackupEntriesToZip.ts +80 -0
- package/apps/agents-server/src/utils/backup/serverBackup/createRedactedWalletBackupRecord.ts +34 -0
- package/apps/agents-server/src/utils/backup/serverBackup/createServerBackupManifest.ts +82 -0
- package/apps/agents-server/src/utils/backup/serverBackup/downloadBackupBinaryContent.ts +39 -0
- package/apps/agents-server/src/utils/backup/serverBackup/resolveFeedbackThreadMessages.ts +53 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupAttachments.ts +151 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupContext.ts +167 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupFilenames.ts +161 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupPreviews.ts +97 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupRowUtilities.ts +158 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupTypes.ts +59 -0
- package/apps/agents-server/src/utils/createLocalAgentSourceImporter.ts +159 -0
- package/apps/agents-server/src/utils/createMissingImportedAgentFallback.ts +60 -0
- package/apps/agents-server/src/utils/customDomainRouting.ts +157 -12
- package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +1 -1
- package/apps/agents-server/src/utils/importAgentWithFallback.ts +1 -58
- package/apps/agents-server/src/utils/localAgentRouteReferences.ts +167 -0
- package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +1 -1
- package/apps/agents-server/src/utils/managementApi/managementApiAgents.ts +17 -3
- package/apps/agents-server/src/utils/messages/sendMessage.ts +5 -3
- package/apps/agents-server/src/utils/resolveAgentStateFromSource.ts +7 -1
- package/apps/agents-server/src/utils/resolveInheritedAgentSource.ts +54 -5
- package/apps/agents-server/src/utils/resolveServerAgentContext.ts +12 -1
- package/apps/agents-server/src/utils/resolveStoredAgentState.ts +2 -1
- package/apps/agents-server/src/utils/speech-to-text/SpeechToTextFailoverRecognition/SpeechToTextFailoverRecognitionProviderRuntime.ts +0 -1
- package/apps/agents-server/src/utils/speech-to-text/SpeechToTextFailoverRecognition.ts +34 -2
- package/apps/agents-server/src/utils/userChat/userChatMessageLifecycle.ts +39 -9
- package/apps/agents-server/tests/e2e/support/ChatHistoryNavigationSupport.ts +5 -0
- package/esm/index.es.js +875 -60
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +7 -0
- package/esm/scripts/find-refactor-candidates/selectMostImportantRefactorCandidates.d.ts +12 -0
- package/esm/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +20 -0
- package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +5 -0
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +29 -0
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +4 -0
- package/esm/src/avatars/renderAvatarVisualAsciiArt.d.ts +75 -0
- package/esm/src/book-components/Chat/Chat/insertDictationChunk.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/insertDictationChunk.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/learnDictationDictionary.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/refineFinalDictationChunk.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/createPositiveIntegerOptionParser.d.ts +10 -0
- package/esm/src/utils/ascii-art/$detectTerminalAnsiColorDepth.d.ts +15 -0
- package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +80 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/avatars/avatarAnimationScheduler.ts +2 -1
- package/src/avatars/renderAvatarVisualAsciiArt.ts +138 -0
- package/src/avatars/visuals/octopus3d3AvatarVisual.ts +6 -2
- package/src/avatars/visuals/octopus3d4AvatarVisual.ts +14 -18
- package/src/book-components/Chat/Chat/insertDictationChunk.ts +3 -3
- package/src/book-components/Chat/Chat/learnDictationDictionary.ts +1 -1
- package/src/book-components/Chat/Chat/useChatInputAreaDictation.ts +133 -26
- package/src/cli/cli-commands/agents-server/buildAgentsServer.ts +3 -1
- package/src/cli/cli-commands/coder/boilerplateTemplates.ts +14 -21
- package/src/cli/cli-commands/coder/find-refactor-candidates.ts +9 -2
- package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +1 -4
- package/src/cli/cli-commands/coder/run.ts +3 -27
- package/src/cli/cli-commands/common/createPositiveIntegerOptionParser.ts +31 -0
- package/src/commitments/TEAM/TEAM.ts +5 -5
- package/src/other/templates/getTemplatesPipelineCollection.ts +770 -1169
- package/src/utils/ascii-art/$detectTerminalAnsiColorDepth.ts +45 -0
- package/src/utils/ascii-art/convertImageDataToAsciiArt.ts +396 -0
- package/src/version.ts +2 -2
- package/src/versions.txt +2 -0
- package/umd/index.umd.js +875 -60
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +7 -0
- package/umd/scripts/find-refactor-candidates/selectMostImportantRefactorCandidates.d.ts +12 -0
- package/umd/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +20 -0
- package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +5 -0
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +29 -0
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +4 -0
- package/umd/src/avatars/renderAvatarVisualAsciiArt.d.ts +75 -0
- package/umd/src/book-components/Chat/Chat/insertDictationChunk.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/insertDictationChunk.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/learnDictationDictionary.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/refineFinalDictationChunk.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/createPositiveIntegerOptionParser.d.ts +10 -0
- package/umd/src/utils/ascii-art/$detectTerminalAnsiColorDepth.d.ts +15 -0
- package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +80 -0
- package/umd/src/version.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/common/resolveAgentSystemMessage.d.ts +0 -6
- package/umd/scripts/run-codex-prompts/common/resolveAgentSystemMessage.d.ts +0 -6
|
@@ -15,4 +15,11 @@ export type FindRefactorCandidatesOptions = {
|
|
|
15
15
|
* Aggressiveness level used to score candidate files.
|
|
16
16
|
*/
|
|
17
17
|
readonly level?: RefactorCandidateLevel;
|
|
18
|
+
/**
|
|
19
|
+
* Maximum number of refactor prompts to create in this run.
|
|
20
|
+
*
|
|
21
|
+
* When more candidates are found than this limit, only the most important ones (by severity)
|
|
22
|
+
* are turned into prompts. When omitted, a prompt is created for every candidate.
|
|
23
|
+
*/
|
|
24
|
+
readonly limit?: number;
|
|
18
25
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RefactorCandidate } from './RefactorCandidate';
|
|
2
|
+
/**
|
|
3
|
+
* Keeps at most `limit` refactor candidates, preferring the most important ones.
|
|
4
|
+
*
|
|
5
|
+
* When there are more candidates than `limit`, only the highest-severity candidates are kept
|
|
6
|
+
* (ties broken by relative path for determinism). When `limit` is `undefined` or there are fewer
|
|
7
|
+
* candidates than the limit, every candidate is returned. The original input order is preserved
|
|
8
|
+
* among the kept candidates, so `limit` acts purely as a filter and never reorders prompts.
|
|
9
|
+
*
|
|
10
|
+
* @private function of findRefactorCandidates
|
|
11
|
+
*/
|
|
12
|
+
export declare function selectMostImportantRefactorCandidates(candidates: ReadonlyArray<RefactorCandidate>, limit: number | undefined): ReadonlyArray<RefactorCandidate>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { string_book } from '../../../src/book-2.0/agent-source/string_book';
|
|
2
|
+
/**
|
|
3
|
+
* Agent data resolved from the optional `--agent` book file.
|
|
4
|
+
*/
|
|
5
|
+
export type ResolvedCoderAgent = {
|
|
6
|
+
/**
|
|
7
|
+
* Raw source of the agent `.book` file.
|
|
8
|
+
*/
|
|
9
|
+
readonly agentSource: string_book;
|
|
10
|
+
/**
|
|
11
|
+
* Compiled system message injected into each coding prompt.
|
|
12
|
+
*/
|
|
13
|
+
readonly systemMessage: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Reads an optional agent `.book` file and compiles its system message for injection into coder prompts.
|
|
17
|
+
*
|
|
18
|
+
* Returns `undefined` when no agent path is provided.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveCoderAgent(agentPath: string | undefined, currentWorkingDirectory: string): Promise<ResolvedCoderAgent | undefined>;
|
|
@@ -41,6 +41,7 @@ export type { CoderRunProgressSnapshot };
|
|
|
41
41
|
*/
|
|
42
42
|
export declare class CoderRunUiState extends EventEmitter {
|
|
43
43
|
config: CoderRunConfig;
|
|
44
|
+
agentVisualLines: string[] | undefined;
|
|
44
45
|
currentPromptLabel: string;
|
|
45
46
|
currentScriptPaths: string[];
|
|
46
47
|
currentAttempt: number;
|
|
@@ -72,6 +73,10 @@ export declare class CoderRunUiState extends EventEmitter {
|
|
|
72
73
|
* Replaces the configuration shown in the UI header.
|
|
73
74
|
*/
|
|
74
75
|
setConfig(config: CoderRunConfig): void;
|
|
76
|
+
/**
|
|
77
|
+
* Replaces the ASCII-art agent visual shown instead of the default brand banner.
|
|
78
|
+
*/
|
|
79
|
+
setAgentVisualLines(agentVisualLines: ReadonlyArray<string> | undefined): void;
|
|
75
80
|
/**
|
|
76
81
|
* Feeds new prompt statistics from the main loop so the progress bar updates.
|
|
77
82
|
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { string_book } from '../../../src/book-2.0/agent-source/string_book';
|
|
2
|
+
/**
|
|
3
|
+
* Output width of the coder-run agent visual in terminal character cells.
|
|
4
|
+
*
|
|
5
|
+
* @private internal constant of coder run UI
|
|
6
|
+
*/
|
|
7
|
+
export declare const CODER_RUN_AGENT_VISUAL_COLUMNS = 24;
|
|
8
|
+
/**
|
|
9
|
+
* Output height of the coder-run agent visual in terminal character cells.
|
|
10
|
+
*
|
|
11
|
+
* Half of the columns keeps the square avatar visually square in a common terminal font.
|
|
12
|
+
*
|
|
13
|
+
* @private internal constant of coder run UI
|
|
14
|
+
*/
|
|
15
|
+
export declare const CODER_RUN_AGENT_VISUAL_ROWS = 12;
|
|
16
|
+
/**
|
|
17
|
+
* Builds the ANSI ASCII-art visual of the `--agent` book shown above the coder-run dashboard.
|
|
18
|
+
*
|
|
19
|
+
* The agent's avatar visual is resolved the same way as on the website - the `META AVATAR`
|
|
20
|
+
* commitment wins, then the `META VISUAL` commitment, then the shared default visual - and is
|
|
21
|
+
* rendered dynamically through the shared canvas avatar pipeline into terminal ASCII art.
|
|
22
|
+
*
|
|
23
|
+
* The visual is decorative, so any failure (for example when the optional `@napi-rs/canvas`
|
|
24
|
+
* module is not installed) returns `null` and the caller keeps the default brand banner.
|
|
25
|
+
*
|
|
26
|
+
* @param agentSource Source of the `--agent` book file.
|
|
27
|
+
* @returns ANSI-colored ASCII-art lines or `null` when the visual cannot be rendered.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildCoderRunAgentVisual(agentSource: string_book): Promise<ReadonlyArray<string> | null>;
|
|
@@ -11,6 +11,10 @@ export type BuildCoderRunUiFrameOptions = {
|
|
|
11
11
|
readonly terminalWidth: number;
|
|
12
12
|
readonly animationFrame: number;
|
|
13
13
|
readonly spinner: string;
|
|
14
|
+
/**
|
|
15
|
+
* ANSI ASCII-art lines of the `--agent` avatar visual shown instead of the default brand banner.
|
|
16
|
+
*/
|
|
17
|
+
readonly agentVisualLines?: readonly string[];
|
|
14
18
|
readonly pauseState: CoderRunPauseState;
|
|
15
19
|
readonly pauseTargetLabel: string;
|
|
16
20
|
readonly config: CoderRunConfig;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { AsciiArtColorDepth } from '../utils/ascii-art/convertImageDataToAsciiArt';
|
|
2
|
+
import type { AvatarDefinition } from './types/AvatarDefinition';
|
|
3
|
+
import type { AvatarVisualId } from './types/AvatarVisualDefinition';
|
|
4
|
+
/**
|
|
5
|
+
* Default output width of the ASCII avatar in terminal character cells.
|
|
6
|
+
*
|
|
7
|
+
* @private within the repository
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_AVATAR_ASCII_ART_COLUMNS = 32;
|
|
10
|
+
/**
|
|
11
|
+
* Factory creating a drawable canvas of the requested pixel size.
|
|
12
|
+
*
|
|
13
|
+
* In browsers this is typically `document.createElement('canvas')` (with width/height set),
|
|
14
|
+
* in Node.js an adapter around `createCanvas` of `@napi-rs/canvas` or a compatible library.
|
|
15
|
+
*
|
|
16
|
+
* @private within the repository
|
|
17
|
+
*/
|
|
18
|
+
export type CreateCanvasForAsciiArt = (width: number, height: number) => HTMLCanvasElement;
|
|
19
|
+
/**
|
|
20
|
+
* Options for `renderAvatarVisualAsciiArt`.
|
|
21
|
+
*
|
|
22
|
+
* @private within the repository
|
|
23
|
+
*/
|
|
24
|
+
export type RenderAvatarVisualAsciiArtOptions = {
|
|
25
|
+
/**
|
|
26
|
+
* Stable visual identity of the rendered agent avatar.
|
|
27
|
+
*/
|
|
28
|
+
readonly avatarDefinition: AvatarDefinition;
|
|
29
|
+
/**
|
|
30
|
+
* Built-in avatar visual to render, the same one used on the website.
|
|
31
|
+
*/
|
|
32
|
+
readonly visualId: AvatarVisualId;
|
|
33
|
+
/**
|
|
34
|
+
* Output width in terminal character cells.
|
|
35
|
+
*
|
|
36
|
+
* @default `DEFAULT_AVATAR_ASCII_ART_COLUMNS`
|
|
37
|
+
*/
|
|
38
|
+
readonly columns?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Output height in terminal character cells.
|
|
41
|
+
*
|
|
42
|
+
* @default `columns / 2` so the square avatar stays visually square in a common terminal font
|
|
43
|
+
*/
|
|
44
|
+
readonly rows?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Color depth of the emitted ANSI escape codes.
|
|
47
|
+
*
|
|
48
|
+
* @default 'TRUE_COLOR'
|
|
49
|
+
*/
|
|
50
|
+
readonly colorDepth?: AsciiArtColorDepth;
|
|
51
|
+
/**
|
|
52
|
+
* Animation timestamp for animated visuals.
|
|
53
|
+
*
|
|
54
|
+
* @default `STATIC_AVATAR_ASCII_ART_FRAME_TIME_MS`
|
|
55
|
+
*/
|
|
56
|
+
readonly timeMs?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Platform-specific canvas factory used to rasterize the visual.
|
|
59
|
+
*/
|
|
60
|
+
readonly createCanvas: CreateCanvasForAsciiArt;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Renders one built-in avatar visual into ANSI-colored ASCII art for terminal display.
|
|
64
|
+
*
|
|
65
|
+
* This is the universal bridge between the canvas avatar visuals shown on the website and
|
|
66
|
+
* text-based terminal UIs: the visual is rasterized through the exact same `renderAvatarVisual`
|
|
67
|
+
* pipeline the web uses, then the resulting pixels are converted into colored half-block
|
|
68
|
+
* characters by `convertImageDataToAsciiArt`.
|
|
69
|
+
*
|
|
70
|
+
* @param options Avatar identity, visual selection, output grid size, and the platform canvas factory.
|
|
71
|
+
* @returns One ANSI-colored string per output row.
|
|
72
|
+
*
|
|
73
|
+
* @private within the repository
|
|
74
|
+
*/
|
|
75
|
+
export declare function renderAvatarVisualAsciiArt(options: RenderAvatarVisualAsciiArtOptions): ReadonlyArray<string>;
|
|
@@ -8,7 +8,7 @@ export declare function insertDictationChunk(params: {
|
|
|
8
8
|
readonly dictatedText: string;
|
|
9
9
|
readonly selectionStart: number;
|
|
10
10
|
readonly selectionEnd: number;
|
|
11
|
-
readonly
|
|
11
|
+
readonly isReplacingSelection: boolean;
|
|
12
12
|
}): {
|
|
13
13
|
nextValue: string;
|
|
14
14
|
start: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a Commander argument parser that accepts only positive integers.
|
|
3
|
+
*
|
|
4
|
+
* The returned parser is meant to be passed as the coercion callback of `command.option(...)`.
|
|
5
|
+
* It throws a branded `NotAllowed` error with a clear message referencing the given option name
|
|
6
|
+
* when the provided value is not a positive integer.
|
|
7
|
+
*
|
|
8
|
+
* @private internal utility of `promptbookCli`
|
|
9
|
+
*/
|
|
10
|
+
export declare function createPositiveIntegerOptionParser(optionName: string): (value: string) => number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AsciiArtColorDepth } from './convertImageDataToAsciiArt';
|
|
2
|
+
/**
|
|
3
|
+
* Detects the ANSI color depth supported by the current terminal.
|
|
4
|
+
*
|
|
5
|
+
* Prefers 24-bit true color when the environment advertises it (modern terminals such as
|
|
6
|
+
* Windows Terminal, ConEmu, VS Code, mintty, iTerm2, and WezTerm) and falls back to the
|
|
7
|
+
* portable 256-color palette otherwise.
|
|
8
|
+
*
|
|
9
|
+
* Note: `$` is used to indicate that this function is not a pure function - it reads the process environment
|
|
10
|
+
*
|
|
11
|
+
* @returns Color depth usable by `convertImageDataToAsciiArt`
|
|
12
|
+
*
|
|
13
|
+
* @private within the repository
|
|
14
|
+
*/
|
|
15
|
+
export declare function $detectTerminalAnsiColorDepth(): AsciiArtColorDepth;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color depth of the ANSI escape codes emitted by the ASCII-art conversion.
|
|
3
|
+
*
|
|
4
|
+
* - `TRUE_COLOR` emits 24-bit `38;2;r;g;b` / `48;2;r;g;b` sequences
|
|
5
|
+
* - `ANSI_256` approximates colors on the 256-color ANSI cube for older terminals
|
|
6
|
+
*
|
|
7
|
+
* @private within the repository
|
|
8
|
+
*/
|
|
9
|
+
export type AsciiArtColorDepth = 'TRUE_COLOR' | 'ANSI_256';
|
|
10
|
+
/**
|
|
11
|
+
* Minimal structural subset of the DOM `ImageData` accepted by the ASCII-art conversion.
|
|
12
|
+
*
|
|
13
|
+
* Works with browser canvas `ImageData`, `@napi-rs/canvas` image data, or any raw RGBA buffer.
|
|
14
|
+
*
|
|
15
|
+
* @private within the repository
|
|
16
|
+
*/
|
|
17
|
+
export type AsciiArtImageData = {
|
|
18
|
+
/**
|
|
19
|
+
* Source image width in pixels.
|
|
20
|
+
*/
|
|
21
|
+
readonly width: number;
|
|
22
|
+
/**
|
|
23
|
+
* Source image height in pixels.
|
|
24
|
+
*/
|
|
25
|
+
readonly height: number;
|
|
26
|
+
/**
|
|
27
|
+
* Flat RGBA pixel buffer with 4 bytes per pixel.
|
|
28
|
+
*/
|
|
29
|
+
readonly data: ArrayLike<number>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Options for `convertImageDataToAsciiArt`.
|
|
33
|
+
*
|
|
34
|
+
* @private within the repository
|
|
35
|
+
*/
|
|
36
|
+
export type ConvertImageDataToAsciiArtOptions = {
|
|
37
|
+
/**
|
|
38
|
+
* Source pixels to convert.
|
|
39
|
+
*/
|
|
40
|
+
readonly imageData: AsciiArtImageData;
|
|
41
|
+
/**
|
|
42
|
+
* Output width in terminal character cells.
|
|
43
|
+
*/
|
|
44
|
+
readonly columns: number;
|
|
45
|
+
/**
|
|
46
|
+
* Output height in terminal character cells.
|
|
47
|
+
*
|
|
48
|
+
* Each character cell renders two vertically stacked pixels, so `rows = columns / 2`
|
|
49
|
+
* keeps a square image visually square in a common terminal font.
|
|
50
|
+
*/
|
|
51
|
+
readonly rows: number;
|
|
52
|
+
/**
|
|
53
|
+
* Color depth of the emitted ANSI escape codes.
|
|
54
|
+
*
|
|
55
|
+
* @default 'TRUE_COLOR'
|
|
56
|
+
*/
|
|
57
|
+
readonly colorDepth?: AsciiArtColorDepth;
|
|
58
|
+
/**
|
|
59
|
+
* Alpha channel value (0-255) below which an averaged half-cell is treated as fully transparent.
|
|
60
|
+
*
|
|
61
|
+
* @default 32
|
|
62
|
+
*/
|
|
63
|
+
readonly alphaThreshold?: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Converts raw RGBA image pixels into colored ASCII art for ANSI terminals.
|
|
67
|
+
*
|
|
68
|
+
* This is the universal image-to-terminal technique used across the repository:
|
|
69
|
+
* every output character cell covers a rectangular region of source pixels which is
|
|
70
|
+
* split into a top and bottom half; each half is area-averaged and rendered with
|
|
71
|
+
* half-block characters (`▀` / `▄`) so one character shows two "pixels" vertically.
|
|
72
|
+
* Transparent halves keep the terminal background so non-rectangular images
|
|
73
|
+
* (for example rounded avatar cards) compose naturally into any terminal UI.
|
|
74
|
+
*
|
|
75
|
+
* @param options Source pixels, output grid size, and ANSI color depth.
|
|
76
|
+
* @returns One ANSI-colored string per output row, each ending with a color reset.
|
|
77
|
+
*
|
|
78
|
+
* @private within the repository
|
|
79
|
+
*/
|
|
80
|
+
export declare function convertImageDataToAsciiArt(options: ConvertImageDataToAsciiArtOptions): ReadonlyArray<string>;
|
package/umd/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.113.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.113.0-5`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reads an optional agent `.book` file and compiles its system message for injection into coder prompts.
|
|
3
|
-
*
|
|
4
|
-
* Returns `undefined` when no agent path is provided.
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolveAgentSystemMessage(agentPath: string | undefined, currentWorkingDirectory: string): Promise<string | undefined>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reads an optional agent `.book` file and compiles its system message for injection into coder prompts.
|
|
3
|
-
*
|
|
4
|
-
* Returns `undefined` when no agent path is provided.
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolveAgentSystemMessage(agentPath: string | undefined, currentWorkingDirectory: string): Promise<string | undefined>;
|