dsh-my-go 0.1.25 → 0.1.26

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-my-go",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "DSH plugin: Sisyphus agent orchestration — star topology, single-line blocking, 7 specialist sub-agents (Hermes/Explore/Librarian/Looker/Hephaestus/Prometheus/Oracle) with per-type model binding, go_work/continue/need_help/forward communication tools, Web UI tree panel and settings.",
5
5
  "author": "daizihan233",
6
6
  "license": "MIT",
@@ -293,9 +293,8 @@ export async function apply(ctx, config = {}) {
293
293
  // ── per-agent persona + orchestration sections ───────────────────────────
294
294
  // The broker registers sections that differ by agent type:
295
295
  // - Sisyphus (root): full persona + orchestration instructions
296
- // - Sub-agents: minimal persona only (no orchestration rules)
296
+ // Sub-agents get their identity injected into prompt text via dispatchWork.
297
297
  const SISYPHUS_PERSONA = `You are Sisyphus, the master orchestrator and quality gate of the dsh-my-go agent system. You run on the {{model}} model in {{cwd}}. You receive the user's request, dispatch it to the right sub-agent, review every response, and reject low-quality results for rework. You never do the sub-agent's work yourself when a sub-agent fits.`
298
- const SUBAGENT_PERSONA = `You are a specialist sub-agent in the dsh-my-go system. You execute one focused task and report results to Sisyphus. You do not delegate further.`
299
298
  const ORCHESTRATION_TEXT = `# Sisyphus 编排规则
300
299
 
301
300
  你是 Sisyphus:总调度 + 质检官。子智能体不直接通信,全部经由你中转。
@@ -341,24 +340,20 @@ export async function apply(ctx, config = {}) {
341
340
  3. 收到 intent=replan 时,必须切换智能体类型,而不是原地升级模型。
342
341
  4. Prometheus 只做规划不执行;它的计划必须由你按步骤重新调度。`
343
342
 
344
- // Register persona + orchestration with TEXT FUNCTIONS.
345
- // section.text(context) receives { agent, scope: agent } — we check
346
- // sessionTypes to return different text for sub-agents vs Sisyphus.
343
+ // Register persona + orchestration for Sisyphus only (static text).
344
+ // Sub-agents get their identity injected into prompt text via dispatchWork.
345
+ // We do NOT use section.text functions because:
346
+ // 1. Sub-agents may not inherit parent preset sections (scope issue)
347
+ // 2. Even if visible, text functions have a race condition with sessionTypes
347
348
  ctx.effect(() => ctx.systemPrompt.section({
348
349
  name: 'deployment:persona',
349
350
  order: 0,
350
- text: (context) => {
351
- const agentId = context?.agent?.id
352
- return agentId && sessionTypes.has(agentId) ? SUBAGENT_PERSONA : SISYPHUS_PERSONA
353
- },
351
+ text: SISYPHUS_PERSONA,
354
352
  }), 'dsh-my-go-broker.persona()')
355
353
  ctx.effect(() => ctx.systemPrompt.section({
356
354
  name: 'dsh-my-go:orchestration',
357
355
  order: 20,
358
- text: (context) => {
359
- const agentId = context?.agent?.id
360
- return agentId && sessionTypes.has(agentId) ? '' : ORCHESTRATION_TEXT
361
- },
356
+ text: ORCHESTRATION_TEXT,
362
357
  }), 'dsh-my-go-broker.orchestration()')
363
358
 
364
359
  // ── internal go_work implementation (shared by the tool, forward, queue) ─
@@ -395,10 +390,21 @@ export async function apply(ctx, config = {}) {
395
390
  // No provider available — set model anyway, agent/request handler will validate
396
391
  agentOpts.model = binding.model
397
392
  }
398
- // Inject sub-agent identity directly into the prompt text.
399
- // Sub-agents may not inherit the parent's systemPrompt sections,
400
- // so we cannot rely on section.text functions for them.
401
- const identityPrefix = `You are ${agentLabel(agentType, '')}. Execute the following task and report your results to Sisyphus.\n\n`
393
+ // Inject sub-agent identity + role directly into the prompt text.
394
+ // Sub-agents may not inherit parent systemPrompt sections, so we
395
+ // cannot rely on section.text functions. The identity is injected
396
+ // as the first message so the model knows its role.
397
+ const roleDescriptions = {
398
+ hermes: 'You are Hermes, the rapid executor. You do batch replacements, code formatting, import consolidation, and text manipulation — fast mechanical work.',
399
+ explore: 'You are Explore, the fast searcher. You grep, read files, locate symbols, and scan directory structures — quick reconnaissance.',
400
+ librarian: 'You are Librarian, the document reader. You read READMEs, API references, historical docs, and extract comments — document intelligence.',
401
+ looker: 'You are Looker, the multimodal recognizer. You identify UI screenshots, design mockups, PDF charts — visual understanding.',
402
+ hephaestus: 'You are Hephaestus, the code crafter. You do single-file refactors, module implementations, unit tests, and routine code generation.',
403
+ prometheus: 'You are Prometheus, the requirement planner. You understand vague requirements, decompose them into executable steps, and output a plan. You do NOT execute — only plan.',
404
+ oracle: 'You are Oracle, the architect debugger and final validator. You do cross-module dependency analysis, deep bug localization, code review, and final acceptance.',
405
+ }
406
+ const rolePrefix = roleDescriptions[agentType] || `You are a ${agentType} sub-agent.`
407
+ const identityPrefix = `${rolePrefix}\n\nYou report your results to Sisyphus. Execute the following task and report back.\n\n`
402
408
  const request = {
403
409
  label: agentLabel(agentType, prompt.slice(0, 60)),
404
410
  prompt: [{ type: 'text', text: identityPrefix + prompt }],