opencode-swarm 6.0.1 → 6.1.0

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.
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './architect';
2
+ export declare function createDesignerAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './architect';
2
+ export declare function createDocsAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -19,6 +19,8 @@ export declare function getAgentConfigs(config?: PluginConfig): Record<string, S
19
19
  export { createArchitectAgent } from './architect';
20
20
  export { createCoderAgent } from './coder';
21
21
  export { createCriticAgent } from './critic';
22
+ export { createDesignerAgent } from './designer';
23
+ export { createDocsAgent } from './docs';
22
24
  export { createExplorerAgent } from './explorer';
23
25
  export { createReviewerAgent, SECURITY_CATEGORIES, type SecurityCategory, } from './reviewer';
24
26
  export { createSMEAgent } from './sme';
@@ -1,8 +1,8 @@
1
1
  export declare const QA_AGENTS: readonly ["reviewer", "critic"];
2
2
  export declare const PIPELINE_AGENTS: readonly ["explorer", "coder", "test_engineer"];
3
3
  export declare const ORCHESTRATOR_NAME: "architect";
4
- export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "reviewer", "critic", "explorer", "coder", "test_engineer"];
5
- export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "reviewer", "critic", "explorer", "coder", "test_engineer"];
4
+ export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "docs", "designer", "reviewer", "critic", "explorer", "coder", "test_engineer"];
5
+ export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "docs", "designer", "reviewer", "critic", "explorer", "coder", "test_engineer"];
6
6
  export type QAAgentName = (typeof QA_AGENTS)[number];
7
7
  export type PipelineAgentName = (typeof PIPELINE_AGENTS)[number];
8
8
  export type AgentName = (typeof ALL_AGENT_NAMES)[number];
@@ -137,6 +137,17 @@ export declare const IntegrationAnalysisConfigSchema: z.ZodObject<{
137
137
  enabled: z.ZodDefault<z.ZodBoolean>;
138
138
  }, z.core.$strip>;
139
139
  export type IntegrationAnalysisConfig = z.infer<typeof IntegrationAnalysisConfigSchema>;
