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

@@ -43,7 +43,7 @@ function validateHookEvent(
fail('hook/invoked point and handlerId must be non-empty')
}
const dialect: string = event.data.dialect
if (dialect !== 'claude' && dialect !== 'codex') {
if (dialect !== 'claude-code' && dialect !== 'codex') {
fail(`hook/invoked carries unknown dialect ${JSON.stringify(dialect)}`)
}
return { key: hookKey(event.data), delta: 1 }

View File

@@ -37,7 +37,7 @@ function compileRegex(pattern: string): RegExp | undefined {
export function matcherDiagnostic(matcher: string | undefined, mode: MatcherMode): string | undefined {
if (isMatchAll(matcher)) return undefined
const pattern = matcher as string
if (mode === 'claude' && CLAUDE_LITERAL.test(pattern)) return undefined
if (mode === 'claude-code' && CLAUDE_LITERAL.test(pattern)) return undefined
return compileRegex(pattern) === undefined
? `invalid ${mode} regex matcher ${JSON.stringify(pattern)}`
: undefined
@@ -58,7 +58,7 @@ export function matchesMatcher(matcher: string | undefined, query: string, mode:
if (isMatchAll(matcher)) return true
// matcher is a non-empty string past the match-all guard.
const pattern = matcher as string
if (mode === 'claude' && CLAUDE_LITERAL.test(pattern)) {
if (mode === 'claude-code' && CLAUDE_LITERAL.test(pattern)) {
return pattern.split('|').includes(query)
}
return compileRegex(pattern)?.test(query) ?? false

View File

@@ -1,12 +1,12 @@
/**
* Execute command hooks through `ctx.bash`, using its credential scrub,
* Execute command hooks through `ctx.shell`, using its credential scrub,
* process-group cancellation, and timeout machinery. The bridge supplies the
* trusted stdin payload and dialect environment, then this module decodes the
* captured outcome.
* @module @deepseek-ai/dsh-hook-protocol/runner
*/
import type { BashExecutor } from '@deepseek-ai/dsh-bash'
import type { ShellExecutor } from '@deepseek-ai/dsh-shell'
import { parseHookOutput } from './codec.ts'
import type { CommandHook, HookOutput } from './types.ts'
@@ -65,7 +65,7 @@ export interface RunHookResult {
* @returns the decoded output plus the run's wall-clock duration.
*/
export async function runHook(
bash: BashExecutor,
bash: ShellExecutor,
hook: CommandHook,
options: RunHookOptions,
now: () => number,
@@ -85,7 +85,7 @@ export async function runHook(
try {
const result = await bash.run(bash.resolve(request))
// BashRunResult.exitCode is `number | null` (null = died by signal); the
// ShellRunResult.exitCode is `number | null` (null = died by signal); the
// protocol's exit-code contract is numeric, so a signal death maps to
// `undefined` (a non-blocking error — no clean exit code to act on).
const exitCode = result.exitCode ?? undefined

View File

@@ -9,7 +9,7 @@ declare module '@deepseek-ai/dsh-session/types' {
interface SessionEventMap {
/**
* A hook command was invoked at a hook point — a log-only record (like
* `compact/*`; NOT a {@link SurfaceEventType}, carries no `surfaceOp`).
* `compaction/*`; NOT a {@link SurfaceEventType}, carries no `surfaceOp`).
* `dialect` is the bridge that ran it (`claude`/`codex`), `point`
* the hook point (`PreToolUse`, `Stop`, …), `matcher` the matcher-group
* pattern that selected it (absent for match-all), `handlerId` a stable id
@@ -41,11 +41,11 @@ declare module '@deepseek-ai/dsh-session/types' {
}
/**
* The bridge that ran a hook — the CC bridge stamps `'claude'`, the Codex
* The bridge that ran a hook — the CC bridge stamps `'claude-code'`, the Codex
* bridge `'codex'`. A native plugin at the interception points is not a bridge
* and writes no `hook/*` invocation/result records (see the interception extension-points Agent Note).
*/
export type HookDialect = 'claude' | 'codex'
export type HookDialect = 'claude-code' | 'codex'
/**
* One configured command hook (the `{ type: 'command', command, timeout? }`
@@ -76,7 +76,7 @@ export interface MatcherGroup {
* {@link regex} otherwise; Codex is always {@link regex}. The bridge picks the
* mode for its dialect.
*/
export type MatcherMode = 'claude' | 'codex'
export type MatcherMode = 'claude-code' | 'codex'
/**
* The dialect-neutral OUTCOME a hook produced, parsed from its exit code +