-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathmain.tsp
More file actions
188 lines (168 loc) · 5.47 KB
/
main.tsp
File metadata and controls
188 lines (168 loc) · 5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import "@typespec/http";
import "@typespec/openapi3";
import "@microsoft/typespec-m365-copilot";
using TypeSpec.Http;
using TypeSpec.M365.Copilot.Agents;
using TypeSpec.M365.Copilot.Actions;
@agent(
"Repairs Hub Agent (OAuth)",
"An agent for managing repair information"
)
@instructions("""
You are a repairs expert agent.
""")
@conversationStarter(#{
title: "List repairs",
text: "List all repairs"
})
@conversationStarter(#{
title: "List all Karin's repairs",
text: "List all repairs assigned to Karin"
})
@conversationStarter(#{
title: "List all repairs about oil",
text: "List all repairs that are about oil"
})
@conversationStarter(#{
title: "List all overdue repairs",
text: "List all overdue repairs"
})
@conversationStarter(#{
title: "Create repair",
text: "Create a new repair titled [TO_REPLACE] and assign it to me"
})
@conversationStarter(#{
title: "Assign me a repair",
text: "Update the repairs about [TO_REPLACE] and assign it to me"
})
namespace RepairsAgent {
@service
@actions(#{
nameForHuman: "Repairs Hub",
descriptionForHuman: "Manage your repairs and maintenance tasks.",
descriptionForModel: "Plugin to add, update, remove, and view repair objects.",
})
@server("https://repairshub-oauth.azurewebsites.net", "Repairs Hub API")
@useAuth(RepairsHubAuth)
namespace RepairsHub {
/**
* List all repairs.
* @param assignedTo Optional filter to list repairs assigned to a specific user.
*/
/*@responding("""
* **ALWAYS** return the data in a markdown table format that includes the following columns:
* Title
* Description
* Assigned To
* If there is no data for a column, leave it blank.
* Always add a link to the image in the title column using this format [title](image)
""")*/
@route("/repairs")
@card(#{ dataPath: "$", title: "$.title", url: "$.image", file: "cards/repair.json" })
@get op listRepairs(@query assignedTo?: string): string;
/**
* Create a new repair.
* When creating a repair, the `id` field is optional and will be generated by the server.
* The `date` field should be in ISO 8601 format (e.g., "2023-10-01T12:00:00Z").
* The `image` field should be a valid URL pointing to the image associated with the repair.
* @param repair The repair to create.
*/
@route("/repairs")
@capabilities(#{
confirmation: #{
type: "AdaptiveCard",
title: "Create a new repair",
body: """
Creating a new repair with the following details:
* **Title**: {{ function.parameters.title }}
* **Description**: {{ function.parameters.description }}
* **Assigned To**: {{ function.parameters.assignedTo }}
"""
}
})
@post op createRepair(@body repair: Repair): Repair;
/**
* Update an existing repair.
* The `id` field is required to identify the repair to update.
* The `date` field should be in ISO 8601 format (e.g., "2023-10-01T12:00:00Z").
* The `image` field should be a valid URL pointing to the image associated with the repair.
* @param repair The repair to update.
*/
@route("/repairs")
/*@reasoning("""
**ALWAYS** use the listRepairs function to get the ID first.
""")*/
@capabilities(#{
confirmation: #{
type: "AdaptiveCard",
title: "Create a new repair",
body: """
Updating a repair with the following details:
* **ID**: {{ function.parameters.id }}
* **Title**: {{ function.parameters.title }}
* **Description**: {{ function.parameters.description }}
* **Assigned To**: {{ function.parameters.assignedTo }}
"""
}
})
@patch op updateRepair(@body repair: Repair): Repair;
/**
* Delete a repair.
* The `id` field is required to identify the repair to delete.
* @param repair The repair to delete.
*/
@route("/repairs")
/*@reasoning("""
**ALWAYS** use the listRepairs function to get the ID first.
""");*/
@capabilities(#{
confirmation: #{
type: "AdaptiveCard",
title: "Delete a repair",
body: """
Deleting a repair with the following details:
* **ID**: {{ function.parameters.id }}
"""
}
})
@delete op deleteRepair(@body repair: Repair): Repair;
/**
* A model representing a repair.
*/
model Repair {
/**
* The unique identifier for the repair.
*/
id?: string;
/**
* The short summary or title of the repair.
*/
title: string;
/**
* The detailed description of the repair.
*/
description?: string;
/**
* The user who is assigned to the repair.
*/
assignedTo?: string;
/**
* The optional date and time when the repair is scheduled or completed.
*/
@format("date-time")
date?: string;
/**
* The URL of the image associated with the repair.
*/
@format("uri")
image?: string;
}
}
@authReferenceId("\${{REPAIRSHUBAUTH_REGISTRATION_ID}}")
model RepairsHubAuth is OAuth2Auth<[{
type: OAuth2FlowType.authorizationCode;
authorizationUrl: "https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize";
tokenUrl: "https://login.microsoftonline.com/organizations/oauth2/v2.0/token";
refreshUrl: "https://login.microsoftonline.com/organizations/oauth2/v2.0/token";
}]> { }
}