Files
deepseek-harness/packages/experimental/claude-code-mods/tests/support/claude-code.ts
T
Tianyi Cui f1715c67ec refactor(experimental): make mods DSH plugins and drop the persistence change
A mod is now a plugin built with defineMod() around its register(on,
options); the bridge is the ClaudeCodeMods service (ctx.claudeCodeMods)
that keeps the loaded mods and raises their events. The plugin.json /
hooks.json loader, pluginDirs, and dynamic imports are gone.

prompt.submit context becomes text blocks appended to the human's own
prompt message and $.prompt.submit queues a user-sourced message, so the
bridge adds no message source kind: the persistence record and the
regenerated schema are removed and the artifacts match master again.

Engine correctness from the review round: next() is memoized and every
started run beneath is awaited before a hook's answer settles; a rewritten
tool argument skips the hook with a report pointing at the pre-tool input
rewrite proposal; timers belong to the session whose event started them;
$.tool.call injects a tool's deferred contexts; $.clock.sleep honors the
event signal; a built-in tool answered with { result } is validated against
its output schema before it becomes an error-shaped result; hooks on events
this host never raises are reported at load.

Examples: the three mods from the Claude Code blog post under examples/,
Token Weather and its test unchanged, Blast Radius and Replay Theater
completed from the published fragments, run by their own tests through a
claude-code/testing alias over the new test kit ($.ui.mount/find/press).
2026-10-03 01:38:21 +08:00

13 lines
508 B
TypeScript

/**
* The `claude-code` module as a mod's `types/index.d.ts` augments it: the
* `PluginState` interface a mod declares its `$.state` keys in. This host
* reads no declarations; the module exists so the example mods' type
* contracts compile unchanged.
* @module
*/
/** State keys by plugin, as `declare module 'claude-code' { interface PluginState { … } }` adds them. */
export interface PluginState {}
export type { ModOn as On, ModRegister as Register, ModsApi as Api } from '../../src/types.ts'