@promptbook/browser 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/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/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 +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/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
|
@@ -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/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/browser",
|
|
3
|
-
"version": "0.113.0-
|
|
3
|
+
"version": "0.113.0-8",
|
|
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,
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"types": "./esm/src/_packages/browser.index.d.ts",
|
|
99
99
|
"typings": "./esm/src/_packages/browser.index.d.ts",
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@promptbook/core": "0.113.0-
|
|
101
|
+
"@promptbook/core": "0.113.0-8"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@openai/agents": "0.4.15",
|
package/umd/index.umd.js
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* @generated
|
|
30
30
|
* @see https://github.com/webgptorg/promptbook
|
|
31
31
|
*/
|
|
32
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.113.0-
|
|
32
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.113.0-8';
|
|
33
33
|
/**
|
|
34
34
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
35
35
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -9558,7 +9558,7 @@
|
|
|
9558
9558
|
isAnimated: true,
|
|
9559
9559
|
supportsPointerTracking: true,
|
|
9560
9560
|
render({ context, size, palette, createRandom, timeMs, interaction }) {
|
|
9561
|
-
const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset, tentacleProfiles, skinSpots } = getOctopus3d4StableState(createRandom);
|
|
9561
|
+
const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset, tentacleProfiles, skinSpots, } = getOctopus3d4StableState(createRandom);
|
|
9562
9562
|
const sceneCenterX = size * 0.5;
|
|
9563
9563
|
const sceneCenterY = size * 0.535;
|
|
9564
9564
|
const bob = Math.sin(timeMs / 980 + animationPhase) * size * 0.013;
|
|
@@ -9906,10 +9906,7 @@
|
|
|
9906
9906
|
Math.max(0, Math.cos(effectiveLongitude)) * 0.12 +
|
|
9907
9907
|
lowerBlend * tentacleInfluence.core * (0.12 + tentacleInfluence.depthScale * 0.07) -
|
|
9908
9908
|
Math.max(0, -Math.cos(effectiveLongitude)) * 0.05;
|
|
9909
|
-
const tentacleTubeRadius = lowerBlend *
|
|
9910
|
-
tentacleInfluence.core *
|
|
9911
|
-
(0.12 + tipBlend * 0.07 + tentacleInfluence.widthScale * 0.028) *
|
|
9912
|
-
radiusX;
|
|
9909
|
+
const tentacleTubeRadius = lowerBlend * tentacleInfluence.core * (0.12 + tipBlend * 0.07 + tentacleInfluence.widthScale * 0.028) * radiusX;
|
|
9913
9910
|
const planarRadiusX = cosineLatitude * radiusX * horizontalScale + tentacleTubeRadius;
|
|
9914
9911
|
const planarRadiusZ = cosineLatitude * radiusZ * depthScale + tentacleTubeRadius * 0.74;
|
|
9915
9912
|
const lowerDrop = lowerBlend *
|
|
@@ -9921,9 +9918,7 @@
|
|
|
9921
9918
|
(morphologyProfile.tentacles.flowLengthScale - 1) * 0.1));
|
|
9922
9919
|
const combinedTentacleSway = (primaryTentacleWave + secondaryTentacleWave) * radiusX * (0.06 + tipBlend * 0.06);
|
|
9923
9920
|
return {
|
|
9924
|
-
x: Math.sin(effectiveLongitude) * planarRadiusX +
|
|
9925
|
-
combinedTentacleSway +
|
|
9926
|
-
tentacleCurl * radiusX * 0.18,
|
|
9921
|
+
x: Math.sin(effectiveLongitude) * planarRadiusX + combinedTentacleSway + tentacleCurl * radiusX * 0.18,
|
|
9927
9922
|
y: Math.sin(latitude) * radiusY * (1 + upperBlend * 0.14) -
|
|
9928
9923
|
upperBlend * radiusY * 0.12 +
|
|
9929
9924
|
lowerDrop +
|
|
@@ -13167,10 +13162,10 @@
|
|
|
13167
13162
|
*
|
|
13168
13163
|
* @private
|
|
13169
13164
|
*/
|
|
13170
|
-
const
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
|
|
13165
|
+
const TEAM_SYSTEM_MESSAGE_GUIDANCE = spacetrim.spaceTrim(`
|
|
13166
|
+
- If a teammate is relevant to the request, consult that teammate using the matching tool.
|
|
13167
|
+
- Do not ask the user for information that a listed teammate can provide directly.
|
|
13168
|
+
`);
|
|
13174
13169
|
/**
|
|
13175
13170
|
* Constant for remote agents by Url.
|
|
13176
13171
|
*/
|
|
@@ -13352,7 +13347,7 @@
|
|
|
13352
13347
|
`);
|
|
13353
13348
|
});
|
|
13354
13349
|
return spacetrim.spaceTrim((block) => `
|
|
13355
|
-
${block(
|
|
13350
|
+
${block(TEAM_SYSTEM_MESSAGE_GUIDANCE)}
|
|
13356
13351
|
|
|
13357
13352
|
${block(teammateSections.join('\n\n'))}
|
|
13358
13353
|
`);
|