Przeglądaj źródła

fix: apply ts-build-config adjustment to new packages

imccyu 3 miesięcy temu
rodzic
commit
88b75181ad

+ 1 - 1
package.json

@@ -13,7 +13,7 @@
   ],
   "scripts": {
     "build": "tsc -b tsconfig.build.json && tsdown",
-    "clean:build": "rm -rf .typecheck packages/*/lib vendor/*/lib *.tsbuildinfo",
+    "clean:build": "rm -rf .typecheck packages/*/*/lib vendor/*/lib *.tsbuildinfo",
     "typecheck": "tsc -b tsconfig.json",
     "lint": "eslint .",
     "lint:fix": "eslint . --fix",

+ 1 - 1
packages/bash/bash/src/index.ts

@@ -17,7 +17,7 @@
 import { Context, Service } from 'cordis'
 import type { BashExecRequest, BashExecSpec, BashRunResult, BashTask, BashTaskId, BashTaskListener, BashTaskRead, OwnerToken } from './types'
 
-export { BashTaskId, OwnerToken } from './types.ts'
+export { BashTaskId, OwnerToken } from './types'
 export type {
   BashExecRequest,
   BashExecSpec,

+ 5 - 3
packages/core/agent-core/package.json

@@ -5,17 +5,19 @@
   "private": true,
   "type": "module",
   "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "types": "lib/types/index.d.ts",
   "exports": {
     ".": {
-      "types": "./lib/index.d.ts",
+      "types": "./lib/types/index.d.ts",
       "default": "./lib/index.js"
     },
     "./src/*": "./src/*",
     "./package.json": "./package.json"
   },
   "files": [
-    "lib",
+    "lib/index.js",
+    "lib/types/**/*.d.ts",
+    "lib/types/**/*.d.ts.map",
     "src"
   ],
   "license": "BSD-3-Clause",

+ 1 - 1
packages/core/agent-core/tests/agent-core.spec.ts

@@ -1,7 +1,7 @@
 import { describe, expect, it } from 'vitest'
 import { Context } from 'cordis'
 import Loader from '@cordisjs/plugin-loader'
-import * as agentCore from '../src/index.ts'
+import * as agentCore from '../src/index'
 import { AgentId } from '@deepseek-ai/dsh-agent'
 
 /**

+ 1 - 1
packages/core/agent-core/tsconfig.json

@@ -2,7 +2,7 @@
   "extends": "../../../tsconfig.base.json",
   "compilerOptions": {
     "rootDir": "src",
-    "outDir": "lib"
+    "outDir": "lib/types"
   },
   "include": [
     "src"

+ 1 - 1
packages/core/agent-loop/tests/cancel.spec.ts

@@ -18,7 +18,7 @@ import SystemPrompt from '@deepseek-ai/dsh-system-prompt'
 import ToolRegistry from '@deepseek-ai/dsh-tools'
 import AgentRegistry, { AgentId } from '@deepseek-ai/dsh-agent'
 import AgentLoop, { ReactLoopAgent } from '@deepseek-ai/dsh-agent-loop'
-import { MockAdapter, textResponse } from './mock-adapter.ts'
+import { MockAdapter, textResponse } from './mock-adapter'
 
 async function harness(adapter: MockAdapter) {
   const ctx = new Context()

+ 1 - 1
packages/core/agent/tests/gen-cordis-catalog.spec.ts

@@ -14,7 +14,7 @@ import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'
 import { tmpdir } from 'node:os'
 import { join } from 'node:path'
 import { afterEach, describe, expect, it } from 'vitest'
-import { collectEvents } from '../../../../scripts/gen-cordis-catalog.ts'
+import { collectEvents } from '../../../../scripts/gen-cordis-catalog'
 
 /** Write a fixture package exposing one `interface Events` block and return the
  * scan root to hand `collectEvents`. */

+ 1 - 1
packages/llm/llm-deepseek/tests/adapter.e2e.ts

@@ -4,7 +4,7 @@ import LlmService, { CallId } from '@deepseek-ai/dsh-llm'
 import type { Message, ToolSchema } from '@deepseek-ai/dsh-llm'
 import * as LlmDeepSeek from '@deepseek-ai/dsh-llm-deepseek'
 import type { Config } from '@deepseek-ai/dsh-llm-deepseek'
-import { assemble, type AssembledResult } from './assemble.ts'
+import { assemble, type AssembledResult } from './assemble'
 
 /**
  * Real-API e2e for the hand-rolled adapter: V4 Flash + V4 Pro across

+ 1 - 1
packages/llm/llm-deepseek/tests/adapter.spec.ts

@@ -5,7 +5,7 @@ import { Context } from 'cordis'
 import LlmService, { LlmError } from '@deepseek-ai/dsh-llm'
 import * as LlmDeepSeek from '@deepseek-ai/dsh-llm-deepseek'
 import { DeepSeekAdapter, httpErrorCode } from '@deepseek-ai/dsh-llm-deepseek'
-import { assemble } from './assemble.ts'
+import { assemble } from './assemble'
 
 /** One scripted behavior for the next request the mock server receives. */
 type Behavior =

+ 1 - 1
packages/llm/llm-pi-ai/tests/adapter.e2e.ts

@@ -5,7 +5,7 @@ import type { Message, ToolSchema } from '@deepseek-ai/dsh-llm'
 import * as LlmPiAi from '@deepseek-ai/dsh-llm-pi-ai'
 import type { Config } from '@deepseek-ai/dsh-llm-pi-ai'
 import * as LlmDeepSeek from '@deepseek-ai/dsh-llm-deepseek'
-import { assemble, type AssembledResult } from './assemble.ts'
+import { assemble, type AssembledResult } from './assemble'
 
 /**
  * Real-API e2e for the pi-ai-backed adapter: V4 Flash + V4 Pro across all

+ 1 - 1
packages/llm/llm-pi-ai/tests/adapter.spec.ts

@@ -5,7 +5,7 @@ import { Context } from 'cordis'
 import LlmService, { CallId, LlmError } from '@deepseek-ai/dsh-llm'
 import * as LlmPiAi from '@deepseek-ai/dsh-llm-pi-ai'
 import { buildModel, PiAiAdapter } from '@deepseek-ai/dsh-llm-pi-ai'
-import { assemble } from './assemble.ts'
+import { assemble } from './assemble'
 
 /** Scripted SSE responses, one per request (OpenAI chat-completions shape). */
 interface MockServer {

+ 2 - 2
packages/llm/llm/src/assembler.ts

@@ -6,8 +6,8 @@
  * @module @deepseek-ai/dsh-llm/assembler
  */
 
-import { CallId } from './brand.ts'
-import { assertNever } from './never.ts'
+import { CallId } from './brand'
+import { assertNever } from './never'
 import type { ContentBlock, FinishReason, Message, StreamChunk, TokenUsage } from './types'
 
 interface PartialBlock {

+ 1 - 1
packages/session-persistence/session-persistence/src/coordinator.ts

@@ -27,7 +27,7 @@
 import { Context } from 'cordis'
 import { interruptedTurnClosers, SESSION_FORMAT_VERSION } from '@deepseek-ai/dsh-session'
 import type { Session, SessionEvent, SessionId, SessionHeader } from '@deepseek-ai/dsh-session'
-import { assertSerializable, seedCoversPrefix } from './index.ts'
+import { assertSerializable, seedCoversPrefix } from './index'
 
 /**
  * A stored session's durable prefix as read back from a backend: its

+ 2 - 2
packages/session-persistence/session-persistence/src/index.ts

@@ -29,8 +29,8 @@ import type { SessionEvent, SessionId, SessionHeader } from '@deepseek-ai/dsh-se
 export type { SessionHeader } from '@deepseek-ai/dsh-session'
 
 // The backend-agnostic write-path orchestration first-party backends compose.
-export { PersistenceCoordinator } from './coordinator.ts'
-export type { PersistenceBackend, StoredPrefix } from './coordinator.ts'
+export { PersistenceCoordinator } from './coordinator'
+export type { PersistenceBackend, StoredPrefix } from './coordinator'
 
 declare module 'cordis' {
   interface Context {

+ 2 - 2
packages/session-persistence/session-persistence/tests/coordinator-contract.ts

@@ -30,8 +30,8 @@ import { describe, expect, it } from 'vitest'
 import { Context, type Fiber } from 'cordis'
 import SessionStore, { SESSION_FORMAT_VERSION, SessionId } from '@deepseek-ai/dsh-session'
 import type { Session, SessionEvent } from '@deepseek-ai/dsh-session'
-import type { SessionPersistence } from '../src/index.ts'
-import { meta, oneTurnLog } from './contract.ts'
+import type { SessionPersistence } from '../src/index'
+import { meta, oneTurnLog } from './contract'
 
 /**
  * The backend-specific capabilities the orchestration suite needs beyond the

+ 7 - 4
packages/ui/acp-agent/package.json

@@ -5,24 +5,27 @@
   "private": true,
   "type": "module",
   "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "types": "lib/types/index.d.ts",
   "bin": {
     "dsh-acp-agent": "lib/bin.js"
   },
   "exports": {
     ".": {
-      "types": "./lib/index.d.ts",
+      "types": "./lib/types/index.d.ts",
       "default": "./lib/index.js"
     },
     "./bin": {
-      "types": "./lib/bin.d.ts",
+      "types": "./lib/types/bin.d.ts",
       "default": "./lib/bin.js"
     },
     "./src/*": "./src/*",
     "./package.json": "./package.json"
   },
   "files": [
-    "lib",
+    "lib/index.js",
+    "lib/bin.js",
+    "lib/types/**/*.d.ts",
+    "lib/types/**/*.d.ts.map",
     "src"
   ],
   "license": "BSD-3-Clause",

+ 1 - 1
packages/ui/acp-agent/tests/acp-agent.spec.ts

@@ -1,7 +1,7 @@
 import { describe, expect, it } from 'vitest'
 import { Context } from 'cordis'
 import Loader from '@cordisjs/plugin-loader'
-import * as acpAgent from '../src/index.ts'
+import * as acpAgent from '../src/index'
 
 /**
  * In-process unit coverage for the @deepseek-ai/dsh-acp-agent composition:

+ 1 - 1
packages/ui/acp-agent/tsconfig.json

@@ -2,7 +2,7 @@
   "extends": "../../../tsconfig.base.json",
   "compilerOptions": {
     "rootDir": "src",
-    "outDir": "lib"
+    "outDir": "lib/types"
   },
   "include": [
     "src"

+ 4 - 3
packages/ui/acp-agent/tsdown.config.ts

@@ -3,11 +3,12 @@ import { defineConfig } from 'tsdown'
 /**
  * acp-agent ships TWO entries: the plugin (`index`) and the CLI `bin` (`bin`),
  * the latter referenced by package.json `bin`/`exports["./bin"]`. The root
- * tsdown builds only `src/index.ts`, so this override adds `bin.ts`.
- * Declarations come from `tsc -b` (dts: false), matching every package.
+ * tsdown builds only `lib/types/index.js`, so this override adds
+ * `lib/types/bin.js`. Declarations come from `tsc -b` (dts: false),
+ * matching every package.
  */
 export default defineConfig({
-  entry: ['src/index.ts', 'src/bin.ts'],
+  entry: ['lib/types/index.js', 'lib/types/bin.js'],
   outDir: 'lib',
   format: ['esm'],
   platform: 'node',

+ 7 - 4
packages/ui/stdio-agent/package.json

@@ -5,24 +5,27 @@
   "private": true,
   "type": "module",
   "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "types": "lib/types/index.d.ts",
   "bin": {
     "dsh-stdio-agent": "lib/bin.js"
   },
   "exports": {
     ".": {
-      "types": "./lib/index.d.ts",
+      "types": "./lib/types/index.d.ts",
       "default": "./lib/index.js"
     },
     "./bin": {
-      "types": "./lib/bin.d.ts",
+      "types": "./lib/types/bin.d.ts",
       "default": "./lib/bin.js"
     },
     "./src/*": "./src/*",
     "./package.json": "./package.json"
   },
   "files": [
-    "lib",
+    "lib/index.js",
+    "lib/bin.js",
+    "lib/types/**/*.d.ts",
+    "lib/types/**/*.d.ts.map",
     "src"
   ],
   "license": "BSD-3-Clause",

+ 1 - 1
packages/ui/stdio-agent/tests/stdio-agent.spec.ts

@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest'
 import { Context } from 'cordis'
 import Loader from '@cordisjs/plugin-loader'
 import { AgentId } from '@deepseek-ai/dsh-agent'
-import * as stdioAgent from '../src/index.ts'
+import * as stdioAgent from '../src/index'
 
 /**
  * Unit coverage for the @deepseek-ai/dsh-stdio-agent app plugin: mounting it

+ 1 - 1
packages/ui/stdio-agent/tsconfig.json

@@ -2,7 +2,7 @@
   "extends": "../../../tsconfig.base.json",
   "compilerOptions": {
     "rootDir": "src",
-    "outDir": "lib"
+    "outDir": "lib/types"
   },
   "include": [
     "src"

+ 4 - 3
packages/ui/stdio-agent/tsdown.config.ts

@@ -3,11 +3,12 @@ import { defineConfig } from 'tsdown'
 /**
  * stdio-agent ships TWO entries: the plugin (`index`) and the CLI `bin`
  * (`bin`), the latter referenced by package.json `bin`/`exports["./bin"]`.
- * The root tsdown builds only `src/index.ts`, so this override adds `bin.ts`.
- * Declarations come from `tsc -b` (dts: false), matching every package.
+ * The root tsdown builds only `lib/types/index.js`, so this override adds
+ * `lib/types/bin.js`. Declarations come from `tsc -b` (dts: false),
+ * matching every package.
  */
 export default defineConfig({
-  entry: ['src/index.ts', 'src/bin.ts'],
+  entry: ['lib/types/index.js', 'lib/types/bin.js'],
   outDir: 'lib',
   format: ['esm'],
   platform: 'node',

+ 5 - 3
packages/util/brand/package.json

@@ -5,17 +5,19 @@
   "private": true,
   "type": "module",
   "main": "lib/index.js",
-  "types": "lib/index.d.ts",
+  "types": "lib/types/index.d.ts",
   "exports": {
     ".": {
-      "types": "./lib/index.d.ts",
+      "types": "./lib/types/index.d.ts",
       "default": "./lib/index.js"
     },
     "./src/*": "./src/*",
     "./package.json": "./package.json"
   },
   "files": [
-    "lib",
+    "lib/index.js",
+    "lib/types/**/*.d.ts",
+    "lib/types/**/*.d.ts.map",
     "src"
   ],
   "license": "BSD-3-Clause",

+ 1 - 1
packages/util/brand/tsconfig.json

@@ -2,7 +2,7 @@
   "extends": "../../../tsconfig.base.json",
   "compilerOptions": {
     "rootDir": "src",
-    "outDir": "lib"
+    "outDir": "lib/types"
   },
   "include": [
     "src"

+ 22 - 18
tsconfig.json

@@ -20,23 +20,27 @@
     { "path": "./vendor/timer" },
     { "path": "./vendor/hmr" },
     { "path": "./vendor/logger-console" },
-    { "path": "./packages/llm" },
-    { "path": "./packages/session" },
-    { "path": "./packages/session-persistence" },
-    { "path": "./packages/session-persistence-jsonl" },
-    { "path": "./packages/session-persistence-sqlite" },
-    { "path": "./packages/system-prompt" },
-    { "path": "./packages/agent" },
-    { "path": "./packages/tools" },
-    { "path": "./packages/agent-loop" },
-    { "path": "./packages/bash" },
-    { "path": "./packages/llm-deepseek" },
-    { "path": "./packages/llm-pi-ai" },
-    { "path": "./packages/bash-local" },
-    { "path": "./packages/tool-bash" },
-    { "path": "./packages/invariants" },
-    { "path": "./packages/acp" },
-    { "path": "./packages/ui-stdio" },
-    { "path": "./packages/llm-replay" }
+    { "path": "./packages/util/brand" },
+    { "path": "./packages/llm/llm" },
+    { "path": "./packages/core/session" },
+    { "path": "./packages/session-persistence/session-persistence" },
+    { "path": "./packages/session-persistence/session-persistence-jsonl" },
+    { "path": "./packages/session-persistence/session-persistence-sqlite" },
+    { "path": "./packages/core/system-prompt" },
+    { "path": "./packages/core/agent" },
+    { "path": "./packages/core/tools" },
+    { "path": "./packages/core/agent-loop" },
+    { "path": "./packages/core/agent-core" },
+    { "path": "./packages/bash/bash" },
+    { "path": "./packages/llm/llm-deepseek" },
+    { "path": "./packages/llm/llm-pi-ai" },
+    { "path": "./packages/bash/bash-local" },
+    { "path": "./packages/bash/tool-bash" },
+    { "path": "./packages/support/invariants" },
+    { "path": "./packages/ui/acp" },
+    { "path": "./packages/ui/acp-agent" },
+    { "path": "./packages/ui/stdio-agent" },
+    { "path": "./packages/support/ui-stdio" },
+    { "path": "./packages/support/llm-replay" }
   ]
 }