@agentuity/opencode 1.0.1 → 1.0.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/AGENTS.md +121 -13
- package/README.md +133 -12
- package/dist/agents/architect.d.ts +1 -1
- package/dist/agents/architect.d.ts.map +1 -1
- package/dist/agents/architect.js +2 -2
- package/dist/agents/builder.d.ts +1 -1
- package/dist/agents/builder.d.ts.map +1 -1
- package/dist/agents/builder.js +2 -2
- package/dist/agents/builder.js.map +1 -1
- package/dist/agents/expert-backend.d.ts +4 -0
- package/dist/agents/expert-backend.d.ts.map +1 -0
- package/dist/agents/expert-backend.js +493 -0
- package/dist/agents/expert-backend.js.map +1 -0
- package/dist/agents/expert-frontend.d.ts +4 -0
- package/dist/agents/expert-frontend.d.ts.map +1 -0
- package/dist/agents/expert-frontend.js +480 -0
- package/dist/agents/expert-frontend.js.map +1 -0
- package/dist/agents/expert-ops.d.ts +4 -0
- package/dist/agents/expert-ops.d.ts.map +1 -0
- package/dist/agents/expert-ops.js +375 -0
- package/dist/agents/expert-ops.js.map +1 -0
- package/dist/agents/expert.d.ts +1 -1
- package/dist/agents/expert.d.ts.map +1 -1
- package/dist/agents/expert.js +172 -913
- package/dist/agents/expert.js.map +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +8 -2
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/lead.d.ts +1 -1
- package/dist/agents/lead.d.ts.map +1 -1
- package/dist/agents/lead.js +359 -58
- package/dist/agents/lead.js.map +1 -1
- package/dist/agents/memory/entities.d.ts.map +1 -1
- package/dist/agents/memory/entities.js +8 -2
- package/dist/agents/memory/entities.js.map +1 -1
- package/dist/agents/memory.d.ts +1 -1
- package/dist/agents/memory.d.ts.map +1 -1
- package/dist/agents/memory.js +285 -10
- package/dist/agents/memory.js.map +1 -1
- package/dist/agents/monitor.d.ts +4 -0
- package/dist/agents/monitor.d.ts.map +1 -0
- package/dist/agents/monitor.js +106 -0
- package/dist/agents/monitor.js.map +1 -0
- package/dist/agents/product.d.ts +1 -1
- package/dist/agents/product.d.ts.map +1 -1
- package/dist/agents/product.js +161 -21
- package/dist/agents/product.js.map +1 -1
- package/dist/agents/reasoner.d.ts +1 -1
- package/dist/agents/reasoner.d.ts.map +1 -1
- package/dist/agents/reasoner.js +94 -11
- package/dist/agents/reasoner.js.map +1 -1
- package/dist/agents/scout.d.ts +1 -1
- package/dist/agents/scout.d.ts.map +1 -1
- package/dist/agents/scout.js +6 -4
- package/dist/agents/scout.js.map +1 -1
- package/dist/agents/types.d.ts +6 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/background/manager.d.ts +22 -1
- package/dist/background/manager.d.ts.map +1 -1
- package/dist/background/manager.js +218 -1
- package/dist/background/manager.js.map +1 -1
- package/dist/background/types.d.ts +19 -0
- package/dist/background/types.d.ts.map +1 -1
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +10 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/plugin/hooks/cadence.d.ts +2 -1
- package/dist/plugin/hooks/cadence.d.ts.map +1 -1
- package/dist/plugin/hooks/cadence.js +66 -3
- package/dist/plugin/hooks/cadence.js.map +1 -1
- package/dist/plugin/hooks/keyword.d.ts.map +1 -1
- package/dist/plugin/hooks/keyword.js +5 -3
- package/dist/plugin/hooks/keyword.js.map +1 -1
- package/dist/plugin/hooks/session-memory.d.ts +2 -1
- package/dist/plugin/hooks/session-memory.d.ts.map +1 -1
- package/dist/plugin/hooks/session-memory.js +57 -5
- package/dist/plugin/hooks/session-memory.js.map +1 -1
- package/dist/plugin/hooks/tools.d.ts.map +1 -1
- package/dist/plugin/hooks/tools.js +29 -5
- package/dist/plugin/hooks/tools.js.map +1 -1
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +119 -68
- package/dist/plugin/plugin.js.map +1 -1
- package/dist/services/auth.d.ts.map +1 -1
- package/dist/services/auth.js +9 -0
- package/dist/services/auth.js.map +1 -1
- package/dist/tmux/executor.d.ts.map +1 -1
- package/dist/tmux/executor.js +13 -4
- package/dist/tmux/executor.js.map +1 -1
- package/dist/tools/background.d.ts +4 -1
- package/dist/tools/background.d.ts.map +1 -1
- package/dist/tools/index.d.ts +0 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +0 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
- package/src/agents/architect.ts +2 -2
- package/src/agents/builder.ts +2 -2
- package/src/agents/expert-backend.ts +495 -0
- package/src/agents/expert-frontend.ts +482 -0
- package/src/agents/expert-ops.ts +377 -0
- package/src/agents/expert.ts +172 -913
- package/src/agents/index.ts +8 -2
- package/src/agents/lead.ts +359 -58
- package/src/agents/memory/entities.ts +9 -2
- package/src/agents/memory.ts +285 -10
- package/src/agents/monitor.ts +108 -0
- package/src/agents/product.ts +161 -21
- package/src/agents/reasoner.ts +94 -11
- package/src/agents/scout.ts +6 -4
- package/src/agents/types.ts +6 -0
- package/src/background/manager.ts +259 -2
- package/src/background/types.ts +17 -0
- package/src/config/loader.ts +11 -1
- package/src/plugin/hooks/cadence.ts +79 -3
- package/src/plugin/hooks/keyword.ts +5 -3
- package/src/plugin/hooks/session-memory.ts +68 -6
- package/src/plugin/hooks/tools.ts +35 -6
- package/src/plugin/plugin.ts +128 -70
- package/src/services/auth.ts +10 -0
- package/src/tmux/executor.ts +13 -4
- package/src/tools/index.ts +0 -1
- package/src/types.ts +4 -1
- package/dist/agents/planner.d.ts +0 -4
- package/dist/agents/planner.d.ts.map +0 -1
- package/dist/agents/planner.js +0 -158
- package/dist/agents/planner.js.map +0 -1
- package/dist/tools/delegate.d.ts +0 -45
- package/dist/tools/delegate.d.ts.map +0 -1
- package/dist/tools/delegate.js +0 -72
- package/dist/tools/delegate.js.map +0 -1
- package/src/agents/planner.ts +0 -161
- package/src/tools/delegate.ts +0 -83
package/dist/tools/delegate.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
// Schema for the delegate tool
|
|
3
|
-
export const DelegateArgsSchema = z.object({
|
|
4
|
-
agent: z
|
|
5
|
-
.enum([
|
|
6
|
-
'scout',
|
|
7
|
-
'builder',
|
|
8
|
-
'architect',
|
|
9
|
-
'reviewer',
|
|
10
|
-
'memory',
|
|
11
|
-
'reasoner',
|
|
12
|
-
'expert',
|
|
13
|
-
'planner',
|
|
14
|
-
'runner',
|
|
15
|
-
'product',
|
|
16
|
-
])
|
|
17
|
-
.describe('The agent to delegate to'),
|
|
18
|
-
task: z.string().describe('Clear description of the task to delegate'),
|
|
19
|
-
context: z.string().optional().describe('Additional context from previous tasks'),
|
|
20
|
-
waitForResult: z
|
|
21
|
-
.boolean()
|
|
22
|
-
.default(true)
|
|
23
|
-
.describe('Whether to wait for the result before continuing'),
|
|
24
|
-
});
|
|
25
|
-
// Agent display names for @mentions
|
|
26
|
-
const AGENT_MENTIONS = {
|
|
27
|
-
lead: '@Agentuity Coder Lead',
|
|
28
|
-
scout: '@Agentuity Coder Scout',
|
|
29
|
-
builder: '@Agentuity Coder Builder',
|
|
30
|
-
architect: '@Agentuity Coder Architect',
|
|
31
|
-
reviewer: '@Agentuity Coder Reviewer',
|
|
32
|
-
memory: '@Agentuity Coder Memory',
|
|
33
|
-
expert: '@Agentuity Coder Expert',
|
|
34
|
-
planner: '@Agentuity Coder Planner',
|
|
35
|
-
runner: '@Agentuity Coder Runner',
|
|
36
|
-
reasoner: '@Agentuity Coder Reasoner',
|
|
37
|
-
product: '@Agentuity Coder Product',
|
|
38
|
-
};
|
|
39
|
-
export const delegateTool = {
|
|
40
|
-
name: 'agentuity_coder_delegate',
|
|
41
|
-
description: `Delegate a task to a specialized Agentuity Coder agent.
|
|
42
|
-
|
|
43
|
-
Use this to:
|
|
44
|
-
- Scout: Explore codebase, find patterns, research documentation
|
|
45
|
-
- Builder: Implement features, write code, run tests (interactive work)
|
|
46
|
-
- Architect: Complex autonomous tasks, Cadence mode, deep reasoning (GPT Codex)
|
|
47
|
-
- Reviewer: Review changes, catch issues, apply fixes
|
|
48
|
-
- Memory: Store context, remember decisions across sessions
|
|
49
|
-
- Reasoner: Extract structured conclusions, resolve conflicts, surface corrections
|
|
50
|
-
- Expert: Get help with Agentuity CLI and cloud services
|
|
51
|
-
- Planner: Strategic advisor for complex architecture and deep planning (read-only)
|
|
52
|
-
- Runner: Run lint/build/test/typecheck/format/clean/install commands, returns structured results
|
|
53
|
-
- Product: Drive clarity on requirements, validate features, track progress, Cadence briefings
|
|
54
|
-
|
|
55
|
-
The task will be executed by the specified agent and the result returned.`,
|
|
56
|
-
args: DelegateArgsSchema,
|
|
57
|
-
async execute(args, _context) {
|
|
58
|
-
const mention = AGENT_MENTIONS[args.agent];
|
|
59
|
-
// Build the delegation prompt
|
|
60
|
-
let prompt = `${mention}\n\n## Task\n${args.task}`;
|
|
61
|
-
if (args.context) {
|
|
62
|
-
prompt = `${mention}\n\n## Context\n${args.context}\n\n## Task\n${args.task}`;
|
|
63
|
-
}
|
|
64
|
-
// In Open Code, this would trigger the Task tool with the appropriate agent
|
|
65
|
-
// For now, return the formatted prompt that Lead should use
|
|
66
|
-
return {
|
|
67
|
-
output: `To delegate this task, use the Task tool with this prompt:\n\n${prompt}\n\nThe ${args.agent} agent will handle this task.`,
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
export default delegateTool;
|
|
72
|
-
//# sourceMappingURL=delegate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delegate.js","sourceRoot":"","sources":["../../src/tools/delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,+BAA+B;AAC/B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC;SACN,IAAI,CAAC;QACL,OAAO;QACP,SAAS;QACT,WAAW;QACX,UAAU;QACV,QAAQ;QACR,UAAU;QACV,QAAQ;QACR,SAAS;QACT,QAAQ;QACR,SAAS;KACT,CAAC;SACD,QAAQ,CAAC,0BAA0B,CAAC;IACtC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IACtE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;IACjF,aAAa,EAAE,CAAC;SACd,OAAO,EAAE;SACT,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,kDAAkD,CAAC;CAC9D,CAAC,CAAC;AAIH,oCAAoC;AACpC,MAAM,cAAc,GAA8B;IACjD,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE,wBAAwB;IAC/B,OAAO,EAAE,0BAA0B;IACnC,SAAS,EAAE,4BAA4B;IACvC,QAAQ,EAAE,2BAA2B;IACrC,MAAM,EAAE,yBAAyB;IACjC,MAAM,EAAE,yBAAyB;IACjC,OAAO,EAAE,0BAA0B;IACnC,MAAM,EAAE,yBAAyB;IACjC,QAAQ,EAAE,2BAA2B;IACrC,OAAO,EAAE,0BAA0B;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE;;;;;;;;;;;;;;0EAc4D;IAEzE,IAAI,EAAE,kBAAkB;IAExB,KAAK,CAAC,OAAO,CAAC,IAAkB,EAAE,QAAiB;QAClD,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,KAAkB,CAAC,CAAC;QAExD,8BAA8B;QAC9B,IAAI,MAAM,GAAG,GAAG,OAAO,gBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC;QAEnD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,GAAG,GAAG,OAAO,mBAAmB,IAAI,CAAC,OAAO,gBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC;QAC/E,CAAC;QAED,4EAA4E;QAC5E,4DAA4D;QAC5D,OAAO;YACN,MAAM,EAAE,iEAAiE,MAAM,WAAW,IAAI,CAAC,KAAK,+BAA+B;SACnI,CAAC;IACH,CAAC;CACD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/src/agents/planner.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import type { AgentDefinition } from './types';
|
|
2
|
-
|
|
3
|
-
export const PLANNER_SYSTEM_PROMPT = `# Planner Agent
|
|
4
|
-
|
|
5
|
-
You are a strategic technical advisor with deep reasoning capabilities, operating as a specialized consultant within the Agentuity Coder team.
|
|
6
|
-
|
|
7
|
-
## Context
|
|
8
|
-
|
|
9
|
-
You function as an on-demand specialist invoked by the Lead agent when complex analysis or architectural decisions require elevated reasoning. Each consultation is standalone—treat every request as complete and self-contained since no clarifying dialogue is possible.
|
|
10
|
-
|
|
11
|
-
## What You ARE / ARE NOT
|
|
12
|
-
|
|
13
|
-
| You ARE | You ARE NOT |
|
|
14
|
-
|---------|-------------|
|
|
15
|
-
| Strategic technical advisor | Code implementer |
|
|
16
|
-
| Architecture analyst | Direct file editor |
|
|
17
|
-
| Deep reasoning specialist | Quick task executor |
|
|
18
|
-
| Decision framework provider | Build/test runner |
|
|
19
|
-
| Risk assessor | Project manager |
|
|
20
|
-
|
|
21
|
-
## What You Do
|
|
22
|
-
|
|
23
|
-
Your expertise covers:
|
|
24
|
-
- Dissecting codebases to understand structural patterns and design choices
|
|
25
|
-
- Formulating concrete, implementable technical recommendations
|
|
26
|
-
- Architecting solutions and mapping out implementation roadmaps
|
|
27
|
-
- Resolving intricate technical questions through systematic reasoning
|
|
28
|
-
- Surfacing hidden issues and crafting preventive measures
|
|
29
|
-
- Creating detailed, actionable plans that Builder can execute
|
|
30
|
-
|
|
31
|
-
## Decision Framework
|
|
32
|
-
|
|
33
|
-
Apply pragmatic minimalism in all recommendations:
|
|
34
|
-
|
|
35
|
-
**Bias toward simplicity**: The right solution is typically the least complex one that fulfills the actual requirements. Resist hypothetical future needs.
|
|
36
|
-
|
|
37
|
-
**Leverage what exists**: Favor modifications to current code, established patterns, and existing dependencies over introducing new components. New libraries, services, or infrastructure require explicit justification.
|
|
38
|
-
|
|
39
|
-
**Prioritize developer experience**: Optimize for readability, maintainability, and reduced cognitive load. Theoretical performance gains or architectural purity matter less than practical usability.
|
|
40
|
-
|
|
41
|
-
**One clear path**: Present a single primary recommendation. Mention alternatives only when they offer substantially different trade-offs worth considering.
|
|
42
|
-
|
|
43
|
-
**Match depth to complexity**: Quick questions get quick answers. Reserve thorough analysis for genuinely complex problems or explicit requests for depth.
|
|
44
|
-
|
|
45
|
-
**Signal the investment**: Tag recommendations with estimated effort—use Quick(<1h), Short(1-4h), Medium(1-2d), or Large(3d+) to set expectations.
|
|
46
|
-
|
|
47
|
-
**Know when to stop**: "Working well" beats "theoretically optimal." Identify what conditions would warrant revisiting with a more sophisticated approach.
|
|
48
|
-
|
|
49
|
-
## Working With Tools
|
|
50
|
-
|
|
51
|
-
You are a **read-only** agent. You can:
|
|
52
|
-
- Read files to understand code structure
|
|
53
|
-
- Use glob/grep to find patterns
|
|
54
|
-
- Fetch documentation
|
|
55
|
-
|
|
56
|
-
You **cannot** and **should not**:
|
|
57
|
-
- Write or edit files
|
|
58
|
-
- Run bash commands
|
|
59
|
-
- Execute tests or builds
|
|
60
|
-
- Make any modifications
|
|
61
|
-
|
|
62
|
-
Your role is to analyze and recommend. Builder will execute your plans.
|
|
63
|
-
|
|
64
|
-
## Response Structure
|
|
65
|
-
|
|
66
|
-
Organize your final answer in three tiers:
|
|
67
|
-
|
|
68
|
-
### Essential (always include)
|
|
69
|
-
|
|
70
|
-
**Bottom Line**: 2-3 sentences capturing your recommendation
|
|
71
|
-
|
|
72
|
-
**Action Plan**: Numbered steps or checklist for implementation
|
|
73
|
-
- Each step should be specific enough for Builder to execute
|
|
74
|
-
- Include file paths, function names, and expected changes
|
|
75
|
-
- Order steps by dependency (what must happen first)
|
|
76
|
-
|
|
77
|
-
**Effort Estimate**: Using the Quick/Short/Medium/Large scale
|
|
78
|
-
|
|
79
|
-
### Expanded (include when relevant)
|
|
80
|
-
|
|
81
|
-
**Why This Approach**: Brief reasoning and key trade-offs considered
|
|
82
|
-
|
|
83
|
-
**Watch Out For**: Risks, edge cases, and mitigation strategies
|
|
84
|
-
|
|
85
|
-
**Dependencies**: What needs to exist before this work can begin
|
|
86
|
-
|
|
87
|
-
### Edge Cases (only when genuinely applicable)
|
|
88
|
-
|
|
89
|
-
**Escalation Triggers**: Specific conditions that would justify a more complex solution
|
|
90
|
-
|
|
91
|
-
**Alternative Sketch**: High-level outline of the advanced path (not a full design)
|
|
92
|
-
|
|
93
|
-
## Plan Format for Builder
|
|
94
|
-
|
|
95
|
-
When creating implementation plans, use this structure:
|
|
96
|
-
|
|
97
|
-
\`\`\`markdown
|
|
98
|
-
## Implementation Plan
|
|
99
|
-
|
|
100
|
-
### Phase 1: [Name]
|
|
101
|
-
**Effort**: Quick/Short/Medium/Large
|
|
102
|
-
|
|
103
|
-
1. **[Step Name]**
|
|
104
|
-
- File: \`path/to/file.ts\`
|
|
105
|
-
- Action: [Create/Modify/Delete]
|
|
106
|
-
- Details: [Specific changes needed]
|
|
107
|
-
|
|
108
|
-
2. **[Step Name]**
|
|
109
|
-
- File: \`path/to/other.ts\`
|
|
110
|
-
- Action: [Create/Modify/Delete]
|
|
111
|
-
- Details: [Specific changes needed]
|
|
112
|
-
|
|
113
|
-
### Phase 2: [Name]
|
|
114
|
-
...
|
|
115
|
-
|
|
116
|
-
### Verification
|
|
117
|
-
- [ ] [Specific test or check]
|
|
118
|
-
- [ ] [Another verification step]
|
|
119
|
-
\`\`\`
|
|
120
|
-
|
|
121
|
-
## Guiding Principles
|
|
122
|
-
|
|
123
|
-
- **Actionable insight over exhaustive analysis**: Give Builder what they need to execute
|
|
124
|
-
- **Depth matches complexity**: Simple questions get simple answers
|
|
125
|
-
- **One recommendation**: Present the best path, not all possible paths
|
|
126
|
-
- **Concrete specifics**: File paths, function names, exact changes
|
|
127
|
-
- **Risk awareness**: Surface potential issues before they become problems
|
|
128
|
-
|
|
129
|
-
## Collaboration
|
|
130
|
-
|
|
131
|
-
You work primarily with Lead and Builder/Architect:
|
|
132
|
-
|
|
133
|
-
| Agent | How You Help Them |
|
|
134
|
-
|-------|-------------------|
|
|
135
|
-
| Lead | Provide strategic analysis, architecture decisions, detailed plans |
|
|
136
|
-
| Builder or Architect | Create step-by-step implementation plans they can execute |
|
|
137
|
-
| Reviewer | Offer architectural context for code reviews |
|
|
138
|
-
| Scout | N/A (Scout gathers info for you to analyze) |
|
|
139
|
-
|
|
140
|
-
## Critical Note
|
|
141
|
-
|
|
142
|
-
Your response goes directly to the Lead agent who will delegate to Builder. Make your final message self-contained: a clear recommendation and actionable plan that Builder can execute immediately.
|
|
143
|
-
|
|
144
|
-
**You are read-only.** Analyze, recommend, and plan—but never attempt to modify code yourself.
|
|
145
|
-
`;
|
|
146
|
-
|
|
147
|
-
export const plannerAgent: AgentDefinition = {
|
|
148
|
-
role: 'planner',
|
|
149
|
-
id: 'ag-planner',
|
|
150
|
-
displayName: 'Agentuity Coder Planner',
|
|
151
|
-
description:
|
|
152
|
-
'Strategic technical advisor for complex architecture and deep planning. Read-only, high-reasoning specialist.',
|
|
153
|
-
defaultModel: 'openai/gpt-5.2',
|
|
154
|
-
systemPrompt: PLANNER_SYSTEM_PROMPT,
|
|
155
|
-
mode: 'subagent',
|
|
156
|
-
tools: {
|
|
157
|
-
exclude: ['write', 'edit', 'apply_patch', 'bash'], // Read-only agent
|
|
158
|
-
},
|
|
159
|
-
reasoningEffort: 'xhigh', // Maximum reasoning for GPT models
|
|
160
|
-
temperature: 0.1, // Low for consistent, deterministic analysis
|
|
161
|
-
};
|
package/src/tools/delegate.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { AgentRole } from '../types';
|
|
3
|
-
|
|
4
|
-
// Schema for the delegate tool
|
|
5
|
-
export const DelegateArgsSchema = z.object({
|
|
6
|
-
agent: z
|
|
7
|
-
.enum([
|
|
8
|
-
'scout',
|
|
9
|
-
'builder',
|
|
10
|
-
'architect',
|
|
11
|
-
'reviewer',
|
|
12
|
-
'memory',
|
|
13
|
-
'reasoner',
|
|
14
|
-
'expert',
|
|
15
|
-
'planner',
|
|
16
|
-
'runner',
|
|
17
|
-
'product',
|
|
18
|
-
])
|
|
19
|
-
.describe('The agent to delegate to'),
|
|
20
|
-
task: z.string().describe('Clear description of the task to delegate'),
|
|
21
|
-
context: z.string().optional().describe('Additional context from previous tasks'),
|
|
22
|
-
waitForResult: z
|
|
23
|
-
.boolean()
|
|
24
|
-
.default(true)
|
|
25
|
-
.describe('Whether to wait for the result before continuing'),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export type DelegateArgs = z.infer<typeof DelegateArgsSchema>;
|
|
29
|
-
|
|
30
|
-
// Agent display names for @mentions
|
|
31
|
-
const AGENT_MENTIONS: Record<AgentRole, string> = {
|
|
32
|
-
lead: '@Agentuity Coder Lead',
|
|
33
|
-
scout: '@Agentuity Coder Scout',
|
|
34
|
-
builder: '@Agentuity Coder Builder',
|
|
35
|
-
architect: '@Agentuity Coder Architect',
|
|
36
|
-
reviewer: '@Agentuity Coder Reviewer',
|
|
37
|
-
memory: '@Agentuity Coder Memory',
|
|
38
|
-
expert: '@Agentuity Coder Expert',
|
|
39
|
-
planner: '@Agentuity Coder Planner',
|
|
40
|
-
runner: '@Agentuity Coder Runner',
|
|
41
|
-
reasoner: '@Agentuity Coder Reasoner',
|
|
42
|
-
product: '@Agentuity Coder Product',
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const delegateTool = {
|
|
46
|
-
name: 'agentuity_coder_delegate',
|
|
47
|
-
description: `Delegate a task to a specialized Agentuity Coder agent.
|
|
48
|
-
|
|
49
|
-
Use this to:
|
|
50
|
-
- Scout: Explore codebase, find patterns, research documentation
|
|
51
|
-
- Builder: Implement features, write code, run tests (interactive work)
|
|
52
|
-
- Architect: Complex autonomous tasks, Cadence mode, deep reasoning (GPT Codex)
|
|
53
|
-
- Reviewer: Review changes, catch issues, apply fixes
|
|
54
|
-
- Memory: Store context, remember decisions across sessions
|
|
55
|
-
- Reasoner: Extract structured conclusions, resolve conflicts, surface corrections
|
|
56
|
-
- Expert: Get help with Agentuity CLI and cloud services
|
|
57
|
-
- Planner: Strategic advisor for complex architecture and deep planning (read-only)
|
|
58
|
-
- Runner: Run lint/build/test/typecheck/format/clean/install commands, returns structured results
|
|
59
|
-
- Product: Drive clarity on requirements, validate features, track progress, Cadence briefings
|
|
60
|
-
|
|
61
|
-
The task will be executed by the specified agent and the result returned.`,
|
|
62
|
-
|
|
63
|
-
args: DelegateArgsSchema,
|
|
64
|
-
|
|
65
|
-
async execute(args: DelegateArgs, _context: unknown): Promise<{ output: string }> {
|
|
66
|
-
const mention = AGENT_MENTIONS[args.agent as AgentRole];
|
|
67
|
-
|
|
68
|
-
// Build the delegation prompt
|
|
69
|
-
let prompt = `${mention}\n\n## Task\n${args.task}`;
|
|
70
|
-
|
|
71
|
-
if (args.context) {
|
|
72
|
-
prompt = `${mention}\n\n## Context\n${args.context}\n\n## Task\n${args.task}`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// In Open Code, this would trigger the Task tool with the appropriate agent
|
|
76
|
-
// For now, return the formatted prompt that Lead should use
|
|
77
|
-
return {
|
|
78
|
-
output: `To delegate this task, use the Task tool with this prompt:\n\n${prompt}\n\nThe ${args.agent} agent will handle this task.`,
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export default delegateTool;
|