From 8fe7a9853b01cd476fcad232c21fba3620bbf544 Mon Sep 17 00:00:00 2001 From: YiJie Date: Mon, 24 Aug 2026 00:47:18 +0800 Subject: [PATCH 1/5] feat(avatar): replace legacy renderer with 3d sdk --- .github/actions/setup-workspace/action.yml | 8 +- .github/workflows/chrome-extension-ci.yml | 3 + .../workflows/chrome-extension-release.yml | 4 + .github/workflows/deploy-avatar.yml | 1 - .github/workflows/deploy-pwa.yml | 3 +- .github/workflows/deploy-relay-admin.yml | 3 + .github/workflows/deploy-relay-dev.yml | 3 + .github/workflows/deploy-relay-server.yml | 4 + .github/workflows/desktop-package.yml | 4 +- .github/workflows/npm-publish-alpha.yml | 4 +- .github/workflows/relay-ci.yml | 4 +- .../workflows/stable-windows-msi-release.yml | 2 + .github/workflows/vscode-extension-ci.yml | 3 + .../workflows/vscode-extension-release.yml | 5 + .github/workflows/workspace-cache-warm.yml | 1 + .oo/docs/en/usage/avatar-runtime.md | 45 +- .oo/docs/en/usage/avatar.md | 18 +- .oo/docs/usage/avatar-runtime.md | 45 +- .oo/docs/usage/avatar.md | 18 +- .oo/rules/maintenance/README.md | 8 +- .oo/rules/release/npm-trusted-publishing.md | 2 +- .oo/rules/release/process.md | 2 +- .../__tests__/agent-room-rendering.spec.tsx | 20 +- .../agent-room-sidebar-card.spec.tsx | 13 +- .../chat-header-session-title.spec.tsx | 4 +- apps/client/package.json | 1 + .../@components/AgentRoomAvatarContent.tsx | 8 +- .../@components/AgentRoomBubble.tsx | 12 +- .../@components/AgentRoomRoster.tsx | 4 +- .../components/agent-room/AgentRoomView.scss | 40 +- .../src/components/chat/ChatHeader.scss | 20 +- .../client/src/components/chat/ChatHeader.tsx | 4 +- .../components/chat/messages/MessageItem.scss | 12 +- .../components/chat/messages/MessageItem.tsx | 6 +- .../account-select/AccountAvatar.scss | 8 +- .../account-select/AccountAvatar.tsx | 4 +- .../config/AdapterAccountPreview.scss | 8 +- .../config/AdapterAccountPreview.tsx | 4 +- .../config/AdapterAccountsManager.scss | 8 +- .../config/AdapterAccountsManager.tsx | 4 +- .../components/entity-card/EntityCard.scss | 6 +- .../src/components/entity-card/EntityCard.tsx | 4 +- .../entity-summary/EntitySummary.scss | 10 +- .../entity-summary/EntitySummary.tsx | 4 +- .../components/group-avatar/GroupAvatar.scss | 3 +- .../components/group-avatar/GroupAvatar.tsx | 38 +- .../components/room-avatar/RoomAvatar.scss | 35 + .../src/components/room-avatar/RoomAvatar.tsx | 35 + .../room-pixel-avatar/RoomPixelAvatar.scss | 36 - .../room-pixel-avatar/RoomPixelAvatar.tsx | 36 - .../src/components/sidebar/RoomItem.scss | 28 +- .../src/components/sidebar/RoomItem.tsx | 4 +- assets/AGENTS.md | 6 +- assets/avatar | 2 +- changelog/1.0.0-rc.6/avatar.md | 4 +- dprint.json | 1 + packages/avatar/AGENTS.md | 20 - packages/avatar/README.md | 80 -- packages/avatar/README.zh-Hans.md | 80 -- packages/avatar/__tests__/avatar.spec.ts | 52 - packages/avatar/package.json | 48 - packages/avatar/src/avatar.ts | 963 ------------------ packages/avatar/src/index.ts | 2 - packages/avatar/src/seed.ts | 72 -- packages/avatar/tsconfig.build.json | 16 - packages/avatar/tsconfig.json | 11 - packages/channels/lark/AGENTS.md | 2 +- packages/channels/lark/debugging/lessons.md | 2 +- .../plugins/channel-oneworks/package.json | 1 - pnpm-lock.yaml | 63 +- pnpm-workspace.yaml | 1 + scripts/AGENTS.md | 2 +- scripts/__tests__/dev-service-output.spec.ts | 20 +- scripts/__tests__/pr-validation-scope.spec.ts | 9 +- .../__tests__/publish-plan-repository.spec.ts | 30 + scripts/__tests__/release-tags.spec.ts | 4 +- scripts/__tests__/run-tools-bootstrap.spec.ts | 123 +++ .../workspace-dependency-bootstrap.spec.ts | 3 +- scripts/dev-start/git-workspace.ts | 5 + scripts/dev-start/manager.ts | 3 +- scripts/pr-validation-scope.cjs | 5 +- scripts/publish-plan-core.d.mts | 3 + scripts/publish-plan-core.mjs | 27 +- scripts/run-tools.mjs | 41 +- scripts/workspace-dependency-bootstrap.mjs | 31 +- scripts/workspace-submodule-bootstrap.mjs | 50 + 86 files changed, 729 insertions(+), 1662 deletions(-) create mode 100644 apps/client/src/components/room-avatar/RoomAvatar.scss create mode 100644 apps/client/src/components/room-avatar/RoomAvatar.tsx delete mode 100644 apps/client/src/components/room-pixel-avatar/RoomPixelAvatar.scss delete mode 100644 apps/client/src/components/room-pixel-avatar/RoomPixelAvatar.tsx delete mode 100644 packages/avatar/AGENTS.md delete mode 100644 packages/avatar/README.md delete mode 100644 packages/avatar/README.zh-Hans.md delete mode 100644 packages/avatar/__tests__/avatar.spec.ts delete mode 100644 packages/avatar/package.json delete mode 100644 packages/avatar/src/avatar.ts delete mode 100644 packages/avatar/src/index.ts delete mode 100644 packages/avatar/src/seed.ts delete mode 100644 packages/avatar/tsconfig.build.json delete mode 100644 packages/avatar/tsconfig.json create mode 100644 scripts/__tests__/run-tools-bootstrap.spec.ts create mode 100644 scripts/workspace-submodule-bootstrap.mjs diff --git a/.github/actions/setup-workspace/action.yml b/.github/actions/setup-workspace/action.yml index 3f56e2765..8cca687c6 100644 --- a/.github/actions/setup-workspace/action.yml +++ b/.github/actions/setup-workspace/action.yml @@ -4,6 +4,10 @@ description: Setup Node.js and pnpm, restoring an exact platform-specific worksp runs: using: composite steps: + - name: Checkout Avatar SDK submodule + shell: bash + run: git submodule update --init --depth 1 -- assets/avatar + - name: Restore workspace dependencies id: workspace-cache uses: actions/cache@v4 @@ -11,6 +15,7 @@ runs: path: | node_modules assets/avatar/node_modules + assets/avatar/packages/*/node_modules apps/*/node_modules packages/*/node_modules packages/adapters/*/node_modules @@ -20,7 +25,8 @@ runs: workspace-v1-pnpm-11.7.0-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/actions/setup-workspace/action.yml', '.node-version', '.npmrc', 'package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'patches/**/*.patch', - 'assets/avatar/package.json', 'apps/*/package.json', + 'assets/avatar/package.json', 'assets/avatar/packages/*/package.json', + 'apps/*/package.json', 'packages/*/package.json', 'packages/adapters/*/package.json', 'packages/channels/*/package.json', 'packages/plugins/*/package.json') }} diff --git a/.github/workflows/chrome-extension-ci.yml b/.github/workflows/chrome-extension-ci.yml index 59fcdd838..d88cbd834 100644 --- a/.github/workflows/chrome-extension-ci.yml +++ b/.github/workflows/chrome-extension-ci.yml @@ -50,6 +50,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Checkout Avatar SDK submodule + run: git submodule update --init --depth 1 -- assets/avatar + - name: Setup pnpm uses: pnpm/action-setup@v4 with: diff --git a/.github/workflows/chrome-extension-release.yml b/.github/workflows/chrome-extension-release.yml index b28c822b6..8c6f1c701 100644 --- a/.github/workflows/chrome-extension-release.yml +++ b/.github/workflows/chrome-extension-release.yml @@ -40,6 +40,8 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Checkout Avatar SDK submodule + run: git submodule update --init --depth 1 -- assets/avatar - name: Setup pnpm uses: pnpm/action-setup@v4 with: @@ -154,6 +156,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Checkout Avatar SDK submodule + run: git submodule update --init --depth 1 -- assets/avatar - name: Setup pnpm uses: pnpm/action-setup@v4 with: diff --git a/.github/workflows/deploy-avatar.yml b/.github/workflows/deploy-avatar.yml index 169c20dd9..d27a108ea 100644 --- a/.github/workflows/deploy-avatar.yml +++ b/.github/workflows/deploy-avatar.yml @@ -7,7 +7,6 @@ on: paths: - assets/avatar - assets/avatar/** - - packages/avatar/** - .github/workflows/deploy-avatar.yml workflow_dispatch: diff --git a/.github/workflows/deploy-pwa.yml b/.github/workflows/deploy-pwa.yml index 662af3fa1..09f876959 100644 --- a/.github/workflows/deploy-pwa.yml +++ b/.github/workflows/deploy-pwa.yml @@ -5,9 +5,10 @@ on: branches: - main paths: + - assets/avatar + - assets/avatar/** - apps/client/** - packages/adapters/** - - packages/avatar/** - packages/channels/lark/** - packages/cli-helper/** - packages/components/** diff --git a/.github/workflows/deploy-relay-admin.yml b/.github/workflows/deploy-relay-admin.yml index f6cec5ca5..bd1c1c046 100644 --- a/.github/workflows/deploy-relay-admin.yml +++ b/.github/workflows/deploy-relay-admin.yml @@ -38,6 +38,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Checkout Avatar SDK submodule + run: git submodule update --init --depth 1 -- assets/avatar + - name: Setup pnpm uses: pnpm/action-setup@v4 with: diff --git a/.github/workflows/deploy-relay-dev.yml b/.github/workflows/deploy-relay-dev.yml index 251c3bc7d..1cdfbb685 100644 --- a/.github/workflows/deploy-relay-dev.yml +++ b/.github/workflows/deploy-relay-dev.yml @@ -70,6 +70,9 @@ jobs: - name: Checkout repository if: steps.credentials.outputs.available == 'true' uses: actions/checkout@v4 + - name: Checkout Avatar SDK submodule + if: steps.credentials.outputs.available == 'true' + run: git submodule update --init --depth 1 -- assets/avatar - name: Setup pnpm if: steps.credentials.outputs.available == 'true' uses: pnpm/action-setup@v4 diff --git a/.github/workflows/deploy-relay-server.yml b/.github/workflows/deploy-relay-server.yml index 7c01edf4e..aa9ea47dc 100644 --- a/.github/workflows/deploy-relay-server.yml +++ b/.github/workflows/deploy-relay-server.yml @@ -76,6 +76,8 @@ jobs: fi - name: Checkout repository uses: actions/checkout@v4 + - name: Checkout Avatar SDK submodule + run: git submodule update --init --depth 1 -- assets/avatar - name: Setup pnpm uses: pnpm/action-setup@v4 with: @@ -143,6 +145,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Checkout Avatar SDK submodule + run: git submodule update --init --depth 1 -- assets/avatar - name: Setup pnpm uses: pnpm/action-setup@v4 with: diff --git a/.github/workflows/desktop-package.yml b/.github/workflows/desktop-package.yml index 7bc740879..8a141b3ac 100644 --- a/.github/workflows/desktop-package.yml +++ b/.github/workflows/desktop-package.yml @@ -632,7 +632,9 @@ jobs: - name: Install dependencies working-directory: ${{ steps.desktop_workspace.outputs.workspace_dir }} - run: pnpm install --frozen-lockfile + run: | + git submodule update --init --depth 1 -- assets/avatar + pnpm install --frozen-lockfile - name: Run desktop package preflight working-directory: ${{ steps.desktop_workspace.outputs.workspace_dir }} diff --git a/.github/workflows/npm-publish-alpha.yml b/.github/workflows/npm-publish-alpha.yml index d7b4db719..58bf8ee08 100644 --- a/.github/workflows/npm-publish-alpha.yml +++ b/.github/workflows/npm-publish-alpha.yml @@ -49,8 +49,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Checkout demo video submodule - run: git submodule update --init --depth 1 -- assets/demo-video + - name: Checkout required workspace submodules + run: git submodule update --init --depth 1 -- assets/avatar assets/demo-video - name: Setup pnpm uses: pnpm/action-setup@v4 with: diff --git a/.github/workflows/relay-ci.yml b/.github/workflows/relay-ci.yml index f459103db..da8827987 100644 --- a/.github/workflows/relay-ci.yml +++ b/.github/workflows/relay-ci.yml @@ -87,8 +87,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Checkout demo video submodule - run: git submodule update --init --depth 1 -- assets/demo-video + - name: Checkout required workspace submodules + run: git submodule update --init --depth 1 -- assets/avatar assets/demo-video - name: Setup pnpm uses: pnpm/action-setup@v4 diff --git a/.github/workflows/stable-windows-msi-release.yml b/.github/workflows/stable-windows-msi-release.yml index d8bc31eca..019c25ac8 100644 --- a/.github/workflows/stable-windows-msi-release.yml +++ b/.github/workflows/stable-windows-msi-release.yml @@ -53,6 +53,8 @@ jobs: fetch-depth: 0 ref: ${{ github.sha }} + - name: Checkout Avatar SDK submodule + run: git submodule update --init --depth 1 -- assets/avatar - name: Setup Node.js uses: actions/setup-node@v4 with: diff --git a/.github/workflows/vscode-extension-ci.yml b/.github/workflows/vscode-extension-ci.yml index 4ad05e417..97878d45c 100644 --- a/.github/workflows/vscode-extension-ci.yml +++ b/.github/workflows/vscode-extension-ci.yml @@ -44,6 +44,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Checkout Avatar SDK submodule + run: git submodule update --init --depth 1 -- assets/avatar + - name: Setup pnpm uses: pnpm/action-setup@v4 with: diff --git a/.github/workflows/vscode-extension-release.yml b/.github/workflows/vscode-extension-release.yml index 5384e6a68..c28acc2e4 100644 --- a/.github/workflows/vscode-extension-release.yml +++ b/.github/workflows/vscode-extension-release.yml @@ -37,6 +37,8 @@ jobs: with: fetch-depth: 0 ref: refs/tags/${{ inputs.release_tag }} + - name: Checkout Avatar SDK submodule + run: git submodule update --init --depth 1 -- assets/avatar - name: Setup pnpm uses: pnpm/action-setup@v4 with: @@ -127,6 +129,9 @@ jobs: fetch-depth: 0 ref: refs/tags/${{ needs.build.outputs.release_tag }} + - name: Checkout Avatar SDK submodule + run: git submodule update --init --depth 1 -- assets/avatar + - name: Validate immutable release source env: EXPECTED_SOURCE_SHA: ${{ needs.build.outputs.source_sha }} diff --git a/.github/workflows/workspace-cache-warm.yml b/.github/workflows/workspace-cache-warm.yml index e7d2c14d0..b76188fec 100644 --- a/.github/workflows/workspace-cache-warm.yml +++ b/.github/workflows/workspace-cache-warm.yml @@ -14,6 +14,7 @@ on: - pnpm-workspace.yaml - patches/**/*.patch - assets/avatar/package.json + - assets/avatar/packages/*/package.json - apps/*/package.json - packages/*/package.json - packages/adapters/*/package.json diff --git a/.oo/docs/en/usage/avatar-runtime.md b/.oo/docs/en/usage/avatar-runtime.md index 4605d315b..d8e3d9360 100644 --- a/.oo/docs/en/usage/avatar-runtime.md +++ b/.oo/docs/en/usage/avatar-runtime.md @@ -11,17 +11,54 @@ import { createDefaultAvatarDefinition, parseAvatarDefinition, serializeAvatarDefinition -} from '@oneworks/avatar-core' +} from '@oneworks/avatar' const definition = createDefaultAvatarDefinition() const json = serializeAvatarDefinition(definition) const restored = parseAvatarDefinition(json) ``` +The face can enable a configurable highlight inside each eye. `scene.decals` adds vector color shapes that are projected onto a body or entity-part surface, so blush, mouth marks, badges, and similar details follow the same 3D pose and export path instead of becoming separate floating geometry. + +```ts +const decorated = { + ...definition, + scene: { + ...definition.scene, + face: { + ...definition.scene.face, + eyeHighlight: { + color: '#ffffff', + enabled: true, + offsetX: -18, + offsetY: -20, + opacity: 96, + size: 30 + } + }, + decals: [ + { + color: '#f29a93', + height: 18, + id: 'blush-left', + label: 'Left blush', + opacity: 88, + rotation: -6, + shape: 'ellipse', + targetPartId: null, + width: 30, + x: -50, + y: 31 + } + ] + } +} +``` + Applications can supply multiple animation libraries. A library contains groups and clips, and a clip may also be passed directly to playback. A `relative` clip anchors each pose dimension at that dimension's first explicitly authored value; an `absolute` clip uses the recorded values directly. ```ts -import type { AvatarAnimationLibrary } from '@oneworks/avatar-core' +import type { AvatarAnimationLibrary } from '@oneworks/avatar' export const supportAnimations = { id: 'support', @@ -62,7 +99,7 @@ Version 1 animation patches support `colorGrade`, `face`, and the `pitch`, `yaw` `Avatar` and `AvatarEditor` consume the same definition and animation libraries. The editor is the complete editor used by the hosted product, not a reduced settings form. ```tsx -import { createDefaultAvatarDefinition } from '@oneworks/avatar-core' +import { createDefaultAvatarDefinition } from '@oneworks/avatar' import { Avatar, AvatarEditor } from '@oneworks/avatar-react' import type { AvatarHandle } from '@oneworks/avatar-react' import { useRef, useState } from 'react' @@ -110,7 +147,7 @@ The renderer ref provides `play`, `pause`, `resume`, `seek`, `stop`, `capture`, ```vue