diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 5020380..8beca93 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -33,6 +33,14 @@ runs: key: desktop-tools-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json', 'bun.lock', 'apps/desktop/package.json', 'apps/desktop/hutch.config.ts') }} restore-keys: | desktop-tools-v1-${{ runner.os }}-${{ runner.arch }}- + - name: 缓存 Turborepo 任务结果 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: .turbo/cache + key: turbo-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('bun.lock', 'turbo.json') }}-${{ github.sha }}-${{ github.job }} + restore-keys: | + turbo-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('bun.lock', 'turbo.json') }}- + turbo-v1-${{ runner.os }}-${{ runner.arch }}- - name: 从根目录安装依赖 shell: bash env: diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 3e02342..aebd6ba 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -16,7 +16,7 @@ jobs: uses: ./.github/workflows/ci.yml release: - name: 打包、验收并创建 Release 草稿 + name: 打包、验收并发布 npm 包 needs: check runs-on: ubuntu-24.04 timeout-minutes: 15 @@ -26,6 +26,14 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + - name: 检查 npm 发布凭据 + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + if [[ -z "$NPM_TOKEN" ]]; then + echo '::error::请在仓库 Actions Secrets 配置有 @jointarp/module-cli 发布权限的 NPM_TOKEN。' + exit 1 + fi - uses: ./.github/actions/setup - name: 准备 CLI 兼容性验收运行时 uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 @@ -33,12 +41,16 @@ jobs: node-version: "22.12.0" package-manager-cache: false - name: 校验 tag 与 CLI 版本 + id: version run: | bun run - <<'JS' + const { appendFileSync } = require('node:fs'); const { version } = require('./packages/module-cli/package.json'); if (process.env.GITHUB_REF_NAME !== `cli-v${version}`) { throw new Error(`tag 必须为 cli-v${version}`); } + const npmTag = version.split('+')[0].includes('-') ? 'next' : 'latest'; + appendFileSync(process.env.GITHUB_OUTPUT, `npm-tag=${npmTag}\n`); JS - run: bun run --filter @jointarp/module-cli pack - run: bun scripts/release/smoke.ts cli @@ -53,3 +65,8 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: bash scripts/release/draft.sh release-assets + - name: 发布已验收的 npm 包 + env: + NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TAG: ${{ steps.version.outputs.npm-tag }} + run: bun publish "release-assets/tarp-$GITHUB_REF_NAME.tgz" --registry https://registry.npmjs.org --access public --tag "$NPM_TAG" diff --git a/.gitignore b/.gitignore index 9f10415..ebf6e50 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ release/ .env .env.* !.env.example + +.turbo/ diff --git a/README.md b/README.md index 74189bf..c5888b6 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,8 @@ bun run dev | `bun run package` | 打包桌面应用目录 | | `bun run dist` | 生成桌面分发产物 | +类型检查与构建由 Turborepo 调度,可复用 CLI 和页面构建结果;缓存范围与 Actions 配置见[发布流程](docs/发布流程.md)。完整测试与桌面原生打包仍实际执行。 + 构建 CLI 后,可以直接用 Bun 校验模组: ```sh diff --git a/apps/desktop/README.md b/apps/desktop/README.md index b34618e..83f409c 100644 --- a/apps/desktop/README.md +++ b/apps/desktop/README.md @@ -70,7 +70,7 @@ GitHub Actions 的版本 tag、跨平台构建、签名配置和 Release 草稿 - `src/main/`:Electrobun 启动与桌面 RPC 入口。`config/` 负责用户配置;`modules/` 负责模组列表与导入;`sessions/` 接入本地房间资源与笔记接口;`game/` 管理本机模型配置、房间模型选择与订阅登录;`tts/` 维护语音服务。房间存档、聊天、状态、开局与 AI 执行位于 `packages/core/`,通用模组加载、校验和计算位于 `packages/module/`。 - `src/renderer/src/native-bridge.ts`:Electrobun 页面桥,连接 oRPC、桌面事件和本地图片服务。 -- `src/shared/`:主进程和渲染进程之间的桌面契约。游戏共享契约从 `@tarp/core/shared/*` 导入,浏览器不引用 `node` 入口。 +- `src/shared/`:主进程和渲染进程之间的桌面契约。游戏共享契约从 `@jointarp/core/shared/*` 导入,浏览器不引用 `node` 入口。 - `src/renderer/src/features/modules/`:模组库列表、打开模组与文档预览。 - `src/renderer/src/features/settings/`:设置导航、常规设置与外观设置。 - `src/renderer/src/components/`:跨功能复用的界面组件,`ui/` 存放基于 Base UI 或原生元素维护的基础组件。 diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 048ddcd..22026d3 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -17,13 +17,15 @@ "preview": "electrobun dev", "package": "bun run scripts/desktop.ts package", "dist": "bun run scripts/desktop.ts dist", - "prepare:desktop": "electrobun prepare" + "prepare:desktop": "electrobun prepare", + "build:renderer": "bun --bun x --no-install vite build" }, "dependencies": { "@base-ui/react": "^1.8.0", "@colyseus/schema": "5.0.34", "@earendil-works/pi-ai": "1.2.0", "@earendil-works/pi-coding-agent": "1.2.0", + "@jointarp/core": "workspace:*", "@jointarp/module": "workspace:*", "@jointarp/module-cli": "workspace:*", "@modelcontextprotocol/sdk": "^1.32.1", @@ -34,7 +36,6 @@ "@tanstack/react-query": "^5.103.1", "@tanstack/react-router": "^1.170.17", "@tanstack/react-virtual": "^3.14.13", - "@tarp/core": "workspace:*", "class-variance-authority": "^0.7.1", "cn": "^0.2.6", "es-toolkit": "^1.52.0", diff --git a/apps/desktop/scripts/desktop.ts b/apps/desktop/scripts/desktop.ts index 5728214..6dc9804 100644 --- a/apps/desktop/scripts/desktop.ts +++ b/apps/desktop/scripts/desktop.ts @@ -77,7 +77,7 @@ if (process.platform === "darwin") { } } } -await run(["bun", "--bun", "x", "--no-install", "vite", "build"]); +await run(["bun", "../../scripts/tasks.ts", "run", "build:renderer", "--filter=./apps/desktop"]); if (mode === "dev") { // Vite 提供页面热更新;Electrobun 监听主进程并重启。 const vite = Bun.spawn(["bun", "--bun", "x", "--no-install", "vite"], { diff --git a/apps/desktop/scripts/runtime-smoke.ts b/apps/desktop/scripts/runtime-smoke.ts index b809edc..f21ffbb 100644 --- a/apps/desktop/scripts/runtime-smoke.ts +++ b/apps/desktop/scripts/runtime-smoke.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; -import { SqliteDatabase } from "@tarp/core/node/storage/sqlite"; +import { SqliteDatabase } from "@jointarp/core/node/storage/sqlite"; import { Kysely, SqliteDialect } from "kysely"; import { getQuickJS } from "quickjs-emscripten"; diff --git a/apps/desktop/src/main/agent/host-system-prompt.test.ts b/apps/desktop/src/main/agent/host-system-prompt.test.ts index 7934c6d..062c439 100644 --- a/apps/desktop/src/main/agent/host-system-prompt.test.ts +++ b/apps/desktop/src/main/agent/host-system-prompt.test.ts @@ -4,12 +4,12 @@ import { mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { roomResources } from "@tarp/core/node/agent/pi-runtime"; +import { roomResources } from "@jointarp/core/node/agent/pi-runtime"; import { defaultHostSystemPrompt, hostInputInstructions, -} from "@tarp/core/shared/host-system-prompt"; -import { narrativeInstructions } from "@tarp/core/shared/narrative"; +} from "@jointarp/core/shared/host-system-prompt"; +import { narrativeInstructions } from "@jointarp/core/shared/narrative"; import { readAppConfig, updateAppConfig } from "../config/app-config"; import { readGameDefaults, updateGameDefaults } from "../config/app-settings"; diff --git a/apps/desktop/src/main/config/app-settings.ts b/apps/desktop/src/main/config/app-settings.ts index 94f63e6..692531f 100644 --- a/apps/desktop/src/main/config/app-settings.ts +++ b/apps/desktop/src/main/config/app-settings.ts @@ -1,11 +1,11 @@ -import { createIdentityId } from "@tarp/core/node/identity"; -import { structuredFile, StructuredFileError } from "@tarp/core/node/storage/structured-file"; -import { playerSchema } from "@tarp/core/shared/game"; +import { createIdentityId } from "@jointarp/core/node/identity"; +import { structuredFile, StructuredFileError } from "@jointarp/core/node/storage/structured-file"; +import { playerSchema } from "@jointarp/core/shared/game"; import { gameDefaultsSchema, patchGameDefaults, type GameDefaultsPatch, -} from "@tarp/core/shared/game-defaults"; +} from "@jointarp/core/shared/game-defaults"; import { z } from "zod"; import { appConfigSchema } from "../../shared/app-config"; diff --git a/apps/desktop/src/main/desktop-rpc-context.ts b/apps/desktop/src/main/desktop-rpc-context.ts index aa28475..5cd8266 100644 --- a/apps/desktop/src/main/desktop-rpc-context.ts +++ b/apps/desktop/src/main/desktop-rpc-context.ts @@ -1,5 +1,5 @@ +import type { GameContext } from "@jointarp/core/node"; import { os, ORPCError } from "@orpc/server"; -import type { GameContext } from "@tarp/core/node"; import { AppConfigError } from "./config/app-config"; import type { LocalGameSettings } from "./game/local-settings"; diff --git a/apps/desktop/src/main/desktop-rpc.ts b/apps/desktop/src/main/desktop-rpc.ts index 054d8b8..42ca26c 100644 --- a/apps/desktop/src/main/desktop-rpc.ts +++ b/apps/desktop/src/main/desktop-rpc.ts @@ -1,8 +1,8 @@ +import { gameRouter } from "@jointarp/core/node"; +import { gameDefaultsPatchSchema } from "@jointarp/core/shared/game-defaults"; import { onError } from "@orpc/server"; import { RPCHandler } from "@orpc/server/message-port"; import { appConfigSchema } from "@shared/app-config"; -import { gameRouter } from "@tarp/core/node"; -import { gameDefaultsPatchSchema } from "@tarp/core/shared/game-defaults"; import { z } from "zod"; import { readAppConfig, updateAppConfig } from "./config/app-config"; diff --git a/apps/desktop/src/main/desktop.ts b/apps/desktop/src/main/desktop.ts index 357e3c6..70104ad 100644 --- a/apps/desktop/src/main/desktop.ts +++ b/apps/desktop/src/main/desktop.ts @@ -1,9 +1,9 @@ import { isAbsolute, join } from "node:path"; +import { ChatService, createPiRuntime } from "@jointarp/core/node"; +import { narrationGapMs } from "@jointarp/core/shared/narration"; import { modulePreviewHash } from "@jointarp/module-cli/commands"; import { NativeMessagePort, type NativeBridge } from "@shared/native-bridge"; -import { ChatService, createPiRuntime } from "@tarp/core/node"; -import { narrationGapMs } from "@tarp/core/shared/narration"; import Electrobun, { BrowserView, Utils } from "electrobun/main"; import { readAppConfig, resolveAppConfigLocation } from "./config/app-config"; diff --git a/apps/desktop/src/main/game/local-settings.ts b/apps/desktop/src/main/game/local-settings.ts index b10fc19..3c4480a 100644 --- a/apps/desktop/src/main/game/local-settings.ts +++ b/apps/desktop/src/main/game/local-settings.ts @@ -2,18 +2,18 @@ import { join } from "node:path"; import type { AuthContext, Provider } from "@earendil-works/pi-ai"; import { builtinProviders } from "@earendil-works/pi-ai/providers/all"; -import { ORPCError } from "@orpc/server"; -import { ModelRuntime, InMemoryModelsStore } from "@tarp/core/node/agent/models"; -import { createIdentityId } from "@tarp/core/node/identity"; -import { structuredFile, StructuredFileError } from "@tarp/core/node/storage/structured-file"; +import { ModelRuntime, InMemoryModelsStore } from "@jointarp/core/node/agent/models"; +import { createIdentityId } from "@jointarp/core/node/identity"; +import { structuredFile, StructuredFileError } from "@jointarp/core/node/storage/structured-file"; import { playerSchema, customAiApis, type AiSettings, type ThinkingLevel, type AvailableAiModel, -} from "@tarp/core/shared/game"; -import { gameDefaultsSchema, type GameDefaultsPatch } from "@tarp/core/shared/game-defaults"; +} from "@jointarp/core/shared/game"; +import { gameDefaultsSchema, type GameDefaultsPatch } from "@jointarp/core/shared/game-defaults"; +import { ORPCError } from "@orpc/server"; import { z } from "zod"; import { diff --git a/apps/desktop/src/main/game/room-ai-settings.test.ts b/apps/desktop/src/main/game/room-ai-settings.test.ts index 164369e..d239657 100644 --- a/apps/desktop/src/main/game/room-ai-settings.test.ts +++ b/apps/desktop/src/main/game/room-ai-settings.test.ts @@ -6,11 +6,11 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { builtinProviders } from "@earendil-works/pi-ai/providers/all"; +import { ChatService } from "@jointarp/core/node/game/chat-service"; +import { readRoomSettings } from "@jointarp/core/node/sessions/room-settings"; +import { createSession } from "@jointarp/core/node/sessions/session-store"; import { waitFor } from "@jointarp/module/testing/async"; import { writeTestFile as writeFile } from "@jointarp/module/testing/files"; -import { ChatService } from "@tarp/core/node/game/chat-service"; -import { readRoomSettings } from "@tarp/core/node/sessions/room-settings"; -import { createSession } from "@tarp/core/node/sessions/session-store"; import { LocalGameSettings } from "./local-settings"; import { RoomAiSettingsStore } from "./room-ai-settings"; diff --git a/apps/desktop/src/main/game/room-ai-settings.ts b/apps/desktop/src/main/game/room-ai-settings.ts index 1383cbb..e5449cd 100644 --- a/apps/desktop/src/main/game/room-ai-settings.ts +++ b/apps/desktop/src/main/game/room-ai-settings.ts @@ -1,12 +1,12 @@ -import { ORPCError } from "@orpc/server"; import { readCompactionSettingsFile, saveCompactionSettingsFile, -} from "@tarp/core/node/game/compaction-settings"; -import { readRoomSettings, updateRoomSettings } from "@tarp/core/node/sessions/room-settings"; -import { readRoomState } from "@tarp/core/node/sessions/session-store"; -import type { CompactionRole, CompactionSettings } from "@tarp/core/shared/compaction-settings"; -import type { AvailableAiModel, RoomAiSettings, ThinkingLevel } from "@tarp/core/shared/game"; +} from "@jointarp/core/node/game/compaction-settings"; +import { readRoomSettings, updateRoomSettings } from "@jointarp/core/node/sessions/room-settings"; +import { readRoomState } from "@jointarp/core/node/sessions/session-store"; +import type { CompactionRole, CompactionSettings } from "@jointarp/core/shared/compaction-settings"; +import type { AvailableAiModel, RoomAiSettings, ThinkingLevel } from "@jointarp/core/shared/game"; +import { ORPCError } from "@orpc/server"; import type { LocalGameSettings } from "./local-settings"; diff --git a/apps/desktop/src/main/game/room-state-service.test.ts b/apps/desktop/src/main/game/room-state-service.test.ts index 4087dd2..05aeb25 100644 --- a/apps/desktop/src/main/game/room-state-service.test.ts +++ b/apps/desktop/src/main/game/room-state-service.test.ts @@ -7,45 +7,45 @@ import { join } from "node:path"; import { MessageChannel } from "node:worker_threads"; import { Decoder } from "@colyseus/schema"; -import type { WorkbenchView } from "@jointarp/module/creation-workbench"; -import { writeTestFile as writeFile } from "@jointarp/module/testing/files"; -import { createORPCClient } from "@orpc/client"; -import { RPCLink } from "@orpc/client/message-port"; -import type { ContractRouterClient } from "@orpc/contract"; -import { RPCHandler } from "@orpc/server/message-port"; -import { ChatService } from "@tarp/core/node/game/chat-service"; -import { gameRouter } from "@tarp/core/node/game/game-router"; -import { RoomStateEncoder } from "@tarp/core/node/game/room-state-encoder"; +import { ChatService } from "@jointarp/core/node/game/chat-service"; +import { gameRouter } from "@jointarp/core/node/game/game-router"; +import { RoomStateEncoder } from "@jointarp/core/node/game/room-state-encoder"; import { assertRoomOverlayAdmission, projectLaunch, projectEntities, -} from "@tarp/core/node/game/room-state-projection"; -import { readCharacters } from "@tarp/core/node/sessions/character-db"; +} from "@jointarp/core/node/game/room-state-projection"; +import { readCharacters } from "@jointarp/core/node/sessions/character-db"; import { characterSnapshot, validateCharacterDraft, -} from "@tarp/core/node/sessions/character-store"; +} from "@jointarp/core/node/sessions/character-store"; import { materializeCharacter, updateGameDocument, writeGameDocument, -} from "@tarp/core/node/sessions/game-state"; -import { launchState } from "@tarp/core/node/sessions/launch-store"; -import { notifyRoomChanged } from "@tarp/core/node/sessions/room-changes"; -import { roomDirectoryForDatabase } from "@tarp/core/node/sessions/session-paths"; +} from "@jointarp/core/node/sessions/game-state"; +import { launchState } from "@jointarp/core/node/sessions/launch-store"; +import { notifyRoomChanged } from "@jointarp/core/node/sessions/room-changes"; +import { roomDirectoryForDatabase } from "@jointarp/core/node/sessions/session-paths"; import { createSession, loadSessionModuleResources, openSessionDatabase, gameDirectoryForDatabase, -} from "@tarp/core/node/sessions/session-store"; -import { documentRevision } from "@tarp/core/node/sessions/state-version"; -import type { gameContract, RoomNotification } from "@tarp/core/shared/game"; -import type { LaunchAction } from "@tarp/core/shared/launch"; -import { ROOM_PROTOCOL_VERSION } from "@tarp/core/shared/room-state"; -import { RoomStateSchema } from "@tarp/core/shared/room-state-schema"; -import { createLaunchTestModule } from "@tarp/core/testing/launch-module"; +} from "@jointarp/core/node/sessions/session-store"; +import { documentRevision } from "@jointarp/core/node/sessions/state-version"; +import type { gameContract, RoomNotification } from "@jointarp/core/shared/game"; +import type { LaunchAction } from "@jointarp/core/shared/launch"; +import { ROOM_PROTOCOL_VERSION } from "@jointarp/core/shared/room-state"; +import { RoomStateSchema } from "@jointarp/core/shared/room-state-schema"; +import { createLaunchTestModule } from "@jointarp/core/testing/launch-module"; +import type { WorkbenchView } from "@jointarp/module/creation-workbench"; +import { writeTestFile as writeFile } from "@jointarp/module/testing/files"; +import { createORPCClient } from "@orpc/client"; +import { RPCLink } from "@orpc/client/message-port"; +import type { ContractRouterClient } from "@orpc/contract"; +import { RPCHandler } from "@orpc/server/message-port"; import { RoomConnection } from "../../renderer/src/features/sessions/room-connection"; import { diff --git a/apps/desktop/src/main/game/subscription-auth.ts b/apps/desktop/src/main/game/subscription-auth.ts index 412d043..76d0455 100644 --- a/apps/desktop/src/main/game/subscription-auth.ts +++ b/apps/desktop/src/main/game/subscription-auth.ts @@ -1,7 +1,7 @@ import { randomUUID } from "node:crypto"; import { registerBunOAuthFlows } from "@earendil-works/pi-ai/bun-oauth"; -import type { ModelRuntime } from "@tarp/core/node/agent/models"; +import type { ModelRuntime } from "@jointarp/core/node/agent/models"; // 桌面主进程会被 Bun 打包,pi 的变量路径动态导入无法随包发布。 registerBunOAuthFlows(); diff --git a/apps/desktop/src/main/mcp/playtest.test.ts b/apps/desktop/src/main/mcp/playtest.test.ts index 264d50d..7c353ee 100644 --- a/apps/desktop/src/main/mcp/playtest.test.ts +++ b/apps/desktop/src/main/mcp/playtest.test.ts @@ -6,15 +6,15 @@ import { createServer } from "node:http"; import { join } from "node:path"; import { fauxAssistantMessage, fauxToolCall } from "@earendil-works/pi-ai"; +import { ChatService, type Runtime } from "@jointarp/core/node"; +import { updateGameDocument } from "@jointarp/core/node/sessions/game-state"; +import { createSession, openSessionDatabase } from "@jointarp/core/node/sessions/session-store"; +import { gameDefaultsSchema } from "@jointarp/core/shared/game-defaults"; import { waitFor } from "@jointarp/module/testing/async"; import { writeTestFile as writeFile } from "@jointarp/module/testing/files"; import { createTestModule } from "@jointarp/module/testing/test-module"; import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; -import { ChatService, type Runtime } from "@tarp/core/node"; -import { updateGameDocument } from "@tarp/core/node/sessions/game-state"; -import { createSession, openSessionDatabase } from "@tarp/core/node/sessions/session-store"; -import { gameDefaultsSchema } from "@tarp/core/shared/game-defaults"; import { PlaytestService, playtestCreateSchema } from "./playtest"; import { startPlaytestMcp } from "./server"; diff --git a/apps/desktop/src/main/mcp/playtest.ts b/apps/desktop/src/main/mcp/playtest.ts index 371972f..41af601 100644 --- a/apps/desktop/src/main/mcp/playtest.ts +++ b/apps/desktop/src/main/mcp/playtest.ts @@ -1,28 +1,28 @@ import { join, isAbsolute } from "node:path"; -import { sameDocumentIdentity } from "@jointarp/module/document-path"; -import { emptyFlowRun } from "@jointarp/module/flow"; -import type { ChatService } from "@tarp/core/node"; -import { readCharacters } from "@tarp/core/node/sessions/character-db"; -import { gameDocumentViews } from "@tarp/core/node/sessions/game-state"; +import type { ChatService } from "@jointarp/core/node"; +import { readCharacters } from "@jointarp/core/node/sessions/character-db"; +import { gameDocumentViews } from "@jointarp/core/node/sessions/game-state"; import { readLaunchConfig, readLaunchRoom, saveLaunchProgress, saveLaunchRoom, -} from "@tarp/core/node/sessions/launch-db"; -import { patchRoomSettings, readRoomSettings } from "@tarp/core/node/sessions/room-settings"; +} from "@jointarp/core/node/sessions/launch-db"; +import { patchRoomSettings, readRoomSettings } from "@jointarp/core/node/sessions/room-settings"; import { createSession, deleteSession, openSessionDatabase, readRoomState, roomDirectory, -} from "@tarp/core/node/sessions/session-store"; -import { structuredFile } from "@tarp/core/node/storage/structured-file"; -import { chatText } from "@tarp/core/shared/agent-message"; -import { aiConfigSchema, type Player } from "@tarp/core/shared/game"; -import type { GameDefaults } from "@tarp/core/shared/game-defaults"; +} from "@jointarp/core/node/sessions/session-store"; +import { structuredFile } from "@jointarp/core/node/storage/structured-file"; +import { chatText } from "@jointarp/core/shared/agent-message"; +import { aiConfigSchema, type Player } from "@jointarp/core/shared/game"; +import type { GameDefaults } from "@jointarp/core/shared/game-defaults"; +import { sameDocumentIdentity } from "@jointarp/module/document-path"; +import { emptyFlowRun } from "@jointarp/module/flow"; import { z } from "zod"; export const playtestCreateSchema = z.strictObject({ diff --git a/apps/desktop/src/main/mcp/server.ts b/apps/desktop/src/main/mcp/server.ts index dc11d6a..5eb1379 100644 --- a/apps/desktop/src/main/mcp/server.ts +++ b/apps/desktop/src/main/mcp/server.ts @@ -3,9 +3,9 @@ import { rm } from "node:fs/promises"; import { createServer } from "node:http"; import { join } from "node:path"; +import { writeFileAtomic } from "@jointarp/core/node/storage/write-file-atomic"; import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js"; -import { writeFileAtomic } from "@tarp/core/node/storage/write-file-atomic"; import { z } from "zod"; import { PlaytestService, playtestCreateSchema } from "./playtest"; diff --git a/apps/desktop/src/main/mcp/service.ts b/apps/desktop/src/main/mcp/service.ts index 74572fc..33cc656 100644 --- a/apps/desktop/src/main/mcp/service.ts +++ b/apps/desktop/src/main/mcp/service.ts @@ -1,8 +1,8 @@ import { randomBytes } from "node:crypto"; import { join } from "node:path"; +import { structuredFile } from "@jointarp/core/node/storage/structured-file"; import type { McpStatus } from "@shared/mcp"; -import { structuredFile } from "@tarp/core/node/storage/structured-file"; import { z } from "zod"; import type { PlaytestService } from "./playtest"; diff --git a/apps/desktop/src/main/media-path.ts b/apps/desktop/src/main/media-path.ts index 3624bd2..a864160 100644 --- a/apps/desktop/src/main/media-path.ts +++ b/apps/desktop/src/main/media-path.ts @@ -2,7 +2,7 @@ import { realpathSync } from "node:fs"; import { realpath, stat } from "node:fs/promises"; import { dirname, isAbsolute, join, resolve } from "node:path"; -import { isInsideDirectory } from "@tarp/core/node/storage/path"; +import { isInsideDirectory } from "@jointarp/core/node/storage/path"; export const mediaScheme = "tarp"; const imagePattern = /\.(avif|gif|jpe?g|png|svg|webp)$/iu; diff --git a/apps/desktop/src/main/modules/import-local-module.ts b/apps/desktop/src/main/modules/import-local-module.ts index 2ca53eb..e36f3b3 100644 --- a/apps/desktop/src/main/modules/import-local-module.ts +++ b/apps/desktop/src/main/modules/import-local-module.ts @@ -1,10 +1,10 @@ import { mkdir, readdir, realpath } from "node:fs/promises"; import { basename, join } from "node:path"; +import { copyModule, directoryExists } from "@jointarp/core/node/sessions/module-copy"; import { configFilePath } from "@jointarp/module/node/config-file"; import { extractModuleZip } from "@jointarp/module/node/extract-zip"; import { loadModuleMetadata } from "@jointarp/module/node/module-metadata"; -import { copyModule, directoryExists } from "@tarp/core/node/sessions/module-copy"; import { assertNoSymlinks, moduleFolderName, publishModule } from "./module-import"; import { resolveModuleRoot } from "./module-root"; diff --git a/apps/desktop/src/main/modules/list-modules.test.ts b/apps/desktop/src/main/modules/list-modules.test.ts index 84d4797..947ab72 100644 --- a/apps/desktop/src/main/modules/list-modules.test.ts +++ b/apps/desktop/src/main/modules/list-modules.test.ts @@ -7,6 +7,7 @@ import { dirname, join } from "node:path"; import { pathToFileURL } from "node:url"; import { promisify } from "node:util"; +import { createSession } from "@jointarp/core/node/sessions/session-store"; import { loadDocumentTypes } from "@jointarp/module/node/document-types"; import { loadModuleDocuments, @@ -15,7 +16,6 @@ import { import { loadModuleMetadata } from "@jointarp/module/node/module-metadata"; import { loadModulePages } from "@jointarp/module/node/module-pages"; import { writeTestFile as writeFile } from "@jointarp/module/testing/files"; -import { createSession } from "@tarp/core/node/sessions/session-store"; import { documentMediaUrl } from "../../shared/document-media"; import { resolveMediaRequestFile } from "../media-path"; diff --git a/apps/desktop/src/main/modules/module-companions.test.ts b/apps/desktop/src/main/modules/module-companions.test.ts index 9061559..8af3570 100644 --- a/apps/desktop/src/main/modules/module-companions.test.ts +++ b/apps/desktop/src/main/modules/module-companions.test.ts @@ -2,11 +2,11 @@ import { test } from "bun:test"; import { strict as assert } from "node:assert"; import { randomUUID } from "node:crypto"; +import { ChatService } from "@jointarp/core/node/game/chat-service"; +import { advanceLaunch, launchState } from "@jointarp/core/node/sessions/launch-store"; +import { createSession } from "@jointarp/core/node/sessions/session-store"; import { loadModuleMetadata } from "@jointarp/module/node/module-metadata"; import { createTestModule } from "@jointarp/module/testing/test-module"; -import { ChatService } from "@tarp/core/node/game/chat-service"; -import { advanceLaunch, launchState } from "@tarp/core/node/sessions/launch-store"; -import { createSession } from "@tarp/core/node/sessions/session-store"; test("模组预设角色可作为 AI 队友入队,真人角色不可重复占用", async () => { const fixture = await createTestModule(); diff --git a/apps/desktop/src/main/modules/module-import.ts b/apps/desktop/src/main/modules/module-import.ts index aa85050..992b076 100644 --- a/apps/desktop/src/main/modules/module-import.ts +++ b/apps/desktop/src/main/modules/module-import.ts @@ -1,9 +1,9 @@ import { lstat, mkdir, mkdtemp, readdir, rename, rm } from "node:fs/promises"; import { join, relative } from "node:path"; +import { isMissingFile, withFileMutation } from "@jointarp/core/node/storage/file-queue"; import { loadDocumentTypes } from "@jointarp/module/node/document-types"; import { loadModuleMetadata } from "@jointarp/module/node/module-metadata"; -import { isMissingFile, withFileMutation } from "@tarp/core/node/storage/file-queue"; import { resolveModuleRoot } from "./module-root"; diff --git a/apps/desktop/src/main/modules/module-integration.test.ts b/apps/desktop/src/main/modules/module-integration.test.ts index 01d88c0..bf865c6 100644 --- a/apps/desktop/src/main/modules/module-integration.test.ts +++ b/apps/desktop/src/main/modules/module-integration.test.ts @@ -4,22 +4,22 @@ import { randomUUID } from "node:crypto"; import { readFile } from "node:fs/promises"; import { join } from "node:path"; -import { createTestModule, type TestComputedCharacter } from "@jointarp/module/testing/test-module"; -import { createGameTools } from "@tarp/core/node/agent/game-tools"; -import { ChatService } from "@tarp/core/node/game/chat-service"; +import { createGameTools } from "@jointarp/core/node/agent/game-tools"; +import { ChatService } from "@jointarp/core/node/game/chat-service"; import { gameDocumentViews, gameFolderIndex, readGamePath, updateGameDocument, -} from "@tarp/core/node/sessions/game-state"; -import { advanceLaunch, launchState } from "@tarp/core/node/sessions/launch-store"; +} from "@jointarp/core/node/sessions/game-state"; +import { advanceLaunch, launchState } from "@jointarp/core/node/sessions/launch-store"; import { createSession, gameDirectoryForDatabase, openSessionDatabase, roomDirectory, -} from "@tarp/core/node/sessions/session-store"; +} from "@jointarp/core/node/sessions/session-store"; +import { createTestModule, type TestComputedCharacter } from "@jointarp/module/testing/test-module"; test("模组选角与开场隔离秘密,主持可读取资料,字段揭示与结算持久化且失败不写入", async () => { const f = await createTestModule(); diff --git a/apps/desktop/src/main/modules/module-root.ts b/apps/desktop/src/main/modules/module-root.ts index 28e787d..4a97e4e 100644 --- a/apps/desktop/src/main/modules/module-root.ts +++ b/apps/desktop/src/main/modules/module-root.ts @@ -1,8 +1,8 @@ import { lstat } from "node:fs/promises"; import { join } from "node:path"; +import { isMissingFile } from "@jointarp/core/node/storage/file-queue"; import { configFilePath } from "@jointarp/module/node/config-file"; -import { isMissingFile } from "@tarp/core/node/storage/file-queue"; /** 模组库允许直接内容目录或固定 module/ 外层,根路径本身可以是本地快捷方式。 */ export async function resolveModuleRoot(directory: string): Promise { diff --git a/apps/desktop/src/main/reference-window-state.ts b/apps/desktop/src/main/reference-window-state.ts index edc38fe..71f55ad 100644 --- a/apps/desktop/src/main/reference-window-state.ts +++ b/apps/desktop/src/main/reference-window-state.ts @@ -1,4 +1,4 @@ -import { structuredFile } from "@tarp/core/node/storage/structured-file"; +import { structuredFile } from "@jointarp/core/node/storage/structured-file"; import { z } from "zod"; import type { WindowRectangle } from "./reference-window-bounds"; diff --git a/apps/desktop/src/main/sessions/character-store.test.ts b/apps/desktop/src/main/sessions/character-store.test.ts index fe68de4..0a9a8c3 100644 --- a/apps/desktop/src/main/sessions/character-store.test.ts +++ b/apps/desktop/src/main/sessions/character-store.test.ts @@ -5,17 +5,17 @@ import { access, mkdir, mkdtemp, realpath, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { writeTestFile as writeFile } from "@jointarp/module/testing/files"; -import { readAdventureState } from "@tarp/core/node/sessions/adventure-state"; -import { readCharacters } from "@tarp/core/node/sessions/character-db"; +import { readAdventureState } from "@jointarp/core/node/sessions/adventure-state"; +import { readCharacters } from "@jointarp/core/node/sessions/character-db"; import { characterSnapshot, characterViews, validateCharacterDraft, withCharacters, -} from "@tarp/core/node/sessions/character-store"; -import { publicGameDocuments } from "@tarp/core/node/sessions/game-state"; -import { createSession } from "@tarp/core/node/sessions/session-store"; +} from "@jointarp/core/node/sessions/character-store"; +import { publicGameDocuments } from "@jointarp/core/node/sessions/game-state"; +import { createSession } from "@jointarp/core/node/sessions/session-store"; +import { writeTestFile as writeFile } from "@jointarp/module/testing/files"; import { documentMediaUrl } from "../../shared/document-media"; import { resolveMediaRequestFile } from "../media-path"; diff --git a/apps/desktop/src/main/sessions/local-room-resources.ts b/apps/desktop/src/main/sessions/local-room-resources.ts index 2c4a4d4..931f513 100644 --- a/apps/desktop/src/main/sessions/local-room-resources.ts +++ b/apps/desktop/src/main/sessions/local-room-resources.ts @@ -1,7 +1,7 @@ import { join } from "node:path"; -import { listSessions, loadSession, loadSessionModuleResources } from "@tarp/core/node"; -import { roomDirectory } from "@tarp/core/node/sessions/session-store"; +import { listSessions, loadSession, loadSessionModuleResources } from "@jointarp/core/node"; +import { roomDirectory } from "@jointarp/core/node/sessions/session-store"; import { allowDocumentMediaRoots } from "../media-path"; diff --git a/apps/desktop/src/main/sessions/local-session-lifecycle.ts b/apps/desktop/src/main/sessions/local-session-lifecycle.ts index b3d12ef..6887537 100644 --- a/apps/desktop/src/main/sessions/local-session-lifecycle.ts +++ b/apps/desktop/src/main/sessions/local-session-lifecycle.ts @@ -1,5 +1,5 @@ -import type { ChatService } from "@tarp/core/node"; -import { deleteSession, setSessionStatus } from "@tarp/core/node/sessions/session-store"; +import type { ChatService } from "@jointarp/core/node"; +import { deleteSession, setSessionStatus } from "@jointarp/core/node/sessions/session-store"; /** 本地冒险状态、运行连接与资料窗口的关闭顺序由宿主统一协调。 */ export class LocalSessionLifecycle { diff --git a/apps/desktop/src/main/sessions/room-notes-router.test.ts b/apps/desktop/src/main/sessions/room-notes-router.test.ts index 5c51bd7..238df16 100644 --- a/apps/desktop/src/main/sessions/room-notes-router.test.ts +++ b/apps/desktop/src/main/sessions/room-notes-router.test.ts @@ -5,8 +5,8 @@ import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { initializeAdventure } from "@jointarp/core/node/sessions/room-storage"; import { call } from "@orpc/server"; -import { initializeAdventure } from "@tarp/core/node/sessions/room-storage"; import { roomNotesRouter } from "./room-notes-router"; diff --git a/apps/desktop/src/main/sessions/room-notes-router.ts b/apps/desktop/src/main/sessions/room-notes-router.ts index 7bb744d..c9fc9ca 100644 --- a/apps/desktop/src/main/sessions/room-notes-router.ts +++ b/apps/desktop/src/main/sessions/room-notes-router.ts @@ -1,6 +1,6 @@ +import { loadRoomNotes, saveRoomNotes } from "@jointarp/core/node/sessions/session-store"; +import { playerSchema, type Player } from "@jointarp/core/shared/game"; import { os, ORPCError } from "@orpc/server"; -import { loadRoomNotes, saveRoomNotes } from "@tarp/core/node/sessions/session-store"; -import { playerSchema, type Player } from "@tarp/core/shared/game"; import { z } from "zod"; interface RoomNotesContext { diff --git a/apps/desktop/src/main/sessions/session-router.ts b/apps/desktop/src/main/sessions/session-router.ts index 99ecf14..465aadd 100644 --- a/apps/desktop/src/main/sessions/session-router.ts +++ b/apps/desktop/src/main/sessions/session-router.ts @@ -1,22 +1,22 @@ -import { ORPCError } from "@orpc/server"; -import { ttsVoiceOverrideSchema } from "@shared/tts"; import { bindModuleSource, checkModuleUpdate, readModuleSource, -} from "@tarp/core/node/sessions/module-sync"; -import { roomDisplaySettings } from "@tarp/core/node/sessions/room-display-settings"; -import { readRoomSettings, patchRoomSettings } from "@tarp/core/node/sessions/room-settings"; -import { roomDirectory, createSession } from "@tarp/core/node/sessions/session-store"; +} from "@jointarp/core/node/sessions/module-sync"; +import { roomDisplaySettings } from "@jointarp/core/node/sessions/room-display-settings"; +import { readRoomSettings, patchRoomSettings } from "@jointarp/core/node/sessions/room-settings"; +import { roomDirectory, createSession } from "@jointarp/core/node/sessions/session-store"; import { compactionRoleSchema, compactionSettingsSchema, -} from "@tarp/core/shared/compaction-settings"; -import { companionInputSchema } from "@tarp/core/shared/companion"; -import { companionInitiativeSchema } from "@tarp/core/shared/companion-initiative"; -import { thinkingLevelSchema } from "@tarp/core/shared/game"; -import { roomConfigurationPatchSchema } from "@tarp/core/shared/game-defaults"; -import { identityIdSchema } from "@tarp/core/shared/identity"; +} from "@jointarp/core/shared/compaction-settings"; +import { companionInputSchema } from "@jointarp/core/shared/companion"; +import { companionInitiativeSchema } from "@jointarp/core/shared/companion-initiative"; +import { thinkingLevelSchema } from "@jointarp/core/shared/game"; +import { roomConfigurationPatchSchema } from "@jointarp/core/shared/game-defaults"; +import { identityIdSchema } from "@jointarp/core/shared/identity"; +import { ORPCError } from "@orpc/server"; +import { ttsVoiceOverrideSchema } from "@shared/tts"; import { z } from "zod"; import { assertAbsolutePath } from "../config/app-config"; diff --git a/apps/desktop/src/main/sessions/session-store.test.ts b/apps/desktop/src/main/sessions/session-store.test.ts index 868b581..5bd8f94 100644 --- a/apps/desktop/src/main/sessions/session-store.test.ts +++ b/apps/desktop/src/main/sessions/session-store.test.ts @@ -16,16 +16,15 @@ import { import { tmpdir } from "node:os"; import { join } from "node:path"; -import { writeTestFile as writeFile } from "@jointarp/module/testing/files"; import { beginAdventureEdit, commitAdventureEdit, updateAdventureState, -} from "@tarp/core/node/sessions/adventure-state"; -import { updateGameDocument } from "@tarp/core/node/sessions/game-state"; -import { roomDisplaySettings } from "@tarp/core/node/sessions/room-display-settings"; -import { readRoomSettings } from "@tarp/core/node/sessions/room-settings"; -import { readAdventure } from "@tarp/core/node/sessions/room-storage"; +} from "@jointarp/core/node/sessions/adventure-state"; +import { updateGameDocument } from "@jointarp/core/node/sessions/game-state"; +import { roomDisplaySettings } from "@jointarp/core/node/sessions/room-display-settings"; +import { readRoomSettings } from "@jointarp/core/node/sessions/room-settings"; +import { readAdventure } from "@jointarp/core/node/sessions/room-storage"; import { createSession, deleteSession, @@ -34,7 +33,8 @@ import { roomDirectory, saveRoomNotes, setSessionStatus, -} from "@tarp/core/node/sessions/session-store"; +} from "@jointarp/core/node/sessions/session-store"; +import { writeTestFile as writeFile } from "@jointarp/module/testing/files"; import { documentMediaUrl } from "../../shared/document-media"; import { resolveMediaRequestFile } from "../media-path"; diff --git a/apps/desktop/src/main/tts/mimo.ts b/apps/desktop/src/main/tts/mimo.ts index 1d3feac..1fff4d1 100644 --- a/apps/desktop/src/main/tts/mimo.ts +++ b/apps/desktop/src/main/tts/mimo.ts @@ -1,4 +1,4 @@ -import { defaultTtsConfig } from "@tarp/core/shared/voice"; +import { defaultTtsConfig } from "@jointarp/core/shared/voice"; import { TtsError, type TtsRequest, type TtsProvider } from "./provider"; import { readSse } from "./sse"; diff --git a/apps/desktop/src/main/tts/router.ts b/apps/desktop/src/main/tts/router.ts index 1ced188..8d1378c 100644 --- a/apps/desktop/src/main/tts/router.ts +++ b/apps/desktop/src/main/tts/router.ts @@ -1,7 +1,7 @@ +import { identityIdSchema } from "@jointarp/core/shared/identity"; import { eventIterator } from "@orpc/contract"; import { ORPCError } from "@orpc/server"; import { ttsVoiceOverrideSchema, ttsChunkSchema, ttsSynthesizeSchema } from "@shared/tts"; -import { identityIdSchema } from "@tarp/core/shared/identity"; import { z } from "zod"; import { AppConfigError } from "../config/app-config"; diff --git a/apps/desktop/src/main/tts/service.test.ts b/apps/desktop/src/main/tts/service.test.ts index 997b3aa..626b9e2 100644 --- a/apps/desktop/src/main/tts/service.test.ts +++ b/apps/desktop/src/main/tts/service.test.ts @@ -4,9 +4,9 @@ import { mkdir, mkdtemp, readFile, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { initializeRoomSettings } from "@jointarp/core/node/sessions/room-settings"; +import { initializeAdventure, updateAdventure } from "@jointarp/core/node/sessions/room-storage"; import { writeTestFile as writeFile } from "@jointarp/module/testing/files"; -import { initializeRoomSettings } from "@tarp/core/node/sessions/room-settings"; -import { initializeAdventure, updateAdventure } from "@tarp/core/node/sessions/room-storage"; import { mimoTtsProvider } from "./mimo"; import type { TtsProvider } from "./provider"; diff --git a/apps/desktop/src/main/tts/service.ts b/apps/desktop/src/main/tts/service.ts index d319ef3..dfa0a6b 100644 --- a/apps/desktop/src/main/tts/service.ts +++ b/apps/desktop/src/main/tts/service.ts @@ -1,11 +1,11 @@ import { createHash } from "node:crypto"; import { join } from "node:path"; +import { readRoomSettings, updateRoomSettings } from "@jointarp/core/node/sessions/room-settings"; +import { readAdventure } from "@jointarp/core/node/sessions/room-storage"; +import { roomDirectory } from "@jointarp/core/node/sessions/session-store"; import { documentIdentity } from "@jointarp/module/document-path"; import { loadModuleMetadata } from "@jointarp/module/node/module-metadata"; -import { readRoomSettings, updateRoomSettings } from "@tarp/core/node/sessions/room-settings"; -import { readAdventure } from "@tarp/core/node/sessions/room-storage"; -import { roomDirectory } from "@tarp/core/node/sessions/session-store"; import { z } from "zod"; import type { ModuleMetadata } from "../../shared/desktop-api"; diff --git a/apps/desktop/src/renderer/src/features/sessions/AgentContextDialog.tsx b/apps/desktop/src/renderer/src/features/sessions/AgentContextDialog.tsx index a930b9e..a8cdc13 100644 --- a/apps/desktop/src/renderer/src/features/sessions/AgentContextDialog.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/AgentContextDialog.tsx @@ -1,5 +1,5 @@ +import type { AgentContext } from "@jointarp/core/shared/agent-context"; import { useMutation, useQuery } from "@tanstack/react-query"; -import type { AgentContext } from "@tarp/core/shared/agent-context"; import { Copy, RefreshCw } from "lucide-react"; import { Button } from "../../components/ui/button"; diff --git a/apps/desktop/src/renderer/src/features/sessions/AgentDetails.tsx b/apps/desktop/src/renderer/src/features/sessions/AgentDetails.tsx index 3ab7715..4e9224e 100644 --- a/apps/desktop/src/renderer/src/features/sessions/AgentDetails.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/AgentDetails.tsx @@ -1,5 +1,5 @@ +import type { ChatMessage } from "@jointarp/core/shared/game"; import { useQuery } from "@tanstack/react-query"; -import type { ChatMessage } from "@tarp/core/shared/game"; import { ChevronRight, Brain, Wrench } from "lucide-react"; import { useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/CharacterCardDialog.tsx b/apps/desktop/src/renderer/src/features/sessions/CharacterCardDialog.tsx index d6260e8..41423cd 100644 --- a/apps/desktop/src/renderer/src/features/sessions/CharacterCardDialog.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/CharacterCardDialog.tsx @@ -1,5 +1,5 @@ +import type { GameSession } from "@jointarp/core/shared/session"; import type { Character } from "@jointarp/module/character"; -import type { GameSession } from "@tarp/core/shared/session"; import { useRef } from "react"; import { Dialog, DialogContent, DialogTitle } from "../../components/ui/dialog"; diff --git a/apps/desktop/src/renderer/src/features/sessions/CharacterSummary.tsx b/apps/desktop/src/renderer/src/features/sessions/CharacterSummary.tsx index 6336b11..c8c5cd5 100644 --- a/apps/desktop/src/renderer/src/features/sessions/CharacterSummary.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/CharacterSummary.tsx @@ -1,6 +1,6 @@ +import type { GameSession } from "@jointarp/core/shared/session"; import type { Character } from "@jointarp/module/character"; import type { DocumentType } from "@jointarp/module/document-type"; -import type { GameSession } from "@tarp/core/shared/session"; import { DocumentReferences } from "../modules/DocumentReferences"; import { buildCharacterSheet } from "./character-sheet"; diff --git a/apps/desktop/src/renderer/src/features/sessions/ChatMessageEntry.tsx b/apps/desktop/src/renderer/src/features/sessions/ChatMessageEntry.tsx index eb4b819..bb42ae6 100644 --- a/apps/desktop/src/renderer/src/features/sessions/ChatMessageEntry.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/ChatMessageEntry.tsx @@ -1,8 +1,8 @@ +import { chatText, visibleAgentMessages } from "@jointarp/core/shared/agent-message"; +import { parseCompanionPerformance } from "@jointarp/core/shared/companion"; +import type { ChatMessage } from "@jointarp/core/shared/game"; +import { parseNarrative, type NarrativeSegment } from "@jointarp/core/shared/narrative"; import { documentIdentity } from "@jointarp/module/document-path"; -import { chatText, visibleAgentMessages } from "@tarp/core/shared/agent-message"; -import { parseCompanionPerformance } from "@tarp/core/shared/companion"; -import type { ChatMessage } from "@tarp/core/shared/game"; -import { parseNarrative, type NarrativeSegment } from "@tarp/core/shared/narrative"; import { Flag } from "lucide-react"; import { createContext, diff --git a/apps/desktop/src/renderer/src/features/sessions/ChatPanel.tsx b/apps/desktop/src/renderer/src/features/sessions/ChatPanel.tsx index c771ee8..02fd647 100644 --- a/apps/desktop/src/renderer/src/features/sessions/ChatPanel.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/ChatPanel.tsx @@ -1,9 +1,9 @@ +import type { ChatMessage } from "@jointarp/core/shared/game"; +import type { GameSession, SessionModule } from "@jointarp/core/shared/session"; import type { Character } from "@jointarp/module/character"; import { documentIdentity } from "@jointarp/module/document-path"; import type { SpeechPart } from "@shared/speech-text"; import { useQuery } from "@tanstack/react-query"; -import type { ChatMessage } from "@tarp/core/shared/game"; -import type { GameSession, SessionModule } from "@tarp/core/shared/session"; import { BookOpen } from "lucide-react"; import { useCallback, diff --git a/apps/desktop/src/renderer/src/features/sessions/CompactionSettings.tsx b/apps/desktop/src/renderer/src/features/sessions/CompactionSettings.tsx index 7ef2f32..58a0bc5 100644 --- a/apps/desktop/src/renderer/src/features/sessions/CompactionSettings.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/CompactionSettings.tsx @@ -1,9 +1,9 @@ -import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { compactionSettingsSchema, resolveCompaction, type CompactionRole, -} from "@tarp/core/shared/compaction-settings"; +} from "@jointarp/core/shared/compaction-settings"; +import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { useId, useState } from "react"; import { Button } from "../../components/ui/button"; diff --git a/apps/desktop/src/renderer/src/features/sessions/CompanionInitiativeSettings.tsx b/apps/desktop/src/renderer/src/features/sessions/CompanionInitiativeSettings.tsx index dc73742..57ccfe6 100644 --- a/apps/desktop/src/renderer/src/features/sessions/CompanionInitiativeSettings.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/CompanionInitiativeSettings.tsx @@ -1,9 +1,9 @@ -import { useMutation, useQueryClient } from "@tanstack/react-query"; import { companionInitiativeOptions, companionInitiativeSchema, type CompanionInitiative, -} from "@tarp/core/shared/companion-initiative"; +} from "@jointarp/core/shared/companion-initiative"; +import { useMutation, useQueryClient } from "@tanstack/react-query"; import { useId, useState } from "react"; import { Button } from "../../components/ui/button"; diff --git a/apps/desktop/src/renderer/src/features/sessions/CompanionLaunchCard.tsx b/apps/desktop/src/renderer/src/features/sessions/CompanionLaunchCard.tsx index 67ceddb..4a17318 100644 --- a/apps/desktop/src/renderer/src/features/sessions/CompanionLaunchCard.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/CompanionLaunchCard.tsx @@ -1,5 +1,5 @@ +import type { CardData } from "@jointarp/core/shared/game"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import type { CardData } from "@tarp/core/shared/game"; import { Check, ChevronRight, UserRound, UsersRound } from "lucide-react"; import { useRef } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/CompanionSettingsDialog.tsx b/apps/desktop/src/renderer/src/features/sessions/CompanionSettingsDialog.tsx index fd94122..4c648c0 100644 --- a/apps/desktop/src/renderer/src/features/sessions/CompanionSettingsDialog.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/CompanionSettingsDialog.tsx @@ -1,10 +1,10 @@ -import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import type { CompanionModel } from "@tarp/core/shared/companion"; +import type { CompanionModel } from "@jointarp/core/shared/companion"; import { defaultCompanionInitiative, type CompanionInitiative, -} from "@tarp/core/shared/companion-initiative"; -import type { AiConfig } from "@tarp/core/shared/game"; +} from "@jointarp/core/shared/companion-initiative"; +import type { AiConfig } from "@jointarp/core/shared/game"; +import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { useState } from "react"; import { Button } from "../../components/ui/button"; diff --git a/apps/desktop/src/renderer/src/features/sessions/CreationWorkbench.tsx b/apps/desktop/src/renderer/src/features/sessions/CreationWorkbench.tsx index d6b3ca8..1f14bdb 100644 --- a/apps/desktop/src/renderer/src/features/sessions/CreationWorkbench.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/CreationWorkbench.tsx @@ -1,6 +1,6 @@ +import type { LaunchAction, LaunchState } from "@jointarp/core/shared/launch"; +import type { RoomLaunchState } from "@jointarp/core/shared/room-state"; import type { CreationAnswer } from "@jointarp/module/creation-workbench"; -import type { LaunchAction, LaunchState } from "@tarp/core/shared/launch"; -import type { RoomLaunchState } from "@tarp/core/shared/room-state"; import { Dices, Check } from "lucide-react"; import { lazy, Suspense, useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/DiceCard.tsx b/apps/desktop/src/renderer/src/features/sessions/DiceCard.tsx index 662da89..b32ca9c 100644 --- a/apps/desktop/src/renderer/src/features/sessions/DiceCard.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/DiceCard.tsx @@ -1,5 +1,5 @@ -import { parseDice } from "@tarp/core/shared/dice"; -import type { ChatMessage, Player } from "@tarp/core/shared/game"; +import { parseDice } from "@jointarp/core/shared/dice"; +import type { ChatMessage, Player } from "@jointarp/core/shared/game"; import { Dices } from "lucide-react"; import { AnimatePresence, motion, useReducedMotion } from "motion/react"; import { memo, useCallback, useEffect, useLayoutEffect, useRef, useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/GameParty.tsx b/apps/desktop/src/renderer/src/features/sessions/GameParty.tsx index 2282da7..eaba540 100644 --- a/apps/desktop/src/renderer/src/features/sessions/GameParty.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/GameParty.tsx @@ -1,6 +1,6 @@ +import type { Player } from "@jointarp/core/shared/game"; +import type { GameSession } from "@jointarp/core/shared/session"; import type { Character } from "@jointarp/module/character"; -import type { Player } from "@tarp/core/shared/game"; -import type { GameSession } from "@tarp/core/shared/session"; import { UserRound } from "lucide-react"; import { useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/HistoryAdventureList.tsx b/apps/desktop/src/renderer/src/features/sessions/HistoryAdventureList.tsx index 3ca7812..39fd015 100644 --- a/apps/desktop/src/renderer/src/features/sessions/HistoryAdventureList.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/HistoryAdventureList.tsx @@ -1,6 +1,6 @@ +import type { GameRoom, GameRoomSummary } from "@jointarp/core/shared/session"; import { documentMediaUrl } from "@shared/document-media"; import { Link } from "@tanstack/react-router"; -import type { GameRoom, GameRoomSummary } from "@tarp/core/shared/session"; import { History } from "lucide-react"; import { Button, buttonVariants } from "../../components/ui/button"; diff --git a/apps/desktop/src/renderer/src/features/sessions/LaunchCard.tsx b/apps/desktop/src/renderer/src/features/sessions/LaunchCard.tsx index 48681bf..109bf47 100644 --- a/apps/desktop/src/renderer/src/features/sessions/LaunchCard.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/LaunchCard.tsx @@ -1,5 +1,5 @@ +import type { ChatMessage } from "@jointarp/core/shared/game"; import type { Character } from "@jointarp/module/character"; -import type { ChatMessage } from "@tarp/core/shared/game"; import { Check, ContactRound, X } from "lucide-react"; import { AnimatePresence, motion, useReducedMotion } from "motion/react"; import { memo, useLayoutEffect, useRef, useState, type ReactNode } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/LaunchFlow.tsx b/apps/desktop/src/renderer/src/features/sessions/LaunchFlow.tsx index a1d440c..24f67cd 100644 --- a/apps/desktop/src/renderer/src/features/sessions/LaunchFlow.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/LaunchFlow.tsx @@ -1,5 +1,5 @@ -import type { LaunchAction, LaunchState } from "@tarp/core/shared/launch"; -import type { RoomLaunchState } from "@tarp/core/shared/room-state"; +import type { LaunchAction, LaunchState } from "@jointarp/core/shared/launch"; +import type { RoomLaunchState } from "@jointarp/core/shared/room-state"; import { ArrowLeft, ChevronLeft, ChevronRight, Plus, UserRound } from "lucide-react"; import { AnimatePresence, motion, type Variants } from "motion/react"; import { useEffect, useId, useRef, useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/ReadyLobby.tsx b/apps/desktop/src/renderer/src/features/sessions/ReadyLobby.tsx index 62f4f48..013610d 100644 --- a/apps/desktop/src/renderer/src/features/sessions/ReadyLobby.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/ReadyLobby.tsx @@ -1,5 +1,5 @@ -import type { ChatMessage } from "@tarp/core/shared/game"; -import type { SessionModule } from "@tarp/core/shared/session"; +import type { ChatMessage } from "@jointarp/core/shared/game"; +import type { SessionModule } from "@jointarp/core/shared/session"; import { ArrowRight, Check } from "lucide-react"; import { useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/RoomCompanionSettings.tsx b/apps/desktop/src/renderer/src/features/sessions/RoomCompanionSettings.tsx index d39e493..857dc58 100644 --- a/apps/desktop/src/renderer/src/features/sessions/RoomCompanionSettings.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/RoomCompanionSettings.tsx @@ -1,6 +1,6 @@ +import type { CompanionModel } from "@jointarp/core/shared/companion"; +import type { CompanionInitiative } from "@jointarp/core/shared/companion-initiative"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import type { CompanionModel } from "@tarp/core/shared/companion"; -import type { CompanionInitiative } from "@tarp/core/shared/companion-initiative"; import { Plus, Settings, UserRound, X } from "lucide-react"; import { useState, type ReactNode } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/RoomConfigurationSettings.tsx b/apps/desktop/src/renderer/src/features/sessions/RoomConfigurationSettings.tsx index 37abd49..52bb1a5 100644 --- a/apps/desktop/src/renderer/src/features/sessions/RoomConfigurationSettings.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/RoomConfigurationSettings.tsx @@ -1,5 +1,5 @@ +import { roomConfiguration } from "@jointarp/core/shared/game-defaults"; import { useQuery, useQueryClient } from "@tanstack/react-query"; -import { roomConfiguration } from "@tarp/core/shared/game-defaults"; import { Button } from "../../components/ui/button"; import { desktopOrpc, desktopRpc } from "../../desktop-rpc"; diff --git a/apps/desktop/src/renderer/src/features/sessions/RoomList.tsx b/apps/desktop/src/renderer/src/features/sessions/RoomList.tsx index 616ff6f..8836274 100644 --- a/apps/desktop/src/renderer/src/features/sessions/RoomList.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/RoomList.tsx @@ -1,6 +1,6 @@ +import type { GameRoomSummary } from "@jointarp/core/shared/session"; import { documentMediaUrl } from "@shared/document-media"; import { Link } from "@tanstack/react-router"; -import type { GameRoomSummary } from "@tarp/core/shared/session"; import { cn } from "cn"; import { ArrowRight } from "lucide-react"; import { useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/RoomMentionSettings.tsx b/apps/desktop/src/renderer/src/features/sessions/RoomMentionSettings.tsx index a6616d7..a0fe8fd 100644 --- a/apps/desktop/src/renderer/src/features/sessions/RoomMentionSettings.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/RoomMentionSettings.tsx @@ -1,5 +1,5 @@ +import { mentionReplyLimitSchema } from "@jointarp/core/shared/mentions"; import { useQuery, useQueryClient } from "@tanstack/react-query"; -import { mentionReplyLimitSchema } from "@tarp/core/shared/mentions"; import { Button } from "../../components/ui/button"; import { desktopOrpc, desktopRpc } from "../../desktop-rpc"; diff --git a/apps/desktop/src/renderer/src/features/sessions/RoomModelSettings.tsx b/apps/desktop/src/renderer/src/features/sessions/RoomModelSettings.tsx index 8e2e6d8..1b8ca30 100644 --- a/apps/desktop/src/renderer/src/features/sessions/RoomModelSettings.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/RoomModelSettings.tsx @@ -1,6 +1,6 @@ +import type { AiConfig } from "@jointarp/core/shared/game"; +import type { RoomAiSettings } from "@jointarp/core/shared/game"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import type { AiConfig } from "@tarp/core/shared/game"; -import type { RoomAiSettings } from "@tarp/core/shared/game"; import { useState } from "react"; import { Button } from "../../components/ui/button"; diff --git a/apps/desktop/src/renderer/src/features/sessions/RoomModule.test.tsx b/apps/desktop/src/renderer/src/features/sessions/RoomModule.test.tsx index 7309ee1..6665147 100644 --- a/apps/desktop/src/renderer/src/features/sessions/RoomModule.test.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/RoomModule.test.tsx @@ -1,7 +1,7 @@ import { test, mock } from "bun:test"; import { strict as assert } from "node:assert"; -import type { GameSession } from "@tarp/core/shared/session"; +import type { GameSession } from "@jointarp/core/shared/session"; import type { ReactNode } from "react"; import { renderToReadableStream } from "react-dom/server"; diff --git a/apps/desktop/src/renderer/src/features/sessions/RoomModule.tsx b/apps/desktop/src/renderer/src/features/sessions/RoomModule.tsx index 8cc9897..9f660cc 100644 --- a/apps/desktop/src/renderer/src/features/sessions/RoomModule.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/RoomModule.tsx @@ -1,7 +1,7 @@ +import type { GameSession } from "@jointarp/core/shared/session"; import { documentIdentity, typeFormatLabel } from "@jointarp/module/document-path"; import type { ModuleDocument } from "@shared/desktop-api"; import { searchItems } from "@shared/query"; -import type { GameSession } from "@tarp/core/shared/session"; import { BookOpenText, FileCode2, FileText, Library } from "lucide-react"; import { useEffect, useMemo, useState, type ReactNode } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/SessionStatus.tsx b/apps/desktop/src/renderer/src/features/sessions/SessionStatus.tsx index f31123a..5954fd2 100644 --- a/apps/desktop/src/renderer/src/features/sessions/SessionStatus.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/SessionStatus.tsx @@ -1,5 +1,5 @@ +import type { SessionActorMetrics, SessionMetrics } from "@jointarp/core/shared/session-metrics"; import { useMutation } from "@tanstack/react-query"; -import type { SessionActorMetrics, SessionMetrics } from "@tarp/core/shared/session-metrics"; import { Activity, Bot, diff --git a/apps/desktop/src/renderer/src/features/sessions/WorldStateCard.tsx b/apps/desktop/src/renderer/src/features/sessions/WorldStateCard.tsx index 5e4db86..2844807 100644 --- a/apps/desktop/src/renderer/src/features/sessions/WorldStateCard.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/WorldStateCard.tsx @@ -1,7 +1,7 @@ +import type { GameSession } from "@jointarp/core/shared/session"; import type { DocumentType } from "@jointarp/module/document-type"; import type { ModuleDocument } from "@jointarp/module/module-document"; import { isDocumentVisible } from "@jointarp/module/module-document"; -import type { GameSession } from "@tarp/core/shared/session"; import { ChevronDown } from "lucide-react"; import { useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/adventure-actions.tsx b/apps/desktop/src/renderer/src/features/sessions/adventure-actions.tsx index 2c2564d..2562f92 100644 --- a/apps/desktop/src/renderer/src/features/sessions/adventure-actions.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/adventure-actions.tsx @@ -1,5 +1,5 @@ import { Menu } from "@base-ui/react/menu"; -import type { GameRoom } from "@tarp/core/shared/session"; +import type { GameRoom } from "@jointarp/core/shared/session"; import { Archive, MoreHorizontal, RotateCcw, Trash2 } from "lucide-react"; import { useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/sessions/chat-timeline.test.ts b/apps/desktop/src/renderer/src/features/sessions/chat-timeline.test.ts index cb70fe9..80028ce 100644 --- a/apps/desktop/src/renderer/src/features/sessions/chat-timeline.test.ts +++ b/apps/desktop/src/renderer/src/features/sessions/chat-timeline.test.ts @@ -2,13 +2,13 @@ import { test, mock } from "bun:test"; import { strict as assert } from "node:assert"; import type { AssistantMessage } from "@earendil-works/pi-ai"; +import type { ChatMessage } from "@jointarp/core/shared/game"; import { advanceTimersByTime, getTimerCount, useFakeTimers, useRealTimers, } from "@jointarp/module/testing/async"; -import type { ChatMessage } from "@tarp/core/shared/game"; import { createElement } from "react"; import { renderToStaticMarkup } from "react-dom/server"; diff --git a/apps/desktop/src/renderer/src/features/sessions/chat-timeline.ts b/apps/desktop/src/renderer/src/features/sessions/chat-timeline.ts index cec3b07..771bbe9 100644 --- a/apps/desktop/src/renderer/src/features/sessions/chat-timeline.ts +++ b/apps/desktop/src/renderer/src/features/sessions/chat-timeline.ts @@ -1,4 +1,4 @@ -import type { ChatMessage } from "@tarp/core/shared/game"; +import type { ChatMessage } from "@jointarp/core/shared/game"; import { diceTimeline } from "./dice-timeline"; diff --git a/apps/desktop/src/renderer/src/features/sessions/dice-timeline.ts b/apps/desktop/src/renderer/src/features/sessions/dice-timeline.ts index fbd683a..439f418 100644 --- a/apps/desktop/src/renderer/src/features/sessions/dice-timeline.ts +++ b/apps/desktop/src/renderer/src/features/sessions/dice-timeline.ts @@ -1,4 +1,4 @@ -import type { ChatMessage } from "@tarp/core/shared/game"; +import type { ChatMessage } from "@jointarp/core/shared/game"; /** 同一 AI 回合可能先提出检定,掷骰后再继续;按调用位置展开公开正文。 */ export function diceTimeline(messages: ChatMessage[]): { key: string; message: ChatMessage }[] { diff --git a/apps/desktop/src/renderer/src/features/sessions/game-client.test.ts b/apps/desktop/src/renderer/src/features/sessions/game-client.test.ts index bab2bc8..e658738 100644 --- a/apps/desktop/src/renderer/src/features/sessions/game-client.test.ts +++ b/apps/desktop/src/renderer/src/features/sessions/game-client.test.ts @@ -1,7 +1,7 @@ import { test } from "bun:test"; import { strict as assert } from "node:assert"; -import type { SteeringSnapshot } from "@tarp/core/shared/game"; +import type { SteeringSnapshot } from "@jointarp/core/shared/game"; import { errorMessage, type GameClient } from "./game-client"; import { RoomChatStore } from "./room-chat-store"; diff --git a/apps/desktop/src/renderer/src/features/sessions/game-client.ts b/apps/desktop/src/renderer/src/features/sessions/game-client.ts index b99106d..e694d98 100644 --- a/apps/desktop/src/renderer/src/features/sessions/game-client.ts +++ b/apps/desktop/src/renderer/src/features/sessions/game-client.ts @@ -1,5 +1,5 @@ +import type { gameContract, ChatMessage } from "@jointarp/core/shared/game"; import type { ContractRouterClient } from "@orpc/contract"; -import type { gameContract, ChatMessage } from "@tarp/core/shared/game"; export type GameClient = ContractRouterClient; diff --git a/apps/desktop/src/renderer/src/features/sessions/history-adventures.test.tsx b/apps/desktop/src/renderer/src/features/sessions/history-adventures.test.tsx index 03a82ab..8e5696a 100644 --- a/apps/desktop/src/renderer/src/features/sessions/history-adventures.test.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/history-adventures.test.tsx @@ -1,6 +1,7 @@ import { test, mock } from "bun:test"; import { strict as assert } from "node:assert"; +import type { GameRoomSummary } from "@jointarp/core/shared/session"; import { createMemoryHistory, createRootRoute, @@ -9,7 +10,6 @@ import { Outlet, RouterProvider, } from "@tanstack/react-router"; -import type { GameRoomSummary } from "@tarp/core/shared/session"; import type { ComponentProps, ReactNode } from "react"; import { renderToReadableStream } from "react-dom/server"; diff --git a/apps/desktop/src/renderer/src/features/sessions/history-adventures.ts b/apps/desktop/src/renderer/src/features/sessions/history-adventures.ts index 142d620..09524f1 100644 --- a/apps/desktop/src/renderer/src/features/sessions/history-adventures.ts +++ b/apps/desktop/src/renderer/src/features/sessions/history-adventures.ts @@ -1,4 +1,4 @@ -import type { GameRoom } from "@tarp/core/shared/session"; +import type { GameRoom } from "@jointarp/core/shared/session"; const endedDate = new Intl.DateTimeFormat("zh-CN", { year: "numeric", diff --git a/apps/desktop/src/renderer/src/features/sessions/mention.test.ts b/apps/desktop/src/renderer/src/features/sessions/mention.test.ts index 877e603..1f96a80 100644 --- a/apps/desktop/src/renderer/src/features/sessions/mention.test.ts +++ b/apps/desktop/src/renderer/src/features/sessions/mention.test.ts @@ -1,7 +1,7 @@ import { test } from "bun:test"; import { strict as assert } from "node:assert"; -import { parseMentionRefs, resolveMentionRefs } from "@tarp/core/shared/mentions"; +import { parseMentionRefs, resolveMentionRefs } from "@jointarp/core/shared/mentions"; import { mentionDraftSchema, diff --git a/apps/desktop/src/renderer/src/features/sessions/mention.ts b/apps/desktop/src/renderer/src/features/sessions/mention.ts index 8d5f867..ebcb4cf 100644 --- a/apps/desktop/src/renderer/src/features/sessions/mention.ts +++ b/apps/desktop/src/renderer/src/features/sessions/mention.ts @@ -1,4 +1,4 @@ -import { identityIdSchema } from "@tarp/core/shared/identity"; +import { identityIdSchema } from "@jointarp/core/shared/identity"; import { z } from "zod"; /** 仅编辑器内部使用的文字和原子标签,不进入房间消息协议。 */ diff --git a/apps/desktop/src/renderer/src/features/sessions/npc-portrait-documents.ts b/apps/desktop/src/renderer/src/features/sessions/npc-portrait-documents.ts index 2d8dd06..1e71b4d 100644 --- a/apps/desktop/src/renderer/src/features/sessions/npc-portrait-documents.ts +++ b/apps/desktop/src/renderer/src/features/sessions/npc-portrait-documents.ts @@ -1,8 +1,8 @@ +import { visibleAgentMessages, publicAssistantText } from "@jointarp/core/shared/agent-message"; +import type { ChatMessage } from "@jointarp/core/shared/game"; +import { parseNarrative } from "@jointarp/core/shared/narrative"; import { documentIdentity } from "@jointarp/module/document-path"; import type { ModuleDocument } from "@shared/desktop-api"; -import { visibleAgentMessages, publicAssistantText } from "@tarp/core/shared/agent-message"; -import type { ChatMessage } from "@tarp/core/shared/game"; -import { parseNarrative } from "@tarp/core/shared/narrative"; /** 只选取实际发言的文档,图片和名称仍须读取玩家可见投影。 */ export function npcPortraitDocuments( diff --git a/apps/desktop/src/renderer/src/features/sessions/npc-portrait.test.ts b/apps/desktop/src/renderer/src/features/sessions/npc-portrait.test.ts index 76db3c4..e9766e6 100644 --- a/apps/desktop/src/renderer/src/features/sessions/npc-portrait.test.ts +++ b/apps/desktop/src/renderer/src/features/sessions/npc-portrait.test.ts @@ -1,8 +1,8 @@ import { test } from "bun:test"; import { strict as assert } from "node:assert"; +import type { ChatMessage } from "@jointarp/core/shared/game"; import type { ModuleDocument } from "@shared/desktop-api"; -import type { ChatMessage } from "@tarp/core/shared/game"; import { createNpcPortraitResolver } from "./npc-portrait"; import { npcPortraitDocuments } from "./npc-portrait-documents"; diff --git a/apps/desktop/src/renderer/src/features/sessions/room-chat-store.ts b/apps/desktop/src/renderer/src/features/sessions/room-chat-store.ts index df7b79f..ce7b3c7 100644 --- a/apps/desktop/src/renderer/src/features/sessions/room-chat-store.ts +++ b/apps/desktop/src/renderer/src/features/sessions/room-chat-store.ts @@ -1,10 +1,10 @@ -import { applyChatEvent } from "@tarp/core/shared/agent-message"; +import { applyChatEvent } from "@jointarp/core/shared/agent-message"; import type { ChatEvent, ChatMessage, SubmissionModeSnapshot, SteeringSnapshot, -} from "@tarp/core/shared/game"; +} from "@jointarp/core/shared/game"; import { mergeMessages, type GameClient } from "./game-client"; diff --git a/apps/desktop/src/renderer/src/features/sessions/room-connection.test.ts b/apps/desktop/src/renderer/src/features/sessions/room-connection.test.ts index 88f13b0..1cfcf27 100644 --- a/apps/desktop/src/renderer/src/features/sessions/room-connection.test.ts +++ b/apps/desktop/src/renderer/src/features/sessions/room-connection.test.ts @@ -2,13 +2,13 @@ import { test } from "bun:test"; import { strict as assert } from "node:assert"; import { randomUUID } from "node:crypto"; -import { advanceTimersByTime, useFakeTimers, useRealTimers } from "@jointarp/module/testing/async"; -import type { ChatMessage, RoomNotification } from "@tarp/core/shared/game"; +import type { ChatMessage, RoomNotification } from "@jointarp/core/shared/game"; import { createRoomReplica, createRoomBaseline, createRoomEncoder, -} from "@tarp/core/testing/room-replica"; +} from "@jointarp/core/testing/room-replica"; +import { advanceTimersByTime, useFakeTimers, useRealTimers } from "@jointarp/module/testing/async"; import type { GameClient } from "./game-client"; import { RoomConnection, type LocalRoomModuleLoader } from "./room-connection"; diff --git a/apps/desktop/src/renderer/src/features/sessions/room-connection.ts b/apps/desktop/src/renderer/src/features/sessions/room-connection.ts index a6d97b8..942ec90 100644 --- a/apps/desktop/src/renderer/src/features/sessions/room-connection.ts +++ b/apps/desktop/src/renderer/src/features/sessions/room-connection.ts @@ -1,14 +1,14 @@ -import { publicValues, type Character } from "@jointarp/module/character"; -import { documentIdentity } from "@jointarp/module/document-path"; -import { visibleDocumentProjection } from "@jointarp/module/module-document"; -import type { ModuleDocument } from "@shared/desktop-api"; -import type { ChatEvent } from "@tarp/core/shared/game"; +import type { ChatEvent } from "@jointarp/core/shared/game"; import { ROOM_PROTOCOL_VERSION, type RoomReplica, type SessionModuleResources, type RoomEntity, -} from "@tarp/core/shared/room-state"; +} from "@jointarp/core/shared/room-state"; +import { publicValues, type Character } from "@jointarp/module/character"; +import { documentIdentity } from "@jointarp/module/document-path"; +import { visibleDocumentProjection } from "@jointarp/module/module-document"; +import type { ModuleDocument } from "@shared/desktop-api"; import type { RendererDocumentEvaluator } from "../documents/computation/document-worker-protocol"; import { WorkerDocumentEvaluator } from "../documents/computation/worker-document-evaluator"; diff --git a/apps/desktop/src/renderer/src/features/sessions/room-document-loader.tsx b/apps/desktop/src/renderer/src/features/sessions/room-document-loader.tsx index 267b37f..d3f83a1 100644 --- a/apps/desktop/src/renderer/src/features/sessions/room-document-loader.tsx +++ b/apps/desktop/src/renderer/src/features/sessions/room-document-loader.tsx @@ -1,6 +1,6 @@ +import type { RoomEntity } from "@jointarp/core/shared/room-state"; import type { ModuleDocument } from "@shared/desktop-api"; import { keepPreviousData, useQuery } from "@tanstack/react-query"; -import type { RoomEntity } from "@tarp/core/shared/room-state"; import type { ReactNode } from "react"; import { desktopRpc } from "../../desktop-rpc"; diff --git a/apps/desktop/src/renderer/src/features/sessions/room-launch-view.ts b/apps/desktop/src/renderer/src/features/sessions/room-launch-view.ts index 3929e10..bc7dab3 100644 --- a/apps/desktop/src/renderer/src/features/sessions/room-launch-view.ts +++ b/apps/desktop/src/renderer/src/features/sessions/room-launch-view.ts @@ -1,7 +1,7 @@ +import type { RoomEntity, RoomLaunchState } from "@jointarp/core/shared/room-state"; import type { WorkbenchView } from "@jointarp/module/creation-workbench"; import { documentIdentity } from "@jointarp/module/document-path"; import type { ModuleDocument } from "@shared/desktop-api"; -import type { RoomEntity, RoomLaunchState } from "@tarp/core/shared/room-state"; /** 仅供下一条命令使用,不作为界面展示缓存。 */ export type LaunchCommandProgress = Pick & { roomId: string }; diff --git a/apps/desktop/src/renderer/src/features/sessions/room-state-store.test.ts b/apps/desktop/src/renderer/src/features/sessions/room-state-store.test.ts index 4044a0d..5dc0681 100644 --- a/apps/desktop/src/renderer/src/features/sessions/room-state-store.test.ts +++ b/apps/desktop/src/renderer/src/features/sessions/room-state-store.test.ts @@ -2,13 +2,13 @@ import { test } from "bun:test"; import { strict as assert } from "node:assert"; import { Decoder } from "@colyseus/schema"; -import { ROOM_MAX_FRAME_BYTES, type RoomReplica } from "@tarp/core/shared/room-state"; -import { RoomStateSchema } from "@tarp/core/shared/room-state-schema"; +import { ROOM_MAX_FRAME_BYTES, type RoomReplica } from "@jointarp/core/shared/room-state"; +import { RoomStateSchema } from "@jointarp/core/shared/room-state-schema"; import { createRoomReplica, createRoomBaseline, createRoomEncoder, -} from "@tarp/core/testing/room-replica"; +} from "@jointarp/core/testing/room-replica"; import { RoomStateStore } from "./room-state-store"; function setFields(state: RoomReplica, fields: Record) { diff --git a/apps/desktop/src/renderer/src/features/sessions/room-state-store.ts b/apps/desktop/src/renderer/src/features/sessions/room-state-store.ts index a7adafb..c268eb3 100644 --- a/apps/desktop/src/renderer/src/features/sessions/room-state-store.ts +++ b/apps/desktop/src/renderer/src/features/sessions/room-state-store.ts @@ -8,9 +8,9 @@ import { type RoomReplica, type RoomSections, type RoomStateFrame, -} from "@tarp/core/shared/room-state"; -import { applyRoomEntityOverlay } from "@tarp/core/shared/room-state-overlay"; -import { RoomStateSchema, stableJson } from "@tarp/core/shared/room-state-schema"; +} from "@jointarp/core/shared/room-state"; +import { applyRoomEntityOverlay } from "@jointarp/core/shared/room-state-overlay"; +import { RoomStateSchema, stableJson } from "@jointarp/core/shared/room-state-schema"; /** Decoder 保存累计覆盖;只有合并模组基线并校验成功后才发布当前视图。 */ export class RoomStateStore { diff --git a/apps/desktop/src/renderer/src/features/sessions/use-adventure-actions.ts b/apps/desktop/src/renderer/src/features/sessions/use-adventure-actions.ts index c3fabbb..7fb4518 100644 --- a/apps/desktop/src/renderer/src/features/sessions/use-adventure-actions.ts +++ b/apps/desktop/src/renderer/src/features/sessions/use-adventure-actions.ts @@ -1,6 +1,6 @@ +import type { GameRoom } from "@jointarp/core/shared/session"; import { useMutation, useQuery } from "@tanstack/react-query"; import { useNavigate } from "@tanstack/react-router"; -import type { GameRoom } from "@tarp/core/shared/session"; import { useState } from "react"; import { desktopOrpc, desktopRpc, queryClient } from "../../desktop-rpc"; diff --git a/apps/desktop/src/renderer/src/features/sessions/use-chat-composer.ts b/apps/desktop/src/renderer/src/features/sessions/use-chat-composer.ts index 96cfe0d..7960dfc 100644 --- a/apps/desktop/src/renderer/src/features/sessions/use-chat-composer.ts +++ b/apps/desktop/src/renderer/src/features/sessions/use-chat-composer.ts @@ -4,9 +4,9 @@ import type { SendInput, SubmissionMode, SteeringSnapshot, -} from "@tarp/core/shared/game"; -import { parseMentionRefs } from "@tarp/core/shared/mentions"; -import type { ChatActivitySnapshot } from "@tarp/core/shared/room-state"; +} from "@jointarp/core/shared/game"; +import { parseMentionRefs } from "@jointarp/core/shared/mentions"; +import type { ChatActivitySnapshot } from "@jointarp/core/shared/room-state"; import { useCallback, useEffect, useRef, useState } from "react"; import { errorMessage, type GameClient } from "./game-client"; diff --git a/apps/desktop/src/renderer/src/features/sessions/use-chat-log.ts b/apps/desktop/src/renderer/src/features/sessions/use-chat-log.ts index 6f7d0b5..e5d4a98 100644 --- a/apps/desktop/src/renderer/src/features/sessions/use-chat-log.ts +++ b/apps/desktop/src/renderer/src/features/sessions/use-chat-log.ts @@ -1,5 +1,9 @@ +import type { + ChatMessage, + SubmissionModeSnapshot, + SteeringSnapshot, +} from "@jointarp/core/shared/game"; import { AutomaticSpeechTracker, type SpeechPart } from "@shared/speech-text"; -import type { ChatMessage, SubmissionModeSnapshot, SteeringSnapshot } from "@tarp/core/shared/game"; import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react"; import { errorMessage, type GameClient } from "./game-client"; diff --git a/apps/desktop/src/renderer/src/features/sessions/use-room-state.ts b/apps/desktop/src/renderer/src/features/sessions/use-room-state.ts index a962007..d3365bc 100644 --- a/apps/desktop/src/renderer/src/features/sessions/use-room-state.ts +++ b/apps/desktop/src/renderer/src/features/sessions/use-room-state.ts @@ -1,8 +1,8 @@ +import type { LaunchState } from "@jointarp/core/shared/launch"; +import type { RoomEntity, RoomReplica } from "@jointarp/core/shared/room-state"; import { publicDocumentType, type Character } from "@jointarp/module/character"; import type { ModuleDocument } from "@shared/desktop-api"; import { keepPreviousData, useQueries, useQuery, useQueryClient } from "@tanstack/react-query"; -import type { LaunchState } from "@tarp/core/shared/launch"; -import type { RoomEntity, RoomReplica } from "@tarp/core/shared/room-state"; import { useEffect, useMemo, useRef, useSyncExternalStore } from "react"; import { desktopOrpc, desktopRpc } from "../../desktop-rpc"; diff --git a/apps/desktop/src/renderer/src/features/sessions/use-room-visible-documents.ts b/apps/desktop/src/renderer/src/features/sessions/use-room-visible-documents.ts index 4a5f5f2..f3011dc 100644 --- a/apps/desktop/src/renderer/src/features/sessions/use-room-visible-documents.ts +++ b/apps/desktop/src/renderer/src/features/sessions/use-room-visible-documents.ts @@ -1,7 +1,7 @@ +import type { ChatMessage } from "@jointarp/core/shared/game"; import { documentIdentity } from "@jointarp/module/document-path"; import type { ModuleDocument } from "@shared/desktop-api"; import { useQueries } from "@tanstack/react-query"; -import type { ChatMessage } from "@tarp/core/shared/game"; import { useMemo } from "react"; import { desktopRpc } from "../../desktop-rpc"; diff --git a/apps/desktop/src/renderer/src/features/settings/AiSettingsPanel.tsx b/apps/desktop/src/renderer/src/features/settings/AiSettingsPanel.tsx index 523ba6e..78de941 100644 --- a/apps/desktop/src/renderer/src/features/settings/AiSettingsPanel.tsx +++ b/apps/desktop/src/renderer/src/features/settings/AiSettingsPanel.tsx @@ -1,4 +1,4 @@ -import { customAiApis, type AiProviderSettings, type AiSettings } from "@tarp/core/shared/game"; +import { customAiApis, type AiProviderSettings, type AiSettings } from "@jointarp/core/shared/game"; import { Check, ChevronRight, Eye, EyeOff, Plus } from "lucide-react"; import { useCallback, useEffect, useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/settings/GameConfigurationFields.tsx b/apps/desktop/src/renderer/src/features/settings/GameConfigurationFields.tsx index bca6cf6..fccfe2c 100644 --- a/apps/desktop/src/renderer/src/features/settings/GameConfigurationFields.tsx +++ b/apps/desktop/src/renderer/src/features/settings/GameConfigurationFields.tsx @@ -1,17 +1,17 @@ -import { companionInitiativeOptions } from "@tarp/core/shared/companion-initiative"; +import { companionInitiativeOptions } from "@jointarp/core/shared/companion-initiative"; import { companionRoleplayInstructions, maxCompanionRoleplayLength, resolveCompanionRoleplay, -} from "@tarp/core/shared/companion-roleplay"; -import type { GameDefaults } from "@tarp/core/shared/game-defaults"; +} from "@jointarp/core/shared/companion-roleplay"; +import type { GameDefaults } from "@jointarp/core/shared/game-defaults"; import { defaultHostSystemPrompt, maxHostSystemPromptLength, resolveHostSystemPrompt, -} from "@tarp/core/shared/host-system-prompt"; -import { mentionReplyLimitSchema } from "@tarp/core/shared/mentions"; -import type { TtsVoiceOverride } from "@tarp/core/shared/voice"; +} from "@jointarp/core/shared/host-system-prompt"; +import { mentionReplyLimitSchema } from "@jointarp/core/shared/mentions"; +import type { TtsVoiceOverride } from "@jointarp/core/shared/voice"; import { useState, type ReactNode } from "react"; import { Button } from "../../components/ui/button"; diff --git a/apps/desktop/src/renderer/src/features/settings/GameConfigurationForm.tsx b/apps/desktop/src/renderer/src/features/settings/GameConfigurationForm.tsx index 85f265d..e3f14e7 100644 --- a/apps/desktop/src/renderer/src/features/settings/GameConfigurationForm.tsx +++ b/apps/desktop/src/renderer/src/features/settings/GameConfigurationForm.tsx @@ -1,5 +1,5 @@ -import { companionRoleplayInstructions } from "@tarp/core/shared/companion-roleplay"; -import { defaultHostSystemPrompt } from "@tarp/core/shared/host-system-prompt"; +import { companionRoleplayInstructions } from "@jointarp/core/shared/companion-roleplay"; +import { defaultHostSystemPrompt } from "@jointarp/core/shared/host-system-prompt"; import { useRef, useState } from "react"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../components/ui/tabs"; diff --git a/apps/desktop/src/renderer/src/features/settings/ModelPicker.tsx b/apps/desktop/src/renderer/src/features/settings/ModelPicker.tsx index 4619a25..bf003c3 100644 --- a/apps/desktop/src/renderer/src/features/settings/ModelPicker.tsx +++ b/apps/desktop/src/renderer/src/features/settings/ModelPicker.tsx @@ -2,7 +2,7 @@ import { thinkingLevelSchema, type ThinkingLevel, type AvailableAiModel, -} from "@tarp/core/shared/game"; +} from "@jointarp/core/shared/game"; import { Check, Search } from "lucide-react"; import { useRef, useState } from "react"; diff --git a/apps/desktop/src/renderer/src/features/settings/use-game-configuration.ts b/apps/desktop/src/renderer/src/features/settings/use-game-configuration.ts index 9adb38f..4473bc2 100644 --- a/apps/desktop/src/renderer/src/features/settings/use-game-configuration.ts +++ b/apps/desktop/src/renderer/src/features/settings/use-game-configuration.ts @@ -1,9 +1,9 @@ -import { useQuery } from "@tanstack/react-query"; import { patchGameDefaults, type GameDefaults, type GameDefaultsPatch, -} from "@tarp/core/shared/game-defaults"; +} from "@jointarp/core/shared/game-defaults"; +import { useQuery } from "@tanstack/react-query"; import { useEffect, useRef, useState } from "react"; import { desktopOrpc } from "../../desktop-rpc"; diff --git a/apps/desktop/src/shared/speech-text.test.ts b/apps/desktop/src/shared/speech-text.test.ts index b4115ca..dda5ce8 100644 --- a/apps/desktop/src/shared/speech-text.test.ts +++ b/apps/desktop/src/shared/speech-text.test.ts @@ -1,7 +1,7 @@ import { test } from "bun:test"; import { strict as assert } from "node:assert"; -import type { ChatMessage } from "@tarp/core/shared/game"; +import type { ChatMessage } from "@jointarp/core/shared/game"; import { AutomaticSpeechTracker, speechText, splitSpeechText } from "./speech-text"; import { ttsTextLimit } from "./tts"; diff --git a/apps/desktop/src/shared/speech-text.ts b/apps/desktop/src/shared/speech-text.ts index c9d9426..73261b8 100644 --- a/apps/desktop/src/shared/speech-text.ts +++ b/apps/desktop/src/shared/speech-text.ts @@ -1,6 +1,6 @@ -import { chatText, publicAssistantText } from "@tarp/core/shared/agent-message"; -import type { ChatMessage } from "@tarp/core/shared/game"; -import { parseNarrative } from "@tarp/core/shared/narrative"; +import { chatText, publicAssistantText } from "@jointarp/core/shared/agent-message"; +import type { ChatMessage } from "@jointarp/core/shared/game"; +import { parseNarrative } from "@jointarp/core/shared/narrative"; import type { TtsSpeaker } from "./tts"; import { ttsTextLimit } from "./tts"; diff --git a/apps/desktop/src/shared/tts.ts b/apps/desktop/src/shared/tts.ts index 456a175..4e867d2 100644 --- a/apps/desktop/src/shared/tts.ts +++ b/apps/desktop/src/shared/tts.ts @@ -1,12 +1,12 @@ -import type { TtsVoiceOverride } from "@tarp/core/shared/voice"; +import type { TtsVoiceOverride } from "@jointarp/core/shared/voice"; import { z } from "zod"; -export { roomTtsSettingsSchema, ttsVoiceOverrideSchema } from "@tarp/core/shared/voice"; -export type { TtsVoiceOverride } from "@tarp/core/shared/voice"; +export { roomTtsSettingsSchema, ttsVoiceOverrideSchema } from "@jointarp/core/shared/voice"; +export type { TtsVoiceOverride } from "@jointarp/core/shared/voice"; /** 播放端只依赖通用音频与配置;服务商协议留在主进程。 */ -export { ttsConfigSchema } from "@tarp/core/shared/voice"; -export type { TtsConfig } from "@tarp/core/shared/voice"; -import { ttsConfigSchema, type TtsConfig } from "@tarp/core/shared/voice"; +export { ttsConfigSchema } from "@jointarp/core/shared/voice"; +export type { TtsConfig } from "@jointarp/core/shared/voice"; +import { ttsConfigSchema, type TtsConfig } from "@jointarp/core/shared/voice"; export interface TtsProviderInfo { id: string; name: string; diff --git a/bun.lock b/bun.lock index 3a439f4..6487dbf 100644 --- a/bun.lock +++ b/bun.lock @@ -3,7 +3,7 @@ "configVersion": 1, "workspaces": { "": { - "name": "jointarp", + "name": "tarp", "dependencies": { "fast-json-patch": "^3.1.1", "nanoid": "^6.0.2", @@ -12,6 +12,7 @@ "lint-staged": "^17.6.0", "oxfmt": "^0.68.0", "simple-git-hooks": "^2.14.0", + "turbo": "2.11.10", }, }, "apps/desktop": { @@ -30,7 +31,7 @@ "@tanstack/react-query": "^5.103.1", "@tanstack/react-router": "^1.170.17", "@tanstack/react-virtual": "^3.14.13", - "@tarp/core": "workspace:*", + "@jointarp/core": "workspace:*", "@jointarp/module": "workspace:*", "@jointarp/module-cli": "workspace:*", "class-variance-authority": "^0.7.1", @@ -72,7 +73,7 @@ }, }, "packages/core": { - "name": "@tarp/core", + "name": "@jointarp/core", "version": "0.1.0", "dependencies": { "@colyseus/schema": "5.0.34", @@ -432,7 +433,7 @@ "@tanstack/virtual-core": ["@tanstack/virtual-core@3.17.11", "", {}, "sha512-+ILjvtHup6Y2hzQ6YzwMgX1Q+oQpxEGOXCEsCNaPoIP0VxMbizIBTmYTDtkerkIQS8/CbP1BRuyt8V/8BCsy1g=="], - "@tarp/core": ["@tarp/core@workspace:packages/core"], + "@jointarp/core": ["@jointarp/core@workspace:packages/core"], "@jointarp/desktop": ["@jointarp/desktop@workspace:apps/desktop"], @@ -440,6 +441,18 @@ "@jointarp/module-cli": ["@jointarp/module-cli@workspace:packages/module-cli"], + "@turbo/darwin-64": ["@turbo/darwin-64@2.11.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-By4idRap5+nLnMuRzLB4qkOPRlvNdyY1ne4VJYDyUoUB11H94k7uif9mbe3JT8JSNXs1D68uMcBj6hJ/jMQRvA=="], + + "@turbo/darwin-arm64": ["@turbo/darwin-arm64@2.11.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-pyEYlVcuexOPa92p0Wlwl9YT1Is5D60lxN3ItWm3g30YLvFaUq86TF4BBWg5ZAc0uMTnrOzCvuCsOBTdzUWnRQ=="], + + "@turbo/linux-64": ["@turbo/linux-64@2.11.10", "", { "os": [ "linux", "android", ], "cpu": "x64" }, "sha512-1tYeR/IDZ5HEdsb0jNq2L2xam5nMQ+g80tlV2BZmv4OFw+pMcUM0mMmUcfc5wXPPNHVNPuDMjh9Y8G8HgXPLZA=="], + + "@turbo/linux-arm64": ["@turbo/linux-arm64@2.11.10", "", { "os": [ "linux", "android", ], "cpu": "arm64" }, "sha512-HuekQxvVGhUd46g1Im/DKdOtglHr4/gguZAvzEpPUgtxNkztSa8lWhQEGQ+EmPQ0n7w19qjThFU+OfEEd0uvlw=="], + + "@turbo/windows-64": ["@turbo/windows-64@2.11.10", "", { "os": "win32", "cpu": "x64" }, "sha512-UJOP3BkbreY3/JlMgJR6ZiimxYIBn+c+B4tnBIxD0E9c3Estmk+XoVNVBNBottZLNRXe3/ScgOU4+/k8tIWysg=="], + + "@turbo/windows-arm64": ["@turbo/windows-arm64@2.11.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-xOkEjF3ws/b/YNlc+bvJHMYBn+vL+QbEISZFVi0qS+ImmhA1X3/gmNmBrjjIG3dg6aeN+n6gQitzSkXQ286qJQ=="], + "@types/bun": ["@types/bun@1.4.3", "", { "dependencies": { "bun-types": "1.4.3" } }, "sha512-N67Pqy8JXbAY/j0tNraS3V5mubGvc6rrrNDmDCtZLlFzccbUJPDb0tvgUBC5q4m8ybkP93Jcn1QB+RYQ6PvBhw=="], "@types/debug": ["@types/debug@4.1.13", "", { "dependencies": { "@types/ms": "*" } }, "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw=="], @@ -1122,6 +1135,8 @@ "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "turbo": ["turbo@2.11.10", "", { "optionalDependencies": { "@turbo/darwin-64": "2.11.10", "@turbo/darwin-arm64": "2.11.10", "@turbo/linux-64": "2.11.10", "@turbo/linux-arm64": "2.11.10", "@turbo/windows-64": "2.11.10", "@turbo/windows-arm64": "2.11.10" }, "bin": { "turbo": "bin/turbo" } }, "sha512-3GJYwig8ygEI89oaOZdduJX8/aw6O9eRPYHoIt6T3FZl9hkKjiyIspufJoVgqXihPoJu8M5CSV0DlZvzfohBCw=="], + "tw-animate-css": ["tw-animate-css@1.4.0", "", {}, "sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ=="], "type-detect": ["type-detect@4.0.8", "", {}, "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g=="], diff --git "a/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" "b/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" index 25c1a53..9b372f5 100644 --- "a/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" +++ "b/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" @@ -6,11 +6,15 @@ | --------------------------------------- | -------------------------- | ----------------------------------------------- | | `.github/workflows/ci.yml` | PR、手动运行、发布流程调用 | 格式、类型、完整测试与构建;PR 另验收桌面安装包 | | `.github/workflows/release-desktop.yml` | `desktop-v*` tag | 检查 → 各平台打包与验收 → Release 草稿 | -| `.github/workflows/release-cli.yml` | `cli-v*` tag | 检查 → CLI 打包与验收 → Release 草稿 | +| `.github/workflows/release-cli.yml` | `cli-v*` tag | 检查 → CLI 打包与验收 → Release 草稿 → npm 发布 | 发布工作流复用 CI,共用 `.github/actions/setup/action.yml` 安装根级 `packageManager` 指定的 Bun。依赖统一从根目录按 `bun.lock` 安装;共享包随产品构建,官网和剧情模组不参与构建。CLI 兼容性检查与 CLI 发布流程另外安装 Node.js 22.12.0,验证支持的最低版本。第三方 Actions 固定到提交 SHA,升级时同步核对版本。 -开发环境安装步骤缓存 Bun 的依赖下载目录,以及 Hutch 下的 `npm/`、`releases/`、`toolchains/`;按操作系统、架构、锁文件与工具链配置区分缓存。命中后仍执行 `bun install --frozen-lockfile`、构建和验收,不缓存 `node_modules`、项目构建目录、安装包或签名凭据。缓存不可用时按正常流程重新下载。 +开发环境安装步骤缓存 Bun 的依赖下载目录,以及 Hutch 下的 `npm/`、`releases/`、`toolchains/`;按操作系统、架构、锁文件与工具链配置区分缓存。命中后仍执行 `bun install --frozen-lockfile`、构建和验收,下载缓存不包含 `node_modules`、项目构建目录、安装包或签名凭据。缓存不可用时按正常流程重新下载。 + +根级 `bun run typecheck` 和 `bun run build` 由 Turborepo 调度。类型检查、CLI 构建以及桌面 Vite 页面构建可复用成功任务的结果;共享包源码通过依赖任务参与指纹,实际 Bun 版本、操作系统、架构和构建环境变量也参与区分。CLI 打包与测试准备复用同一构建任务。桌面主进程及原生应用始终重新构建,完整测试、打包、签名、公证、分发验收和 npm 发布均实际执行,不以缓存命中替代。 + +Actions 在开发环境安装步骤恢复并保存 `.turbo/cache`,按系统和架构隔离归档,无需新增 Secret 或远程缓存账号。缓存键包含锁文件、任务配置、提交和 job,后续提交通过前缀恢复已有任务结果,再由 Turbo 决定哪些任务需要重跑。`scripts/tasks.ts` 统一注入实际平台和 Bun 版本;排查时可运行 `bun scripts/tasks.ts run typecheck --force` 强制执行,或用 `--dry=json` 查看依赖和指纹。缓存输出不包括签名凭据、桌面原生应用及已发布的安装包。 GitHub 缓存有分支和 tag 作用域限制,PR 保存的缓存不能由合并后的发布 tag 直接读取;首次发布或新的 tag 可能需要重新下载,同一 tag 重跑可复用已有缓存。默认分支已有的兼容缓存也可供其他分支及发布流程读取。 @@ -56,10 +60,17 @@ macOS 签名使用仓库 Secrets `MAC_CSC_LINK`(HTTPS 证书地址或 Base64 P 流程完成后,在 GitHub Releases 检查草稿附件、版本说明和源码。在目标系统验收安装、GUI 启动、模组加载、计算及签名,再公开草稿;自动化验收不能替代安装器和 GUI 验证。源码与许可声明随分发产物提供,公开后同步官网的玩家下载入口。 -CLI 暂不自动上传 npm。确认包名、scope 权限和版本后,从草稿下载已验收的 tgz,在本机登录 npm 并使用 Bun 发布;正式版本使用 `latest`,预发布版本使用 `next`: +## CLI 自动发布到 npm -```sh -bun publish ./tarp-cli-v0.1.0.tgz --access public --tag latest -``` +推送 `cli-v*` tag 后,工作流先检查版本、打包并在 Node.js 与 Bun 下独立安装验收,再创建 GitHub Release 草稿,最后将同一份已验收 tgz 发布到 npm。包名为 `@jointarp/module-cli`,公开访问;正式版本使用 `latest`,带预发布标识的版本使用 `next`。GitHub Release 仍需手动公开,但 npm 包会在流程成功后立即公开。 + +首次使用前完成以下配置: + +1. npm 账号拥有 `@jointarp` scope,并有权发布 `@jointarp/module-cli`;首次发布时 Token 的权限需要覆盖新包创建。 +2. 在 npm 创建 Granular Access Token,授予目标包或 scope 的发布写权限;启用用于无人值守发布的 2FA bypass,并设置合适的有效期。 +3. 在 GitHub 仓库 `Settings → Secrets and variables → Actions` 添加 `NPM_TOKEN`。工作流仅在凭据检查和发布步骤读取它,不将其写入下载缓存。 +4. 修改 CLI 版本并同步根级锁文件,合并 PR 后推送完全一致的 tag。发布成功后可用 `bunx --bun @jointarp/module-cli@0.1.0 --version` 验证目标版本。 + +工作流使用 Bun 发布,无需 npm CLI。缺失 Token、权限不足、Token 过期或同版本已存在均会使任务失败;不会跳过失败并宣称已发布。 构建或上传失败可重跑失败任务,Actions 中间产物保留 14 天。已有草稿可重跑更新同名附件,已公开版本拒绝覆盖;修复源码或产物时发布新版本,不移动已发布 tag。npm 同名同版本不可重复上传。 diff --git "a/docs/\346\265\213\350\257\225\347\273\264\346\212\244.md" "b/docs/\346\265\213\350\257\225\347\273\264\346\212\244.md" index b011f87..9cee96c 100644 --- "a/docs/\346\265\213\350\257\225\347\273\264\346\212\244.md" +++ "b/docs/\346\265\213\350\257\225\347\273\264\346\212\244.md" @@ -4,7 +4,7 @@ 测试统一使用 Bun 内置的 `bun:test`,运行环境与桌面主进程一致。`scripts/test.ts` 负责 workspace 范围和 CLI 预构建,使用 `--isolate` 隔离每个测试文件的模块与全局状态。根级 `bunfig.toml` 加载 `scripts/test-preload.ts`,解析已有 UI 别名并忽略样式导入;TypeScript 与 TSX 由 Bun 原生处理。当前界面测试验证服务端渲染结果,真实界面交互按相关变更手工检查。 -数据库直接使用 `bun:sqlite` 与 Kysely,业务查询和事务同步执行,建表在打开连接时完成。开发环境和 CI 使用 Bun 1.4.0 或更新版本。CLI 测试在执行前构建产物,并分别通过 Node.js 和 Bun 验证同一份实际分发入口;这部分测试需要 Node.js 22.12.0 或更新版本,CI 固定最低版本执行。可用 `TARP_CLI_NODE` 指向指定的 Node.js 可执行文件。 +数据库直接使用 `bun:sqlite` 与 Kysely,业务查询和事务同步执行,建表在打开连接时完成。开发环境和 CI 使用 Bun 1.4.0 或更新版本。CLI 测试在执行前通过 Turborepo 构建或恢复与当前源码和 Bun 环境对应的产物,并分别通过 Node.js 和 Bun 验证同一份实际分发入口;这部分测试需要 Node.js 22.12.0 或更新版本,CI 固定最低版本执行。可用 `TARP_CLI_NODE` 指向指定的 Node.js 可执行文件。 测试用于发现独立故障。新增测试应说明具体触发条件、错误结果和用户影响;不按函数数量、文件数量或覆盖率目标补用例。 @@ -16,7 +16,7 @@ | `bun run test <文件路径或功能目录>` | 已知修改范围时直接运行相关测试 | | `bun run test` | 平台完整回归,包含同步、存档、计算核心和界面消费者 | -根目录运行以上命令覆盖整个平台,在应用或包目录执行时只运行对应 workspace。也可以在根目录使用 `bun run test --scope @tarp/core` 指定 workspace。 +根目录运行以上命令覆盖整个平台,在应用或包目录执行时只运行对应 workspace。也可以在根目录使用 `bun run test --scope @jointarp/core` 指定 workspace。 Git 影响筛选使用 Bun 的导入关系,无法替代运行时协议、磁盘格式和跨进程链路验证,也不会跟踪运行时从磁盘复制的测试模组文件。修改包内固定测试模组时运行 `bun run test`。修改这些边界时运行平台完整回归。改动已提交后,默认影响筛选可能没有结果;此时明确指定文件或用 `bun run test --changed=<提交或分支>` 指定比较基准。性能脚本按相关改动运行,不纳入每次迭代的默认测试。 diff --git a/package.json b/package.json index 9882a64..9535f53 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "jointarp", + "name": "tarp", "private": true, "homepage": "https://jointarp.party", "license": "GPL-3.0-only", @@ -11,8 +11,8 @@ "scripts": { "dev": "bun run --filter @jointarp/desktop dev", "cli": "bun packages/module-cli/out/index.js", - "build": "bun run --workspaces --if-present build", - "typecheck": "bun run --workspaces typecheck", + "build": "bun scripts/tasks.ts run build", + "typecheck": "bun scripts/tasks.ts run typecheck", "test": "bun scripts/test.ts", "fmt": "oxfmt", "fmt:check": "oxfmt --check", @@ -28,7 +28,8 @@ "devDependencies": { "lint-staged": "^17.6.0", "oxfmt": "^0.68.0", - "simple-git-hooks": "^2.14.0" + "simple-git-hooks": "^2.14.0", + "turbo": "2.11.10" }, "simple-git-hooks": { "pre-commit": "bunx --bun lint-staged" diff --git a/packages/core/README.md b/packages/core/README.md index 491eaf2..c8fd07f 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -1,16 +1,16 @@ # 游戏服务核心 -`@tarp/core` 提供桌面主进程与未来云端宿主共用的房间服务。依赖方向为宿主 → `core` → `module`;核心不引用桌面源码、Electrobun、React 或个人应用配置。 +`@jointarp/core` 提供桌面主进程与未来云端宿主共用的房间服务。依赖方向为宿主 → `core` → `module`;核心不引用桌面源码、Electrobun、React 或个人应用配置。 ## 入口与职责 -| 入口 | 职责 | -| ---------------------- | ------------------------------------------------------ | -| `@tarp/core/shared` | 游戏通信契约、房间与开局类型;浏览器和宿主共用 | -| `@tarp/core/shared/*` | 消息处理、同步结构、叙事解析、队友与声音配置等共享能力 | -| `@tarp/core/node` | `ChatService`、游戏路由、Pi runtime 和房间存档入口 | -| `@tarp/core/node/*` | 房间存储、状态、AI 工具及文件读写等服务端能力 | -| `@tarp/core/testing/*` | 已有测试共用的独立临时模组与房间数据 | +| 入口 | 职责 | +| -------------------------- | ------------------------------------------------------ | +| `@jointarp/core/shared` | 游戏通信契约、房间与开局类型;浏览器和宿主共用 | +| `@jointarp/core/shared/*` | 消息处理、同步结构、叙事解析、队友与声音配置等共享能力 | +| `@jointarp/core/node` | `ChatService`、游戏路由、Pi runtime 和房间存档入口 | +| `@jointarp/core/node/*` | 房间存储、状态、AI 工具及文件读写等服务端能力 | +| `@jointarp/core/testing/*` | 已有测试共用的独立临时模组与房间数据 | `node` 入口在浏览器条件下不可导入。共享入口只引用浏览器可用的实现或类型,不导出 SQLite、文件系统和 AI runtime。 diff --git a/packages/core/package.json b/packages/core/package.json index 5b701b9..8a34b63 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,5 +1,5 @@ { - "name": "@tarp/core", + "name": "@jointarp/core", "version": "0.1.0", "private": true, "license": "GPL-3.0-only", @@ -19,8 +19,8 @@ }, "scripts": { "typecheck": "bun --bun x --no-install tsc --noEmit", - "test": "bun ../../scripts/test.ts --scope @tarp/core", - "test:changed": "bun ../../scripts/test.ts --scope @tarp/core --changed" + "test": "bun ../../scripts/test.ts --scope @jointarp/core", + "test:changed": "bun ../../scripts/test.ts --scope @jointarp/core --changed" }, "dependencies": { "@colyseus/schema": "5.0.34", diff --git a/packages/module-cli/README.md b/packages/module-cli/README.md index 0199f36..f77228e 100644 --- a/packages/module-cli/README.md +++ b/packages/module-cli/README.md @@ -12,7 +12,7 @@ tarp --help tarp module validate ./module --json ``` -安装时自动提供 YAML、Zod、smol-toml,不需要源码仓库。预览仍需安装桌面应用,并设置 `TARP_DESKTOP` 为其可执行文件路径。包名与 scope 需在实际发布前确认。 +安装时自动提供 YAML、Zod、smol-toml,不需要源码仓库。预览仍需安装桌面应用,并设置 `TARP_DESKTOP` 为其可执行文件路径。 完整使用说明只在「官网 CLI 指南」维护。本页保留 npm 最小入口及源码开发、协议验收和发布步骤。 @@ -52,9 +52,9 @@ bun run build 发布包只包含 `index.js`、`package.json`、README、GPL v3 LICENSE 和 NOTICE.md。发布时使用独立的 `out/` 目录。`bun run pack` 只生成本地产物,不上传到 npm。 -确认包名、scope 权限和版本后,在本子包执行 `bun publish --cwd out` 发布。用户安装的是构建后的 JavaScript,无需在安装时运行 Bun 构建。 +推送与 CLI 版本一致的 `cli-v*` tag 后,GitHub Actions 验收 tgz,再将同一份包自动发布到 npm;需要预先配置 `NPM_TOKEN`。用户安装的是构建后的 JavaScript,无需在安装时运行 Bun 构建。 -GitHub Actions 的 CLI tag、独立安装验收、Release 草稿和手动 npm 发布见[发布流程](../../docs/发布流程.md)。 +GitHub Actions 的 CLI tag、独立安装验收、Release 草稿和 npm 自动发布见[发布流程](../../docs/发布流程.md)。 ## 许可证 diff --git a/packages/module-cli/package.json b/packages/module-cli/package.json index 0674351..a1e2c46 100644 --- a/packages/module-cli/package.json +++ b/packages/module-cli/package.json @@ -15,7 +15,7 @@ "build": "bun scripts/build.mjs", "typecheck": "bun --bun x --no-install tsc --noEmit", "test": "bun ../../scripts/test.ts --scope @jointarp/module-cli", - "pack": "bun run build && bun pm pack --cwd out --filename tarp-module-cli.tgz", + "pack": "bun ../../scripts/tasks.ts run build --filter=./packages/module-cli && bun pm pack --cwd out --filename tarp-module-cli.tgz", "test:changed": "bun ../../scripts/test.ts --scope @jointarp/module-cli --changed" }, "dependencies": { diff --git a/packages/module/README.md b/packages/module/README.md index c663685..ed5e8a8 100644 --- a/packages/module/README.md +++ b/packages/module/README.md @@ -1,6 +1,6 @@ # 模组共享能力 -`@jointarp/module` 提供游戏服务核心、桌面应用与模组 CLI 共用的文档模型、字段计算和加载校验逻辑。房间生命周期与本局状态由 `@tarp/core` 管理,通用模组读取不依赖游戏服务。 +`@jointarp/module` 提供游戏服务核心、桌面应用与模组 CLI 共用的文档模型、字段计算和加载校验逻辑。房间生命周期与本局状态由 `@jointarp/core` 管理,通用模组读取不依赖游戏服务。 - 根级子路径:文档类型、元配置、引用、开局和计算字段等逻辑,可供前端与主进程使用。 - `@jointarp/module/node/*`:JSON/TOML/Markdown 编解码、文件加载、模组校验与 ZIP 安全解压,仅供具备文件系统能力的运行时使用。 diff --git a/scripts/tasks.ts b/scripts/tasks.ts new file mode 100644 index 0000000..0896751 --- /dev/null +++ b/scripts/tasks.ts @@ -0,0 +1,18 @@ +import { resolve } from "node:path"; + +// 平台与实际 Bun 版本参与任务指纹,避免本地和不同 runner 误用缓存。 +const child = Bun.spawn( + [process.execPath, "x", "--no-install", "turbo", ...process.argv.slice(2)], + { + cwd: resolve(import.meta.dirname, ".."), + env: { + ...process.env, + TARP_TASK_PLATFORM: `${process.platform}-${process.arch}`, + TARP_TASK_BUN: Bun.version, + }, + stdin: "inherit", + stdout: "inherit", + stderr: "inherit", + }, +); +process.exit(await child.exited); diff --git a/scripts/test.ts b/scripts/test.ts index 5be4018..0aef8de 100644 --- a/scripts/test.ts +++ b/scripts/test.ts @@ -5,20 +5,23 @@ const args = process.argv.slice(2); const scopeIndex = args.indexOf("--scope"); const scopes: Record = { "@jointarp/desktop": ["apps/desktop/src", "apps/desktop/scripts"], - "@tarp/core": ["packages/core/src"], + "@jointarp/core": ["packages/core/src"], "@jointarp/module": ["packages/module/src"], "@jointarp/module-cli": ["packages/module-cli/src"], }; const scope = scopeIndex >= 0 ? args.splice(scopeIndex, 2)[1] : undefined; if (scopeIndex >= 0 && !scope) throw new Error("请指定测试 workspace"); if (scope && !scopes[scope]) throw new Error(`未知测试范围:${scope}`); -// CLI 测试验证实际分发入口,不能依赖此前构建留下的文件。 +// CLI 测试验证实际分发入口;Turbo 按源码和运行环境构建或恢复对应产物。 if (!scope || scope === "@jointarp/module-cli") { - const build = Bun.spawn([process.execPath, "run", "--filter", "@jointarp/module-cli", "build"], { - cwd: root, - stdout: "inherit", - stderr: "inherit", - }); + const build = Bun.spawn( + [process.execPath, "scripts/tasks.ts", "run", "build", "--filter=./packages/module-cli"], + { + cwd: root, + stdout: "inherit", + stderr: "inherit", + }, + ); if (await build.exited) process.exit(1); } const ignored = scope diff --git a/turbo.json b/turbo.json new file mode 100644 index 0000000..04f2f16 --- /dev/null +++ b/turbo.json @@ -0,0 +1,50 @@ +{ + "$schema": "https://turborepo.dev/schema.json", + "globalDependencies": [ + "bunfig.toml", + "scripts/**/*.ts", + "scripts/**/*.mjs", + "LICENSE", + "NOTICE.md" + ], + "globalEnv": ["TARP_TASK_PLATFORM", "TARP_TASK_BUN", "NODE_ENV"], + "globalPassThroughEnv": [ + "HUTCH_HOME", + "DASH_HOME", + "BUN_INSTALL_CACHE_DIR", + "TMPDIR", + "TMP", + "TEMP" + ], + "tasks": { + "source": { + "dependsOn": ["^source"] + }, + "typecheck": { + "dependsOn": ["^source"], + "outputs": [] + }, + "build": { + "dependsOn": ["^source"], + "outputs": [ + "out/index.js", + "out/package.json", + "out/README.md", + "out/LICENSE", + "out/NOTICE.md" + ] + }, + "@jointarp/desktop#build": { + "dependsOn": ["^build"], + "cache": false, + "env": ["TARP_CODESIGN", "TARP_NOTARIZE", "ELECTROBUN_*"], + "outputs": [] + }, + "build:renderer": { + "dependsOn": ["^source"], + "env": ["VITE_*"], + "inputs": ["$TURBO_DEFAULT$", ".env", ".env.*", "src/renderer/.env", "src/renderer/.env.*"], + "outputs": ["out/renderer/**"] + } + } +}