refactor: apply repository naming contract

Apply the accepted pre-release package, service, type, directory, and role renames as one repository-wide change.
This commit is contained in:
Tianyi Cui
2026-08-13 00:36:22 +08:00
parent 101df7cf58
commit a2d0f7f411
3281 changed files with 21730 additions and 21592 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/goal/README.md
README.md: 9d307278b39ecee61df9feace9fec4235b45d794
README.zh.md: fec870751b1f331bf4d09dcbee04d977183064ad
README.md: aa4cf88016bc1707761f2fcd1b833eaf6e648dba
README.zh.md: 0044aeca82ee561a91ff16b012db2f86e8754ecf

View File

@@ -7,7 +7,7 @@ Durable objective state for an agent session, owned independently of the model-f
| Package | Role | ctx key |
|---|---|---|
| [`goal/`](goal/README.md) | Goal state and lifecycle | `ctx.goals` |
| [`goal-session/`](goal-session/README.md) | Same-session goal continuation | — |
| [`goal-round-driver/`](goal-round-driver/README.md) | Same-session goal continuation | — |
| [`tool-goal/`](tool-goal/README.md) | Model-facing goal tools | — |
| [`command-goal/`](command-goal/README.md) | Human-facing goal command | — |

View File

@@ -7,7 +7,7 @@ agent 会话的持久目标状态,独立于消费它的面向模型工具与
| 包 | 职责 | ctx 键 |
|---|---|---|
| [`goal/`](goal/README.md) | 目标状态与生命周期 | `ctx.goals` |
| [`goal-session/`](goal-session/README.md) | 同会话目标续行 | 无 |
| [`goal-round-driver/`](goal-round-driver/README.md) | 同会话目标续行 | 无 |
| [`tool-goal/`](tool-goal/README.md) | 面向模型的目标工具 | 无 |
| [`command-goal/`](command-goal/README.md) | 面向用户的目标命令 | 无 |

View File

