dsh-cc-agents 0.3.1 → 0.3.3
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/package.json +2 -2
- package/src/index.js +10 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cc-agents",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Load Claude Code .claude/agents (identity-anchored subagents: frontmatter + system-prompt body) into DSH delegation via the persona channel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"dsh-cc-loader": "^0.3.
|
|
31
|
+
"dsh-cc-loader": "^0.3.3"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@deepseek-ai/cordis": "*",
|
package/src/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// CC agents are identity-anchored subagents: frontmatter (name/description/
|
|
5
5
|
// tools/disallowedTools/model/skills/…) + a system-prompt body. DSH has no
|
|
6
6
|
// pre-registered agent directory, so this adapter provides both halves:
|
|
7
|
-
// 1. catalog injection (
|
|
7
|
+
// 1. catalog injection (session start → user message): the model sees
|
|
8
8
|
// the available agents' name + description (CC @-mention semantics).
|
|
9
9
|
// 2. a `cc_agent` delegation tool: looks the agent up, then starts a
|
|
10
10
|
// subagent via ctx.subagents with
|
|
@@ -21,7 +21,7 @@ import { readFile } from 'node:fs/promises'
|
|
|
21
21
|
import { homedir } from 'node:os'
|
|
22
22
|
import z from '@deepseek-ai/schemastery'
|
|
23
23
|
import { createUserMessage } from '@deepseek-ai/dsh-llm'
|
|
24
|
-
import { loadClaude, parseFrontmatter, expandCcToolToDsh, pluginComponentName } from 'dsh-cc-loader'
|
|
24
|
+
import { injectedSource, loadClaude, onSessionStart, parseFrontmatter, expandCcToolToDsh, pluginComponentName } from 'dsh-cc-loader'
|
|
25
25
|
|
|
26
26
|
export const name = 'cc-agents'
|
|
27
27
|
export const inject = ['tools', 'subagents']
|
|
@@ -56,8 +56,8 @@ export const Config = z.object({
|
|
|
56
56
|
modelAliases: z.dict(z.string()).default({}),
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
const PLUGIN_SOURCE =
|
|
59
|
+
/** Source for the catalog reminder this adapter injects — see dsh-cc-loader's message-source.js. */
|
|
60
|
+
const PLUGIN_SOURCE = injectedSource('cc-agents')
|
|
61
61
|
|
|
62
62
|
export function apply(ctx, config = {}) {
|
|
63
63
|
const homeDir = config.homeDir ?? homedir()
|
|
@@ -93,14 +93,18 @@ export function apply(ctx, config = {}) {
|
|
|
93
93
|
return entry
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// ─── catalog injection (
|
|
96
|
+
// ─── catalog injection (session start) ────────────────────────────────────
|
|
97
97
|
// Top-level sessions only: subagents (delegated children carry a
|
|
98
98
|
// parentSession header) get their own system prompt — the CC agent body as
|
|
99
99
|
// persona — and must NOT receive the parent's catalog reminder. Injecting it
|
|
100
100
|
// would append a user message after the delegation prompt, which the child
|
|
101
101
|
// then mistakes for its actual task.
|
|
102
|
+
//
|
|
103
|
+
// `onSessionStart` spans the host move from `agent/session-start` (0.1.5) to
|
|
104
|
+
// `agent/created` (0.2.0) and runs the discovery below detached, so it cannot
|
|
105
|
+
// stall session publication.
|
|
102
106
|
if (config.injectCatalog !== false) {
|
|
103
|
-
ctx
|
|
107
|
+
onSessionStart(ctx, async ({ agent }) => {
|
|
104
108
|
try {
|
|
105
109
|
if (agent?.session?.header?.parentSession !== undefined) return
|
|
106
110
|
const { agents } = await catalogFor(agent)
|