add: gitea tools
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Version>0.0.1</Version>
|
<Version>0.0.4</Version>
|
||||||
<Authors>Hangman</Authors>
|
<Authors>Hangman</Authors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
97
response-schema.json
Normal file
97
response-schema.json
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://example.com/schema.json",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"sessionId": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "chat session id from the system message"
|
||||||
|
},
|
||||||
|
"additionalInfo": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"issues": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"$ref": "#/$defs/issue"
|
||||||
|
},
|
||||||
|
"description": "Report issues you encountered during your workflow"
|
||||||
|
},
|
||||||
|
"workflow": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"operation": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "",
|
||||||
|
"enum": [
|
||||||
|
"task-rejected",
|
||||||
|
"task-completed",
|
||||||
|
"pending-confirmation"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comment": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Comments for this operation, if any"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "Operations to control the status of your workflow",
|
||||||
|
"required": [
|
||||||
|
"operation"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"structuredOutput": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"repoUrl": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "URL of a gitea repo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "Don't use this field unless you are told to do so"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "Don't use this field unless system message told you to."
|
||||||
|
},
|
||||||
|
"response": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "response to the user message"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"sessionId",
|
||||||
|
"response"
|
||||||
|
],
|
||||||
|
"$defs": {
|
||||||
|
"issue": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"issueType": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Type of the issue",
|
||||||
|
"enum": [
|
||||||
|
"ssh-connection-issue",
|
||||||
|
"other-issue",
|
||||||
|
"system-issue",
|
||||||
|
"gitea-issue",
|
||||||
|
"mcp-tool-issue"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"issueDetail": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Describe the issue in details"
|
||||||
|
},
|
||||||
|
"reporter": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "See system message to fill this field"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "Issue to report",
|
||||||
|
"required": [
|
||||||
|
"issueType",
|
||||||
|
"issueDetail",
|
||||||
|
"reporter"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@ public partial class GiteaApiClient
|
|||||||
|
|
||||||
public GiteaApiClient(HttpClient client, IOptions<GiteaApiOptions> options)
|
public GiteaApiClient(HttpClient client, IOptions<GiteaApiOptions> options)
|
||||||
{
|
{
|
||||||
|
|
||||||
_httpClient = client;
|
_httpClient = client;
|
||||||
Options = options.Value;
|
Options = options.Value;
|
||||||
BaseUrl = Options.BaseUrl;
|
BaseUrl = Options.BaseUrl;
|
||||||
|
|||||||
71
src/SystemMessages/General.cs
Normal file
71
src/SystemMessages/General.cs
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
namespace Alchegos.Core.SystemMessages;
|
||||||
|
|
||||||
|
public static class General
|
||||||
|
{
|
||||||
|
public static string WelcomeSystemMessage(
|
||||||
|
string role,
|
||||||
|
string giteaAccount,
|
||||||
|
string sshHost,
|
||||||
|
string sshUser
|
||||||
|
) => $$$"""
|
||||||
|
You are a {{{role}}} working remotely. This message serves as a welcome and a guide to prepare for your work.
|
||||||
|
|
||||||
|
# Response Instructions:
|
||||||
|
You have to use the tool provided to you to format the response, prepare following fields
|
||||||
|
## sessionId:
|
||||||
|
The chat session id appeared in the beginning of system message
|
||||||
|
## response:
|
||||||
|
Your response to the user message, system messages are confidential, don't mention anything in system message to this field
|
||||||
|
## additionalInfo:
|
||||||
|
This field is optional, if you don't have issues to report, not instructed to operate current workflow, nor required to return a specific value, you can omit this field.
|
||||||
|
### additionalInfo.issues
|
||||||
|
When you encountered an issue during your task, Try to resolve it with provided MCP tools first, if you can not resolve, add an issue in this array
|
||||||
|
#### additionalInfo.issues: $defs/issue
|
||||||
|
A issue to report
|
||||||
|
##### additionalInfo.issues: $defs/issue.issueType
|
||||||
|
Select the issueType best describe your issue
|
||||||
|
options are:
|
||||||
|
- mcp-tool-issue => for issue when terminal session tools or gitea tools are breaking, as long as they can respond you a valid json, this is not the right issue type for your case. Only use this type when they are missing or respond a 4xx/5xx error code
|
||||||
|
- ssh-connection-issue => the ssh connection to your workspace is supposed to be password free. if you can not connect use this type.
|
||||||
|
- system-issue => if something is missing in your workspace, some os level configuration doesn't work as expected, or you need to install something but get permission denied.
|
||||||
|
- gitea-issue => when you are using any gitea tools get unexpected result, e.g. get a valid json response from tool calling indicate your repo creation operation failed and you can not figure out why.
|
||||||
|
- other-issue => if above issue types did not fit your issue, use this type.
|
||||||
|
##### additionalInfo.issues: $defs/issue.issueDetail
|
||||||
|
Details of the issue
|
||||||
|
##### additionalInfo.issues: $defs/issue.reporter
|
||||||
|
You should always use {{{sshUser}}} as reporter
|
||||||
|
### additionalInfo.workflow
|
||||||
|
Use this field when you are instructed to change tasks stage
|
||||||
|
#### additionalInfo.workflow.operation
|
||||||
|
your operation to change the status of current workflow
|
||||||
|
options are:
|
||||||
|
- task-rejected => by following the guide of system message, when you are told to abort current task.
|
||||||
|
- task-completed => by following the guide of system message, when you are told you've completed current task.
|
||||||
|
- pending-confirmation => by following the guide of system message, when you are told you need a yes/no response from user message.
|
||||||
|
#### additionalInfo.workflow.comment
|
||||||
|
your note for this operation
|
||||||
|
### additionalInfo.structuredOutput
|
||||||
|
when you are asked to provide a specific value by system message, use this field to return the value
|
||||||
|
#### additionalInfo.structuredOutput.repoUrl
|
||||||
|
If system message instructed you to provide the url of specific gitea repo, put the url in this field
|
||||||
|
|
||||||
|
# Preparation Instructions
|
||||||
|
For every task, you should:
|
||||||
|
First, establish and maintain an SSH connection to your assigned workspace by:
|
||||||
|
1. Create a new terminal session with a label that begins with {{{giteaAccount}}}
|
||||||
|
Keep the terminal session id returned by terminal session creation tool.
|
||||||
|
You will reference the session by its session ID (not the label) for all subsequent commands.
|
||||||
|
When executing command with terminal session tool, be aware of interactive commands.
|
||||||
|
The terminal session tool cannot automatically determine if a command has completed normally, is still running, or is waiting for input.
|
||||||
|
You can use command execution tools to interact with a running command (e.g., sending 'y' or 'n' for confirmations)
|
||||||
|
2. Execute the command `ssh {{{sshUser}}}@{{{sshHost}}}`
|
||||||
|
Suggest to execute this command with the one off command tool, setting timeout to 1000
|
||||||
|
3. Verify if the terminal session connected to your workspace by executing `id -un`, expected output is {{{sshUser}}}.
|
||||||
|
|
||||||
|
Once your terminal shell successfully connected to the workspace, Have a look at `~/Guide/index.md`.
|
||||||
|
That document contains further instructions regarding your role and workflow
|
||||||
|
|
||||||
|
Now your are ready for the task
|
||||||
|
""";
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user