@@ -3,7 +3,7 @@ import { Context } from '@deepseek-ai/cordis'
import Loader from '@deepseek-ai/cordis-plugin-loader'
import AgentRegistry, { Inbox } from '@deepseek-ai/dsh-agent'
import type { Agent, AgentStatus } from '@deepseek-ai/dsh-agent'
import CommandService from '@deepseek-ai/dsh-commands'
import CommandRuntime from '@deepseek-ai/dsh-commands'
import GoalService from '@deepseek-ai/dsh-goal'
import type { GoalRef } from '@deepseek-ai/dsh-goal'
import SessionStore, { Session, SessionId } from '@deepseek-ai/dsh-session'
@@ -44,7 +44,7 @@ function stubAgent(ctx: Context, id: string): { agent: Agent; session: Session }
async function harness(): Promise<Harness> {
const ctx = new Context()
await ctx.plugin(SessionStore)
await ctx.plugin(CommandService)
await ctx.plugin(CommandRuntime)
await ctx.plugin(AgentRegistry)
await ctx.plugin(GoalService)
const plugin = await ctx.plugin(commandGoal)
@@ -69,7 +69,7 @@ function domainEvents(session: Session): readonly Session['events'][number][] {
}
/** Execute `/goal` through the same registry boundary as a UI adapter. */
async function run(test: Harness, suffix = ''): Promise<NonNullable<Awaited<ReturnType<CommandService['execute']>>>['result']> {
async function run(test: Harness, suffix = ''): Promise<NonNullable<Awaited<ReturnType<CommandRuntime['execute']>>>['result']> {
const execution = await test.ctx.commands.execute(
test.agent,
`/goal${suffix}`,

View File

@@ -21,7 +21,7 @@
"path": "../goal"
},
{
"path": "../../support/invariants"
"path": "../../runtime-diagnostics/invariants"
}
]
}

View File

@@ -1,6 +1,6 @@
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/goal/goal-session/README.md
README.md: 4534c937fcc53295b83bb207416715ef67b1f911
README.zh.md: 3a10e4dc3213ab9a8ec1f090c47e39eda584b1d0
# pnpm run verify-translation-pairing --write packages/goal/goal-round-driver/README.md
README.md: 34b11714b8ccf574549567f33b80204f3c0dde6a
README.zh.md: 63ae705627e8eaaf763de5b3fe2f5123cfa61b07

View File

@@ -1,4 +1,4 @@
# @deepseek-ai/dsh-goal-session
# @deepseek-ai/dsh-goal-round-driver
English | [中文](README.zh.md)
@@ -13,8 +13,8 @@ Same-session continuation driver for [`ctx.goals`](../goal/README.md). It turns
- id: tool-goal
name: '@deepseek-ai/dsh-tool-goal'
- id: goal-session
name: '@deepseek-ai/dsh-goal-session'
- id: goal-round-driver
name: '@deepseek-ai/dsh-goal-round-driver'
```
The plugin has no tunable configuration. `maxGoalRounds` belongs to the goal definition, while the model-facing blocked threshold belongs to [`dsh-tool-goal`](../tool-goal/README.md); duplicating either value in the driver could produce divergent policy.

View File

@@ -1,4 +1,4 @@
# @deepseek-ai/dsh-goal-session
# @deepseek-ai/dsh-goal-round-driver
[English](README.md) | 中文
@@ -13,8 +13,8 @@
- id: tool-goal
name: '@deepseek-ai/dsh-tool-goal'
- id: goal-session
name: '@deepseek-ai/dsh-goal-session'
- id: goal-round-driver
name: '@deepseek-ai/dsh-goal-round-driver'
```
该插件没有可调配置。`maxGoalRounds` 属于目标定义,面向模型的阻塞阈值则属于 [`dsh-tool-goal`](../tool-goal/README.md);在驱动器中重复任一数值都可能产生分歧策略。

View File

@@ -1,5 +1,5 @@
{
"name": "@deepseek-ai/dsh-goal-session",
"name": "@deepseek-ai/dsh-goal-round-driver",
"description": "Race-fenced same-session goal-round driver",
"version": "0.0.1-rc.2",
"publishConfig": {
@@ -8,7 +8,7 @@
"repository": {
"type": "git",
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
"directory": "packages/goal/goal-session"
"directory": "packages/goal/goal-round-driver"
},
"type": "module",
"main": "lib/index.js",

View File

@@ -1,6 +1,6 @@
/**
* Same-session goal-round driver over public agent, session, and goal services.
* @module @deepseek-ai/dsh-goal-session
* @module @deepseek-ai/dsh-goal-round-driver
*/
import { isDeepStrictEqual } from 'node:util'
@@ -15,7 +15,7 @@ import { renderGoalRoundPrompt } from './prompt.ts'
export { renderGoalRoundPrompt } from './prompt.ts'
export const name = 'goal-session'
export const name = 'goal-round-driver'
export const inject = ['agents', 'goals', 'sessions']
/** Identity reserved before a goal continuation enters the agent inbox. */
@@ -119,7 +119,7 @@ export function apply(ctx: Context): void {
const goal = currentGoal(state)
if (goal?.activation === 'armed') ctx.goals.disarm(state.agent)
} catch (error: unknown) {
ctx.logger.warn(`goal-session: could not disarm agent "${state.agent.id}": ${renderThrown(error)}`)
ctx.logger.warn(`goal-round-driver: could not disarm agent "${state.agent.id}": ${renderThrown(error)}`)
}
}
@@ -144,7 +144,7 @@ export function apply(ctx: Context): void {
try {
await ctx.sessions.flush(agent.session)
} catch (error: unknown) {
ctx.logger.warn(`goal-session: durability checkpoint failed for agent "${agent.id}": ${renderThrown(error)}`)
ctx.logger.warn(`goal-round-driver: durability checkpoint failed for agent "${agent.id}": ${renderThrown(error)}`)
disarm(state)
return
}
@@ -192,7 +192,7 @@ export function apply(ctx: Context): void {
agent.followup(message)
} catch (error: unknown) {
state.attempt = undefined
ctx.logger.warn(`goal-session: could not queue round ${round} for agent "${agent.id}": ${renderThrown(error)}`)
ctx.logger.warn(`goal-round-driver: could not queue round ${round} for agent "${agent.id}": ${renderThrown(error)}`)
const latest = currentGoal(state)
if (latest !== undefined && latest.id === goal.id && latest.revision === goal.revision
&& latest.phase === 'active' && latest.activation === 'armed') {
@@ -218,13 +218,13 @@ export function apply(ctx: Context): void {
try {
await drive(state)
} catch (error: unknown) {
ctx.logger.warn(`goal-session: driver failed for agent "${state.agent.id}": ${renderThrown(error)}`)
ctx.logger.warn(`goal-round-driver: driver failed for agent "${state.agent.id}": ${renderThrown(error)}`)
disarm(state)
}
}
})
} catch (error: unknown) {
ctx.logger.warn(`goal-session: could not start driver for agent "${state.agent.id}": ${renderThrown(error)}`)
ctx.logger.warn(`goal-round-driver: could not start driver for agent "${state.agent.id}": ${renderThrown(error)}`)
disarm(state)
return
}
@@ -234,7 +234,7 @@ export function apply(ctx: Context): void {
if (state.requested && !state.stopping) requestDrive(state)
}
void run.then(retire, (error: unknown) => {
ctx.logger.warn(`goal-session: driver task rejected for agent "${state.agent.id}": ${renderThrown(error)}`)
ctx.logger.warn(`goal-round-driver: driver task rejected for agent "${state.agent.id}": ${renderThrown(error)}`)
disarm(state)
retire()
})
@@ -268,7 +268,7 @@ export function apply(ctx: Context): void {
try {
ctx.goals.pause(agent, goalRef(goal))
} catch (error: unknown) {
ctx.logger.warn(`goal-session: could not pause cancelled goal for agent "${agent.id}": ${renderThrown(error)}`)
ctx.logger.warn(`goal-round-driver: could not pause cancelled goal for agent "${agent.id}": ${renderThrown(error)}`)
disarm(state)
}
}
@@ -356,7 +356,7 @@ export function apply(ctx: Context): void {
try {
valid = validReservation(state, content, source)
} catch (error: unknown) {
ctx.logger.warn(`goal-session: pre-step check failed for agent "${agent.id}": ${renderThrown(error)}`)
ctx.logger.warn(`goal-round-driver: pre-step check failed for agent "${agent.id}": ${renderThrown(error)}`)
disarm(state)
}
if (!valid) {
@@ -400,7 +400,7 @@ export function apply(ctx: Context): void {
try {
valid = validReservation(state, content, source)
} catch (error: unknown) {
ctx.logger.warn(`goal-session: post-decision check failed for agent "${agent.id}": ${renderThrown(error)}`)
ctx.logger.warn(`goal-round-driver: post-decision check failed for agent "${agent.id}": ${renderThrown(error)}`)
disarm(state)
valid = false
}
@@ -441,5 +441,5 @@ export function apply(ctx: Context): void {
await Promise.allSettled(waits)
states.clear()
}
}, 'goal-session lifecycle')
}, 'goal-round-driver lifecycle')
}

