@promptbook/utils 0.112.0-46 → 0.112.0-48
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/README.md +16 -16
- package/esm/index.es.js +1 -1
- package/esm/src/avatars/AvatarOrImage.d.ts +49 -0
- package/esm/src/avatars/avatarInteractionUtils.d.ts +81 -0
- package/esm/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
- package/esm/src/avatars/avatarPointerTracking.d.ts +17 -0
- package/esm/src/avatars/avatarRenderingUtils.d.ts +3 -2
- package/esm/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
- package/esm/src/avatars/index.d.ts +2 -1
- package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +41 -1
- package/esm/src/avatars/visuals/asciiOctopusAvatarVisual.d.ts +7 -0
- package/esm/src/avatars/visuals/octopus3AvatarVisual.d.ts +7 -0
- package/esm/src/avatars/visuals/octopusAvatarVisualShared.d.ts +159 -0
- package/esm/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatToolCallModalComponents.d.ts +8 -2
- package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
- package/esm/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +2 -0
- package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +10 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
- package/esm/src/commitments/USE/USE.d.ts +1 -0
- package/esm/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +1 -1
- package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +47 -0
- package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +1 -0
- package/esm/src/commitments/_common/createSerpSearchToolFunction.d.ts +12 -0
- package/esm/src/commitments/index.d.ts +2 -1
- package/esm/src/config.d.ts +2 -2
- package/esm/src/llm-providers/agent/RemoteAgent.d.ts +3 -0
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
- package/esm/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +49 -5
- package/esm/src/utils/agents/resolveAgentAvatarImageUrl.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +1 -1
- package/umd/src/avatars/AvatarOrImage.d.ts +49 -0
- package/umd/src/avatars/avatarInteractionUtils.d.ts +81 -0
- package/umd/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
- package/umd/src/avatars/avatarPointerTracking.d.ts +17 -0
- package/umd/src/avatars/avatarRenderingUtils.d.ts +3 -2
- package/umd/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
- package/umd/src/avatars/index.d.ts +2 -1
- package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +41 -1
- package/umd/src/avatars/visuals/asciiOctopusAvatarVisual.d.ts +7 -0
- package/umd/src/avatars/visuals/octopus3AvatarVisual.d.ts +7 -0
- package/umd/src/avatars/visuals/octopusAvatarVisualShared.d.ts +159 -0
- package/umd/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatToolCallModalComponents.d.ts +8 -2
- package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
- package/umd/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +2 -0
- package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +10 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
- package/umd/src/commitments/USE/USE.d.ts +1 -0
- package/umd/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +1 -1
- package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +47 -0
- package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +1 -0
- package/umd/src/commitments/_common/createSerpSearchToolFunction.d.ts +12 -0
- package/umd/src/commitments/index.d.ts +2 -1
- package/umd/src/config.d.ts +2 -2
- package/umd/src/llm-providers/agent/RemoteAgent.d.ts +3 -0
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
- package/umd/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +49 -5
- package/umd/src/utils/agents/resolveAgentAvatarImageUrl.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!-- ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten -->
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# 🐙 Promptbook: Invisible AI Agents
|
|
4
4
|
|
|
5
|
-
Create persistent AI agents that turn your company's scattered knowledge into action
|
|
5
|
+
Create persistent AI agents that turn your company's scattered knowledge into action - powered by the [Agents Server](https://gallery.ptbk.io/)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -363,13 +363,13 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
363
363
|
|
|
364
364
|
## 📖 The Book Whitepaper
|
|
365
365
|
|
|
366
|
-
Promptbook lets you create **persistent AI agents** that work on real goals for your company. The [**Agents Server**](https://gallery.ptbk.io/) is the heart of the project
|
|
366
|
+
Promptbook lets you create **persistent AI agents** that work on real goals for your company. The [**Agents Server**](https://gallery.ptbk.io/) is the heart of the project - a place where your AI agents live, remember context, collaborate in teams, and get things done.
|
|
367
367
|
|
|
368
368
|
Nowadays, the biggest challenge for most business applications isn't the raw capabilities of AI models. Large language models such as GPT-5.2 and Claude-4.5 are incredibly capable.
|
|
369
369
|
|
|
370
370
|
The main challenge lies in **managing the context**, providing rules and knowledge, and narrowing the personality.
|
|
371
371
|
|
|
372
|
-
In Promptbook, you define your agents **using simple Books**
|
|
372
|
+
In Promptbook, you define your agents **using simple Books** - a human-readable language that is explicit, easy to understand and write, reliable, and highly portable. You then deploy them to the **Agents Server**, where they run persistently and work toward their goals.
|
|
373
373
|
|
|
374
374
|
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
375
375
|
|
|
@@ -470,7 +470,7 @@ Your job is to provide legal advice and support to the company and its employees
|
|
|
470
470
|
|
|
471
471
|
#### `Use` commitments
|
|
472
472
|
|
|
473
|
-
Use commitments grant the agent real capabilities
|
|
473
|
+
Use commitments grant the agent real capabilities - tools it can use to interact with the outside world. `USE EMAIL` lets the agent send emails, `USE BROWSER` lets it access and read web content, `USE SEARCH ENGINE` lets it search the web, and many more.
|
|
474
474
|
|
|
475
475
|
These are what turn a chatbot into a persistent agent that actually does work.
|
|
476
476
|
|
|
@@ -519,7 +519,7 @@ Your job is to provide legal advice and support to the company and its employees
|
|
|
519
519
|
|
|
520
520
|
### Promptbook Ecosystem
|
|
521
521
|
|
|
522
|
-
Promptbook is an ecosystem of tools centered around the **Agents Server**
|
|
522
|
+
Promptbook is an ecosystem of tools centered around the **Agents Server** - a production-ready platform for running persistent AI agents.
|
|
523
523
|
|
|
524
524
|
#### Agents Server
|
|
525
525
|
|
|
@@ -541,7 +541,7 @@ The [Promptbook Engine](https://github.com/webgptorg/promptbook) is the open-sou
|
|
|
541
541
|
|
|
542
542
|
## 💜 The Promptbook Project
|
|
543
543
|
|
|
544
|
-
Promptbook project is an ecosystem centered around the **Agents Server**
|
|
544
|
+
Promptbook project is an ecosystem centered around the **Agents Server** - a platform for creating, deploying, and running persistent AI agents. Following is a list of the most important pieces of the project:
|
|
545
545
|
|
|
546
546
|
<table>
|
|
547
547
|
<thead>
|
|
@@ -554,7 +554,7 @@ Promptbook project is an ecosystem centered around the **Agents Server** — a p
|
|
|
554
554
|
<tr>
|
|
555
555
|
<td><a href="https://gallery.ptbk.io/"><strong>⭐ Agents Server</strong></a></td>
|
|
556
556
|
<td>
|
|
557
|
-
The primary way to use Promptbook. A production-ready platform where your AI agents live
|
|
557
|
+
The primary way to use Promptbook. A production-ready platform where your AI agents live - create, manage, deploy, and interact with persistent agents that work on goals. Available as a hosted service or <a href="https://hub.docker.com/r/hejny/promptbook/">self-hosted via Docker</a>.
|
|
558
558
|
</td>
|
|
559
559
|
</tr>
|
|
560
560
|
<tr>
|
|
@@ -644,8 +644,8 @@ For information on reporting security vulnerabilities, see our [Security Policy]
|
|
|
644
644
|
|
|
645
645
|
The fastest way to get started is with the **Agents Server**:
|
|
646
646
|
|
|
647
|
-
- 🐋 **[Docker image](https://hub.docker.com/r/hejny/promptbook/)**
|
|
648
|
-
- ☁️ **[Hosted Agents Server](https://gallery.ptbk.io/)**
|
|
647
|
+
- 🐋 **[Docker image](https://hub.docker.com/r/hejny/promptbook/)** - Self-host the Agents Server with full control over your data
|
|
648
|
+
- ☁️ **[Hosted Agents Server](https://gallery.ptbk.io/)** - Start creating agents immediately, no setup required
|
|
649
649
|
|
|
650
650
|
### NPM Packages _(for developers embedding the Engine)_
|
|
651
651
|
|
|
@@ -790,7 +790,7 @@ npx ptbk coder verify
|
|
|
790
790
|
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------ | ---- | ----- | ------------------------------------------------------------------------ |
|
|
791
791
|
| `ptbk coder init` | Creates `prompts/`, `prompts/done/`, the project-generic template files materialized in `prompts/templates/` (currently `common.md`), and a starter `AGENTS.md`; ensures `.env` contains `CODING_AGENT_GIT_NAME`, `CODING_AGENT_GIT_EMAIL`, and `CODING_AGENT_GIT_SIGNING_KEY`; adds helper coder scripts to `package.json`; ensures `.gitignore` contains `/.tmp`; and configures `.vscode/settings.json` to save pasted prompt images into `prompts/screenshots/`. |
|
|
792
792
|
| `ptbk coder generate-boilerplates` | Creates new prompt markdown files with fresh emoji tags so you can quickly fill in coding tasks; `--template` accepts either a built-in alias or a markdown file path relative to the project root. |
|
|
793
|
-
| `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, can optionally verify each attempt with a shell test command and feed failing output back for retries, then marks success or failure, commits the result, and pushes only when `--auto-push` is enabled.
|
|
793
|
+
| `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, can optionally verify each attempt with a shell test command and feed failing output back for retries, then marks success or failure, commits the result, and pushes only when `--auto-push` is enabled. |
|
|
794
794
|
| `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors; `--level <xlow | low | medium | high | xhigh | extreme>` ranges from a very benevolent scan to a very aggressive sweep. |
|
|
795
795
|
| `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
|
|
796
796
|
|
|
@@ -801,7 +801,7 @@ npx ptbk coder verify
|
|
|
801
801
|
| `--agent <name>` | Selects the coding backend. |
|
|
802
802
|
| `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
|
|
803
803
|
| `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
|
|
804
|
-
| `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries.
|
|
804
|
+
| `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
|
|
805
805
|
| `--thinking-level <level>` | Sets reasoning effort for supported runners. |
|
|
806
806
|
| `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
|
|
807
807
|
| `--ignore-git-changes` | Disables the clean-working-tree guard. |
|
|
@@ -904,8 +904,8 @@ _Note: This section is not a complete dictionary, more list of general AI / LLM
|
|
|
904
904
|
|
|
905
905
|
The **[Agents Server](https://gallery.ptbk.io/)** is the primary way to use Promptbook. It is a production-ready platform where you create, deploy, and manage persistent AI agents that work toward goals. Agents remember context across conversations, collaborate in teams, and follow the rules and knowledge you define in the Book language.
|
|
906
906
|
|
|
907
|
-
- **Hosted** at [gallery.ptbk.io](https://gallery.ptbk.io/)
|
|
908
|
-
- **Self-hosted** via [Docker](https://hub.docker.com/r/hejny/promptbook/)
|
|
907
|
+
- **Hosted** at [gallery.ptbk.io](https://gallery.ptbk.io/) - start creating agents immediately
|
|
908
|
+
- **Self-hosted** via [Docker](https://hub.docker.com/r/hejny/promptbook/) - full control over your data and infrastructure
|
|
909
909
|
- **API** for integrating agents into your own applications
|
|
910
910
|
|
|
911
911
|
## 🚂 Promptbook Engine
|
|
@@ -923,7 +923,7 @@ The Engine is the open-source core that powers the Agents Server. If you need to
|
|
|
923
923
|
- When you want agents that **collaborate in teams** and consult each other
|
|
924
924
|
- When you need to **integrate AI agents into your existing applications** via API
|
|
925
925
|
- When you want to **self-host** your AI agents with full control over data and infrastructure
|
|
926
|
-
- When you are writing an app that generates complex things via LLM
|
|
926
|
+
- When you are writing an app that generates complex things via LLM - like **websites, articles, presentations, code, stories, songs**,...
|
|
927
927
|
- When you want to **version** your agent definitions and **test multiple versions**
|
|
928
928
|
- When you want to **log** agent execution and backtrace issues
|
|
929
929
|
|
|
@@ -935,7 +935,7 @@ The Engine is the open-source core that powers the Agents Server. If you need to
|
|
|
935
935
|
- When [OpenAI Assistant (GPTs)](https://help.openai.com/en/articles/8673914-gpts-vs-assistants) is enough for you
|
|
936
936
|
- When you need streaming _(this may be implemented in the future, [see discussion](https://github.com/webgptorg/promptbook/discussions/102))_
|
|
937
937
|
- When you need to use something other than JavaScript or TypeScript _(other languages are on the way, [see the discussion](https://github.com/webgptorg/promptbook/discussions/101))_
|
|
938
|
-
- When your main focus is on something other than text
|
|
938
|
+
- When your main focus is on something other than text - like images, audio, video, spreadsheets _(other media types may be added in the future, [see discussion](https://github.com/webgptorg/promptbook/discussions/103))_
|
|
939
939
|
- When you need to use recursion _([see the discussion](https://github.com/webgptorg/promptbook/discussions/38))_
|
|
940
940
|
|
|
941
941
|
[See more](https://github.com/webgptorg/promptbook/discussions/112)
|
package/esm/index.es.js
CHANGED
|
@@ -18,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
18
18
|
* @generated
|
|
19
19
|
* @see https://github.com/webgptorg/promptbook
|
|
20
20
|
*/
|
|
21
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
21
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-48';
|
|
22
22
|
/**
|
|
23
23
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
24
24
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { string_css_class, string_url_image } from '../types/typeAliases';
|
|
3
|
+
import type { AvatarDefinition } from './types/AvatarDefinition';
|
|
4
|
+
import type { AvatarSurfaceStyle, AvatarVisualId } from './types/AvatarVisualDefinition';
|
|
5
|
+
/**
|
|
6
|
+
* Shared avatar-rendering props for places that may receive either an image URL or a deterministic avatar visual.
|
|
7
|
+
*
|
|
8
|
+
* @private shared component for avatar media rendering
|
|
9
|
+
*/
|
|
10
|
+
export type AvatarOrImageProps = {
|
|
11
|
+
/**
|
|
12
|
+
* Explicit image URL to render.
|
|
13
|
+
*/
|
|
14
|
+
readonly imageUrl?: string_url_image | null;
|
|
15
|
+
/**
|
|
16
|
+
* Deterministic avatar definition used by built-in visuals.
|
|
17
|
+
*/
|
|
18
|
+
readonly avatarDefinition?: AvatarDefinition | null;
|
|
19
|
+
/**
|
|
20
|
+
* Selected built-in visual id used with `avatarDefinition`.
|
|
21
|
+
*/
|
|
22
|
+
readonly visualId?: AvatarVisualId | null;
|
|
23
|
+
/**
|
|
24
|
+
* Surface used to composite a built-in visual in its parent shell.
|
|
25
|
+
*/
|
|
26
|
+
readonly surface?: AvatarSurfaceStyle;
|
|
27
|
+
/**
|
|
28
|
+
* Output size in CSS pixels.
|
|
29
|
+
*/
|
|
30
|
+
readonly size: number;
|
|
31
|
+
/**
|
|
32
|
+
* Accessible label used for the rendered media.
|
|
33
|
+
*/
|
|
34
|
+
readonly alt: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional CSS class name applied to the rendered element.
|
|
37
|
+
*/
|
|
38
|
+
readonly className?: string_css_class;
|
|
39
|
+
/**
|
|
40
|
+
* Optional inline styles forwarded to the rendered element.
|
|
41
|
+
*/
|
|
42
|
+
readonly style?: CSSProperties;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Renders either a static image or a deterministic canvas avatar using one common prop shape.
|
|
46
|
+
*
|
|
47
|
+
* @private shared component for avatar media rendering
|
|
48
|
+
*/
|
|
49
|
+
export declare function AvatarOrImage(props: AvatarOrImageProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { AvatarDefinition } from './types/AvatarDefinition';
|
|
2
|
+
import type { AvatarInteractionState, AvatarPointerType } from './types/AvatarVisualDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* Internal interaction state kept between animation frames.
|
|
5
|
+
*
|
|
6
|
+
* @private utility of the avatar rendering system
|
|
7
|
+
*/
|
|
8
|
+
export type AvatarInteractionRuntimeState = AvatarInteractionState & {
|
|
9
|
+
readonly lastFrameMs: number | null;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Raw shared pointer sample used to derive one avatar-local gaze target.
|
|
13
|
+
*
|
|
14
|
+
* @private utility of the avatar rendering system
|
|
15
|
+
*/
|
|
16
|
+
export type AvatarPointerSnapshot = {
|
|
17
|
+
readonly clientX: number;
|
|
18
|
+
readonly clientY: number;
|
|
19
|
+
readonly isPointerActive: boolean;
|
|
20
|
+
readonly pointerType: Exclude<AvatarPointerType, 'idle'>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Avatar-local pointer target resolved from viewport coordinates.
|
|
24
|
+
*
|
|
25
|
+
* @private utility of the avatar rendering system
|
|
26
|
+
*/
|
|
27
|
+
export type AvatarPointerTarget = {
|
|
28
|
+
readonly gazeX: number;
|
|
29
|
+
readonly gazeY: number;
|
|
30
|
+
readonly bodyOffsetX: number;
|
|
31
|
+
readonly bodyOffsetY: number;
|
|
32
|
+
readonly intensity: number;
|
|
33
|
+
readonly isPointerActive: boolean;
|
|
34
|
+
readonly pointerType: AvatarPointerType;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Creates one stable cache key from the meaningful avatar-definition fields.
|
|
38
|
+
*
|
|
39
|
+
* @param avatarDefinition Normalized or raw avatar definition.
|
|
40
|
+
* @returns Stable cache key that ignores object identity churn.
|
|
41
|
+
*
|
|
42
|
+
* @private utility of the avatar rendering system
|
|
43
|
+
*/
|
|
44
|
+
export declare function createAvatarDefinitionKey(avatarDefinition: AvatarDefinition): string;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the neutral interaction state used by static/server-side renders.
|
|
47
|
+
*
|
|
48
|
+
* @returns Zeroed interaction state.
|
|
49
|
+
*
|
|
50
|
+
* @private utility of the avatar rendering system
|
|
51
|
+
*/
|
|
52
|
+
export declare function createIdleAvatarInteractionState(): AvatarInteractionState;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a fresh runtime state for the interactive animation loop.
|
|
55
|
+
*
|
|
56
|
+
* @returns Runtime interaction state with neutral values.
|
|
57
|
+
*
|
|
58
|
+
* @private utility of the avatar rendering system
|
|
59
|
+
*/
|
|
60
|
+
export declare function createAvatarInteractionRuntimeState(): AvatarInteractionRuntimeState;
|
|
61
|
+
/**
|
|
62
|
+
* Converts the shared viewport pointer state into one avatar-local gaze target.
|
|
63
|
+
*
|
|
64
|
+
* @param avatarBounds Canvas bounds in viewport coordinates.
|
|
65
|
+
* @param pointerSnapshot Latest shared pointer sample.
|
|
66
|
+
* @returns Local target used to steer eyes and subtle body lean.
|
|
67
|
+
*
|
|
68
|
+
* @private utility of the avatar rendering system
|
|
69
|
+
*/
|
|
70
|
+
export declare function resolveAvatarPointerTarget(avatarBounds: Pick<DOMRectReadOnly, 'left' | 'top' | 'width' | 'height'>, pointerSnapshot: AvatarPointerSnapshot | null): AvatarPointerTarget;
|
|
71
|
+
/**
|
|
72
|
+
* Advances the smoothed interaction state toward the latest pointer target.
|
|
73
|
+
*
|
|
74
|
+
* @param runtimeState Previous animation-frame state.
|
|
75
|
+
* @param pointerTarget Latest local pointer target.
|
|
76
|
+
* @param nowMs Current animation-frame timestamp.
|
|
77
|
+
* @returns Next runtime state to keep in the animation loop.
|
|
78
|
+
*
|
|
79
|
+
* @private utility of the avatar rendering system
|
|
80
|
+
*/
|
|
81
|
+
export declare function stepAvatarInteractionRuntimeState(runtimeState: AvatarInteractionRuntimeState, pointerTarget: AvatarPointerTarget, nowMs: number): AvatarInteractionRuntimeState;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AvatarPointerSnapshot } from './avatarInteractionUtils';
|
|
2
|
+
/**
|
|
3
|
+
* Starts the shared pointer tracker and returns a disposer for the caller.
|
|
4
|
+
*
|
|
5
|
+
* @returns Cleanup function that releases one consumer.
|
|
6
|
+
*
|
|
7
|
+
* @private utility of the avatar rendering system
|
|
8
|
+
*/
|
|
9
|
+
export declare function retainAvatarPointerTracking(): () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the latest shared viewport pointer sample when available.
|
|
12
|
+
*
|
|
13
|
+
* @returns Shared pointer snapshot or `null`.
|
|
14
|
+
*
|
|
15
|
+
* @private utility of the avatar rendering system
|
|
16
|
+
*/
|
|
17
|
+
export declare function getAvatarPointerSnapshot(): AvatarPointerSnapshot | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentBasicInformation } from '../book-2.0/agent-source/AgentBasicInformation';
|
|
2
2
|
import type { string_color } from '../types/typeAliases';
|
|
3
3
|
import type { AvatarDefinition } from './types/AvatarDefinition';
|
|
4
|
-
import type { AvatarPalette } from './types/AvatarVisualDefinition';
|
|
4
|
+
import type { AvatarPalette, AvatarSurfaceStyle } from './types/AvatarVisualDefinition';
|
|
5
5
|
/**
|
|
6
6
|
* Default square size used by avatar renderers.
|
|
7
7
|
*
|
|
@@ -48,11 +48,12 @@ export declare function createAvatarDefinitionFromAgentBasicInformation(agentBas
|
|
|
48
48
|
* Creates the shared derived palette used by every avatar visual.
|
|
49
49
|
*
|
|
50
50
|
* @param avatarDefinition Stable avatar definition.
|
|
51
|
+
* @param surface Surface style used by the parent UI.
|
|
51
52
|
* @returns Derived palette.
|
|
52
53
|
*
|
|
53
54
|
* @private utility of the avatar rendering system
|
|
54
55
|
*/
|
|
55
|
-
export declare function createAvatarPalette(avatarDefinition: AvatarDefinition): AvatarPalette;
|
|
56
|
+
export declare function createAvatarPalette(avatarDefinition: AvatarDefinition, surface?: AvatarSurfaceStyle): AvatarPalette;
|
|
56
57
|
/**
|
|
57
58
|
* Draws the common rounded background frame used by most visuals.
|
|
58
59
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Avatar } from './Avatar';
|
|
2
|
+
export { AvatarOrImage } from './AvatarOrImage';
|
|
2
3
|
export { renderAvatarVisual } from './renderAvatarVisual';
|
|
3
4
|
export { createAvatarDefinitionFromAgentBasicInformation } from './avatarRenderingUtils';
|
|
4
5
|
export { AVATAR_VISUALS, getAvatarVisualById } from './visuals/avatarVisualRegistry';
|
|
5
6
|
export type { AvatarDefinition } from './types/AvatarDefinition';
|
|
6
|
-
export type { AvatarPalette, AvatarProps, AvatarVisual, AvatarVisualDefinition, AvatarVisualId, AvatarVisualRenderContext, RenderAvatarVisualOptions, } from './types/AvatarVisualDefinition';
|
|
7
|
+
export type { AvatarInteractionState, AvatarPalette, AvatarPointerType, AvatarProps, AvatarVisual, AvatarVisualDefinition, AvatarVisualId, AvatarVisualRenderContext, RenderAvatarVisualOptions, } from './types/AvatarVisualDefinition';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
1
2
|
import type { string_color, string_css_class } from '../../types/typeAliases';
|
|
2
3
|
import type { AvatarDefinition } from './AvatarDefinition';
|
|
3
4
|
/**
|
|
@@ -5,7 +6,7 @@ import type { AvatarDefinition } from './AvatarDefinition';
|
|
|
5
6
|
*
|
|
6
7
|
* @private shared contract for the avatar rendering system
|
|
7
8
|
*/
|
|
8
|
-
export type AvatarVisualId = 'pixel-art' | 'octopus' | 'octopus2' | 'minecraft' | 'fractal';
|
|
9
|
+
export type AvatarVisualId = 'pixel-art' | 'octopus' | 'octopus2' | 'octopus3' | 'ascii-octopus' | 'minecraft' | 'fractal';
|
|
9
10
|
/**
|
|
10
11
|
* Derived color palette used by avatar visuals.
|
|
11
12
|
*
|
|
@@ -21,6 +22,32 @@ export type AvatarPalette = {
|
|
|
21
22
|
readonly shadow: string_color;
|
|
22
23
|
readonly ink: string_color;
|
|
23
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Surface style used when placing the avatar into different UI shells.
|
|
27
|
+
*
|
|
28
|
+
* @private shared contract for the avatar rendering system
|
|
29
|
+
*/
|
|
30
|
+
export type AvatarSurfaceStyle = 'framed' | 'transparent';
|
|
31
|
+
/**
|
|
32
|
+
* Pointer source currently driving avatar interaction.
|
|
33
|
+
*
|
|
34
|
+
* @private shared contract for the avatar rendering system
|
|
35
|
+
*/
|
|
36
|
+
export type AvatarPointerType = 'idle' | 'mouse' | 'touch' | 'pen';
|
|
37
|
+
/**
|
|
38
|
+
* Smoothed interaction state forwarded to animated avatar visuals.
|
|
39
|
+
*
|
|
40
|
+
* @private shared contract for the avatar rendering system
|
|
41
|
+
*/
|
|
42
|
+
export type AvatarInteractionState = {
|
|
43
|
+
readonly gazeX: number;
|
|
44
|
+
readonly gazeY: number;
|
|
45
|
+
readonly bodyOffsetX: number;
|
|
46
|
+
readonly bodyOffsetY: number;
|
|
47
|
+
readonly intensity: number;
|
|
48
|
+
readonly isPointerActive: boolean;
|
|
49
|
+
readonly pointerType: AvatarPointerType;
|
|
50
|
+
};
|
|
24
51
|
/**
|
|
25
52
|
* Rendering context forwarded to a single avatar visual.
|
|
26
53
|
*
|
|
@@ -35,6 +62,8 @@ export type AvatarVisualRenderContext = {
|
|
|
35
62
|
readonly avatarDefinition: AvatarDefinition;
|
|
36
63
|
readonly palette: AvatarPalette;
|
|
37
64
|
readonly createRandom: (salt: string) => () => number;
|
|
65
|
+
readonly surface: AvatarSurfaceStyle;
|
|
66
|
+
readonly interaction: AvatarInteractionState;
|
|
38
67
|
};
|
|
39
68
|
/**
|
|
40
69
|
* Signature of one canvas-based avatar visual renderer.
|
|
@@ -52,6 +81,7 @@ export type AvatarVisualDefinition = {
|
|
|
52
81
|
readonly title: string;
|
|
53
82
|
readonly description: string;
|
|
54
83
|
readonly isAnimated: boolean;
|
|
84
|
+
readonly supportsPointerTracking?: boolean;
|
|
55
85
|
readonly render: AvatarVisual;
|
|
56
86
|
};
|
|
57
87
|
/**
|
|
@@ -68,6 +98,10 @@ export type AvatarProps = {
|
|
|
68
98
|
* Selected visual style.
|
|
69
99
|
*/
|
|
70
100
|
readonly visualId: AvatarVisualId;
|
|
101
|
+
/**
|
|
102
|
+
* Surface used to composite the avatar in its parent UI.
|
|
103
|
+
*/
|
|
104
|
+
readonly surface?: AvatarSurfaceStyle;
|
|
71
105
|
/**
|
|
72
106
|
* Output size in CSS pixels.
|
|
73
107
|
*/
|
|
@@ -80,6 +114,10 @@ export type AvatarProps = {
|
|
|
80
114
|
* Optional CSS class name applied to the canvas.
|
|
81
115
|
*/
|
|
82
116
|
readonly className?: string_css_class;
|
|
117
|
+
/**
|
|
118
|
+
* Optional inline style applied to the canvas.
|
|
119
|
+
*/
|
|
120
|
+
readonly style?: CSSProperties;
|
|
83
121
|
};
|
|
84
122
|
/**
|
|
85
123
|
* Low-level rendering options for a single canvas frame.
|
|
@@ -90,7 +128,9 @@ export type RenderAvatarVisualOptions = {
|
|
|
90
128
|
readonly canvas: HTMLCanvasElement;
|
|
91
129
|
readonly avatarDefinition: AvatarDefinition;
|
|
92
130
|
readonly visualId: AvatarVisualId;
|
|
131
|
+
readonly surface?: AvatarSurfaceStyle;
|
|
93
132
|
readonly size: number;
|
|
94
133
|
readonly timeMs: number;
|
|
95
134
|
readonly devicePixelRatio?: number;
|
|
135
|
+
readonly interaction?: AvatarInteractionState;
|
|
96
136
|
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { AvatarInteractionState } from '../types/AvatarVisualDefinition';
|
|
2
|
+
/**
|
|
3
|
+
* One 2D point used by the shared organic octopus geometry helpers.
|
|
4
|
+
*
|
|
5
|
+
* @private helper of octopus avatar visuals
|
|
6
|
+
*/
|
|
7
|
+
type Point = {
|
|
8
|
+
readonly x: number;
|
|
9
|
+
readonly y: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Shape parameters for the smooth octopus silhouette generator.
|
|
13
|
+
*
|
|
14
|
+
* @private helper of octopus avatar visuals
|
|
15
|
+
*/
|
|
16
|
+
type CreateOrganicOctopusBodyPointsOptions = {
|
|
17
|
+
readonly centerX: number;
|
|
18
|
+
readonly centerY: number;
|
|
19
|
+
readonly bodyRadius: number;
|
|
20
|
+
readonly horizontalStretch: number;
|
|
21
|
+
readonly verticalStretch: number;
|
|
22
|
+
readonly mantleLift: number;
|
|
23
|
+
readonly lowerDrop: number;
|
|
24
|
+
readonly tentacleDepth: number;
|
|
25
|
+
readonly wobbleAmplitude: number;
|
|
26
|
+
readonly lobeCount: number;
|
|
27
|
+
readonly shapePhase: number;
|
|
28
|
+
readonly timeMs: number;
|
|
29
|
+
readonly pointCount?: number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* One deterministic ribbon tentacle attached to an organic octopus mantle.
|
|
33
|
+
*
|
|
34
|
+
* @private shared geometry helper of `octopus3AvatarVisual` and `asciiOctopusAvatarVisual`
|
|
35
|
+
*/
|
|
36
|
+
export type OrganicTentacleShape = {
|
|
37
|
+
readonly startPoint: Point;
|
|
38
|
+
readonly controlPointOne: Point;
|
|
39
|
+
readonly controlPointTwo: Point;
|
|
40
|
+
readonly endPoint: Point;
|
|
41
|
+
readonly baseWidth: number;
|
|
42
|
+
readonly tipWidth: number;
|
|
43
|
+
readonly colorBias: number;
|
|
44
|
+
readonly highlightBias: number;
|
|
45
|
+
readonly sampleCount: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Options for generating deterministic organic octopus tentacles.
|
|
49
|
+
*
|
|
50
|
+
* @private shared geometry helper of `octopus3AvatarVisual` and `asciiOctopusAvatarVisual`
|
|
51
|
+
*/
|
|
52
|
+
type CreateOrganicOctopusTentacleShapesOptions = {
|
|
53
|
+
readonly size: number;
|
|
54
|
+
readonly centerX: number;
|
|
55
|
+
readonly centerY: number;
|
|
56
|
+
readonly bodyRadius: number;
|
|
57
|
+
readonly horizontalStretch: number;
|
|
58
|
+
readonly tentacleCount: number;
|
|
59
|
+
readonly shapePhase: number;
|
|
60
|
+
readonly createRandom: (salt: string) => () => number;
|
|
61
|
+
readonly timeMs: number;
|
|
62
|
+
readonly saltPrefix: string;
|
|
63
|
+
readonly bodyPoints?: ReadonlyArray<Point>;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* One sampled ribbon point on an organic octopus tentacle.
|
|
67
|
+
*
|
|
68
|
+
* @private shared geometry helper of `octopus3AvatarVisual` and `asciiOctopusAvatarVisual`
|
|
69
|
+
*/
|
|
70
|
+
export type OrganicTentacleRibbonPoint = {
|
|
71
|
+
readonly x: number;
|
|
72
|
+
readonly y: number;
|
|
73
|
+
readonly normalX: number;
|
|
74
|
+
readonly normalY: number;
|
|
75
|
+
readonly width: number;
|
|
76
|
+
readonly progress: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* One resolved eye-motion sample shared by the octopus-family renderers.
|
|
80
|
+
*
|
|
81
|
+
* @private shared geometry helper of octopus avatar visuals
|
|
82
|
+
*/
|
|
83
|
+
export type OrganicEyeMotion = {
|
|
84
|
+
readonly pupilOffsetX: number;
|
|
85
|
+
readonly pupilOffsetY: number;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Minimal interaction subset needed to steer octopus-eye pupils.
|
|
89
|
+
*
|
|
90
|
+
* @private shared geometry helper of octopus avatar visuals
|
|
91
|
+
*/
|
|
92
|
+
type OrganicEyeInteraction = Pick<AvatarInteractionState, 'gazeX' | 'gazeY' | 'intensity'>;
|
|
93
|
+
/**
|
|
94
|
+
* Builds a smoothly morphing octopus-like silhouette from deterministic parameters.
|
|
95
|
+
*
|
|
96
|
+
* @param options Shape construction options.
|
|
97
|
+
* @returns Closed-loop body points.
|
|
98
|
+
*
|
|
99
|
+
* @private shared geometry helper of `octopus2AvatarVisual` and `octopus3AvatarVisual`
|
|
100
|
+
*/
|
|
101
|
+
export declare function createOrganicOctopusBodyPoints(options: CreateOrganicOctopusBodyPointsOptions): Array<Point>;
|
|
102
|
+
/**
|
|
103
|
+
* Traces a smooth closed path through the provided points.
|
|
104
|
+
*
|
|
105
|
+
* @param context Canvas 2D context.
|
|
106
|
+
* @param points Closed-loop points.
|
|
107
|
+
*
|
|
108
|
+
* @private shared geometry helper of `octopus2AvatarVisual` and `octopus3AvatarVisual`
|
|
109
|
+
*/
|
|
110
|
+
export declare function traceSmoothClosedPath(context: CanvasRenderingContext2D, points: ReadonlyArray<Point>): void;
|
|
111
|
+
/**
|
|
112
|
+
* Creates deterministic ribbon tentacles for the organic octopus visuals.
|
|
113
|
+
*
|
|
114
|
+
* @param options Tentacle construction options.
|
|
115
|
+
* @returns Tentacle descriptors.
|
|
116
|
+
*
|
|
117
|
+
* @private shared geometry helper of `octopus3AvatarVisual` and `asciiOctopusAvatarVisual`
|
|
118
|
+
*/
|
|
119
|
+
export declare function createOrganicOctopusTentacleShapes(options: CreateOrganicOctopusTentacleShapesOptions): Array<OrganicTentacleShape>;
|
|
120
|
+
/**
|
|
121
|
+
* Samples the cubic tentacle centerline and offsets normals to build a filled ribbon.
|
|
122
|
+
*
|
|
123
|
+
* @param tentacleShape Deterministic tentacle descriptor.
|
|
124
|
+
* @returns Sampled ribbon points.
|
|
125
|
+
*
|
|
126
|
+
* @private shared geometry helper of `octopus3AvatarVisual` and `asciiOctopusAvatarVisual`
|
|
127
|
+
*/
|
|
128
|
+
export declare function sampleOrganicTentacleRibbonPoints(tentacleShape: OrganicTentacleShape): Array<OrganicTentacleRibbonPoint>;
|
|
129
|
+
/**
|
|
130
|
+
* Resolves smooth pupil offsets that blend autonomous idle drift with live viewer tracking.
|
|
131
|
+
*
|
|
132
|
+
* @param options Eye motion options.
|
|
133
|
+
* @returns Resolved pupil offsets.
|
|
134
|
+
*
|
|
135
|
+
* @private shared geometry helper of octopus avatar visuals
|
|
136
|
+
*/
|
|
137
|
+
export declare function resolveOrganicEyeMotion(options: {
|
|
138
|
+
readonly radiusX: number;
|
|
139
|
+
readonly radiusY: number;
|
|
140
|
+
readonly timeMs: number;
|
|
141
|
+
readonly phase: number;
|
|
142
|
+
readonly interaction: OrganicEyeInteraction;
|
|
143
|
+
readonly autonomousDriftRatioX?: number;
|
|
144
|
+
readonly autonomousDriftRatioY?: number;
|
|
145
|
+
}): OrganicEyeMotion;
|
|
146
|
+
/**
|
|
147
|
+
* Samples one point on a cubic Bezier curve.
|
|
148
|
+
*
|
|
149
|
+
* @param startPoint Curve start point.
|
|
150
|
+
* @param controlPointOne First control point.
|
|
151
|
+
* @param controlPointTwo Second control point.
|
|
152
|
+
* @param endPoint Curve end point.
|
|
153
|
+
* @param progress Sampling progress in the range `[0, 1]`.
|
|
154
|
+
* @returns Sampled point.
|
|
155
|
+
*
|
|
156
|
+
* @private shared geometry helper of `octopus3AvatarVisual`
|
|
157
|
+
*/
|
|
158
|
+
export declare function getCubicBezierPoint(startPoint: Point, controlPointOne: Point, controlPointTwo: Point, endPoint: Point, progress: number): Point;
|
|
159
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -75,7 +75,7 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'onActionButton' | 'on
|
|
|
75
75
|
/**
|
|
76
76
|
* Controls whether assistant replies render as bubbles or article blocks.
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
visualMode?: ChatProps['visualMode'];
|
|
79
79
|
/**
|
|
80
80
|
* Called when a tool call chiplet is clicked.
|
|
81
81
|
*/
|
|
@@ -46,7 +46,7 @@ export type ChatMessageListProps = {
|
|
|
46
46
|
toolTitles?: Record<string, string>;
|
|
47
47
|
teammates?: ChatProps['teammates'];
|
|
48
48
|
teamAgentProfiles?: ChatProps['teamAgentProfiles'];
|
|
49
|
-
|
|
49
|
+
visualMode?: ChatProps['visualMode'];
|
|
50
50
|
onToolCallClick?: (toolCall: NonNullable<ChatMessage['toolCalls']>[number]) => void;
|
|
51
51
|
onCitationClick?: (citation: ParsedCitation) => void;
|
|
52
52
|
soundSystem?: ChatProps['soundSystem'];
|