@promptbook/wizard 0.113.0-4 → 0.113.0-6
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/esm/index.es.js +9 -14
- package/esm/index.es.js.map +1 -1
- package/esm/src/avatars/renderAvatarVisualAsciiArt.d.ts +75 -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 +2 -2
- package/umd/index.umd.js +9 -14
- package/umd/index.umd.js.map +1 -1
- package/umd/src/avatars/renderAvatarVisualAsciiArt.d.ts +75 -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
|
@@ -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>;
|
|
@@ -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/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.113.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.113.0-5`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/wizard",
|
|
3
|
-
"version": "0.113.0-
|
|
3
|
+
"version": "0.113.0-6",
|
|
4
4
|
"description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"types": "./esm/src/_packages/wizard.index.d.ts",
|
|
100
100
|
"typings": "./esm/src/_packages/wizard.index.d.ts",
|
|
101
101
|
"peerDependencies": {
|
|
102
|
-
"@promptbook/core": "0.113.0-
|
|
102
|
+
"@promptbook/core": "0.113.0-6"
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
105
|
"@ai-sdk/deepseek": "0.1.17",
|
package/umd/index.umd.js
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
* @generated
|
|
53
53
|
* @see https://github.com/webgptorg/promptbook
|
|
54
54
|
*/
|
|
55
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.113.0-
|
|
55
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.113.0-6';
|
|
56
56
|
/**
|
|
57
57
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
58
58
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -25508,7 +25508,7 @@
|
|
|
25508
25508
|
isAnimated: true,
|
|
25509
25509
|
supportsPointerTracking: true,
|
|
25510
25510
|
render({ context, size, palette, createRandom, timeMs, interaction }) {
|
|
25511
|
-
const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset, tentacleProfiles, skinSpots } = getOctopus3d4StableState(createRandom);
|
|
25511
|
+
const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset, tentacleProfiles, skinSpots, } = getOctopus3d4StableState(createRandom);
|
|
25512
25512
|
const sceneCenterX = size * 0.5;
|
|
25513
25513
|
const sceneCenterY = size * 0.535;
|
|
25514
25514
|
const bob = Math.sin(timeMs / 980 + animationPhase) * size * 0.013;
|
|
@@ -25856,10 +25856,7 @@
|
|
|
25856
25856
|
Math.max(0, Math.cos(effectiveLongitude)) * 0.12 +
|
|
25857
25857
|
lowerBlend * tentacleInfluence.core * (0.12 + tentacleInfluence.depthScale * 0.07) -
|
|
25858
25858
|
Math.max(0, -Math.cos(effectiveLongitude)) * 0.05;
|
|
25859
|
-
const tentacleTubeRadius = lowerBlend *
|
|
25860
|
-
tentacleInfluence.core *
|
|
25861
|
-
(0.12 + tipBlend * 0.07 + tentacleInfluence.widthScale * 0.028) *
|
|
25862
|
-
radiusX;
|
|
25859
|
+
const tentacleTubeRadius = lowerBlend * tentacleInfluence.core * (0.12 + tipBlend * 0.07 + tentacleInfluence.widthScale * 0.028) * radiusX;
|
|
25863
25860
|
const planarRadiusX = cosineLatitude * radiusX * horizontalScale + tentacleTubeRadius;
|
|
25864
25861
|
const planarRadiusZ = cosineLatitude * radiusZ * depthScale + tentacleTubeRadius * 0.74;
|
|
25865
25862
|
const lowerDrop = lowerBlend *
|
|
@@ -25871,9 +25868,7 @@
|
|
|
25871
25868
|
(morphologyProfile.tentacles.flowLengthScale - 1) * 0.1));
|
|
25872
25869
|
const combinedTentacleSway = (primaryTentacleWave + secondaryTentacleWave) * radiusX * (0.06 + tipBlend * 0.06);
|
|
25873
25870
|
return {
|
|
25874
|
-
x: Math.sin(effectiveLongitude) * planarRadiusX +
|
|
25875
|
-
combinedTentacleSway +
|
|
25876
|
-
tentacleCurl * radiusX * 0.18,
|
|
25871
|
+
x: Math.sin(effectiveLongitude) * planarRadiusX + combinedTentacleSway + tentacleCurl * radiusX * 0.18,
|
|
25877
25872
|
y: Math.sin(latitude) * radiusY * (1 + upperBlend * 0.14) -
|
|
25878
25873
|
upperBlend * radiusY * 0.12 +
|
|
25879
25874
|
lowerDrop +
|
|
@@ -29043,10 +29038,10 @@
|
|
|
29043
29038
|
*
|
|
29044
29039
|
* @private
|
|
29045
29040
|
*/
|
|
29046
|
-
const
|
|
29047
|
-
|
|
29048
|
-
|
|
29049
|
-
|
|
29041
|
+
const TEAM_SYSTEM_MESSAGE_GUIDANCE = _spaceTrim.spaceTrim(`
|
|
29042
|
+
- If a teammate is relevant to the request, consult that teammate using the matching tool.
|
|
29043
|
+
- Do not ask the user for information that a listed teammate can provide directly.
|
|
29044
|
+
`);
|
|
29050
29045
|
/**
|
|
29051
29046
|
* Constant for remote agents by Url.
|
|
29052
29047
|
*/
|
|
@@ -29228,7 +29223,7 @@
|
|
|
29228
29223
|
`);
|
|
29229
29224
|
});
|
|
29230
29225
|
return _spaceTrim.spaceTrim((block) => `
|
|
29231
|
-
${block(
|
|
29226
|
+
${block(TEAM_SYSTEM_MESSAGE_GUIDANCE)}
|
|
29232
29227
|
|
|
29233
29228
|
${block(teammateSections.join('\n\n'))}
|
|
29234
29229
|
`);
|