refactor: ts in packages use extensionless import

This commit is contained in:
imccyu
2026-06-17 23:17:38 +08:00
parent 20773e12bd
commit 6f6e0517d4
22 changed files with 62 additions and 62 deletions

View File

@@ -69,7 +69,7 @@ import {
harnessBlockToAcpContent,
promptHasUnsupportedContent,
turnEndToStopReason,
} from './codec.ts'
} from './codec'
export const name = 'acp'
// The bridge programs against the interface packages only (architecture rule:

View File

@@ -11,8 +11,8 @@ import type { AgentId, AgentOptions, AgentStatus, SendOptions } from '@deepseek-
import type { Agent } from '@deepseek-ai/dsh-agent'
import type { ContentBlock, MessageSource } from '@deepseek-ai/dsh-llm'
import type { Session } from '@deepseek-ai/dsh-session'
import { Inbox } from './inbox.ts'
import { isTurnOpen, lastTurnNumber, runLoop } from './loop.ts'
import { Inbox } from './inbox'
import { isTurnOpen, lastTurnNumber, runLoop } from './loop'
/**
* The concrete {@link Agent} implementation owned by the agent-loop plugin.

View File

@@ -18,11 +18,11 @@ import type { Session } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-system-prompt'
import type {} from '@deepseek-ai/dsh-tools'
import type { SessionPersistence } from '@deepseek-ai/dsh-session-persistence'
import { ReactLoopAgent } from './agent.ts'
import { ReactLoopAgent } from './agent'
export { ReactLoopAgent } from './agent.ts'
export { Inbox, type InboxMessage } from './inbox.ts'
export { runLoop } from './loop.ts'
export { ReactLoopAgent } from './agent'
export { Inbox, type InboxMessage } from './inbox'
export { runLoop } from './loop'
declare module 'cordis' {
interface Context {

View File

@@ -13,7 +13,7 @@ import { BlockAssembler, HarnessError } from '@deepseek-ai/dsh-llm'
import type { Session, TurnEndReason, TurnTrigger } from '@deepseek-ai/dsh-session'
import { renderPrompt } from '@deepseek-ai/dsh-system-prompt'
import type {} from '@deepseek-ai/dsh-tools'
import type { ReactLoopAgent } from './agent.ts'
import type { ReactLoopAgent } from './agent'
/** An Error with an optional machine-readable code (e.g., from LlmError or a throwing plugin). */
type CodedError = Error & { code?: string }

View File