View File

@@ -1,4 +1,4 @@
/** Package-owned goal-round prompt invariants. @module @deepseek-ai/dsh-goal-session/invariant */
/** Package-owned goal-round prompt invariants. @module @deepseek-ai/dsh-goal-round-driver/invariant */
import { isDeepStrictEqual } from 'node:util'
import type { Context } from '@deepseek-ai/cordis'
@@ -7,10 +7,10 @@ import type { InvariantFailure, InvariantInstaller } from '@deepseek-ai/dsh-inva
import type { Session, SessionEvent } from '@deepseek-ai/dsh-session'
import { renderGoalRoundPrompt } from './prompt.ts'
const PACKAGE_NAME = '@deepseek-ai/dsh-goal-session'
const PACKAGE_NAME = '@deepseek-ai/dsh-goal-round-driver'
/** Cordis companion plugin name. */
export const name = 'goal-session-invariant'
export const name = 'goal-round-driver-invariant'
/** Service required before the companion can reserve package ownership. */
export const inject = ['invariants']
@@ -75,7 +75,7 @@ const install: InvariantInstaller = Object.assign((ctx: Context, fail: Invariant
}, { inject: ['sessions'] })
/**
* Register the goal-session invariant companion.
* Register the goal-round-driver invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/

View File

@@ -575,8 +575,8 @@ describe('same-session goal driving', () => {
it('fails closed when a downstream pre-step hook throws', async () => {
const test = await harness([])
// Registered after goal-session's own listener: the throw propagates back
// through goal-session's next() await, dropping the whole step proposal.
// Registered after goal-round-driver's own listener: the throw propagates back
// through goal-round-driver's next() await, dropping the whole step proposal.
let threw = false
test.ctx.on('agent/pre-step', async ({ messages }, next) => {
if (messages[0]?.source.kind === 'goal' && !threw) {
@@ -928,7 +928,7 @@ describe('same-session goal driving', () => {
agentEvents(test.ctx, handle.agent).emit('agent/error', { turn: closed.data.turn, step: 1, error: new Error('late flush failure') })
expect(test.ctx.agents.get(handle.agent.id)).toBeUndefined()
expect(warn).not.toHaveBeenCalledWith(expect.stringContaining('goal-session'))
expect(warn).not.toHaveBeenCalledWith(expect.stringContaining('goal-round-driver'))
})
it('keeps terminal agent failure disarmed and defers queued human work until another wakeup', async () => {

View File

@@ -6,9 +6,9 @@ import {
type GoalSnapshotChangeMeta,
type GoalView,
} from '@deepseek-ai/dsh-goal'
import * as GoalSessionInvariant from '@deepseek-ai/dsh-goal-session/invariant'
import { renderGoalRoundPrompt } from '@deepseek-ai/dsh-goal-session'
import InvariantService, { InvariantError } from '@deepseek-ai/dsh-invariants'
import * as GoalSessionInvariant from '@deepseek-ai/dsh-goal-round-driver/invariant'
import { renderGoalRoundPrompt } from '@deepseek-ai/dsh-goal-round-driver'
import InvariantRegistry, { InvariantError } from '@deepseek-ai/dsh-invariants'
import SessionStore, { SessionId, type Session } from '@deepseek-ai/dsh-session'
const change: GoalSnapshotChangeMeta = {
@@ -16,7 +16,7 @@ const change: GoalSnapshotChangeMeta = {
version: 1,
operation: 'create',
goal: {
id: GoalId('goal-session-invariant'),
id: GoalId('goal-round-driver-invariant'),
revision: 1,
objective: 'verify every continuation prompt',
phase: 'active',
@@ -47,21 +47,21 @@ function appendRound(session: Session, turn: number, content = renderGoalRoundPr
async function mount(sessionFirst = false): Promise<{ ctx: Context; session: Session }> {
const ctx = new Context()
await ctx.plugin(SessionStore)
const session = ctx.sessions.create(SessionId('goal-session-invariant'))
const session = ctx.sessions.create(SessionId('goal-round-driver-invariant'))
if (!sessionFirst) {
await ctx.plugin(InvariantService, { enabled: true })
await ctx.plugin(InvariantRegistry, { enabled: true })
await ctx.plugin(GoalSessionInvariant)
}
return { ctx, session }
}
describe('goal-session prompt invariants', () => {
describe('goal-round-driver prompt invariants', () => {
it('reconstructs existing rounds and accepts the next canonical prompt', async () => {
const { ctx, session } = await mount(true)
appendChange(session)
appendRound(session, 2)
await ctx.plugin(InvariantService, { enabled: true })
await ctx.plugin(InvariantRegistry, { enabled: true })
await ctx.plugin(GoalSessionInvariant)
expect(() => { appendRound(session, 3) }).not.toThrow()
@@ -95,7 +95,7 @@ describe('goal-session prompt invariants', () => {
appendRound(session, 2, [{ type: 'text', text: 'counterfeit continuation' }])
}).toThrow(expect.objectContaining<Partial<InvariantError>>({
code: 'INVARIANT',
packageName: '@deepseek-ai/dsh-goal-session',
packageName: '@deepseek-ai/dsh-goal-round-driver',
}))
})
@@ -110,7 +110,7 @@ describe('goal-session prompt invariants', () => {
source,
}), { surfaceOp: 'append' })
}).toThrow(expect.objectContaining<Partial<InvariantError>>({
packageName: '@deepseek-ai/dsh-goal-session',
packageName: '@deepseek-ai/dsh-goal-round-driver',
}))
})
@@ -118,11 +118,11 @@ describe('goal-session prompt invariants', () => {
const { ctx, session } = await mount(true)
session.append('goal/change', { ...change, extra: true } as never)
appendRound(session, 2)
await ctx.plugin(InvariantService, { enabled: true })
await ctx.plugin(InvariantRegistry, { enabled: true })
await expect(ctx.plugin(GoalSessionInvariant)).rejects.toMatchObject({
code: 'INVARIANT',
packageName: '@deepseek-ai/dsh-goal-session',
packageName: '@deepseek-ai/dsh-goal-round-driver',
})
})
})

View File

@@ -27,7 +27,7 @@
"path": "../../core/session"
},
{
"path": "../../support/invariants"
"path": "../../runtime-diagnostics/invariants"
}
]
}

View File

@@ -60,7 +60,7 @@
"@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-scope": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^",
"@deepseek-ai/dsh-type-meta": "workspace:^",
"@deepseek-ai/dsh-typert-protocol": "workspace:^",
"@deepseek-ai/cordis": "workspace:^"
},
"dependencies": {
@@ -76,7 +76,7 @@
"@deepseek-ai/dsh-loader-smoke": "workspace:^",
"@deepseek-ai/dsh-scope": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^",
"@deepseek-ai/dsh-type-meta": "workspace:^",
"@deepseek-ai/dsh-typert-protocol": "workspace:^",
"@deepseek-ai/cordis": "workspace:^"
}
}

View File

@@ -12,7 +12,7 @@ import type { ZodType } from 'zod'
import { agentEvents } from '@deepseek-ai/dsh-agent'
import type { Agent } from '@deepseek-ai/dsh-agent'
import type { Session, SessionEvent } from '@deepseek-ai/dsh-session'
import { GatewayService, Remote } from '@deepseek-ai/dsh-type-meta'
import { TypertRemoteService, Remote } from '@deepseek-ai/dsh-typert-protocol'
// Type-only: resolves ctx.sessionProjections for the optional unit child.
import type {} from '@deepseek-ai/dsh-session-projection'
import {
@@ -180,7 +180,7 @@ function resolveBlockReason(reason: unknown): GoalBlockReason {
}
/** Goal service (`ctx.goals`) backed exclusively by the owning session log. */
export class GoalService extends GatewayService {
export class GoalService extends TypertRemoteService {
static inject = ['agents']
static Config: z<Config> = z.object({

View File

@@ -6,7 +6,7 @@ import {
type GoalSnapshotChangeMeta,
} from '@deepseek-ai/dsh-goal'
import * as GoalInvariantCompanion from '@deepseek-ai/dsh-goal/invariant'
import InvariantService, { InvariantError } from '@deepseek-ai/dsh-invariants'
import InvariantRegistry, { InvariantError } from '@deepseek-ai/dsh-invariants'
import SessionStore, { SessionId } from '@deepseek-ai/dsh-session'
const change: GoalSnapshotChangeMeta = {
@@ -28,7 +28,7 @@ const change: GoalSnapshotChangeMeta = {
async function setup(): Promise<Context> {
const ctx = new Context()
await ctx.plugin(SessionStore)
await ctx.plugin(InvariantService, { enabled: true })
await ctx.plugin(InvariantRegistry, { enabled: true })
await ctx.plugin(GoalInvariantCompanion)
return ctx
}
@@ -68,7 +68,7 @@ describe('goal stream invariants', () => {
const session = ctx.sessions.create(SessionId('goal-invariant-late-load'))
session.append('goal/change', change)
await ctx.plugin(InvariantService, { enabled: true })
await ctx.plugin(InvariantRegistry, { enabled: true })
await ctx.plugin(GoalInvariantCompanion)
session.append('turn/start', { turn: 1 })
expect(() => {

View File

@@ -36,10 +36,10 @@
"path": "../../session/session-projection"
},
{
"path": "../../typert/type-meta"
"path": "../../typert/protocol"
},
{
"path": "../../support/invariants"
"path": "../../runtime-diagnostics/invariants"
}
]
}

View File

@@ -9,7 +9,7 @@ import { createUserMessage, CallId } from '@deepseek-ai/dsh-llm'
import type { MessageSource } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
import SystemPrompt from '@deepseek-ai/dsh-system-prompt'
import ToolRegistry from '@deepseek-ai/dsh-tools'
import ToolRuntime from '@deepseek-ai/dsh-tools'
import type { ToolExecutionResult } from '@deepseek-ai/dsh-tools'
import * as toolGoal from '@deepseek-ai/dsh-tool-goal'
@@ -73,7 +73,7 @@ async function harness(config: toolGoal.Config = {}) {
const ctx = new Context()
await ctx.plugin(SystemPrompt)
await ctx.plugin(AgentRegistry)
await ctx.plugin(ToolRegistry)
await ctx.plugin(ToolRuntime)
await ctx.plugin(GoalService)
const fiber = await ctx.plugin(toolGoal, config)
const root = stubAgent(`goal-tool-root-${Math.random()}`)
@@ -173,7 +173,7 @@ describe('goal tool registration and presentation', () => {
const ctx = new Context()
await ctx.plugin(SystemPrompt)
await ctx.plugin(AgentRegistry)
await ctx.plugin(ToolRegistry)
await ctx.plugin(ToolRuntime)
await ctx.plugin(GoalService)
expect(() => {
toolGoal.apply(ctx, { blockedAfterConsecutiveRounds: 1.5 })
@@ -187,7 +187,7 @@ describe('goal tool registration and presentation', () => {
const ctx = new Context()
await ctx.plugin(SystemPrompt)
await ctx.plugin(AgentRegistry)
await ctx.plugin(ToolRegistry)
await ctx.plugin(ToolRuntime)
await ctx.plugin(GoalService)
toolGoal.apply(ctx, {})
const section = (await ctx.systemPrompt.assemble()).sections.find(item => item.name === 'tool:goal')

View File

@@ -36,7 +36,7 @@
"path": "../goal"
},
{
"path": "../../support/invariants"
"path": "../../runtime-diagnostics/invariants"
}
]
}