dsh-claude-compat 0.8.3 â 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/package.json +1 -1
- package/src/hooks.js +3 -2
- package/src/index.js +4 -4
- package/src/lib.js +9 -0
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<a href="README.zh-CN.md"><img src="https://img.shields.io/badge/đ_įŽäŊ䏿-įšæé
č¯ģ䏿-red?style=for-the-badge" alt="įŽäŊ䏿"></a>
|
|
9
9
|
<img src="https://img.shields.io/npm/dm/dsh-claude-compat?style=flat-square&label=downloads/month&color=brightgreen" alt="npm downloads/month">
|
|
10
10
|
<img src="https://img.shields.io/npm/dt/dsh-claude-compat?style=flat-square&label=total%20downloads&color=blue" alt="npm total downloads">
|
|
11
|
-
<img src="https://img.shields.io/badge/version-0.8.
|
|
11
|
+
<img src="https://img.shields.io/badge/version-0.8.4-blue?style=flat-square" alt="Version">
|
|
12
12
|
<img src="https://img.shields.io/badge/license-MIT-orange?style=flat-square" alt="License">
|
|
13
13
|
</p>
|
|
14
14
|
|
package/README.zh-CN.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<a href="README.md"><img src="https://img.shields.io/badge/đ_English-Click_me-red?style=for-the-badge" alt="English"></a>
|
|
9
9
|
<img src="https://img.shields.io/npm/dm/dsh-claude-compat?style=flat-square&label=downloads/month&color=brightgreen" alt="npm downloads/month">
|
|
10
10
|
<img src="https://img.shields.io/npm/dt/dsh-claude-compat?style=flat-square&label=total%20downloads&color=blue" alt="npm total downloads">
|
|
11
|
-
<img src="https://img.shields.io/badge/version-0.8.
|
|
11
|
+
<img src="https://img.shields.io/badge/version-0.8.4-blue?style=flat-square" alt="Version">
|
|
12
12
|
<img src="https://img.shields.io/badge/license-MIT-orange?style=flat-square" alt="License">
|
|
13
13
|
</p>
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-claude-compat",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "DeepSeek Harness plugin: bridge Claude Code's .claude/ directories (project and ~/.claude: skills, commands, rules) into DSH native skill registry and message-stream rules injection.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/hooks.js
CHANGED
|
@@ -13,6 +13,7 @@ import { readFileSync } from 'node:fs';
|
|
|
13
13
|
import { join } from 'node:path';
|
|
14
14
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
15
15
|
import {
|
|
16
|
+
CLAUDE_COMPAT_SOURCE_KIND,
|
|
16
17
|
findProjectRootSync,
|
|
17
18
|
resolveUserClaudeDir,
|
|
18
19
|
} from './lib.js';
|
|
@@ -108,7 +109,7 @@ export function mapPostHookOutput(exitCode, stdout, { warn = console.warn } = {}
|
|
|
108
109
|
kind: 'accept',
|
|
109
110
|
additionalContexts: [createUserMessage({
|
|
110
111
|
content: [{ type: 'text', text: additional }],
|
|
111
|
-
source: { kind:
|
|
112
|
+
source: { kind: CLAUDE_COMPAT_SOURCE_KIND, form: 'hook-context' },
|
|
112
113
|
})],
|
|
113
114
|
};
|
|
114
115
|
}
|
|
@@ -339,7 +340,7 @@ async function runPromptHooks(hooks, agent, config) {
|
|
|
339
340
|
if (text === '') continue;
|
|
340
341
|
extra.push(createUserMessage({
|
|
341
342
|
content: [{ type: 'text', text }],
|
|
342
|
-
source: { kind:
|
|
343
|
+
source: { kind: CLAUDE_COMPAT_SOURCE_KIND, form: 'hook-context' },
|
|
343
344
|
}));
|
|
344
345
|
}
|
|
345
346
|
return extra.length > 0 ? extra : undefined;
|
package/src/index.js
CHANGED
|
@@ -54,6 +54,7 @@ import { registerHooks } from './hooks.js';
|
|
|
54
54
|
import { mountMcpServers, mountMcpConfigs } from './mcp.js';
|
|
55
55
|
import { discoverPluginContent, readInstalledClaudePlugins, translatePluginMcp } from './plugins.js';
|
|
56
56
|
import {
|
|
57
|
+
CLAUDE_COMPAT_SOURCE_KIND,
|
|
57
58
|
findProjectRoot,
|
|
58
59
|
findProjectRootSync,
|
|
59
60
|
listMdFilesSync,
|
|
@@ -405,7 +406,7 @@ function registerRulesSection(ctx, config) {
|
|
|
405
406
|
ctx.on('agent/pre-step', async ({ agent, messages }, next) => {
|
|
406
407
|
const decision = await next();
|
|
407
408
|
if (decision.kind !== 'enter') return decision;
|
|
408
|
-
const present = (list) => list.some((m) => m?.source?.kind ===
|
|
409
|
+
const present = (list) => list.some((m) => m?.source?.kind === CLAUDE_COMPAT_SOURCE_KIND);
|
|
409
410
|
// dsh 0.1.2 made the event log private â exact lookup is eventAt(seq),
|
|
410
411
|
// the same API dsh core uses for its own surface scans. Legacy dsh
|
|
411
412
|
// exposed a plain session.events array; keep an optional fallback.
|
|
@@ -414,8 +415,7 @@ function registerRulesSection(ctx, config) {
|
|
|
414
415
|
|| agent.session.surface.nodes.some((seq) => {
|
|
415
416
|
const event = agent.session.eventAt?.(seq) ?? agent.session.events?.[seq];
|
|
416
417
|
return event?.type === 'user/message'
|
|
417
|
-
&& event.data?.source?.kind ===
|
|
418
|
-
&& event.data.source.plugin === 'dsh-claude-compat';
|
|
418
|
+
&& event.data?.source?.kind === CLAUDE_COMPAT_SOURCE_KIND;
|
|
419
419
|
});
|
|
420
420
|
if (alreadyInjected) return decision;
|
|
421
421
|
// Session cwd, NOT process.cwd() â the DSH process may be launched from
|
|
@@ -430,7 +430,7 @@ function registerRulesSection(ctx, config) {
|
|
|
430
430
|
// of the message array. Not in system prompt.
|
|
431
431
|
cache.set(cwd, createUserMessage({
|
|
432
432
|
content: [{ type: 'text', text }],
|
|
433
|
-
source: { kind:
|
|
433
|
+
source: { kind: CLAUDE_COMPAT_SOURCE_KIND, form: 'rules' },
|
|
434
434
|
}));
|
|
435
435
|
}
|
|
436
436
|
return {
|
package/src/lib.js
CHANGED
|
@@ -8,6 +8,15 @@ import { dirname, join, resolve } from 'node:path';
|
|
|
8
8
|
import { homedir } from 'node:os';
|
|
9
9
|
import { parse } from 'yaml';
|
|
10
10
|
|
|
11
|
+
// Producer-owned source kind for every message this plugin injects. dsh's
|
|
12
|
+
// session format v4 admission (session-format-v3-to-v4/src/message-sources.ts)
|
|
13
|
+
// rejects the retired V3 `kind: 'plugin'` wrapper: a third-party producer must
|
|
14
|
+
// emit its own kind. dsh derives exactly this string for us â `producerKind()`
|
|
15
|
+
// falls through RENAMED_PRODUCERS and RELEASED_SAME_NAME_PRODUCERS to
|
|
16
|
+
// `plugin:${plugin}` â so a V3 log migrated by dsh and a message we emit today
|
|
17
|
+
// carry the identical kind. Emission and dedup must both use this constant.
|
|
18
|
+
export const CLAUDE_COMPAT_SOURCE_KIND = 'plugin:dsh-claude-compat';
|
|
19
|
+
|
|
11
20
|
export function resolveUserClaudeDir(dir) {
|
|
12
21
|
if (dir === undefined || dir === null || dir === '') return join(homedir(), '.claude');
|
|
13
22
|
if (dir === '~') return homedir();
|