dsh-my-go 0.1.26 → 0.1.27
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 +1 -1
- package/preset/tools/broker.mjs +62 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-my-go",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
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",
|
package/preset/tools/broker.mjs
CHANGED
|
@@ -340,22 +340,62 @@ export async function apply(ctx, config = {}) {
|
|
|
340
340
|
3. 收到 intent=replan 时,必须切换智能体类型,而不是原地升级模型。
|
|
341
341
|
4. Prometheus 只做规划不执行;它的计划必须由你按步骤重新调度。`
|
|
342
342
|
|
|
343
|
-
//
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
//
|
|
347
|
-
//
|
|
343
|
+
// ── per-agent persona + orchestration via systemPrompt ────────────────────
|
|
344
|
+
//
|
|
345
|
+
// Sub-agents inherit the preset's scope, so they DO see these sections.
|
|
346
|
+
// We use text functions with parentSession detection (no race condition)
|
|
347
|
+
// to differentiate Sisyphus from sub-agents.
|
|
348
|
+
//
|
|
349
|
+
// For sub-agents:
|
|
350
|
+
// - deployment:persona: empty (sub-agent persona is injected via context)
|
|
351
|
+
// - dsh-my-go:orchestration: empty (sub-agents don't orchestrate)
|
|
352
|
+
// - systemPrompt.context: injects the sub-agent's role description
|
|
353
|
+
//
|
|
354
|
+
// For Sisyphus:
|
|
355
|
+
// - deployment:persona: full Sisyphus persona
|
|
356
|
+
// - dsh-my-go:orchestration: full orchestration rules
|
|
357
|
+
// - systemPrompt.context: empty (Sisyphus has no extra context)
|
|
358
|
+
|
|
359
|
+
const isSubAgentContext = (context) => {
|
|
360
|
+
// context = { agent, scope: agent } from assembleContextFor()
|
|
361
|
+
// Sub-agents have parentSession set in their session header
|
|
362
|
+
return context?.agent?.session?.header?.parentSession != null
|
|
363
|
+
}
|
|
364
|
+
|
|
348
365
|
ctx.effect(() => ctx.systemPrompt.section({
|
|
349
366
|
name: 'deployment:persona',
|
|
350
367
|
order: 0,
|
|
351
|
-
text: SISYPHUS_PERSONA,
|
|
368
|
+
text: (context) => isSubAgentContext(context) ? '' : SISYPHUS_PERSONA,
|
|
352
369
|
}), 'dsh-my-go-broker.persona()')
|
|
353
370
|
ctx.effect(() => ctx.systemPrompt.section({
|
|
354
371
|
name: 'dsh-my-go:orchestration',
|
|
355
372
|
order: 20,
|
|
356
|
-
text: ORCHESTRATION_TEXT,
|
|
373
|
+
text: (context) => isSubAgentContext(context) ? '' : ORCHESTRATION_TEXT,
|
|
357
374
|
}), 'dsh-my-go-broker.orchestration()')
|
|
358
375
|
|
|
376
|
+
// Inject sub-agent identity via systemPrompt.context (system prompt level).
|
|
377
|
+
// The text function checks parentSession — no race condition.
|
|
378
|
+
const ROLE_DESCRIPTIONS = {
|
|
379
|
+
hermes: 'You are Hermes, the rapid executor. You do batch replacements, code formatting, import consolidation, and text manipulation — fast mechanical work. You report results to Sisyphus.',
|
|
380
|
+
explore: 'You are Explore, the fast searcher. You grep, read files, locate symbols, and scan directory structures — quick reconnaissance. You report results to Sisyphus.',
|
|
381
|
+
librarian: 'You are Librarian, the document reader. You read READMEs, API references, historical docs, and extract comments — document intelligence. You report results to Sisyphus.',
|
|
382
|
+
looker: 'You are Looker, the multimodal recognizer. You identify UI screenshots, design mockups, PDF charts — visual understanding. You report results to Sisyphus.',
|
|
383
|
+
hephaestus: 'You are Hephaestus, the code crafter. You do single-file refactors, module implementations, unit tests, and routine code generation. You report results to Sisyphus.',
|
|
384
|
+
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. You report results to Sisyphus.',
|
|
385
|
+
oracle: 'You are Oracle, the architect debugger and final validator. You do cross-module dependency analysis, deep bug localization, code review, and final acceptance. You report results to Sisyphus.',
|
|
386
|
+
}
|
|
387
|
+
ctx.effect(() => ctx.systemPrompt.context({
|
|
388
|
+
name: 'dsh-my-go:subagent-role',
|
|
389
|
+
order: 10,
|
|
390
|
+
text: (context) => {
|
|
391
|
+
if (!isSubAgentContext(context)) return ''
|
|
392
|
+
// We don't know the exact agent type from the context alone,
|
|
393
|
+
// but we can infer it from the session metadata or just provide
|
|
394
|
+
// a generic sub-agent identity. The specific type info is in the prompt.
|
|
395
|
+
return 'You are a specialist sub-agent in the dsh-my-go orchestration system. You execute one focused task and report results to Sisyphus. You do not delegate further.'
|
|
396
|
+
},
|
|
397
|
+
}), 'dsh-my-go-broker.subagent-role()')
|
|
398
|
+
|
|
359
399
|
// ── internal go_work implementation (shared by the tool, forward, queue) ─
|
|
360
400
|
async function dispatchWork(agentType, prompt, parent, signal) {
|
|
361
401
|
if (!AGENT_TYPES.includes(agentType)) throw new Error(`unknown agent type: ${String(agentType)}`)
|
|
@@ -390,24 +430,25 @@ export async function apply(ctx, config = {}) {
|
|
|
390
430
|
// No provider available — set model anyway, agent/request handler will validate
|
|
391
431
|
agentOpts.model = binding.model
|
|
392
432
|
}
|
|
393
|
-
// Inject sub-agent
|
|
394
|
-
//
|
|
395
|
-
//
|
|
396
|
-
//
|
|
433
|
+
// Inject sub-agent type-specific context via systemPrompt.context (generic)
|
|
434
|
+
// and the specific role via <system-reminder> in user prompt.
|
|
435
|
+
// The context injection provides the base identity; the user prompt
|
|
436
|
+
// provides type-specific details wrapped in <system-reminder> tags.
|
|
397
437
|
const roleDescriptions = {
|
|
398
|
-
hermes: 'You are Hermes, the rapid executor.
|
|
399
|
-
explore: 'You are Explore, the fast searcher.
|
|
400
|
-
librarian: 'You are Librarian, the document reader.
|
|
401
|
-
looker: 'You are Looker, the multimodal recognizer.
|
|
402
|
-
hephaestus: 'You are Hephaestus, the code crafter.
|
|
403
|
-
prometheus: 'You are Prometheus, the requirement planner.
|
|
404
|
-
oracle: 'You are Oracle, the architect debugger
|
|
438
|
+
hermes: 'You are Hermes, the rapid executor. Batch replacements, code formatting, import consolidation, text manipulation.',
|
|
439
|
+
explore: 'You are Explore, the fast searcher. Grep, read files, locate symbols, scan directories.',
|
|
440
|
+
librarian: 'You are Librarian, the document reader. READMEs, API references, historical docs.',
|
|
441
|
+
looker: 'You are Looker, the multimodal recognizer. UI screenshots, design mockups, PDF charts.',
|
|
442
|
+
hephaestus: 'You are Hephaestus, the code crafter. Single-file refactors, module implementations, unit tests.',
|
|
443
|
+
prometheus: 'You are Prometheus, the requirement planner. Understand requirements, decompose into steps, output a plan. Do NOT execute.',
|
|
444
|
+
oracle: 'You are Oracle, the architect debugger. Cross-module analysis, bug localization, code review, final acceptance.',
|
|
405
445
|
}
|
|
406
|
-
const
|
|
407
|
-
const identityPrefix = `${rolePrefix}\n\nYou report your results to Sisyphus. Execute the following task and report back.\n\n`
|
|
446
|
+
const roleInfo = roleDescriptions[agentType] || `You are a ${agentType} sub-agent.`
|
|
408
447
|
const request = {
|
|
409
448
|
label: agentLabel(agentType, prompt.slice(0, 60)),
|
|
410
|
-
prompt: [
|
|
449
|
+
prompt: [
|
|
450
|
+
{ type: 'text', text: `<system-reminder>\n${roleInfo}\nYou report results to Sisyphus. You do not delegate further.\n</system-reminder>\n\n${prompt}` },
|
|
451
|
+
],
|
|
411
452
|
parent,
|
|
412
453
|
...(Object.keys(agentOpts).length > 0 ? { agentOptions: agentOpts } : {}),
|
|
413
454
|
signal,
|