@norman-else/dsh-claude 0.1.34 → 0.1.36
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 +196 -191
- package/lib/bin.mjs +1 -1
- package/lib/client.d.ts +13 -0
- package/lib/client.js +1991 -1174
- package/lib/client.js.map +1 -1
- package/lib/{events-DeSV0S1-.mjs → events-OhBoFNKO.mjs} +13 -2
- package/lib/events-OhBoFNKO.mjs.map +1 -0
- package/lib/index.d.mts +59 -2
- package/lib/index.mjs +1261 -483
- package/lib/index.mjs.map +1 -1
- package/lib/presenters-BBoM1Ju1.mjs +300 -0
- package/lib/presenters-BBoM1Ju1.mjs.map +1 -0
- package/lib/{preset-installer-BY4846KK.mjs → preset-installer-loenwnLS.mjs} +2 -2
- package/lib/{preset-installer-BY4846KK.mjs.map → preset-installer-loenwnLS.mjs.map} +1 -1
- package/lib/preset-route.mjs +2 -172
- package/lib/preset-route.mjs.map +1 -1
- package/package.json +189 -188
- package/lib/command-bridge-DXI6nWhB.mjs +0 -71
- package/lib/command-bridge-DXI6nWhB.mjs.map +0 -1
- package/lib/events-DeSV0S1-.mjs.map +0 -1
package/lib/preset-route.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset-route.mjs","names":[],"sources":["../src/presenters.ts","../src/preset-route.ts"],"sourcesContent":["/**\r\n * Presentation-only tool definitions for the Claude Code preset. Claude Code\r\n * owns tool execution; these definitions exist solely so the host's tool\r\n * presentation pipeline (`viewFor` → `presentCall`/`presentResult`) can\r\n * compute native render intents for the mirrored `tool/call`/`tool/result`\r\n * events, giving Claude tool rows the same cards DSH-executed tools get.\r\n */\r\nimport type { ToolDefinition, ToolResult } from '@deepseek-ai/dsh-tools'\r\nimport type { ToolCallView, ToolResultView } from '@deepseek-ai/dsh-tools/presentation'\r\n\r\nfunction record(value: unknown): Record<string, unknown> | undefined {\r\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : undefined\r\n}\r\n\r\nfunction str(value: unknown): string | undefined {\r\n return typeof value === 'string' && value.length > 0 ? value : undefined\r\n}\r\n\r\nfunction resultText(result: ToolResult): string {\r\n return result.content\r\n .filter((block): block is Extract<typeof block, { type: 'text' }> => block.type === 'text')\r\n .map(block => block.text)\r\n .join('\\n')\r\n}\r\n\r\n/** Bash: a terminal card headed by the command, described above by Claude's own summary. */\r\nexport function bashCallView(args: unknown): ToolCallView | undefined {\r\n const command = str(record(args)?.command)\r\n if (command === undefined) return undefined\r\n const description = str(record(args)?.description)\r\n return { card: 'terminal', title: command, ...(description === undefined ? {} : { description }) }\r\n}\r\n\r\nexport function terminalResultView(_args: unknown, result: ToolResult): ToolResultView | undefined {\r\n const output = resultText(result)\r\n return output.length === 0 ? undefined : { card: 'terminal', output }\r\n}\r\n\r\n/** Read: a generic read card that follow-alongs the file window. */\r\nexport function readCallView(args: unknown): ToolCallView | undefined {\r\n const arguments_ = record(args)\r\n const path = str(arguments_?.file_path)\r\n if (path === undefined) return undefined\r\n const offset = typeof arguments_?.offset === 'number' ? arguments_.offset : undefined\r\n return {\r\n card: 'generic',\r\n kind: 'read',\r\n title: `Read ${path}`,\r\n locations: [{ path, ...(offset === undefined ? {} : { line: offset }) }],\r\n }\r\n}\r\n\r\nfunction fileDiffs(args: unknown): { path: string; oldText: string | null; newText: string }[] | undefined {\r\n const arguments_ = record(args)\r\n const path = str(arguments_?.file_path)\r\n if (path === undefined) return undefined\r\n if (Array.isArray(arguments_?.edits)) {\r\n const diffs: { path: string; oldText: string | null; newText: string }[] = []\r\n for (const edit of arguments_.edits) {\r\n const item = record(edit)\r\n const oldText = str(item?.old_string)\r\n const newText = str(item?.new_string)\r\n if (newText === undefined) continue\r\n diffs.push({ path, oldText: oldText ?? null, newText })\r\n }\r\n return diffs.length > 0 ? diffs : undefined\r\n }\r\n const newText = str(arguments_?.new_string) ?? arguments_?.content\r\n if (typeof newText !== 'string' || newText.length === 0) return undefined\r\n const oldText = str(arguments_?.old_string)\r\n return [{ path, oldText: oldText ?? null, newText }]\r\n}\r\n\r\n/** Edit / MultiEdit / Write: inline diff cards derived from the call arguments. */\r\nexport function diffCallView(args: unknown): ToolCallView | undefined {\r\n const arguments_ = record(args)\r\n const path = str(arguments_?.file_path)\r\n const diffs = fileDiffs(args)\r\n if (path === undefined || diffs === undefined) return undefined\r\n const verb = typeof arguments_?.new_string === 'string' || Array.isArray(arguments_?.edits) ? 'Edit' : 'Write'\r\n return { card: 'diff', title: `${verb} ${path}`, diffs, locations: [{ path }] }\r\n}\r\n\r\n/** Grep / Glob / WebSearch: search-category cards titled by the query. */\r\nexport function searchCallView(args: unknown): ToolCallView | undefined {\r\n const arguments_ = record(args)\r\n const query = str(arguments_?.pattern) ?? str(arguments_?.query)\r\n if (query === undefined) return undefined\r\n const scope = str(arguments_?.path)\r\n return {\r\n card: 'generic',\r\n kind: 'search',\r\n title: scope === undefined ? query : `${query} · ${scope}`,\r\n rawInput: args,\r\n }\r\n}\r\n\r\n/** WebFetch: a fetch-category card titled by the URL. */\r\nexport function fetchCallView(args: unknown): ToolCallView | undefined {\r\n const url = str(record(args)?.url)\r\n if (url === undefined) return undefined\r\n return { card: 'generic', kind: 'fetch', title: url, rawInput: args }\r\n}\r\n\r\n/** Task: a subagent card titled by Claude's task description. */\r\nexport function taskCallView(args: unknown): ToolCallView | undefined {\r\n const arguments_ = record(args)\r\n const title = str(arguments_?.description) ?? str(arguments_?.subagent_type) ?? 'Subagent'\r\n return { card: 'generic', kind: 'other', title, rawInput: args }\r\n}\r\n\r\nfunction genericTitle(title: string): ToolCallView {\r\n return { card: 'generic', kind: 'other', title }\r\n}\r\n\r\nfunction presenterDefinition(\r\n name: string,\r\n description: string,\r\n presentCall?: (args: unknown) => ToolCallView | undefined,\r\n presentResult?: (args: unknown, result: ToolResult) => ToolResultView | undefined,\r\n): ToolDefinition {\r\n return {\r\n name,\r\n description,\r\n parameters: { type: 'object', properties: {} },\r\n output: {\r\n schema: { type: 'object', properties: {} } as ToolDefinition['output']['schema'],\r\n render: () => [],\r\n },\r\n execute: async () => {\r\n throw new Error(`dsh-claude: Claude Code owns execution of ${name}`)\r\n },\r\n ...(presentCall === undefined ? {} : { presentCall }),\r\n ...(presentResult === undefined ? {} : { presentResult }),\r\n }\r\n}\r\n\r\nconst PRESENTATION_NOTE = 'Presentation mirror of the Claude Code tool; execution is owned by Claude Code.'\r\n\r\n/** Generic call view for dynamically observed tools (MCP tools, new built-ins). */\r\nexport function genericCallView(toolName: string): (args: unknown) => ToolCallView | undefined {\r\n return (args: unknown) => {\r\n const description = str(record(args)?.description)\r\n return { card: 'generic', kind: 'other', title: description ?? toolName, rawInput: args }\r\n }\r\n}\r\n\r\n/** One presenter-only mirror for a tool name discovered at runtime. */\r\nexport function dynamicPresenterDefinition(name: string): ToolDefinition {\r\n return presenterDefinition(name, PRESENTATION_NOTE, genericCallView(name))\r\n}\r\n\r\n/** The presentation-only registry contributed to the Claude Code preset scope. */\r\nexport function claudePresenterDefinitions(): ToolDefinition[] {\r\n return [\r\n presenterDefinition('Bash', PRESENTATION_NOTE, bashCallView, terminalResultView),\r\n presenterDefinition('Read', PRESENTATION_NOTE, readCallView),\r\n presenterDefinition('Edit', PRESENTATION_NOTE, diffCallView),\r\n presenterDefinition('MultiEdit', PRESENTATION_NOTE, diffCallView),\r\n presenterDefinition('Write', PRESENTATION_NOTE, diffCallView),\r\n presenterDefinition('NotebookEdit', PRESENTATION_NOTE, args => {\r\n const path = str(record(args)?.notebook_path)\r\n return path === undefined ? undefined : genericTitle(`NotebookEdit ${path}`)\r\n }),\r\n presenterDefinition('Grep', PRESENTATION_NOTE, searchCallView),\r\n presenterDefinition('Glob', PRESENTATION_NOTE, searchCallView),\r\n presenterDefinition('WebSearch', PRESENTATION_NOTE, searchCallView),\r\n presenterDefinition('WebFetch', PRESENTATION_NOTE, fetchCallView),\r\n presenterDefinition('Task', PRESENTATION_NOTE, taskCallView),\r\n presenterDefinition('TodoWrite', PRESENTATION_NOTE, () => genericTitle('Update todos')),\r\n ]\r\n}\r\n\r\n/** Names covered by the static preset-scope registry; dynamic mirrors skip them. */\r\nexport const CLAUDE_PRESENTER_NAMES: ReadonlySet<string> = new Set(claudePresenterDefinitions().map(definition => definition.name))\r\n","import type { Context } from '@deepseek-ai/cordis'\r\nimport type {} from '@deepseek-ai/dsh-agent'\r\nimport type {} from '@deepseek-ai/dsh-commands'\r\nimport type {} from '@deepseek-ai/dsh-tools'\r\nimport { CLAUDE_CODE_PROVIDER } from './constants.ts'\r\nimport { CLAUDE_COMMANDS_SERVICE } from './command-bridge.ts'\r\nimport { claudePresenterDefinitions } from './presenters.ts'\r\n\r\nexport const name = 'claude-code-preset-route'\r\nexport const inject = ['tools', 'commands']\r\n\r\nexport interface Config {\r\n model?: string\r\n}\r\n\r\nexport function apply(ctx: Context, config: Config = {}): void {\r\n ctx.on('agent/request', async (_payload, next) => {\r\n const upstream = await next()\r\n return {\r\n ...upstream,\r\n provider: CLAUDE_CODE_PROVIDER,\r\n model: config.model ?? upstream.model ?? 'default',\r\n }\r\n })\r\n // Expose the effective Host command names for collision-safe projection.\r\n // Claude Skills are not registered as Host commands: the Client slash source\r\n // submits them as ordinary messages, so no command lifecycle row is created.\r\n ctx.provide(CLAUDE_COMMANDS_SERVICE, {\r\n list: agent => ctx.commands.list(agent as never),\r\n })\r\n // Presentation-only tool mirrors, scoped to this preset's agents: they let\r\n // the host compute native render intents for the mirrored Claude tool\r\n // events. Claude Code owns execution; the stub `execute` never runs.\r\n for (const definition of claudePresenterDefinitions()) {\r\n ctx.effect(() => ctx.tools.register(definition), `dsh-claude: ${definition.name} presentation`)\r\n }\r\n}\r\n"],"mappings":";;;AAUA,SAAS,OAAO,OAAqD;CACnE,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAI,QAAmC,KAAA;AACnH;AAEA,SAAS,IAAI,OAAoC;CAC/C,OAAO,OAAO,UAAU,YAAY,MAAM,S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AY,mBAAmB,aAAa;EAChE,oBAAoB,QAAQ,mBAAmB,YAAY;EAC3D,oBAAoB,aAAa,yBAAyB,aAAa,cAAc,CAAC;CACxF;AACF;AAG2D,IAAI,IAAI,2BAA2B,CAAC,CAAC,KAAI,eAAc,WAAW,IAAI,CAAC;;;ACtKlI,MAAa,OAAO;AACpB,MAAa,SAAS,CAAC,SAAS,UAAU;AAM1C,SAAgB,MAAM,KAAc,SAAiB,CAAC,GAAS;CAC7D,IAAI,GAAG,iBAAiB,OAAO,UAAU,SAAS;EAChD,MAAM,WAAW,MAAM,KAAK;EAC5B,OAAO;GACL,GAAG;GACH,UAAU;GACV,OAAO,OAAO,SAAS,SAAS,SAAS;EAC3C;CACF,CAAC;CAID,IAAI,QAAQ,yBAAyB,EACnC,OAAM,UAAS,IAAI,SAAS,KAAK,KAAc,EACjD,CAAC;CAID,KAAK,MAAM,cAAc,2BAA2B,GAClD,IAAI,aAAa,IAAI,MAAM,SAAS,UAAU,GAAG,eAAe,WAAW,KAAK,cAAc;AAElG"}
|
|
1
|
+
{"version":3,"file":"preset-route.mjs","names":[],"sources":["../src/preset-route.ts"],"sourcesContent":["import type { Context } from '@deepseek-ai/cordis'\r\nimport type {} from '@deepseek-ai/dsh-agent'\r\nimport type {} from '@deepseek-ai/dsh-commands'\r\nimport type {} from '@deepseek-ai/dsh-tools'\r\nimport { CLAUDE_CODE_PROVIDER } from './constants.ts'\r\nimport { CLAUDE_COMMANDS_SERVICE } from './command-bridge.ts'\r\nimport { claudePresenterDefinitions } from './presenters.ts'\r\n\r\nexport const name = 'claude-code-preset-route'\r\nexport const inject = ['tools', 'commands']\r\n\r\nexport interface Config {\r\n model?: string\r\n}\r\n\r\nexport function apply(ctx: Context, config: Config = {}): void {\r\n ctx.on('agent/request', async (_payload, next) => {\r\n const upstream = await next()\r\n return {\r\n ...upstream,\r\n provider: CLAUDE_CODE_PROVIDER,\r\n model: config.model ?? upstream.model ?? 'default',\r\n }\r\n })\r\n // Expose the effective Host command names for collision-safe projection.\r\n // Claude Skills are not registered as Host commands: the Client slash source\r\n // submits them as ordinary messages, so no command lifecycle row is created.\r\n ctx.provide(CLAUDE_COMMANDS_SERVICE, {\r\n list: agent => ctx.commands.list(agent as never),\r\n })\r\n // Presentation-only tool mirrors, scoped to this preset's agents: they let\r\n // the host compute native render intents for the mirrored Claude tool\r\n // events. Claude Code owns execution; the stub `execute` never runs.\r\n for (const definition of claudePresenterDefinitions()) {\r\n ctx.effect(() => ctx.tools.register(definition), `dsh-claude: ${definition.name} presentation`)\r\n }\r\n}\r\n"],"mappings":";;;AAQA,MAAa,OAAO;AACpB,MAAa,SAAS,CAAC,SAAS,UAAU;AAM1C,SAAgB,MAAM,KAAc,SAAiB,CAAC,GAAS;CAC7D,IAAI,GAAG,iBAAiB,OAAO,UAAU,SAAS;EAChD,MAAM,WAAW,MAAM,KAAK;EAC5B,OAAO;GACL,GAAG;GACH,UAAU;GACV,OAAO,OAAO,SAAS,SAAS,SAAS;EAC3C;CACF,CAAC;CAID,IAAI,QAAQ,yBAAyB,EACnC,OAAM,UAAS,IAAI,SAAS,KAAK,KAAc,EACjD,CAAC;CAID,KAAK,MAAM,cAAc,2BAA2B,GAClD,IAAI,aAAa,IAAI,MAAM,SAAS,UAAU,GAAG,eAAe,WAAW,KAAK,cAAc;AAElG"}
|
package/package.json
CHANGED
|
@@ -1,188 +1,189 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@norman-else/dsh-claude",
|
|
3
|
-
"description": "Run the local Claude Code CLI as a first-class main conversation inside DeepSeek Harness",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.mjs",
|
|
7
|
-
"types": "lib/index.d.mts",
|
|
8
|
-
"bin": {
|
|
9
|
-
"dsh-claude": "lib/bin.mjs"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "tsdown",
|
|
13
|
-
"typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.client.json",
|
|
14
|
-
"test": "vitest run",
|
|
15
|
-
"check": "pnpm run typecheck && pnpm run test && pnpm run build",
|
|
16
|
-
"prepack": "pnpm run build",
|
|
17
|
-
"release": "node scripts/publish.mjs",
|
|
18
|
-
"release:check": "node scripts/publish.mjs --dry-run"
|
|
19
|
-
},
|
|
20
|
-
"exports": {
|
|
21
|
-
".": {
|
|
22
|
-
"types": "./lib/index.d.mts",
|
|
23
|
-
"default": "./lib/index.mjs"
|
|
24
|
-
},
|
|
25
|
-
"./preset-route": {
|
|
26
|
-
"types": "./lib/preset-route.d.mts",
|
|
27
|
-
"default": "./lib/preset-route.mjs"
|
|
28
|
-
},
|
|
29
|
-
"./client": "./lib/client.js",
|
|
30
|
-
"./package.json": "./package.json"
|
|
31
|
-
},
|
|
32
|
-
"files": [
|
|
33
|
-
"lib",
|
|
34
|
-
"preset",
|
|
35
|
-
"legacy-preset",
|
|
36
|
-
"cordis.patch.yml",
|
|
37
|
-
"README.md",
|
|
38
|
-
"INSTALL.md",
|
|
39
|
-
"LICENSE"
|
|
40
|
-
],
|
|
41
|
-
"license": "MIT",
|
|
42
|
-
"repository": {
|
|
43
|
-
"type": "git",
|
|
44
|
-
"url": "git+https://github.com/Norman-else/dsh-claude.git"
|
|
45
|
-
},
|
|
46
|
-
"homepage": "https://github.com/Norman-else/dsh-claude#readme",
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/Norman-else/dsh-claude/issues"
|
|
49
|
-
},
|
|
50
|
-
"publishConfig": {
|
|
51
|
-
"access": "public"
|
|
52
|
-
},
|
|
53
|
-
"engines": {
|
|
54
|
-
"node": ">=20"
|
|
55
|
-
},
|
|
56
|
-
"dsh": {
|
|
57
|
-
"bundle": {
|
|
58
|
-
"patch": "./cordis.patch.yml"
|
|
59
|
-
},
|
|
60
|
-
"client": {
|
|
61
|
-
"inject": [
|
|
62
|
-
"@deepseek-ai/dsh-client-connection",
|
|
63
|
-
"@deepseek-ai/dsh-api-session-controller",
|
|
64
|
-
"@deepseek-ai/dsh-api-workspace-controller",
|
|
65
|
-
"@deepseek-ai/dsh-api-remotes",
|
|
66
|
-
"@deepseek-ai/dsh-client-ui-chat",
|
|
67
|
-
"@deepseek-ai/dsh-client-ui-conversation",
|
|
68
|
-
"@deepseek-ai/dsh-client-ui-input-trigger",
|
|
69
|
-
"@deepseek-ai/dsh-client-ui-renderer",
|
|
70
|
-
"@deepseek-ai/dsh-client-ui-session",
|
|
71
|
-
"@deepseek-ai/dsh-client-ui-settings",
|
|
72
|
-
"@deepseek-ai/dsh-client-locale"
|
|
73
|
-
],
|
|
74
|
-
"platform": "web"
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
"dependencies": {
|
|
78
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.247",
|
|
79
|
-
"dompurify": "^3.4.14",
|
|
80
|
-
"marked": "^18.0.11"
|
|
81
|
-
},
|
|
82
|
-
"peerDependencies": {
|
|
83
|
-
"@deepseek-ai/cordis": "^4.0.1",
|
|
84
|
-
"@deepseek-ai/dsh-agent": "*",
|
|
85
|
-
"@deepseek-ai/dsh-agent-presets": "*",
|
|
86
|
-
"@deepseek-ai/dsh-attachment": "*",
|
|
87
|
-
"@deepseek-ai/dsh-brand": "*",
|
|
88
|
-
"@deepseek-ai/dsh-client-locale": "*",
|
|
89
|
-
"@deepseek-ai/dsh-client-runtime": "*",
|
|
90
|
-
"@deepseek-ai/dsh-client-ui-conversation": "*",
|
|
91
|
-
"@deepseek-ai/dsh-client-ui-input-trigger": "*",
|
|
92
|
-
"@deepseek-ai/dsh-client-ui-primitives": "*",
|
|
93
|
-
"@deepseek-ai/dsh-client-ui-settings": "*",
|
|
94
|
-
"@deepseek-ai/dsh-client-ui-slots": "*",
|
|
95
|
-
"@deepseek-ai/dsh-commands": "*",
|
|
96
|
-
"@deepseek-ai/dsh-home-paths": "*",
|
|
97
|
-
"@deepseek-ai/dsh-host-webserver": "*",
|
|
98
|
-
"@deepseek-ai/dsh-llm": "*",
|
|
99
|
-
"@deepseek-ai/dsh-session": "*",
|
|
100
|
-
"@deepseek-ai/dsh-subprocess": "*",
|
|
101
|
-
"@deepseek-ai/dsh-
|
|
102
|
-
"@deepseek-ai/dsh-
|
|
103
|
-
"@deepseek-ai/dsh-user-
|
|
104
|
-
"@deepseek-ai/
|
|
105
|
-
"
|
|
106
|
-
"react
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"@deepseek-ai/
|
|
111
|
-
"@deepseek-ai/dsh-agent
|
|
112
|
-
"@deepseek-ai/dsh-agent-
|
|
113
|
-
"@deepseek-ai/dsh-
|
|
114
|
-
"@deepseek-ai/dsh-api-
|
|
115
|
-
"@deepseek-ai/dsh-
|
|
116
|
-
"@deepseek-ai/dsh-
|
|
117
|
-
"@deepseek-ai/dsh-
|
|
118
|
-
"@deepseek-ai/dsh-
|
|
119
|
-
"@deepseek-ai/dsh-client-
|
|
120
|
-
"@deepseek-ai/dsh-client-
|
|
121
|
-
"@deepseek-ai/dsh-client-
|
|
122
|
-
"@deepseek-ai/dsh-client-ui-
|
|
123
|
-
"@deepseek-ai/dsh-client-ui-
|
|
124
|
-
"@deepseek-ai/dsh-client-ui-
|
|
125
|
-
"@deepseek-ai/dsh-client-ui-
|
|
126
|
-
"@deepseek-ai/dsh-client-ui-
|
|
127
|
-
"@deepseek-ai/dsh-client-ui-
|
|
128
|
-
"@deepseek-ai/dsh-
|
|
129
|
-
"@deepseek-ai/dsh-
|
|
130
|
-
"@deepseek-ai/dsh-
|
|
131
|
-
"@deepseek-ai/dsh-
|
|
132
|
-
"@deepseek-ai/dsh-
|
|
133
|
-
"@deepseek-ai/dsh-
|
|
134
|
-
"@deepseek-ai/dsh-
|
|
135
|
-
"@deepseek-ai/dsh-
|
|
136
|
-
"@deepseek-ai/dsh-
|
|
137
|
-
"@deepseek-ai/dsh-host-
|
|
138
|
-
"@deepseek-ai/dsh-host-
|
|
139
|
-
"@deepseek-ai/dsh-host-
|
|
140
|
-
"@deepseek-ai/dsh-
|
|
141
|
-
"@deepseek-ai/dsh-
|
|
142
|
-
"@deepseek-ai/dsh-
|
|
143
|
-
"@deepseek-ai/dsh-llm
|
|
144
|
-
"@deepseek-ai/dsh-
|
|
145
|
-
"@deepseek-ai/dsh-
|
|
146
|
-
"@deepseek-ai/dsh-
|
|
147
|
-
"@deepseek-ai/dsh-
|
|
148
|
-
"@deepseek-ai/dsh-
|
|
149
|
-
"@deepseek-ai/dsh-
|
|
150
|
-
"@deepseek-ai/dsh-sandbox
|
|
151
|
-
"@deepseek-ai/dsh-
|
|
152
|
-
"@deepseek-ai/dsh-
|
|
153
|
-
"@deepseek-ai/dsh-session
|
|
154
|
-
"@deepseek-ai/dsh-session-
|
|
155
|
-
"@deepseek-ai/dsh-session-projection
|
|
156
|
-
"@deepseek-ai/dsh-session-
|
|
157
|
-
"@deepseek-ai/dsh-session-
|
|
158
|
-
"@deepseek-ai/dsh-session-
|
|
159
|
-
"@deepseek-ai/dsh-session-
|
|
160
|
-
"@deepseek-ai/dsh-
|
|
161
|
-
"@deepseek-ai/dsh-
|
|
162
|
-
"@deepseek-ai/dsh-
|
|
163
|
-
"@deepseek-ai/dsh-
|
|
164
|
-
"@deepseek-ai/dsh-storage
|
|
165
|
-
"@deepseek-ai/dsh-
|
|
166
|
-
"@deepseek-ai/dsh-
|
|
167
|
-
"@deepseek-ai/dsh-
|
|
168
|
-
"@deepseek-ai/dsh-
|
|
169
|
-
"@deepseek-ai/dsh-
|
|
170
|
-
"@deepseek-ai/dsh-
|
|
171
|
-
"@deepseek-ai/dsh-
|
|
172
|
-
"@deepseek-ai/dsh-
|
|
173
|
-
"@deepseek-ai/dsh-typert-
|
|
174
|
-
"@deepseek-ai/dsh-
|
|
175
|
-
"@deepseek-ai/dsh-user-
|
|
176
|
-
"@deepseek-ai/dsh-
|
|
177
|
-
"@deepseek-ai/
|
|
178
|
-
"@
|
|
179
|
-
"@types/
|
|
180
|
-
"@types/react
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"react
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
|
|
188
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@norman-else/dsh-claude",
|
|
3
|
+
"description": "Run the local Claude Code CLI as a first-class main conversation inside DeepSeek Harness",
|
|
4
|
+
"version": "0.1.36",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.mjs",
|
|
7
|
+
"types": "lib/index.d.mts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"dsh-claude": "lib/bin.mjs"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsdown",
|
|
13
|
+
"typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.client.json",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"check": "pnpm run typecheck && pnpm run test && pnpm run build",
|
|
16
|
+
"prepack": "pnpm run build",
|
|
17
|
+
"release": "node scripts/publish.mjs",
|
|
18
|
+
"release:check": "node scripts/publish.mjs --dry-run"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./lib/index.d.mts",
|
|
23
|
+
"default": "./lib/index.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./preset-route": {
|
|
26
|
+
"types": "./lib/preset-route.d.mts",
|
|
27
|
+
"default": "./lib/preset-route.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./client": "./lib/client.js",
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"lib",
|
|
34
|
+
"preset",
|
|
35
|
+
"legacy-preset",
|
|
36
|
+
"cordis.patch.yml",
|
|
37
|
+
"README.md",
|
|
38
|
+
"INSTALL.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/Norman-else/dsh-claude.git"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://github.com/Norman-else/dsh-claude#readme",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/Norman-else/dsh-claude/issues"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=20"
|
|
55
|
+
},
|
|
56
|
+
"dsh": {
|
|
57
|
+
"bundle": {
|
|
58
|
+
"patch": "./cordis.patch.yml"
|
|
59
|
+
},
|
|
60
|
+
"client": {
|
|
61
|
+
"inject": [
|
|
62
|
+
"@deepseek-ai/dsh-client-connection",
|
|
63
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
64
|
+
"@deepseek-ai/dsh-api-workspace-controller",
|
|
65
|
+
"@deepseek-ai/dsh-api-remotes",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-chat",
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
68
|
+
"@deepseek-ai/dsh-client-ui-input-trigger",
|
|
69
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
70
|
+
"@deepseek-ai/dsh-client-ui-session",
|
|
71
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
72
|
+
"@deepseek-ai/dsh-client-locale"
|
|
73
|
+
],
|
|
74
|
+
"platform": "web"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.247",
|
|
79
|
+
"dompurify": "^3.4.14",
|
|
80
|
+
"marked": "^18.0.11"
|
|
81
|
+
},
|
|
82
|
+
"peerDependencies": {
|
|
83
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
84
|
+
"@deepseek-ai/dsh-agent": "*",
|
|
85
|
+
"@deepseek-ai/dsh-agent-presets": "*",
|
|
86
|
+
"@deepseek-ai/dsh-attachment": "*",
|
|
87
|
+
"@deepseek-ai/dsh-brand": "*",
|
|
88
|
+
"@deepseek-ai/dsh-client-locale": "*",
|
|
89
|
+
"@deepseek-ai/dsh-client-runtime": "*",
|
|
90
|
+
"@deepseek-ai/dsh-client-ui-conversation": "*",
|
|
91
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": "*",
|
|
92
|
+
"@deepseek-ai/dsh-client-ui-primitives": "*",
|
|
93
|
+
"@deepseek-ai/dsh-client-ui-settings": "*",
|
|
94
|
+
"@deepseek-ai/dsh-client-ui-slots": "*",
|
|
95
|
+
"@deepseek-ai/dsh-commands": "*",
|
|
96
|
+
"@deepseek-ai/dsh-home-paths": "*",
|
|
97
|
+
"@deepseek-ai/dsh-host-webserver": "*",
|
|
98
|
+
"@deepseek-ai/dsh-llm": "*",
|
|
99
|
+
"@deepseek-ai/dsh-session": "*",
|
|
100
|
+
"@deepseek-ai/dsh-subprocess": "*",
|
|
101
|
+
"@deepseek-ai/dsh-timeout": "*",
|
|
102
|
+
"@deepseek-ai/dsh-tools": "*",
|
|
103
|
+
"@deepseek-ai/dsh-user-approval": "*",
|
|
104
|
+
"@deepseek-ai/dsh-user-questions": "*",
|
|
105
|
+
"@deepseek-ai/schemastery": "^3.18.1",
|
|
106
|
+
"react": "^18.2.0",
|
|
107
|
+
"react-dom": "^18.2.0"
|
|
108
|
+
},
|
|
109
|
+
"devDependencies": {
|
|
110
|
+
"@deepseek-ai/cordis": "4.0.1",
|
|
111
|
+
"@deepseek-ai/dsh-agent": "0.1.1-rc.2",
|
|
112
|
+
"@deepseek-ai/dsh-agent-default-model": "0.1.1-rc.2",
|
|
113
|
+
"@deepseek-ai/dsh-agent-presets": "0.1.1-rc.2",
|
|
114
|
+
"@deepseek-ai/dsh-api-gateway": "0.1.1-rc.2",
|
|
115
|
+
"@deepseek-ai/dsh-api-remotes": "0.1.1-rc.2",
|
|
116
|
+
"@deepseek-ai/dsh-atomic-write": "0.1.1-rc.2",
|
|
117
|
+
"@deepseek-ai/dsh-attachment": "0.1.1-rc.2",
|
|
118
|
+
"@deepseek-ai/dsh-brand": "0.1.1-rc.2",
|
|
119
|
+
"@deepseek-ai/dsh-client-connection": "0.1.1-rc.2",
|
|
120
|
+
"@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
|
|
121
|
+
"@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
|
|
122
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.1.1-rc.2",
|
|
123
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": "0.1.1-rc.2",
|
|
124
|
+
"@deepseek-ai/dsh-client-ui-layout": "0.1.1-rc.2",
|
|
125
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.1.1-rc.2",
|
|
126
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.1-rc.2",
|
|
127
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.1-rc.2",
|
|
128
|
+
"@deepseek-ai/dsh-client-ui-theme": "0.1.1-rc.2",
|
|
129
|
+
"@deepseek-ai/dsh-code-runtime": "0.1.1-rc.2",
|
|
130
|
+
"@deepseek-ai/dsh-commands": "0.1.1-rc.2",
|
|
131
|
+
"@deepseek-ai/dsh-compaction": "0.1.1-rc.2",
|
|
132
|
+
"@deepseek-ai/dsh-cordis-host-runner": "0.1.1-rc.2",
|
|
133
|
+
"@deepseek-ai/dsh-credentials": "0.1.1-rc.2",
|
|
134
|
+
"@deepseek-ai/dsh-file-reference": "0.1.1-rc.2",
|
|
135
|
+
"@deepseek-ai/dsh-goal": "0.1.1-rc.2",
|
|
136
|
+
"@deepseek-ai/dsh-home-paths": "0.1.1-rc.2",
|
|
137
|
+
"@deepseek-ai/dsh-host-apiproxy": "0.1.1-rc.2",
|
|
138
|
+
"@deepseek-ai/dsh-host-directory-picker": "0.1.1-rc.2",
|
|
139
|
+
"@deepseek-ai/dsh-host-plugin-inventory": "0.1.1-rc.2",
|
|
140
|
+
"@deepseek-ai/dsh-host-webserver": "0.1.1-rc.2",
|
|
141
|
+
"@deepseek-ai/dsh-invariants": "0.1.1-rc.2",
|
|
142
|
+
"@deepseek-ai/dsh-jobs": "0.1.1-rc.2",
|
|
143
|
+
"@deepseek-ai/dsh-llm": "0.1.1-rc.2",
|
|
144
|
+
"@deepseek-ai/dsh-llm-retry": "0.1.1-rc.2",
|
|
145
|
+
"@deepseek-ai/dsh-message-feedback": "0.1.1-rc.2",
|
|
146
|
+
"@deepseek-ai/dsh-native-command": "0.1.1-rc.2",
|
|
147
|
+
"@deepseek-ai/dsh-output-retention": "0.1.1-rc.2",
|
|
148
|
+
"@deepseek-ai/dsh-permission-presets": "0.1.1-rc.2",
|
|
149
|
+
"@deepseek-ai/dsh-plan-mode": "0.1.1-rc.2",
|
|
150
|
+
"@deepseek-ai/dsh-sandbox": "0.1.1-rc.2",
|
|
151
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.1.1-rc.2",
|
|
152
|
+
"@deepseek-ai/dsh-scope": "0.1.1-rc.2",
|
|
153
|
+
"@deepseek-ai/dsh-session": "0.1.1-rc.2",
|
|
154
|
+
"@deepseek-ai/dsh-session-persistence": "0.1.1-rc.2",
|
|
155
|
+
"@deepseek-ai/dsh-session-projection": "0.1.1-rc.2",
|
|
156
|
+
"@deepseek-ai/dsh-session-projection-cache": "0.1.1-rc.2",
|
|
157
|
+
"@deepseek-ai/dsh-session-query": "0.1.1-rc.2",
|
|
158
|
+
"@deepseek-ai/dsh-session-reference": "0.1.1-rc.2",
|
|
159
|
+
"@deepseek-ai/dsh-session-stats": "0.1.1-rc.2",
|
|
160
|
+
"@deepseek-ai/dsh-session-title": "0.1.1-rc.2",
|
|
161
|
+
"@deepseek-ai/dsh-settings": "0.1.1-rc.2",
|
|
162
|
+
"@deepseek-ai/dsh-shell": "0.1.1-rc.2",
|
|
163
|
+
"@deepseek-ai/dsh-skill": "0.1.1-rc.2",
|
|
164
|
+
"@deepseek-ai/dsh-storage": "0.1.1-rc.2",
|
|
165
|
+
"@deepseek-ai/dsh-storage-domain": "0.1.1-rc.2",
|
|
166
|
+
"@deepseek-ai/dsh-subagent": "0.1.1-rc.2",
|
|
167
|
+
"@deepseek-ai/dsh-subprocess": "0.1.1-rc.2",
|
|
168
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
|
|
169
|
+
"@deepseek-ai/dsh-timeout": "0.1.1-rc.2",
|
|
170
|
+
"@deepseek-ai/dsh-token-meter": "0.1.1-rc.2",
|
|
171
|
+
"@deepseek-ai/dsh-tool-todo": "0.1.1-rc.2",
|
|
172
|
+
"@deepseek-ai/dsh-tools": "0.1.1-rc.2",
|
|
173
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.1-rc.2",
|
|
174
|
+
"@deepseek-ai/dsh-typert-registry": "0.1.1-rc.2",
|
|
175
|
+
"@deepseek-ai/dsh-user-approval": "0.1.1-rc.2",
|
|
176
|
+
"@deepseek-ai/dsh-user-questions": "0.1.1-rc.2",
|
|
177
|
+
"@deepseek-ai/dsh-workspace": "0.1.1-rc.2",
|
|
178
|
+
"@deepseek-ai/schemastery": "3.18.1",
|
|
179
|
+
"@types/node": "^22.20.1",
|
|
180
|
+
"@types/react": "~18.3.31",
|
|
181
|
+
"@types/react-dom": "~18.3.7",
|
|
182
|
+
"jsdom": "^30.0.1",
|
|
183
|
+
"react": "18.2.0",
|
|
184
|
+
"react-dom": "18.2.0",
|
|
185
|
+
"tsdown": "^0.22.14",
|
|
186
|
+
"typescript": "^5.9.3",
|
|
187
|
+
"vitest": "^4.1.11"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { l as redactText } from "./events-DeSV0S1-.mjs";
|
|
2
|
-
//#region src/command-bridge.ts
|
|
3
|
-
const COMMAND_NAME = /^[a-z][a-z0-9_-]*$/u;
|
|
4
|
-
const MAX_DESCRIPTION_CHARS = 300;
|
|
5
|
-
const MAX_HINT_CHARS = 120;
|
|
6
|
-
/** DSH registry names reject `:`, but plugin-qualified Claude skills carry it
|
|
7
|
-
* (e.g. `awesome-skills:ci-deploy`). Derive a registry-safe public name while
|
|
8
|
-
* forwarding keeps the exact Claude-side name. */
|
|
9
|
-
function registryName(claudeName) {
|
|
10
|
-
if (COMMAND_NAME.test(claudeName)) return claudeName;
|
|
11
|
-
const short = claudeName.includes(":") ? claudeName.slice(claudeName.lastIndexOf(":") + 1) : void 0;
|
|
12
|
-
if (short !== void 0 && COMMAND_NAME.test(short)) return short;
|
|
13
|
-
const sanitized = claudeName.replaceAll(":", "-").toLowerCase();
|
|
14
|
-
return COMMAND_NAME.test(sanitized) ? sanitized : void 0;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Names registered as CLIENT-side commandUi contributions (not host
|
|
18
|
-
* commands). The DSH web command palette fails its whole command group when
|
|
19
|
-
* a host command name equals a contribution name
|
|
20
|
-
* ("contribution /model collides with a host command"), so these can never
|
|
21
|
-
* be registered by this bridge. Keep in sync with the client bundles:
|
|
22
|
-
* dsh-client-ui-model-selection registers "model".
|
|
23
|
-
*/
|
|
24
|
-
const CLIENT_CONTRIBUTION_NAMES = /* @__PURE__ */ new Set(["model"]);
|
|
25
|
-
/**
|
|
26
|
-
* Cordis service name the preset route provides (behind an entry-local
|
|
27
|
-
* isolate realm, so each session gets its own instance) and the host reads
|
|
28
|
-
* back with dsh-agent-presets' official `serviceForAgent(ctx, agent, name)`
|
|
29
|
-
* — the supported cross-scope read for callers that already hold the agent.
|
|
30
|
-
*/
|
|
31
|
-
const CLAUDE_COMMANDS_SERVICE = "claudeCommands";
|
|
32
|
-
function bounded(value, maxChars) {
|
|
33
|
-
return redactText(value, maxChars);
|
|
34
|
-
}
|
|
35
|
-
function projectClaudeCommands(catalog, target) {
|
|
36
|
-
const reservedNames = new Set(target.list().map((command) => command.name));
|
|
37
|
-
for (const name of CLIENT_CONTRIBUTION_NAMES) reservedNames.add(name);
|
|
38
|
-
const assigned = /* @__PURE__ */ new Set();
|
|
39
|
-
const views = [];
|
|
40
|
-
for (const command of catalog) {
|
|
41
|
-
const names = [command.name, ...command.aliases ?? []];
|
|
42
|
-
const commandBases = /* @__PURE__ */ new Set();
|
|
43
|
-
for (const claudeName of names) {
|
|
44
|
-
const base = registryName(claudeName);
|
|
45
|
-
if (base === void 0 || commandBases.has(base)) continue;
|
|
46
|
-
commandBases.add(base);
|
|
47
|
-
let publicName = base;
|
|
48
|
-
let prefixed = false;
|
|
49
|
-
if (reservedNames.has(publicName) || assigned.has(publicName)) {
|
|
50
|
-
publicName = `claude-${base}`;
|
|
51
|
-
prefixed = true;
|
|
52
|
-
}
|
|
53
|
-
if (!COMMAND_NAME.test(publicName) || reservedNames.has(publicName) || assigned.has(publicName)) continue;
|
|
54
|
-
const description = bounded(command.description || `Claude Code /${command.name}`, MAX_DESCRIPTION_CHARS);
|
|
55
|
-
const hint = bounded(command.argumentHint ?? "", MAX_HINT_CHARS);
|
|
56
|
-
views.push({
|
|
57
|
-
publicName,
|
|
58
|
-
claudeName,
|
|
59
|
-
description,
|
|
60
|
-
...hint.length === 0 ? {} : { hint },
|
|
61
|
-
prefixed
|
|
62
|
-
});
|
|
63
|
-
assigned.add(publicName);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return views;
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
|
-
export { projectClaudeCommands as n, CLAUDE_COMMANDS_SERVICE as t };
|
|
70
|
-
|
|
71
|
-
//# sourceMappingURL=command-bridge-DXI6nWhB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-bridge-DXI6nWhB.mjs","names":[],"sources":["../src/command-bridge.ts"],"sourcesContent":["import type { SlashCommand } from '@anthropic-ai/claude-agent-sdk'\r\nimport type { CommandDescriptor } from '@deepseek-ai/dsh-commands'\r\nimport { redactText } from './events.ts'\r\n\r\nconst COMMAND_NAME = /^[a-z][a-z0-9_-]*$/u\r\nconst MAX_DESCRIPTION_CHARS = 300\r\nconst MAX_HINT_CHARS = 120\r\n\r\n/** DSH registry names reject `:`, but plugin-qualified Claude skills carry it\r\n * (e.g. `awesome-skills:ci-deploy`). Derive a registry-safe public name while\r\n * forwarding keeps the exact Claude-side name. */\r\nfunction registryName(claudeName: string): string | undefined {\r\n if (COMMAND_NAME.test(claudeName)) return claudeName\r\n const short = claudeName.includes(':') ? claudeName.slice(claudeName.lastIndexOf(':') + 1) : undefined\r\n if (short !== undefined && COMMAND_NAME.test(short)) return short\r\n const sanitized = claudeName.replaceAll(':', '-').toLowerCase()\r\n return COMMAND_NAME.test(sanitized) ? sanitized : undefined\r\n}\r\n\r\n/**\r\n * Names registered as CLIENT-side commandUi contributions (not host\r\n * commands). The DSH web command palette fails its whole command group when\r\n * a host command name equals a contribution name\r\n * (\"contribution /model collides with a host command\"), so these can never\r\n * be registered by this bridge. Keep in sync with the client bundles:\r\n * dsh-client-ui-model-selection registers \"model\".\r\n */\r\nconst CLIENT_CONTRIBUTION_NAMES: ReadonlySet<string> = new Set(['model'])\r\n\r\nexport interface ClaudeCommandTarget {\r\n list(): readonly Pick<CommandDescriptor, 'name'>[]\r\n}\r\n\r\n/**\r\n * Agent-scope command-directory contract. The commands service is unreachable\r\n * from the host plugin's view of `agent.ctx` (\"without inject\"), but the\r\n * preset route plugin runs inside the agent's preset composition with\r\n * `commands` injected. The Host reads only the exact agent's effective names\r\n * for collision checks; Claude catalog entries are never registered there.\r\n */\r\nexport interface ClaudeAgentCommandService {\r\n list(agent: unknown): readonly Pick<CommandDescriptor, 'name'>[]\r\n}\r\n\r\n/**\r\n * Cordis service name the preset route provides (behind an entry-local\r\n * isolate realm, so each session gets its own instance) and the host reads\r\n * back with dsh-agent-presets' official `serviceForAgent(ctx, agent, name)`\r\n * — the supported cross-scope read for callers that already hold the agent.\r\n */\r\nexport const CLAUDE_COMMANDS_SERVICE = 'claudeCommands'\r\n\r\ndeclare module '@deepseek-ai/cordis' {\r\n interface Context {\r\n claudeCommands?: ClaudeAgentCommandService\r\n }\r\n}\r\n\r\nexport interface ClaudeCommandView {\r\n publicName: string\r\n claudeName: string\r\n description: string\r\n hint?: string\r\n prefixed: boolean\r\n}\r\n\r\nfunction bounded(value: string, maxChars: number): string {\r\n return redactText(value, maxChars)\r\n}\r\n\r\nexport function projectClaudeCommands(\r\n catalog: readonly SlashCommand[],\r\n target: ClaudeCommandTarget,\r\n): readonly ClaudeCommandView[] {\r\n const reservedNames = new Set(target.list().map(command => command.name))\r\n // Client contributions are absent from the Host directory but share the\r\n // same slash menu, so reserve their public names explicitly.\r\n for (const name of CLIENT_CONTRIBUTION_NAMES) reservedNames.add(name)\r\n const assigned = new Set<string>()\r\n const views: ClaudeCommandView[] = []\r\n for (const command of catalog) {\r\n const names = [command.name, ...(command.aliases ?? [])]\r\n const commandBases = new Set<string>()\r\n for (const claudeName of names) {\r\n const base = registryName(claudeName)\r\n if (base === undefined || commandBases.has(base)) continue\r\n commandBases.add(base)\r\n let publicName = base\r\n let prefixed = false\r\n if (reservedNames.has(publicName) || assigned.has(publicName)) {\r\n publicName = `claude-${base}`\r\n prefixed = true\r\n }\r\n if (!COMMAND_NAME.test(publicName) || reservedNames.has(publicName) || assigned.has(publicName)) continue\r\n const description = bounded(command.description || `Claude Code /${command.name}`, MAX_DESCRIPTION_CHARS)\r\n const hint = bounded(command.argumentHint ?? '', MAX_HINT_CHARS)\r\n views.push({\r\n publicName,\r\n claudeName,\r\n description,\r\n ...(hint.length === 0 ? {} : { hint }),\r\n prefixed,\r\n })\r\n assigned.add(publicName)\r\n }\r\n }\r\n return views\r\n}\r\n"],"mappings":";;AAIA,MAAM,eAAe;AACrB,MAAM,wBAAwB;AAC9B,MAAM,iBAAiB;;;;AAKvB,SAAS,aAAa,YAAwC;CAC5D,IAAI,aAAa,KAAK,UAAU,GAAG,OAAO;CAC1C,MAAM,QAAQ,WAAW,SAAS,GAAG,IAAI,WAAW,MAAM,WAAW,YAAY,GAAG,IAAI,CAAC,IAAI,KAAA;CAC7F,IAAI,UAAU,KAAA,KAAa,aAAa,KAAK,KAAK,GAAG,OAAO;CAC5D,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AAI,UAAU;EACzB;CACF;CACA,OAAO;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events-DeSV0S1-.mjs","names":[],"sources":["../src/constants.ts","../src/events.ts"],"sourcesContent":["export const CLAUDE_CODE_PROVIDER = 'claude'\nexport const CLAUDE_CODE_PRESET_ID = 'claude'\nexport const CLAUDE_CODE_PROVIDER_IDS = [CLAUDE_CODE_PROVIDER] as const\nexport const CLAUDE_SESSION_BOUND_EVENT = 'claude-code/session-bound'\nexport const CLAUDE_ACTIVITY_EVENT = 'claude-code/activity'\nexport const CLAUDE_CONTEXT_USAGE_EVENT = 'claude-code/context-usage'\nexport const CLAUDE_TASKS_EVENT = 'claude-code/tasks'\n/** Claude's subagent dispatch tools; rendered as plugin-owned group cards\n * gathering subagent activity instead of native tool cards. */\nexport const TASK_TOOL_NAMES: ReadonlySet<string> = new Set(['Task', 'Agent'])\nexport const SDK_VERSION = '0.3.247'\nexport const CLAUDE_DOCTOR_PATH = '/plugins/dsh-claude/doctor'\nexport const CLAUDE_CLIENT_DIAGNOSTICS_PATH = '/plugins/dsh-claude/client-diagnostics'\nexport const CLAUDE_UPDATE_CHECK_PATH = '/plugins/dsh-claude/update/check'\nexport const CLAUDE_USAGE_PATH = '/plugins/dsh-claude/usage'\nexport const CLAUDE_UPDATE_PATH = '/plugins/dsh-claude/update'\nexport const CLAUDE_PROJECTION_PATH = '/plugins/dsh-claude/projection'\nexport const CLAUDE_GLOBAL_SETTINGS_PATH = '/plugins/dsh-claude/settings/global'\nexport const CLAUDE_REPOSITORY_SETUP_PATH = '/plugins/dsh-claude/repository/setup'\nexport const CLAUDE_REPOSITORY_ACTION_PATH = '/plugins/dsh-claude/repository/action'\nexport const CLAUDE_REVIEW_COMMENT_PATH = '/plugins/dsh-claude/review-comments'\nexport const CLAUDE_REPOSITORY_FEEDBACK_PATH = '/plugins/dsh-claude/repository/feedback'\nexport const CLAUDE_REPOSITORY_STATUS_PATH = '/plugins/dsh-claude/repository/status'\nexport const CLAUDE_REPOSITORY_FILE_PATH = '/plugins/dsh-claude/repository/file'\nexport const CLAUDE_JIRA_PATH = '/plugins/dsh-claude/jira'\nexport const CLAUDE_ASK_PATH = '/plugins/dsh-claude/ask'\nexport const CLAUDE_EDITOR_OPEN_PATH = '/plugins/dsh-claude/editor/open'\nexport const CLAUDE_REWIND_PATH = '/plugins/dsh-claude/rewind'\n","import type { SessionEvent } from '@deepseek-ai/dsh-session'\r\nimport {\r\n CLAUDE_ACTIVITY_EVENT,\r\n CLAUDE_CONTEXT_USAGE_EVENT,\r\n CLAUDE_SESSION_BOUND_EVENT,\r\n CLAUDE_TASKS_EVENT,\r\n} from './constants.ts'\r\n\r\nexport type ClaudeActivityKind =\r\n | 'text'\r\n | 'status'\r\n /** Context compaction boundary; the transcript draws it as a divider. */\r\n | 'compaction'\r\n | 'thinking'\r\n | 'tool-call'\r\n | 'tool-result'\r\n | 'permission'\r\n | 'question'\r\n | 'subagent'\r\n | 'usage'\r\n | 'warning'\r\n | 'error'\r\n\r\nexport type ClaudeActivityPhase =\r\n | 'started'\r\n | 'updated'\r\n | 'completed'\r\n | 'denied'\r\n | 'failed'\r\n\r\nexport interface ClaudeUsage {\r\n inputTokens?: number\r\n outputTokens?: number\r\n cacheReadTokens?: number\r\n cacheCreationTokens?: number\r\n cumulativeCostUsd?: number\r\n}\r\n\r\nexport interface ClaudeSessionBoundEvent {\r\n claudeSessionId: string\r\n cliVersion?: string\r\n sdkVersion: string\r\n cwd: string\r\n}\r\n\r\nexport interface ClaudeActivityEvent {\r\n turn: number\r\n step: number\r\n ordinal: number\r\n kind: ClaudeActivityKind\r\n phase?: ClaudeActivityPhase\r\n /** Claude task-board identity for lifecycle activity; never a transcript path. */\r\n taskId?: string\r\n toolUseId?: string\r\n /** Enclosing Claude tool call for subagent-nested activity. */\r\n parentToolUseId?: string\r\n toolName?: string\r\n title?: string\r\n summary?: string\r\n detail?: string\r\n /** Redacted visible Claude prose used by the plugin-owned interleaved transcript. */\r\n text?: string\r\n isError?: boolean\r\n usage?: ClaudeUsage\r\n}\r\n\r\nexport interface ClaudeContextUsageCategory {\r\n name: string\r\n tokens: number\r\n color: string\r\n isDeferred?: boolean\r\n}\r\n\r\nexport interface ClaudeContextUsageEvent {\r\n model: string\r\n totalTokens: number\r\n maxTokens: number\r\n percentage: number\r\n categories: readonly ClaudeContextUsageCategory[]\r\n}\r\n\r\nexport interface ClaudeContextUsageInput {\r\n model: unknown\r\n totalTokens: unknown\r\n maxTokens: unknown\r\n percentage: unknown\r\n categories: readonly {\r\n name?: unknown\r\n tokens?: unknown\r\n color?: unknown\r\n isDeferred?: unknown\r\n }[]\r\n}\r\n\r\ndeclare module '@deepseek-ai/dsh-session/types' {\r\n interface SessionEventMap {\r\n 'claude-code/session-bound': ClaudeSessionBoundEvent\r\n 'claude-code/activity': ClaudeActivityEvent\r\n 'claude-code/context-usage': ClaudeContextUsageEvent\r\n 'claude-code/tasks': ClaudeTasksEvent\r\n }\r\n}\r\n\r\nconst SECRET_KEY = /(?:^|[_-])(password|passwd|secret|token|api[_-]?key|authorization|credential|private[_-]?key|session[_-]?key|env|environ|environment)(?:$|[_-])/i\r\nconst MAX_SUMMARY_CHARS = 1_000\r\nconst MAX_DETAIL_CHARS = 4_000\r\nconst MAX_TRANSCRIPT_TEXT_CHARS = 64_000\r\nconst MAX_DEPTH = 6\r\nconst MAX_ARRAY_ITEMS = 40\r\nconst MAX_OBJECT_KEYS = 60\r\nconst REDACTED = '[REDACTED]'\r\nconst TRUNCATED = '…[truncated]'\r\nconst SECRET_ASSIGNMENT = /((?:password|passwd|secret|token|api[_-]?key|authorization|credential|private[_-]?key|session[_-]?key)\\s*(?:=|:)\\s*)(?:\"[^\"]*\"|'[^']*'|[^\\s,;&]+)/giu\r\nconst BEARER_TOKEN = /(\\bbearer\\s+)[A-Za-z0-9._~+/=-]+/giu\r\nconst PREFIXED_TOKEN = /\\b(?:sk-(?:ant-|proj-)?|xox[baprs]-|ghp_|github_pat_)[A-Za-z0-9_-]{8,}/giu\r\nconst JWT_TOKEN = /\\beyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\b/gu\r\nconst URL_USERINFO = /([a-z][a-z0-9+.-]*:\\/\\/[^:\\s/@]+:)[^@\\s/]+@/giu\r\nconst URL_SECRET_PARAM = /([?&](?:password|secret|token|api[_-]?key|access[_-]?token|refresh[_-]?token)=)[^&#\\s]+/giu\r\n\r\nexport function boundText(value: string, maxChars: number): string {\r\n if (value.length <= maxChars) return value\r\n return `${value.slice(0, Math.max(0, maxChars - TRUNCATED.length))}${TRUNCATED}`\r\n}\r\n\r\nexport function redactText(value: string, maxChars = MAX_DETAIL_CHARS): string {\r\n return boundText(\r\n value\r\n .replace(JWT_TOKEN, REDACTED)\r\n .replace(PREFIXED_TOKEN, REDACTED)\r\n .replace(BEARER_TOKEN, `$1${REDACTED}`)\r\n .replace(URL_USERINFO, `$1${REDACTED}@`)\r\n .replace(URL_SECRET_PARAM, `$1${REDACTED}`)\r\n .replace(SECRET_ASSIGNMENT, `$1${REDACTED}`),\r\n maxChars,\r\n )\r\n}\r\n\r\nexport function redactValue(value: unknown, depth = 0, seen = new WeakSet<object>()): unknown {\r\n if (depth > MAX_DEPTH) return '[max-depth]'\r\n if (value === null || typeof value === 'boolean' || typeof value === 'number') return value\r\n if (typeof value === 'string') return redactText(value)\r\n if (typeof value === 'bigint') return value.toString()\r\n if (typeof value === 'undefined') return null\r\n if (typeof value === 'function' || typeof value === 'symbol') return `[${typeof value}]`\r\n if (value instanceof Error) {\r\n return { name: value.name, message: redactText(value.message, MAX_SUMMARY_CHARS) }\r\n }\r\n if (typeof value !== 'object') return String(value)\r\n if (seen.has(value)) return '[circular]'\r\n seen.add(value)\r\n try {\r\n if (Array.isArray(value)) {\r\n const items = value.slice(0, MAX_ARRAY_ITEMS).map(item => redactValue(item, depth + 1, seen))\r\n if (value.length > MAX_ARRAY_ITEMS) items.push(`[${value.length - MAX_ARRAY_ITEMS} more items]`)\r\n return items\r\n }\r\n const result: Record<string, unknown> = {}\r\n const entries = Object.entries(value as Record<string, unknown>)\r\n for (const [key, item] of entries.slice(0, MAX_OBJECT_KEYS)) {\r\n result[key] = SECRET_KEY.test(key) ? REDACTED : redactValue(item, depth + 1, seen)\r\n }\r\n if (entries.length > MAX_OBJECT_KEYS) result.__truncatedKeys = entries.length - MAX_OBJECT_KEYS\r\n return result\r\n } finally {\r\n seen.delete(value)\r\n }\r\n}\r\n\r\nexport function safeDetail(value: unknown): string | undefined {\r\n if (value === undefined) return undefined\r\n const redacted = redactValue(value)\r\n const text = typeof redacted === 'string' ? redacted : JSON.stringify(redacted)\r\n return boundText(text, MAX_DETAIL_CHARS)\r\n}\r\n\r\nexport function normalizeActivity(\r\n activity: Omit<ClaudeActivityEvent, 'summary' | 'detail'> & {\r\n summary?: unknown\r\n detail?: unknown\r\n },\r\n): ClaudeActivityEvent {\r\n const normalized: ClaudeActivityEvent = {\r\n turn: activity.turn,\r\n step: activity.step,\r\n ordinal: activity.ordinal,\r\n kind: activity.kind,\r\n }\r\n if (activity.phase !== undefined) normalized.phase = activity.phase\r\n if (activity.taskId !== undefined) normalized.taskId = redactText(activity.taskId, 128)\r\n if (activity.toolUseId !== undefined) normalized.toolUseId = redactText(activity.toolUseId, 256)\r\n if (activity.parentToolUseId !== undefined) normalized.parentToolUseId = redactText(activity.parentToolUseId, 256)\r\n if (activity.toolName !== undefined) normalized.toolName = redactText(activity.toolName, 256)\r\n if (activity.title !== undefined) normalized.title = redactText(activity.title, MAX_SUMMARY_CHARS)\r\n if (activity.summary !== undefined) {\r\n normalized.summary = redactText(\r\n typeof activity.summary === 'string' ? activity.summary : safeDetail(activity.summary) ?? '',\r\n MAX_SUMMARY_CHARS,\r\n )\r\n }\r\n const detail = safeDetail(activity.detail)\r\n if (detail !== undefined) normalized.detail = detail\r\n if (activity.text !== undefined) normalized.text = redactText(activity.text, MAX_TRANSCRIPT_TEXT_CHARS)\r\n if (activity.isError !== undefined) normalized.isError = activity.isError\r\n if (activity.usage !== undefined) normalized.usage = { ...activity.usage }\r\n return normalized\r\n}\r\n\r\nconst MAX_CONTEXT_CATEGORIES = 24\r\nconst FALLBACK_CONTEXT_COLOR = '#8b95a5'\r\nconst SAFE_CONTEXT_COLOR = /^#[0-9a-f]{3,8}$/iu\r\n\r\nfunction nonNegativeInteger(value: unknown): number {\r\n return typeof value === 'number' && Number.isFinite(value)\r\n ? Math.max(0, Math.floor(value))\r\n : 0\r\n}\r\n\r\nexport function normalizeContextUsage(input: ClaudeContextUsageInput): ClaudeContextUsageEvent {\r\n return {\r\n model: redactText(typeof input.model === 'string' ? input.model : 'unknown', 128),\r\n totalTokens: nonNegativeInteger(input.totalTokens),\r\n maxTokens: nonNegativeInteger(input.maxTokens),\r\n percentage: Math.min(100, nonNegativeInteger(input.percentage)),\r\n categories: input.categories.slice(0, MAX_CONTEXT_CATEGORIES).map(category => ({\r\n name: redactText(typeof category.name === 'string' ? category.name : 'Unknown', 128),\r\n tokens: nonNegativeInteger(category.tokens),\r\n color: typeof category.color === 'string' && SAFE_CONTEXT_COLOR.test(category.color)\r\n ? category.color\r\n : FALLBACK_CONTEXT_COLOR,\r\n ...(category.isDeferred === true ? { isDeferred: true } : {}),\r\n })),\r\n }\r\n}\r\n\r\nexport function latestClaudeContextUsage(\r\n events: readonly SessionEvent[],\r\n): ClaudeContextUsageEvent | undefined {\r\n for (let index = events.length - 1; index >= 0; index -= 1) {\r\n const event = events[index]\r\n if (event?.type === CLAUDE_CONTEXT_USAGE_EVENT) return event.data as ClaudeContextUsageEvent\r\n }\r\n return undefined\r\n}\r\n\r\nexport type ClaudeTaskStatus = 'running' | 'completed' | 'failed' | 'stopped' | 'killed'\r\n\r\nexport interface ClaudeTaskUsage {\r\n totalTokens?: number\r\n toolUses?: number\r\n durationMs?: number\r\n}\r\n\r\nexport interface ClaudeTaskInfo {\r\n taskId: string\r\n description: string\r\n status: ClaudeTaskStatus\r\n /** DSH turn during which this task was first observed, when known. */\r\n originTurn?: number\r\n subagentType?: string\r\n taskType?: string\r\n lastToolName?: string\r\n summary?: string\r\n usage?: ClaudeTaskUsage\r\n /** True while the task runs detached (background command/subagent). */\r\n backgrounded?: boolean\r\n}\r\n\r\n/** Level snapshot of one session's Claude task board, REPLACE semantics. */\r\nexport interface ClaudeTasksEvent {\r\n tasks: readonly ClaudeTaskInfo[]\r\n}\r\n\r\nconst MAX_TASKS_PER_SNAPSHOT = 50\r\nconst MAX_TASK_TEXT_CHARS = 300\r\n\r\nconst TASK_STATUSES: ReadonlySet<string> = new Set(['running', 'completed', 'failed', 'stopped', 'killed'])\r\n\r\nfunction normalizeTaskUsage(input: ClaudeTaskUsage | undefined): ClaudeTaskUsage | undefined {\r\n if (input === undefined) return undefined\r\n const usage: ClaudeTaskUsage = {}\r\n if (input.totalTokens !== undefined) usage.totalTokens = nonNegativeInteger(input.totalTokens)\r\n if (input.toolUses !== undefined) usage.toolUses = nonNegativeInteger(input.toolUses)\r\n if (input.durationMs !== undefined) usage.durationMs = nonNegativeInteger(input.durationMs)\r\n return Object.keys(usage).length === 0 ? undefined : usage\r\n}\r\n\r\nexport function normalizeTasksEvent(tasks: readonly ClaudeTaskInfo[]): ClaudeTasksEvent {\r\n return {\r\n tasks: tasks.slice(0, MAX_TASKS_PER_SNAPSHOT).map(task => {\r\n const usage = normalizeTaskUsage(task.usage)\r\n return {\r\n taskId: redactText(String(task.taskId), 128),\r\n description: redactText(String(task.description), MAX_TASK_TEXT_CHARS),\r\n status: TASK_STATUSES.has(task.status) ? task.status : 'running',\r\n ...(task.originTurn === undefined ? {} : { originTurn: nonNegativeInteger(task.originTurn) }),\r\n ...(task.subagentType === undefined ? {} : { subagentType: redactText(task.subagentType, 64) }),\r\n ...(task.taskType === undefined ? {} : { taskType: redactText(task.taskType, 64) }),\r\n ...(task.lastToolName === undefined ? {} : { lastToolName: redactText(task.lastToolName, 64) }),\r\n ...(task.summary === undefined ? {} : { summary: redactText(task.summary, MAX_TASK_TEXT_CHARS) }),\r\n ...(usage === undefined ? {} : { usage }),\r\n ...(task.backgrounded === true ? { backgrounded: true } : {}),\r\n }\r\n }),\r\n }\r\n}\r\n\r\nexport function latestClaudeTasks(\r\n events: readonly SessionEvent[],\r\n): ClaudeTasksEvent | undefined {\r\n for (let index = events.length - 1; index >= 0; index -= 1) {\r\n const event = events[index]\r\n if (event?.type === CLAUDE_TASKS_EVENT) return event.data as ClaudeTasksEvent\r\n }\r\n return undefined\r\n}\r\n\r\nexport type ClaudeActivityInput = Omit<\r\n ClaudeActivityEvent,\r\n 'turn' | 'step' | 'ordinal' | 'summary' | 'detail'\r\n> & {\r\n summary?: unknown\r\n detail?: unknown\r\n}\r\n\r\nexport interface ClaudeActivityCursor {\r\n turn: number\r\n step: number\r\n nextOrdinal: number\r\n}\r\n\r\n/** Derive the current DSH turn/step; activity ordinals are completed from the sidecar. */\r\nexport function currentClaudeActivityCursor(events: readonly SessionEvent[]): ClaudeActivityCursor {\r\n let turn = 0\r\n let step = 0\r\n for (const event of events) {\r\n if (event.type !== 'step/start') continue\r\n const data = event.data as { turn: number; step: number }\r\n turn = data.turn\r\n step = data.step\r\n }\r\n if (turn < 1 || step < 1) {\r\n throw new Error('dsh-claude: Claude activity requires an open DSH step')\r\n }\r\n return { turn, step, nextOrdinal: 0 }\r\n}\r\n\r\nexport function latestClaudeSessionBinding(\r\n events: readonly SessionEvent[],\r\n): ClaudeSessionBoundEvent | undefined {\r\n for (let index = events.length - 1; index >= 0; index -= 1) {\r\n const event = events[index]\r\n if (event?.type === CLAUDE_SESSION_BOUND_EVENT) {\r\n return event.data as ClaudeSessionBoundEvent\r\n }\r\n }\r\n return undefined\r\n}\r\n"],"mappings":";AAAA,MAAa,uBAAuB;AACpC,MAAa,wBAAwB;AACrC,MAAa,2BAA2B,CAAC,oBAAoB;AAE7D,MAAa,wBAAwB;;;AAKrC,MAAa,kCAAuC,IAAI,IAAI,CAAC,QAAQ,OAAO,CAAC;AAC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