@@ -7,9 +7,9 @@
import { Context, Service } from 'cordis'
import type { SessionId } from '@deepseek-ai/dsh-session'
import type { Agent, AgentOptions } from './types.ts'
import type { Agent, AgentOptions } from './types'
export * from './types.ts'
export * from './types'
declare module 'cordis' {
interface Context {

View File

@@ -17,11 +17,11 @@ import { Context } from 'cordis'
import z from 'schemastery'
import { BashExecutor } from '@deepseek-ai/dsh-bash'
import type { BashExecRequest, BashExecSpec, BashRunResult, BashTask, BashTaskRead } from '@deepseek-ai/dsh-bash'
import { runBash } from './run.ts'
import type { RunInternals, RunningBash } from './run.ts'
import { runBash } from './run'
import type { RunInternals, RunningBash } from './run'
export { DEFAULT_GRACE_MS, ENV_OVERRIDES, killGroup, OutputCollector, runBash } from './run.ts'
export type { RunInternals, RunningBash, SpawnOutcome, SpawnSpec } from './run.ts'
export { DEFAULT_GRACE_MS, ENV_OVERRIDES, killGroup, OutputCollector, runBash } from './run'
export type { RunInternals, RunningBash, SpawnOutcome, SpawnSpec } from './run'
/** Plugin config (all optional — `static Config` supplies the defaults). */
export interface Config {

View File

@@ -15,7 +15,7 @@
*/
import { Context, Service } from 'cordis'
import type { BashExecRequest, BashExecSpec, BashRunResult, BashTask, BashTaskListener, BashTaskRead } from './types.ts'
import type { BashExecRequest, BashExecSpec, BashRunResult, BashTask, BashTaskListener, BashTaskRead } from './types'
export type {
BashExecRequest,
@@ -26,7 +26,7 @@ export type {
BashTaskRead,
BashTaskStatus,
CollectedOutput,
} from './types.ts'
} from './types'
declare module 'cordis' {
interface Context {

View File

@@ -7,11 +7,11 @@
import { LlmAdapter, LlmError } from '@deepseek-ai/dsh-llm'
import type { GenerateOptions, StreamChunk } from '@deepseek-ai/dsh-llm'
import { serializeRequest } from './serialize.ts'
import type { RequestDefaults } from './serialize.ts'
import { parseSse } from './sse.ts'
import { translate } from './translate.ts'
import type { WireError } from './types.ts'
import { serializeRequest } from './serialize'
import type { RequestDefaults } from './serialize'
import { parseSse } from './sse'
import { translate } from './translate'
import type { WireError } from './types'
export interface DeepSeekAdapterOptions {
apiKey: string

View File

@@ -21,15 +21,15 @@
import type { Context } from 'cordis'
import z from 'schemastery'
import type {} from '@deepseek-ai/dsh-llm'
import { DeepSeekAdapter } from './adapter.ts'
import { DeepSeekAdapter } from './adapter'
export { DeepSeekAdapter, httpErrorCode } from './adapter.ts'
export type { DeepSeekAdapterOptions } from './adapter.ts'
export { serializeMessages, serializeRequest } from './serialize.ts'
export type { RequestDefaults } from './serialize.ts'
export { DONE, parseSse } from './sse.ts'
export { mapFinishReason, mapUsage, translate } from './translate.ts'
export type * from './types.ts'
export { DeepSeekAdapter, httpErrorCode } from './adapter'
export type { DeepSeekAdapterOptions } from './adapter'
export { serializeMessages, serializeRequest } from './serialize'
export type { RequestDefaults } from './serialize'
export { DONE, parseSse } from './sse'
export { mapFinishReason, mapUsage, translate } from './translate'
export type * from './types'
export const name = 'llm-deepseek'
export const inject = ['llm']

View File

@@ -18,7 +18,7 @@
import { LlmError } from '@deepseek-ai/dsh-llm'
import type { ContentBlock, GenerateOptions, Message } from '@deepseek-ai/dsh-llm'
import type { WireMessage, WireRequest, WireTool } from './types.ts'
import type { WireMessage, WireRequest, WireTool } from './types'
/** Adapter-level request defaults (from plugin config). */
export interface RequestDefaults {

View File

@@ -16,8 +16,8 @@
import { CallId, LlmError } from '@deepseek-ai/dsh-llm'
import type { ContentBlock, FinishReason, StreamChunk, TokenUsage } from '@deepseek-ai/dsh-llm'
import { DONE } from './sse.ts'
import type { WireChunk, WireUsage } from './types.ts'
import { DONE } from './sse'
import type { WireChunk, WireUsage } from './types'
/** One open block under assembly. */
interface OpenBlock {

View File

@@ -15,7 +15,7 @@ import { stream as piStream } from '@earendil-works/pi-ai'
import type { Model } from '@earendil-works/pi-ai'
import { LlmAdapter, LlmError } from '@deepseek-ai/dsh-llm'
import type { GenerateOptions, StreamChunk, ToolSchema } from '@deepseek-ai/dsh-llm'
import { toPiContext, toStreamChunks } from './convert.ts'
import { toPiContext, toStreamChunks } from './convert'
/** Reasoning levels surfaced by this adapter (DeepSeek wire: high|max). */
export type PiAiReasoning = 'off' | 'high' | 'xhigh'

View File

@@ -19,12 +19,12 @@
import type { Context } from 'cordis'
import z from 'schemastery'
import type {} from '@deepseek-ai/dsh-llm'
import { PiAiAdapter } from './adapter.ts'
import type { PiAiReasoning } from './adapter.ts'
import { PiAiAdapter } from './adapter'
import type { PiAiReasoning } from './adapter'
export { buildModel, PiAiAdapter } from './adapter.ts'
export type { PiAiAdapterOptions, PiAiReasoning } from './adapter.ts'
export { mapStopReason, mapUsage, toPiContext, toStreamChunks } from './convert.ts'
export { buildModel, PiAiAdapter } from './adapter'
export type { PiAiAdapterOptions, PiAiReasoning } from './adapter'
export { mapStopReason, mapUsage, toPiContext, toStreamChunks } from './convert'
export const name = 'llm-pi-ai'
export const inject = ['llm']

View File

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

View File

@@ -7,15 +7,15 @@
*/
import { Context, Service } from 'cordis'
import type { ContentBlock, GenerateOptions, GenerateResult, StreamChunk } from './types.ts'
import { BlockAssembler } from './assembler.ts'
import { HarnessError } from './error.ts'
import type { ContentBlock, GenerateOptions, GenerateResult, StreamChunk } from './types'
import { BlockAssembler } from './assembler'
import { HarnessError } from './error'
export * from './brand.ts'
export * from './never.ts'
export * from './error.ts'
export * from './types.ts'
export { BlockAssembler } from './assembler.ts'
export * from './brand'
export * from './never'
export * from './error'
export * from './types'
export { BlockAssembler } from './assembler'
declare module 'cordis' {
interface Context {

View File

@@ -19,7 +19,7 @@
* ```
*/
import type { CallId } from './brand.ts'
import type { CallId } from './brand'
/** Cache hint attached to a content block (provider-interpreted). */
export type CacheHint = 'ephemeral'

View File

@@ -32,7 +32,7 @@ import { interruptedTurnClosers } from '@deepseek-ai/dsh-session'
import type { Session, SessionEvent, SessionId, SessionMeta, SessionSummary } from '@deepseek-ai/dsh-session'
import {
encodeSegment, eventLine, logPath, parseHeaderMeta, scanLog, sessionDir, sidecarPath, toHeaderLine,
} from './format.ts'
} from './format'
export interface Config {
/**

View File

@@ -31,9 +31,9 @@ import { interruptedTurnClosers } from '@deepseek-ai/dsh-session'
import type { Session, SessionEvent, SessionId, SessionMeta, SessionSummary } from '@deepseek-ai/dsh-session'
import {
openDatabase, rowToMeta, scanRows, type EventRow, type SessionRow,
} from './schema.ts'
} from './schema'
export { SCHEMA_VERSION } from './schema.ts'
export { SCHEMA_VERSION } from './schema'
/** Plugin configuration. */
export interface Config {

View File

@@ -9,13 +9,13 @@
import { Context, Service } from 'cordis'
import { isAbsolute } from 'node:path'
import type { ContentBlock, Message, MessageSource } from '@deepseek-ai/dsh-llm'
import { SessionId } from './types.ts'
import type { CreateSessionOptions, SessionEvent, SessionEventMap, SessionEventType, SessionHeader } from './types.ts'
import { isJsonValue } from './json.ts'
import { SessionId } from './types'
import type { CreateSessionOptions, SessionEvent, SessionEventMap, SessionEventType, SessionHeader } from './types'
import { isJsonValue } from './json'
export * from './types.ts'
export { isJsonValue } from './json.ts'
export { interruptedTurnClosers } from './repair.ts'
export * from './types'
export { isJsonValue } from './json'
export { interruptedTurnClosers } from './repair'
declare module 'cordis' {
interface Context {

View File

@@ -36,7 +36,7 @@
*/
import type { CallId } from '@deepseek-ai/dsh-llm'
import type { SessionEvent } from './types.ts'
import type { SessionEvent } from './types'
/**
* Scan `events` for an open turn/step at the tail and return the synthetic

View File

@@ -24,7 +24,7 @@ export {
type InferArgs,
type DefineToolOptions,
type JsonSchemaObject,
} from './schema.ts'
} from './schema'
declare module 'cordis' {
interface Context {

View File

@@ -21,7 +21,7 @@
import type { ContentBlock } from '@deepseek-ai/dsh-llm'
import { assertNever, HarnessError } from '@deepseek-ai/dsh-llm'
import type { ToolCallPresentation, ToolDefinition, ToolExecution, ToolResult, ToolResultPresentation } from './index.ts'
import type { ToolCallPresentation, ToolDefinition, ToolExecution, ToolResult, ToolResultPresentation } from './index'
// ---------------------------------------------------------------------------
// SchemaSpec — the author-facing per-property type