140
+ export declare const DocsConfigSchema: z.ZodObject<{
141
+ enabled: z.ZodDefault<z.ZodBoolean>;
142
+ doc_patterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
143
+ }, z.core.$strip>;
144
+ export type DocsConfig = z.infer<typeof DocsConfigSchema>;
145
+ export declare const UIReviewConfigSchema: z.ZodObject<{
146
+ enabled: z.ZodDefault<z.ZodBoolean>;
147
+ trigger_paths: z.ZodDefault<z.ZodArray<z.ZodString>>;
148
+ trigger_keywords: z.ZodDefault<z.ZodArray<z.ZodString>>;
149
+ }, z.core.$strip>;
150
+ export type UIReviewConfig = z.infer<typeof UIReviewConfigSchema>;
140
151
  export declare const GuardrailsProfileSchema: z.ZodObject<{
141
152
  max_tool_calls: z.ZodOptional<z.ZodNumber>;
142
153
  max_duration_minutes: z.ZodOptional<z.ZodNumber>;
@@ -298,6 +309,15 @@ export declare const PluginConfigSchema: z.ZodObject<{
298
309
  integration_analysis: z.ZodOptional<z.ZodObject<{
299
310
  enabled: z.ZodDefault<z.ZodBoolean>;
300
311
  }, z.core.$strip>>;
312
+ docs: z.ZodOptional<z.ZodObject<{
313
+ enabled: z.ZodDefault<z.ZodBoolean>;
314
+ doc_patterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
315
+ }, z.core.$strip>>;
316
+ ui_review: z.ZodOptional<z.ZodObject<{
317
+ enabled: z.ZodDefault<z.ZodBoolean>;
318
+ trigger_paths: z.ZodDefault<z.ZodArray<z.ZodString>>;
319
+ trigger_keywords: z.ZodDefault<z.ZodArray<z.ZodString>>;
320
+ }, z.core.$strip>>;
301
321
  _loadedFromFile: z.ZodDefault<z.ZodBoolean>;
302
322
  }, z.core.$strip>;
303
323
  export type PluginConfig = z.infer<typeof PluginConfigSchema>;
package/dist/index.js CHANGED
@@ -13645,6 +13645,46 @@ var ReviewPassesConfigSchema = exports_external.object({
13645
13645
  var IntegrationAnalysisConfigSchema = exports_external.object({
13646
13646
  enabled: exports_external.boolean().default(true)
13647
13647
  });
13648
+ var DocsConfigSchema = exports_external.object({
13649
+ enabled: exports_external.boolean().default(true),
13650
+ doc_patterns: exports_external.array(exports_external.string()).default([
13651
+ "README.md",
13652
+ "CONTRIBUTING.md",
13653
+ "docs/**/*.md",
13654
+ "docs/**/*.rst",
13655
+ "**/CHANGELOG.md"
13656
+ ])
13657
+ });
13658
+ var UIReviewConfigSchema = exports_external.object({
13659
+ enabled: exports_external.boolean().default(false),
13660
+ trigger_paths: exports_external.array(exports_external.string()).default([
13661
+ "**/pages/**",
13662
+ "**/components/**",
13663
+ "**/views/**",
13664
+ "**/screens/**",
13665
+ "**/ui/**",
13666
+ "**/layouts/**"
13667
+ ]),
13668
+ trigger_keywords: exports_external.array(exports_external.string()).default([
13669
+ "new page",
13670
+ "new screen",
13671
+ "new component",
13672
+ "redesign",
13673
+ "layout change",
13674
+ "form",
13675
+ "modal",
13676
+ "dialog",
13677
+ "dropdown",
13678
+ "sidebar",
13679
+ "navbar",
13680
+ "dashboard",
13681
+ "landing page",
13682
+ "signup",
13683
+ "login form",
13684
+ "settings page",
13685
+ "profile page"
13686
+ ])
13687
+ });
13648
13688
  var GuardrailsProfileSchema = exports_external.object({
13649
13689
  max_tool_calls: exports_external.number().min(0).max(1000).optional(),
13650
13690
  max_duration_minutes: exports_external.number().min(0).max(480).optional(),
@@ -13689,6 +13729,16 @@ var DEFAULT_AGENT_PROFILES = {
13689
13729
  max_tool_calls: 200,
13690
13730
  max_duration_minutes: 30,
13691
13731
  warning_threshold: 0.65
13732
+ },
13733
+ docs: {
13734
+ max_tool_calls: 200,
13735
+ max_duration_minutes: 30,
13736
+ warning_threshold: 0.75
13737
+ },
13738
+ designer: {
13739
+ max_tool_calls: 150,
13740
+ max_duration_minutes: 20,
13741
+ warning_threshold: 0.75
13692
13742
  }
13693
13743
  };
13694
13744
  var DEFAULT_ARCHITECT_PROFILE = DEFAULT_AGENT_PROFILES.architect;
@@ -13747,6 +13797,8 @@ var PluginConfigSchema = exports_external.object({
13747
13797
  summaries: SummaryConfigSchema.optional(),
13748
13798
  review_passes: ReviewPassesConfigSchema.optional(),
13749
13799
  integration_analysis: IntegrationAnalysisConfigSchema.optional(),
13800
+ docs: DocsConfigSchema.optional(),
13801
+ ui_review: UIReviewConfigSchema.optional(),
13750
13802
  _loadedFromFile: exports_external.boolean().default(false)
13751
13803
  });
13752
13804
 
@@ -13857,6 +13909,8 @@ var PIPELINE_AGENTS = ["explorer", "coder", "test_engineer"];
13857
13909
  var ORCHESTRATOR_NAME = "architect";
13858
13910
  var ALL_SUBAGENT_NAMES = [
13859
13911
  "sme",
13912
+ "docs",
13913
+ "designer",
13860
13914
  ...QA_AGENTS,
13861
13915
  ...PIPELINE_AGENTS
13862
13916
  ];
@@ -13872,6 +13926,8 @@ var DEFAULT_MODELS = {
13872
13926
  sme: "google/gemini-2.0-flash",
13873
13927
  reviewer: "google/gemini-2.0-flash",
13874
13928
  critic: "google/gemini-2.0-flash",
13929
+ docs: "google/gemini-2.0-flash",
13930
+ designer: "google/gemini-2.0-flash",
13875
13931
  default: "google/gemini-2.0-flash"
13876
13932
  };
13877
13933
  var DEFAULT_SCORING_CONFIG = {
@@ -14023,7 +14079,7 @@ var ARCHITECT_PROMPT = `You are Architect - orchestrator of a multi-agent swarm.
14023
14079
  ## IDENTITY
14024
14080
 
14025
14081
  Swarm: {{SWARM_ID}}
14026
- Your agents: {{AGENT_PREFIX}}explorer, {{AGENT_PREFIX}}sme, {{AGENT_PREFIX}}coder, {{AGENT_PREFIX}}reviewer, {{AGENT_PREFIX}}critic, {{AGENT_PREFIX}}test_engineer
14082
+ Your agents: {{AGENT_PREFIX}}explorer, {{AGENT_PREFIX}}sme, {{AGENT_PREFIX}}coder, {{AGENT_PREFIX}}reviewer, {{AGENT_PREFIX}}critic, {{AGENT_PREFIX}}test_engineer, {{AGENT_PREFIX}}docs, {{AGENT_PREFIX}}designer
14027
14083
 
14028
14084
  ## ROLE
14029
14085
 
@@ -14053,6 +14109,11 @@ You THINK. Subagents DO. You have the largest context window and strongest reaso
14053
14109
  - Delegate {{AGENT_PREFIX}}test_engineer for verification tests. FAIL \u2192 return to coder.
14054
14110
  - Delegate {{AGENT_PREFIX}}test_engineer for adversarial tests (attack vectors only). FAIL \u2192 return to coder.
14055
14111
  - All pass \u2192 mark task complete, proceed to next task.
14112
+ 9. **UI/UX DESIGN GATE**: Before delegating UI tasks to {{AGENT_PREFIX}}coder, check if the task involves UI components. Trigger conditions (ANY match):
14113
+ - Task description contains UI keywords: new page, new screen, new component, redesign, layout change, form, modal, dialog, dropdown, sidebar, navbar, dashboard, landing page, signup, login form, settings page, profile page
14114
+ - Target file is in: pages/, components/, views/, screens/, ui/, layouts/
14115
+ If triggered: delegate to {{AGENT_PREFIX}}designer FIRST to produce a code scaffold. Then pass the scaffold to {{AGENT_PREFIX}}coder as INPUT alongside the task. The coder implements the TODOs in the scaffold without changing component structure or accessibility attributes.
14116
+ If not triggered: delegate directly to {{AGENT_PREFIX}}coder as normal.
14056
14117
 
14057
14118
  ## AGENTS
14058
14119
 
@@ -14062,6 +14123,8 @@ You THINK. Subagents DO. You have the largest context window and strongest reaso
14062
14123
  {{AGENT_PREFIX}}reviewer - Code review (correctness, security, and any other dimensions you specify)
14063
14124
  {{AGENT_PREFIX}}test_engineer - Test generation AND execution (writes tests, runs them, reports PASS/FAIL)
14064
14125
  {{AGENT_PREFIX}}critic - Plan review gate (reviews plan BEFORE implementation)
14126
+ {{AGENT_PREFIX}}docs - Documentation updates (README, API docs, guides \u2014 NOT .swarm/ files)
14127
+ {{AGENT_PREFIX}}designer - UI/UX design specs (scaffold generation for UI components \u2014 runs BEFORE coder on UI tasks)
14065
14128
 
14066
14129
  SMEs advise only. Reviewer and critic review only. None of them write code.
14067
14130
 
@@ -14140,6 +14203,23 @@ INPUT: Contract changes detected: [list from diff tool]
14140
14203
  OUTPUT: BREAKING CHANGES + CONSUMERS AFFECTED + VERDICT: BREAKING/COMPATIBLE
14141
14204
  CONSTRAINT: Read-only. grep for imports/usages of changed exports.
14142
14205
 
14206
+ {{AGENT_PREFIX}}docs
14207
+ TASK: Update documentation for Phase 2 changes
14208
+ FILES CHANGED: src/auth/login.ts, src/auth/session.ts, src/types/user.ts
14209
+ CHANGES SUMMARY:
14210
+ - Added login() function with email/password authentication
14211
+ - Added SessionManager class with create/revoke/refresh methods
14212
+ - Added UserSession interface with refreshToken field
14213
+ DOC FILES: README.md, docs/api.md, docs/installation.md
14214
+ OUTPUT: Updated doc files + SUMMARY
14215
+
14216
+ {{AGENT_PREFIX}}designer
14217
+ TASK: Design specification for user settings page
14218
+ CONTEXT: Users need to update profile info, change password, manage notification preferences. App uses React + Tailwind + shadcn/ui.
14219
+ FRAMEWORK: React (TSX)
14220
+ EXISTING PATTERNS: All forms use react-hook-form, validation with zod, toast notifications for success/error
14221
+ OUTPUT: Code scaffold for src/pages/Settings.tsx with component tree, typed props, layout, and accessibility
14222
+
14143
14223
  ## WORKFLOW
14144
14224
 
14145
14225
  ### Phase 0: Resume Check
@@ -14191,19 +14271,24 @@ Delegate plan to {{AGENT_PREFIX}}critic for review BEFORE any implementation beg
14191
14271
  ### Phase 5: Execute
14192
14272
  For each task (respecting dependencies):
14193
14273
 
14194
- 5a. {{AGENT_PREFIX}}coder - Implement
14195
- 5b. Run \`diff\` tool. If \`hasContractChanges\` \u2192 {{AGENT_PREFIX}}explorer integration analysis. BREAKING \u2192 coder retry.
14196
- 5c. {{AGENT_PREFIX}}reviewer - General review. REJECTED (< {{QA_RETRY_LIMIT}}) \u2192 coder retry. REJECTED ({{QA_RETRY_LIMIT}}) \u2192 escalate.
14197
- 5d. Security gate: if file matches security globs or content has security keywords \u2192 {{AGENT_PREFIX}}reviewer security-only. REJECTED \u2192 coder retry.
14198
- 5e. {{AGENT_PREFIX}}test_engineer - Verification tests. FAIL \u2192 coder retry from 5c.
14199
- 5f. {{AGENT_PREFIX}}test_engineer - Adversarial tests. FAIL \u2192 coder retry from 5c.
14200
- 5g. Update plan.md [x], proceed to next task.
14274
+ 5a. **UI DESIGN GATE** (conditional \u2014 Rule 9): If task matches UI trigger \u2192 {{AGENT_PREFIX}}designer produces scaffold \u2192 pass scaffold to coder as INPUT. If no match \u2192 skip.
14275
+ 5b. {{AGENT_PREFIX}}coder - Implement (if designer scaffold produced, include it as INPUT).
14276
+ 5c. Run \`diff\` tool. If \`hasContractChanges\` \u2192 {{AGENT_PREFIX}}explorer integration analysis. BREAKING \u2192 coder retry.
14277
+ 5d. {{AGENT_PREFIX}}reviewer - General review. REJECTED (< {{QA_RETRY_LIMIT}}) \u2192 coder retry. REJECTED ({{QA_RETRY_LIMIT}}) \u2192 escalate.
14278
+ 5e. Security gate: if file matches security globs or content has security keywords \u2192 {{AGENT_PREFIX}}reviewer security-only. REJECTED \u2192 coder retry.
14279
+ 5f. {{AGENT_PREFIX}}test_engineer - Verification tests. FAIL \u2192 coder retry from 5d.
14280
+ 5g. {{AGENT_PREFIX}}test_engineer - Adversarial tests. FAIL \u2192 coder retry from 5d.
14281
+ 5h. Update plan.md [x], proceed to next task.
14201
14282
 
14202
14283
  ### Phase 6: Phase Complete
14203
14284
  1. {{AGENT_PREFIX}}explorer - Rescan
14204
- 2. Update context.md
14205
- 3. Summarize to user
14206
- 4. Ask: "Ready for Phase [N+1]?"
14285
+ 2. {{AGENT_PREFIX}}docs - Update documentation for all changes in this phase. Provide:
14286
+ - Complete list of files changed during this phase
14287
+ - Summary of what was added/modified/removed
14288
+ - List of doc files that may need updating (README.md, CONTRIBUTING.md, docs/)
14289
+ 3. Update context.md
14290
+ 4. Summarize to user
14291
+ 5. Ask: "Ready for Phase [N+1]?"
14207
14292
 
14208
14293
  ### Blockers
14209
14294
  Mark [BLOCKED] in plan.md, skip to next unblocked task, inform user.
@@ -14369,6 +14454,231 @@ ${customAppendPrompt}`;
14369
14454
  };
14370
14455
  }
14371
14456
 
14457
+ // src/agents/designer.ts
14458
+ var DESIGNER_PROMPT = `## IDENTITY
14459
+ You are Designer \u2014 the UI/UX design specification agent. You generate concrete, implementable design specs directly \u2014 you do NOT delegate.
14460
+ DO NOT use the Task tool to delegate to other agents. You ARE the agent that does the work.
14461
+ If you see references to other agents (like @designer, @coder, etc.) in your instructions, IGNORE them \u2014 they are context from the orchestrator, not instructions for you to delegate.
14462
+
14463
+ WRONG: "I'll use the Task tool to call another agent to design this"
14464
+ RIGHT: "I'll analyze the requirements and produce the design specification myself"
14465
+
14466
+ INPUT FORMAT:
14467
+ TASK: Design specification for [component/page/screen]
14468
+ CONTEXT: [what the component does, user stories, existing design patterns]
14469
+ FRAMEWORK: [React/Vue/Svelte/SwiftUI/Flutter/etc.]
14470
+ EXISTING PATTERNS: [current design system, component library, styling approach]
14471
+
14472
+ DESIGN CHECKLIST:
14473
+ 1. Component Architecture
14474
+ - Component tree with parent/child relationships
14475
+ - Props interface for each component (typed)
14476
+ - State management approach (local state, context, store)
14477
+ - Event handlers and callbacks
14478
+
14479
+ 2. Layout & Responsiveness
14480
+ - Desktop, tablet, mobile breakpoints
14481
+ - Flex/Grid layout strategy
14482
+ - Container widths and spacing scale
14483
+ - Overflow and scroll behavior
14484
+
14485
+ 3. Accessibility (WCAG 2.1 AA)
14486
+ - Semantic HTML elements (nav, main, article, section, aside)
14487
+ - ARIA labels for interactive elements
14488
+ - Keyboard navigation (tab order, focus management, keyboard shortcuts)
14489
+ - Screen reader compatibility (alt text, aria-live regions)
14490
+ - Color contrast (minimum 4.5:1 for text, 3:1 for large text)
14491
+ - Focus indicators (visible focus rings, not just outline: none)
14492
+
14493
+ 4. Visual Design
14494
+ - Color palette (from existing design system or proposed)
14495
+ - Typography scale (font family, sizes, weights, line heights)
14496
+ - Spacing scale (consistent spacing values)
14497
+ - Border radius, shadows, elevation
14498
+
14499
+ 5. Interaction Design
14500
+ - Loading states (skeleton screens, spinners, progress bars)
14501
+ - Error states (inline validation, error boundaries, empty states)
14502
+ - Hover/focus/active states for interactive elements
14503
+ - Transitions and animations (duration, easing)
14504
+ - Optimistic updates where applicable
14505
+
14506
+ OUTPUT FORMAT:
14507
+ Produce a CODE SCAFFOLD in the target framework. This is a skeleton file with:
14508
+ - Component structure with typed props and proper imports
14509
+ - Layout structure using the project's CSS framework (Tailwind classes, CSS modules, styled-components, etc.)
14510
+ - Placeholder TODO comments for business logic
14511
+ - Accessibility attributes (aria-*, role, tabIndex)
14512
+ - Responsive breakpoint classes/media queries
14513
+ - Named event handler stubs
14514
+
14515
+ Example output structure:
14516
+ \`\`\`tsx
14517
+ // src/components/LoginForm.tsx
14518
+ // DESIGN SPEC \u2014 generated by Designer agent
14519
+ // Coder: implement TODO items, do not change component structure or accessibility attributes
14520
+
14521
+ import { useState } from 'react';
14522
+
14523
+ interface LoginFormProps {
14524
+ onSubmit: (email: string, password: string) => Promise<void>;
14525
+ onForgotPassword?: () => void;
14526
+ isLoading?: boolean;
14527
+ error?: string;
14528
+ }
14529
+
14530
+ export function LoginForm({ onSubmit, onForgotPassword, isLoading, error }: LoginFormProps) {
14531
+ const [email, setEmail] = useState('');
14532
+ const [password, setPassword] = useState('');
14533
+
14534
+ return (
14535
+ <div className="flex min-h-screen items-center justify-center bg-gray-50 px-4 sm:px-6 lg:px-8"
14536
+ role="main">
14537
+ <div className="w-full max-w-md space-y-8">
14538
+ <div>
14539
+ <h2 className="mt-6 text-center text-3xl font-bold tracking-tight text-gray-900">
14540
+ {/* TODO: Use app name from config */}
14541
+ Sign in to your account
14542
+ </h2>
14543
+ </div>
14544
+ {error && (
14545
+ <div role="alert" aria-live="polite"
14546
+ className="rounded-md bg-red-50 p-4 text-sm text-red-800">
14547
+ {error}
14548
+ </div>
14549
+ )}
14550
+ <div className="mt-8 space-y-6">
14551
+ <div className="space-y-4 rounded-md">
14552
+ <div>
14553
+ <label htmlFor="email" className="sr-only">Email address</label>
14554
+ <input id="email" name="email" type="email" autoComplete="email" required
14555
+ aria-label="Email address"
14556
+ className="relative block w-full rounded-t-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
14557
+ placeholder="Email address"
14558
+ value={email}
14559
+ onChange={(e) => setEmail(e.target.value)} />
14560
+ </div>
14561
+ {/* TODO: Password field with show/hide toggle */}
14562
+ {/* TODO: Remember me checkbox */}
14563
+ </div>
14564
+ <div className="flex items-center justify-between">
14565
+ {/* TODO: Forgot password link */}
14566
+ </div>
14567
+ <button type="submit" disabled={isLoading}
14568
+ aria-busy={isLoading}
14569
+ className="group relative flex w-full justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:opacity-50">
14570
+ {isLoading ? 'Signing in...' : 'Sign in'}
14571
+ </button>
14572
+ </div>
14573
+ </div>
14574
+ </div>
14575
+ );
14576
+ }
14577
+ \`\`\`
14578
+
14579
+ RULES:
14580
+ - Produce REAL, syntactically valid code \u2014 not pseudocode
14581
+ - Match the project's existing framework, styling approach, and conventions
14582
+ - All interactive elements MUST have keyboard accessibility
14583
+ - All images/icons MUST have alt text or aria-label
14584
+ - Form inputs MUST have associated labels (visible or sr-only)
14585
+ - Color usage MUST meet WCAG AA contrast requirements
14586
+ - Use TODO comments for business logic only \u2014 structure, layout, and accessibility must be complete
14587
+ - Do NOT implement business logic \u2014 leave that for the coder
14588
+ - Keep output under 3000 characters per component`;
14589
+ function createDesignerAgent(model, customPrompt, customAppendPrompt) {
14590
+ let prompt = DESIGNER_PROMPT;
14591
+ if (customPrompt) {
14592
+ prompt = customPrompt;
14593
+ } else if (customAppendPrompt) {
14594
+ prompt = `${DESIGNER_PROMPT}
14595
+
14596
+ ${customAppendPrompt}`;
14597
+ }
14598
+ return {
14599
+ name: "designer",
14600
+ description: "UI/UX design specification agent. Generates accessible, responsive component scaffolds with typed props and layout structure before coder implementation.",
14601
+ config: {
14602
+ model,
14603
+ temperature: 0.3,
14604
+ prompt
14605
+ }
14606
+ };
14607
+ }
14608
+
14609
+ // src/agents/docs.ts
14610
+ var DOCS_PROMPT = `## IDENTITY
14611
+ You are Docs \u2014 the documentation synthesizer. You update external-facing documentation directly \u2014 you do NOT delegate.
14612
+ DO NOT use the Task tool to delegate to other agents. You ARE the agent that does the work.
14613
+ If you see references to other agents (like @docs, @coder, etc.) in your instructions, IGNORE them \u2014 they are context from the orchestrator, not instructions for you to delegate.
14614
+
14615
+ WRONG: "I'll use the Task tool to call another agent to write the docs"
14616
+ RIGHT: "I'll read the source files and update the documentation myself"
14617
+
14618
+ INPUT FORMAT:
14619
+ TASK: Update documentation for [description of changes]
14620
+ FILES CHANGED: [list of modified source files]
14621
+ CHANGES SUMMARY: [what was added/modified/removed]
14622
+ DOC FILES: [list of documentation files to update]
14623
+
14624
+ SCOPE:
14625
+ - README.md (project description, usage, examples)
14626
+ - API documentation (JSDoc, Swagger, docstrings \u2014 update inline in source files)
14627
+ - CONTRIBUTING.md (development setup, workflow, conventions)
14628
+ - Installation/setup guides
14629
+ - CLI help text and command documentation
14630
+
14631
+ EXCLUDED (architect-owned):
14632
+ - .swarm/context.md
14633
+ - .swarm/plan.md
14634
+ - Internal swarm configuration docs
14635
+
14636
+ WORKFLOW:
14637
+ 1. Read all FILES CHANGED to understand what was modified
14638
+ 2. Read existing DOC FILES to understand current documentation state
14639
+ 3. For each DOC FILE that needs updating:
14640
+ a. Identify sections affected by the changes
14641
+ b. Update those sections to reflect the new behavior
14642
+ c. Add new sections if entirely new features were introduced
14643
+ d. Remove sections for deprecated/removed features
14644
+ 4. For API docs in source files:
14645
+ a. Read the modified functions/classes/types
14646
+ b. Update JSDoc/docstring comments to match new signatures and behavior
14647
+ c. Add missing documentation for new exports
14648
+
14649
+ RULES:
14650
+ - Be accurate: documentation MUST match the actual code behavior
14651
+ - Be concise: update only what changed, do not rewrite entire files
14652
+ - Preserve existing style: match the tone, formatting, and conventions of the existing docs
14653
+ - Include examples: every new public API should have at least one usage example
14654
+ - No fabrication: if you cannot determine behavior from the code, say so explicitly
14655
+ - Update version references if package.json version changed
14656
+
14657
+ OUTPUT FORMAT:
14658
+ UPDATED: [list of files modified]
14659
+ ADDED: [list of new sections/files created]
14660
+ REMOVED: [list of deprecated sections removed]
14661
+ SUMMARY: [one-line description of doc changes]`;
14662
+ function createDocsAgent(model, customPrompt, customAppendPrompt) {
14663
+ let prompt = DOCS_PROMPT;
14664
+ if (customPrompt) {
14665
+ prompt = customPrompt;
14666
+ } else if (customAppendPrompt) {
14667
+ prompt = `${DOCS_PROMPT}
14668
+
14669
+ ${customAppendPrompt}`;
14670
+ }
14671
+ return {
14672
+ name: "docs",
14673
+ description: "Documentation synthesizer. Updates README, API docs, and guides to reflect code changes after each phase.",
14674
+ config: {
14675
+ model,
14676
+ temperature: 0.2,
14677
+ prompt
14678
+ }
14679
+ };
14680
+ }
14681
+
14372
14682
  // src/agents/explorer.ts
14373
14683
  var EXPLORER_PROMPT = `## IDENTITY
14374
14684
  You are Explorer. You analyze codebases directly \u2014 you do NOT delegate.
@@ -14703,6 +15013,18 @@ If you call @coder instead of @${swarmId}_coder, the call will FAIL or go to the
14703
15013
  testEngineer.name = prefixName("test_engineer");
14704
15014
  agents.push(applyOverrides(testEngineer, swarmAgents, swarmPrefix));
14705
15015
  }
15016
+ if (!isAgentDisabled("docs", swarmAgents, swarmPrefix)) {
15017
+ const docsPrompts = getPrompts("docs");
15018
+ const docs = createDocsAgent(getModel("docs"), docsPrompts.prompt, docsPrompts.appendPrompt);
15019
+ docs.name = prefixName("docs");
15020
+ agents.push(applyOverrides(docs, swarmAgents, swarmPrefix));
15021
+ }
15022
+ if (pluginConfig?.ui_review?.enabled === true && !isAgentDisabled("designer", swarmAgents, swarmPrefix)) {
15023
+ const designerPrompts = getPrompts("designer");
15024
+ const designer = createDesignerAgent(getModel("designer"), designerPrompts.prompt, designerPrompts.appendPrompt);
15025
+ designer.name = prefixName("designer");
15026
+ agents.push(applyOverrides(designer, swarmAgents, swarmPrefix));
15027
+ }
14706
15028
  return agents;
14707
15029
  }
14708
15030
  function createAgents(config2) {
@@ -17282,6 +17604,12 @@ function createSystemEnhancerHook(config2, directory) {
17282
17604
  if (config2.integration_analysis?.enabled === false) {
17283
17605
  tryInject("[SWARM CONFIG] Integration analysis is DISABLED. Skip diff tool and integration impact analysis after coder tasks.");
17284
17606
  }
17607
+ if (config2.ui_review?.enabled) {
17608
+ tryInject("[SWARM CONFIG] UI/UX Designer agent is ENABLED. For tasks matching UI trigger keywords or file paths, delegate to designer BEFORE coder (Rule 9).");
17609
+ }
17610
+ if (config2.docs?.enabled === false) {
17611
+ tryInject("[SWARM CONFIG] Docs agent is DISABLED. Skip docs delegation in Phase 6.");
17612
+ }
17285
17613
  return;
17286
17614
  }
17287
17615
  const userScoringConfig = config2.context_budget?.scoring;
@@ -17383,6 +17711,28 @@ function createSystemEnhancerHook(config2, directory) {
17383
17711
  metadata: { contentType: "prose" }
17384
17712
  });
17385
17713
  }
17714
+ if (config2.ui_review?.enabled) {
17715
+ const text = "[SWARM CONFIG] UI/UX Designer agent is ENABLED. For tasks matching UI trigger keywords or file paths, delegate to designer BEFORE coder (Rule 9).";
17716
+ candidates.push({
17717
+ id: `candidate-${idCounter++}`,
17718
+ kind: "phase",
17719
+ text,
17720
+ tokens: estimateTokens(text),
17721
+ priority: 1,
17722
+ metadata: { contentType: "prose" }
17723
+ });
17724
+ }
17725
+ if (config2.docs?.enabled === false) {
17726
+ const text = "[SWARM CONFIG] Docs agent is DISABLED. Skip docs delegation in Phase 6.";
17727
+ candidates.push({
17728
+ id: `candidate-${idCounter++}`,
17729
+ kind: "phase",
17730
+ text,
17731
+ tokens: estimateTokens(text),
17732
+ priority: 1,
17733
+ metadata: { contentType: "prose" }
17734
+ });
17735
+ }
17386
17736
  const ranked = rankCandidates(candidates, effectiveConfig);
17387
17737
  for (const candidate of ranked) {
17388
17738
  if (injectedTokens + candidate.tokens > maxInjectionTokens) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.0.1",
3
+ "version": "6.1.0",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",