@credal/actions 0.2.172 → 0.2.174
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/dist/actions/autogen/templates.js +176 -0
- package/dist/actions/autogen/types.d.ts +6 -0
- package/dist/actions/autogen/types.js +14 -23
- package/dist/actions/groups.js +4 -1
- package/dist/actions/parse.d.ts +3 -0
- package/dist/actions/parse.js +94 -1
- package/dist/actions/providers/github/fetchFile.d.ts +3 -0
- package/dist/actions/providers/github/fetchFile.js +131 -0
- package/dist/actions/providers/github/getContents.d.ts +3 -0
- package/dist/actions/providers/github/getContents.js +41 -0
- package/dist/actions/providers/slack/archiveChannel.js +9 -2
- package/package.json +2 -2
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/math/index.d.ts +0 -1
- package/dist/actions/providers/math/index.js +0 -37
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +0 -43
- package/dist/actions/providers/slack/index.d.ts +0 -1
- package/dist/actions/providers/slack/index.js +0 -37
- package/dist/actions/providers/slack/listConversations.d.ts +0 -3
- package/dist/actions/providers/slack/listConversations.js +0 -41
|
@@ -101,6 +101,12 @@ export declare const AuthParamsSchema: z.ZodObject<{
|
|
|
101
101
|
redirectUri?: string | undefined;
|
|
102
102
|
}>;
|
|
103
103
|
export type AuthParamsType = z.infer<typeof AuthParamsSchema>;
|
|
104
|
+
export declare const ActionTagSchema: z.ZodEnum<["read", "write"]>;
|
|
105
|
+
export type ActionTag = z.infer<typeof ActionTagSchema>;
|
|
106
|
+
export declare const ACTION_TAGS: readonly ["read", "write"];
|
|
107
|
+
export declare const ParameterTagSchema: z.ZodEnum<["recommend-predefined"]>;
|
|
108
|
+
export type ParameterTag = z.infer<typeof ParameterTagSchema>;
|
|
109
|
+
export declare const PARAMETER_TAGS: readonly ["recommend-predefined"];
|
|
104
110
|
export declare const genericFillTemplateParamsSchema: z.ZodObject<{
|
|
105
111
|
template: z.ZodString;
|
|
106
112
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -57,6 +57,10 @@ export const AuthParamsSchema = z.object({
|
|
|
57
57
|
redirectUri: z.string().optional(),
|
|
58
58
|
userEmail: z.string().optional(),
|
|
59
59
|
});
|
|
60
|
+
export const ActionTagSchema = z.enum(["read", "write"]);
|
|
61
|
+
export const ACTION_TAGS = ["read", "write"];
|
|
62
|
+
export const ParameterTagSchema = z.enum(["recommend-predefined"]);
|
|
63
|
+
export const PARAMETER_TAGS = ["recommend-predefined"];
|
|
60
64
|
export const genericFillTemplateParamsSchema = z.object({
|
|
61
65
|
template: z.string().describe("The template string to be processed and returned"),
|
|
62
66
|
});
|
|
@@ -2185,8 +2189,7 @@ export const googleOauthUpdateSpreadsheetParamsSchema = z.object({
|
|
|
2185
2189
|
const schemas = [
|
|
2186
2190
|
z
|
|
2187
2191
|
.object({
|
|
2188
|
-
addSheet: z
|
|
2189
|
-
.object({
|
|
2192
|
+
addSheet: z.object({
|
|
2190
2193
|
properties: z
|
|
2191
2194
|
.object({
|
|
2192
2195
|
title: z.string().describe("The title of the new sheet").optional(),
|
|
@@ -2198,21 +2201,17 @@ export const googleOauthUpdateSpreadsheetParamsSchema = z.object({
|
|
|
2198
2201
|
.optional(),
|
|
2199
2202
|
})
|
|
2200
2203
|
.optional(),
|
|
2201
|
-
})
|
|
2202
|
-
.optional(),
|
|
2204
|
+
}),
|
|
2203
2205
|
})
|
|
2204
2206
|
.describe("Add or update a sheet"),
|
|
2205
2207
|
z
|
|
2206
2208
|
.object({
|
|
2207
|
-
deleteSheet: z
|
|
2208
|
-
.object({ sheetId: z.number().describe("The ID of the sheet to delete").optional() })
|
|
2209
|
-
.optional(),
|
|
2209
|
+
deleteSheet: z.object({ sheetId: z.number().describe("The ID of the sheet to delete").optional() }),
|
|
2210
2210
|
})
|
|
2211
2211
|
.describe("Delete a sheet"),
|
|
2212
2212
|
z
|
|
2213
2213
|
.object({
|
|
2214
|
-
updateCells: z
|
|
2215
|
-
.object({
|
|
2214
|
+
updateCells: z.object({
|
|
2216
2215
|
range: z
|
|
2217
2216
|
.object({
|
|
2218
2217
|
sheetId: z.number().describe("The ID of the sheet").optional(),
|
|
@@ -2238,14 +2237,12 @@ export const googleOauthUpdateSpreadsheetParamsSchema = z.object({
|
|
|
2238
2237
|
.optional(),
|
|
2239
2238
|
}))
|
|
2240
2239
|
.optional(),
|
|
2241
|
-
})
|
|
2242
|
-
.optional(),
|
|
2240
|
+
}),
|
|
2243
2241
|
})
|
|
2244
2242
|
.describe("Update cells in a range"),
|
|
2245
2243
|
z
|
|
2246
2244
|
.object({
|
|
2247
|
-
updateSheetProperties: z
|
|
2248
|
-
.object({
|
|
2245
|
+
updateSheetProperties: z.object({
|
|
2249
2246
|
properties: z
|
|
2250
2247
|
.object({
|
|
2251
2248
|
sheetId: z.number().describe("The ID of the sheet to update").optional(),
|
|
@@ -2264,14 +2261,12 @@ export const googleOauthUpdateSpreadsheetParamsSchema = z.object({
|
|
|
2264
2261
|
.string()
|
|
2265
2262
|
.describe("The fields to update (comma-separated list using JSON field paths)")
|
|
2266
2263
|
.optional(),
|
|
2267
|
-
})
|
|
2268
|
-
.optional(),
|
|
2264
|
+
}),
|
|
2269
2265
|
})
|
|
2270
2266
|
.describe("Update sheet properties"),
|
|
2271
2267
|
z
|
|
2272
2268
|
.object({
|
|
2273
|
-
updateSpreadsheetProperties: z
|
|
2274
|
-
.object({
|
|
2269
|
+
updateSpreadsheetProperties: z.object({
|
|
2275
2270
|
properties: z
|
|
2276
2271
|
.object({
|
|
2277
2272
|
title: z.string().describe("The title of the spreadsheet").optional(),
|
|
@@ -2326,10 +2321,7 @@ export const googleOauthUpdateSpreadsheetParamsSchema = z.object({
|
|
|
2326
2321
|
fontSize: z.number().describe("The size of the font in points").optional(),
|
|
2327
2322
|
bold: z.boolean().describe("Whether the text is bold").optional(),
|
|
2328
2323
|
italic: z.boolean().describe("Whether the text is italic").optional(),
|
|
2329
|
-
strikethrough: z
|
|
2330
|
-
.boolean()
|
|
2331
|
-
.describe("Whether the text has a strikethrough")
|
|
2332
|
-
.optional(),
|
|
2324
|
+
strikethrough: z.boolean().describe("Whether the text has a strikethrough").optional(),
|
|
2333
2325
|
underline: z.boolean().describe("Whether the text is underlined").optional(),
|
|
2334
2326
|
})
|
|
2335
2327
|
.optional(),
|
|
@@ -2341,8 +2333,7 @@ export const googleOauthUpdateSpreadsheetParamsSchema = z.object({
|
|
|
2341
2333
|
.string()
|
|
2342
2334
|
.describe("The fields to update (comma-separated list using JSON field paths)")
|
|
2343
2335
|
.optional(),
|
|
2344
|
-
})
|
|
2345
|
-
.optional(),
|
|
2336
|
+
}),
|
|
2346
2337
|
})
|
|
2347
2338
|
.describe("Update spreadsheet properties"),
|
|
2348
2339
|
];
|
package/dist/actions/groups.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, slackCreateChannelDefinition, slackArchiveChannelDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, jiraGetServiceDesksDefinition, jiraCreateServiceDeskRequestDefinition, googlemapsNearbysearchRestaurantsDefinition, firecrawlScrapeUrlDefinition, resendSendEmailDefinition, linkedinCreateShareLinkedinPostUrlDefinition, googleOauthCreateNewGoogleDocDefinition, xCreateShareXPostUrlDefinition, firecrawlScrapeTweetDataWithNitterDefinition, finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition, confluenceFetchPageContentDefinition, snowflakeRunSnowflakeQueryDefinition, lookerEnableUserByEmailDefinition, googleOauthUpdateDocDefinition, googleOauthScheduleCalendarMeetingDefinition, googleOauthListCalendarsDefinition, googleOauthListCalendarEventsDefinition, googleOauthUpdateCalendarEventDefinition, googleOauthDeleteCalendarEventDefinition, googleOauthCreateSpreadsheetDefinition, googleOauthUpdateSpreadsheetDefinition, googleOauthCreatePresentationDefinition, googleOauthUpdatePresentationDefinition, googleOauthSearchDriveByKeywordsDefinition, googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition, googleOauthListGroupsDefinition, googleOauthGetGroupDefinition, googleOauthListGroupMembersDefinition, googleOauthHasGroupMemberDefinition, googleOauthAddGroupMemberDefinition, googleOauthDeleteGroupMemberDefinition, salesforceUpdateRecordDefinition, salesforceCreateCaseDefinition, salesforceGenerateSalesReportDefinition, salesforceGetRecordDefinition, salesforceGetSalesforceRecordsByQueryDefinition, microsoftMessageTeamsChatDefinition, microsoftMessageTeamsChannelDefinition, asanaCommentTaskDefinition, asanaCreateTaskDefinition, asanaUpdateTaskDefinition, asanaSearchTasksDefinition, githubCreateOrUpdateFileDefinition, githubCreateBranchDefinition, githubCreatePullRequestDefinition, microsoftUpdateSpreadsheetDefinition, microsoftUpdateDocumentDefinition, microsoftCreateDocumentDefinition, microsoftGetDocumentDefinition, salesforceFetchSalesforceSchemaByObjectDefinition, firecrawlDeepResearchDefinition, jiraGetJiraIssuesByQueryDefinition, githubListPullRequestsDefinition, salesforceCreateRecordDefinition, ashbyCreateNoteDefinition, ashbyGetCandidateInfoDefinition, ashbyListCandidatesDefinition, ashbyListCandidateNotesDefinition, ashbySearchCandidatesDefinition, ashbyCreateCandidateDefinition, ashbyUpdateCandidateDefinition, ashbyAddCandidateToProjectDefinition, bingGetTopNSearchResultUrlsDefinition, gongGetGongTranscriptsDefinition, kandjiGetFVRecoveryKeyForDeviceDefinition, asanaListAsanaTasksByProjectDefinition, notionSearchByTitleDefinition, asanaGetTasksDetailsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, jamfGetJamfUserComputerIdDefinition, jamfLockJamfComputerByIdDefinition, oktaTriggerOktaWorkflowDefinition, jiraOrgAssignJiraTicketDefinition, jiraOrgCreateJiraTicketDefinition, jiraOrgCommentJiraTicketDefinition, jiraOrgGetJiraTicketDetailsDefinition, jiraOrgGetJiraTicketHistoryDefinition, jiraOrgUpdateJiraTicketDetailsDefinition, jiraOrgUpdateJiraTicketStatusDefinition, jiraOrgGetJiraIssuesByQueryDefinition, googleOauthGetDriveFileContentByIdDefinition, googleOauthSearchDriveByQueryDefinition, } from "./autogen/templates.js";
|
|
1
|
+
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, slackCreateChannelDefinition, slackArchiveChannelDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, jiraGetServiceDesksDefinition, jiraCreateServiceDeskRequestDefinition, googlemapsNearbysearchRestaurantsDefinition, firecrawlScrapeUrlDefinition, resendSendEmailDefinition, linkedinCreateShareLinkedinPostUrlDefinition, googleOauthCreateNewGoogleDocDefinition, xCreateShareXPostUrlDefinition, firecrawlScrapeTweetDataWithNitterDefinition, finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition, confluenceFetchPageContentDefinition, snowflakeRunSnowflakeQueryDefinition, lookerEnableUserByEmailDefinition, googleOauthUpdateDocDefinition, googleOauthScheduleCalendarMeetingDefinition, googleOauthListCalendarsDefinition, googleOauthListCalendarEventsDefinition, googleOauthUpdateCalendarEventDefinition, googleOauthDeleteCalendarEventDefinition, googleOauthCreateSpreadsheetDefinition, googleOauthUpdateSpreadsheetDefinition, googleOauthCreatePresentationDefinition, googleOauthUpdatePresentationDefinition, googleOauthSearchDriveByKeywordsDefinition, googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition, googleOauthListGroupsDefinition, googleOauthGetGroupDefinition, googleOauthListGroupMembersDefinition, googleOauthHasGroupMemberDefinition, googleOauthAddGroupMemberDefinition, googleOauthDeleteGroupMemberDefinition, salesforceUpdateRecordDefinition, salesforceCreateCaseDefinition, salesforceGenerateSalesReportDefinition, salesforceGetRecordDefinition, salesforceGetSalesforceRecordsByQueryDefinition, microsoftMessageTeamsChatDefinition, microsoftMessageTeamsChannelDefinition, asanaCommentTaskDefinition, asanaCreateTaskDefinition, asanaUpdateTaskDefinition, asanaSearchTasksDefinition, githubCreateOrUpdateFileDefinition, githubCreateBranchDefinition, githubCreatePullRequestDefinition, microsoftUpdateSpreadsheetDefinition, microsoftUpdateDocumentDefinition, microsoftCreateDocumentDefinition, microsoftGetDocumentDefinition, salesforceFetchSalesforceSchemaByObjectDefinition, firecrawlDeepResearchDefinition, jiraGetJiraIssuesByQueryDefinition, githubListPullRequestsDefinition, salesforceCreateRecordDefinition, ashbyCreateNoteDefinition, ashbyGetCandidateInfoDefinition, ashbyListCandidatesDefinition, ashbyListCandidateNotesDefinition, ashbySearchCandidatesDefinition, ashbyCreateCandidateDefinition, ashbyUpdateCandidateDefinition, ashbyAddCandidateToProjectDefinition, bingGetTopNSearchResultUrlsDefinition, gongGetGongTranscriptsDefinition, kandjiGetFVRecoveryKeyForDeviceDefinition, asanaListAsanaTasksByProjectDefinition, notionSearchByTitleDefinition, asanaGetTasksDetailsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, jamfGetJamfUserComputerIdDefinition, jamfLockJamfComputerByIdDefinition, oktaTriggerOktaWorkflowDefinition, jiraOrgAssignJiraTicketDefinition, jiraOrgCreateJiraTicketDefinition, jiraOrgCommentJiraTicketDefinition, jiraOrgGetJiraTicketDetailsDefinition, jiraOrgGetJiraTicketHistoryDefinition, jiraOrgUpdateJiraTicketDetailsDefinition, jiraOrgUpdateJiraTicketStatusDefinition, jiraOrgGetJiraIssuesByQueryDefinition, googleOauthGetDriveFileContentByIdDefinition, googleOauthSearchDriveByQueryDefinition, googleOauthSearchDriveByQueryAndGetFileContentDefinition, githubGetFileContentDefinition, githubListDirectoryDefinition, } from "./autogen/templates.js";
|
|
2
2
|
export const ACTION_GROUPS = {
|
|
3
3
|
GENERIC: {
|
|
4
4
|
description: "Generic utility actions",
|
|
@@ -47,6 +47,7 @@ export const ACTION_GROUPS = {
|
|
|
47
47
|
googleOauthUpdatePresentationDefinition,
|
|
48
48
|
googleOauthSearchDriveByKeywordsDefinition,
|
|
49
49
|
googleOauthSearchDriveByQueryDefinition,
|
|
50
|
+
googleOauthSearchDriveByQueryAndGetFileContentDefinition,
|
|
50
51
|
googleOauthGetDriveFileContentByIdDefinition,
|
|
51
52
|
],
|
|
52
53
|
},
|
|
@@ -198,6 +199,8 @@ export const ACTION_GROUPS = {
|
|
|
198
199
|
githubCreateBranchDefinition,
|
|
199
200
|
githubCreatePullRequestDefinition,
|
|
200
201
|
githubListPullRequestsDefinition,
|
|
202
|
+
githubGetFileContentDefinition,
|
|
203
|
+
githubListDirectoryDefinition,
|
|
201
204
|
],
|
|
202
205
|
},
|
|
203
206
|
ASHBY: {
|
package/dist/actions/parse.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
declare const actionTemplateSchema: z.ZodObject<{
|
|
3
3
|
description: z.ZodString;
|
|
4
4
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
5
|
+
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<["read", "write"]>, "many">>>;
|
|
5
6
|
parameters: z.ZodOptional<z.ZodObject<{
|
|
6
7
|
type: z.ZodString;
|
|
7
8
|
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -34,6 +35,7 @@ declare const actionTemplateSchema: z.ZodObject<{
|
|
|
34
35
|
}, "strip", z.ZodTypeAny, {
|
|
35
36
|
description: string;
|
|
36
37
|
scopes: string[];
|
|
38
|
+
tags: ("read" | "write")[];
|
|
37
39
|
name: string;
|
|
38
40
|
provider: string;
|
|
39
41
|
parameters?: {
|
|
@@ -51,6 +53,7 @@ declare const actionTemplateSchema: z.ZodObject<{
|
|
|
51
53
|
scopes: string[];
|
|
52
54
|
name: string;
|
|
53
55
|
provider: string;
|
|
56
|
+
tags?: ("read" | "write")[] | undefined;
|
|
54
57
|
parameters?: {
|
|
55
58
|
type: string;
|
|
56
59
|
required?: string[] | undefined;
|
package/dist/actions/parse.js
CHANGED
|
@@ -15,14 +15,25 @@ import { Project, VariableDeclarationKind } from "ts-morph";
|
|
|
15
15
|
import { z } from "zod";
|
|
16
16
|
import { snakeToPascal } from "../utils/string.js";
|
|
17
17
|
// TODO support oneOf correctly
|
|
18
|
+
// Tag enum definitions - must be defined before schemas for validation
|
|
19
|
+
const actionTagValues = [
|
|
20
|
+
"read", // this action is read-only in the source system
|
|
21
|
+
"write", // this action executes writes in the source system
|
|
22
|
+
];
|
|
23
|
+
const parameterTagValues = [
|
|
24
|
+
"recommend-predefined", // we recommend that this parameter is predefined by the user versus AI generated at runtime
|
|
25
|
+
];
|
|
18
26
|
const jsonObjectSchema = z.object({
|
|
19
27
|
type: z.string(),
|
|
20
28
|
required: z.array(z.string()).optional(),
|
|
21
29
|
properties: z.record(z.string(), z.any()).optional(), // Permissive for now, validate using JSON schema later
|
|
22
30
|
});
|
|
31
|
+
const parameterTagEnum = z.enum([...parameterTagValues]);
|
|
32
|
+
const actionTagEnum = z.enum([...actionTagValues]);
|
|
23
33
|
const actionSchema = z.object({
|
|
24
34
|
description: z.string(),
|
|
25
35
|
scopes: z.array(z.string()),
|
|
36
|
+
tags: z.array(actionTagEnum).optional().default([]),
|
|
26
37
|
parameters: jsonObjectSchema.optional(),
|
|
27
38
|
output: jsonObjectSchema.optional(),
|
|
28
39
|
});
|
|
@@ -65,6 +76,8 @@ function validateObject(object) {
|
|
|
65
76
|
strictTuples: true,
|
|
66
77
|
strictRequired: true,
|
|
67
78
|
});
|
|
79
|
+
// Add custom keyword - just allow it, we'll validate manually
|
|
80
|
+
ajv.addKeyword("tags");
|
|
68
81
|
// validate schema and check required fields
|
|
69
82
|
const validParameters = ajv.validateSchema(object);
|
|
70
83
|
if (!validParameters) {
|
|
@@ -79,6 +92,20 @@ function validateObject(object) {
|
|
|
79
92
|
}
|
|
80
93
|
}
|
|
81
94
|
}
|
|
95
|
+
// Validate tags in property schemas using Zod
|
|
96
|
+
if (object.properties) {
|
|
97
|
+
for (const [propName, propSchema] of Object.entries(object.properties)) {
|
|
98
|
+
if (propSchema && typeof propSchema === "object" && "tags" in propSchema) {
|
|
99
|
+
const tags = propSchema.tags;
|
|
100
|
+
if (tags !== undefined) {
|
|
101
|
+
const result = z.array(parameterTagEnum).safeParse(tags);
|
|
102
|
+
if (!result.success) {
|
|
103
|
+
throw new Error(`Property "${propName}" has invalid tags: ${result.error.errors.map(e => e.message).join(", ")}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
82
109
|
});
|
|
83
110
|
}
|
|
84
111
|
function addActionTypes(_a) {
|
|
@@ -183,8 +210,67 @@ function generateTypes(_a) {
|
|
|
183
210
|
type: "z.infer<typeof AuthParamsSchema>",
|
|
184
211
|
isExported: true,
|
|
185
212
|
});
|
|
213
|
+
// ActionTag enum for action-level tags (using values defined at top of file)
|
|
214
|
+
typesFile.addVariableStatement({
|
|
215
|
+
declarationKind: VariableDeclarationKind.Const,
|
|
216
|
+
isExported: true,
|
|
217
|
+
declarations: [
|
|
218
|
+
{
|
|
219
|
+
name: "ActionTagSchema",
|
|
220
|
+
initializer: `z.enum([${actionTagValues.map(t => `"${t}"`).join(", ")}])`,
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
});
|
|
224
|
+
typesFile.addTypeAlias({
|
|
225
|
+
name: "ActionTag",
|
|
226
|
+
type: "z.infer<typeof ActionTagSchema>",
|
|
227
|
+
isExported: true,
|
|
228
|
+
});
|
|
229
|
+
typesFile.addVariableStatement({
|
|
230
|
+
declarationKind: VariableDeclarationKind.Const,
|
|
231
|
+
isExported: true,
|
|
232
|
+
declarations: [
|
|
233
|
+
{
|
|
234
|
+
name: "ACTION_TAGS",
|
|
235
|
+
initializer: `[${actionTagValues.map(t => `"${t}"`).join(", ")}] as const`,
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
});
|
|
239
|
+
// ParameterTag enum for parameter property tags (using values defined at top of file)
|
|
240
|
+
typesFile.addVariableStatement({
|
|
241
|
+
declarationKind: VariableDeclarationKind.Const,
|
|
242
|
+
isExported: true,
|
|
243
|
+
declarations: [
|
|
244
|
+
{
|
|
245
|
+
name: "ParameterTagSchema",
|
|
246
|
+
initializer: `z.enum([${parameterTagValues.map(t => `"${t}"`).join(", ")}])`,
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
});
|
|
250
|
+
typesFile.addTypeAlias({
|
|
251
|
+
name: "ParameterTag",
|
|
252
|
+
type: "z.infer<typeof ParameterTagSchema>",
|
|
253
|
+
isExported: true,
|
|
254
|
+
});
|
|
255
|
+
typesFile.addVariableStatement({
|
|
256
|
+
declarationKind: VariableDeclarationKind.Const,
|
|
257
|
+
isExported: true,
|
|
258
|
+
declarations: [
|
|
259
|
+
{
|
|
260
|
+
name: "PARAMETER_TAGS",
|
|
261
|
+
initializer: `[${parameterTagValues.map(t => `"${t}"`).join(", ")}] as const`,
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
});
|
|
186
265
|
for (const [categoryName, category] of Object.entries(parsedConfig.actions)) {
|
|
187
266
|
for (const [actionName, action] of Object.entries(category)) {
|
|
267
|
+
// Validate action-level tags
|
|
268
|
+
if (action.tags && action.tags.length > 0) {
|
|
269
|
+
const invalidTags = action.tags.filter(tag => !actionTagValues.includes(tag));
|
|
270
|
+
if (invalidTags.length > 0) {
|
|
271
|
+
throw new Error(`Action "${categoryName}.${actionName}" has invalid tag values: ${invalidTags.join(", ")}. Valid values are: ${actionTagValues.join(", ")}`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
188
274
|
if (action.parameters) {
|
|
189
275
|
yield validateObject(action.parameters);
|
|
190
276
|
}
|
|
@@ -223,4 +309,11 @@ function generateTypes(_a) {
|
|
|
223
309
|
yield typesFile.save();
|
|
224
310
|
});
|
|
225
311
|
}
|
|
226
|
-
generateTypes({})
|
|
312
|
+
generateTypes({}).catch(error => {
|
|
313
|
+
console.error("Error generating types:", error);
|
|
314
|
+
if (error instanceof Error) {
|
|
315
|
+
console.error(error.message);
|
|
316
|
+
console.error(error.stack);
|
|
317
|
+
}
|
|
318
|
+
process.exit(1);
|
|
319
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
11
|
+
// Limits on the number of results to return
|
|
12
|
+
const MAX_CODE_RESULTS = 15;
|
|
13
|
+
const MAX_COMMITS = 10;
|
|
14
|
+
const MAX_FILES_PER_COMMIT = 5;
|
|
15
|
+
const MAX_ISSUES_OR_PRS = 10;
|
|
16
|
+
const MAX_FILES_PER_PR = 5;
|
|
17
|
+
const MAX_PATCH_LINES = 20;
|
|
18
|
+
const MAX_FRAGMENT_LINES = 20;
|
|
19
|
+
const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
20
|
+
const { Octokit } = yield import("octokit");
|
|
21
|
+
if (!authParams.authToken) {
|
|
22
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
23
|
+
}
|
|
24
|
+
const octokit = new Octokit({ auth: authParams.authToken });
|
|
25
|
+
const { organization, repository, query } = params;
|
|
26
|
+
// Search CODE with text match metadata
|
|
27
|
+
const codeResultsResponse = yield octokit.rest.search.code({
|
|
28
|
+
q: `${query} in:file,path repo:${organization}/${repository}`,
|
|
29
|
+
text_match: true,
|
|
30
|
+
headers: {
|
|
31
|
+
accept: "application/vnd.github.v3.text-match+json",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const codeResults = codeResultsResponse.data.items.slice(0, MAX_CODE_RESULTS).map(item => ({
|
|
35
|
+
name: item.name,
|
|
36
|
+
path: item.path,
|
|
37
|
+
sha: item.sha,
|
|
38
|
+
url: item.url,
|
|
39
|
+
repository: {
|
|
40
|
+
full_name: item.repository.full_name,
|
|
41
|
+
html_url: item.repository.html_url,
|
|
42
|
+
},
|
|
43
|
+
score: item.score,
|
|
44
|
+
textMatches: item.text_matches
|
|
45
|
+
? item.text_matches.map(match => {
|
|
46
|
+
var _a, _b, _c, _d;
|
|
47
|
+
return ({
|
|
48
|
+
object_url: (_a = match.object_url) !== null && _a !== void 0 ? _a : undefined,
|
|
49
|
+
object_type: (_b = match.object_type) !== null && _b !== void 0 ? _b : undefined,
|
|
50
|
+
fragment: (_c = match.fragment) === null || _c === void 0 ? void 0 : _c.split("\n").slice(0, MAX_FRAGMENT_LINES).join("\n"),
|
|
51
|
+
matches: (_d = match.matches) !== null && _d !== void 0 ? _d : [],
|
|
52
|
+
});
|
|
53
|
+
})
|
|
54
|
+
: [],
|
|
55
|
+
}));
|
|
56
|
+
// Search COMMITS
|
|
57
|
+
const commitResults = yield octokit.rest.search.commits({
|
|
58
|
+
q: `${query} repo:${organization}/${repository}`,
|
|
59
|
+
headers: {
|
|
60
|
+
accept: "application/vnd.github.cloak-preview+json",
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const commitSHAs = commitResults.data.items.slice(0, MAX_COMMITS).map(item => item.sha);
|
|
64
|
+
const commitDetails = yield Promise.all(commitSHAs.map(sha => octokit.rest.repos.getCommit({ owner: organization, repo: repository, ref: sha })));
|
|
65
|
+
const enrichedCommits = commitResults.data.items.slice(0, MAX_COMMITS).map(item => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
const full = commitDetails.find(c => c.data.sha === item.sha);
|
|
68
|
+
return {
|
|
69
|
+
sha: item.sha,
|
|
70
|
+
url: item.url,
|
|
71
|
+
commit: {
|
|
72
|
+
message: item.commit.message,
|
|
73
|
+
author: item.commit.author,
|
|
74
|
+
},
|
|
75
|
+
score: item.score,
|
|
76
|
+
author: (_a = item.author) !== null && _a !== void 0 ? _a : undefined,
|
|
77
|
+
files: ((_b = full === null || full === void 0 ? void 0 : full.data.files) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_FILES_PER_COMMIT).map(f => {
|
|
78
|
+
var _a;
|
|
79
|
+
return ({
|
|
80
|
+
filename: f.filename,
|
|
81
|
+
status: f.status,
|
|
82
|
+
patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
|
|
83
|
+
});
|
|
84
|
+
})) || [],
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
// Search ISSUES & PRs
|
|
88
|
+
const issueResults = yield octokit.rest.search.issuesAndPullRequests({
|
|
89
|
+
q: `${query} repo:${organization}/${repository}`,
|
|
90
|
+
});
|
|
91
|
+
const prItems = issueResults.data.items.filter(item => item.pull_request).slice(0, MAX_ISSUES_OR_PRS);
|
|
92
|
+
const prNumbers = prItems.map(item => item.number);
|
|
93
|
+
const prFiles = yield Promise.all(prNumbers.map(number => octokit.rest.pulls.listFiles({ owner: organization, repo: repository, pull_number: number })));
|
|
94
|
+
const issuesAndPRs = issueResults.data.items
|
|
95
|
+
.slice(0, MAX_ISSUES_OR_PRS)
|
|
96
|
+
.map(item => {
|
|
97
|
+
var _a, _b, _c, _d;
|
|
98
|
+
const isPR = !!item.pull_request;
|
|
99
|
+
const prIndex = prNumbers.indexOf(item.number);
|
|
100
|
+
const files = isPR && prIndex !== -1
|
|
101
|
+
? prFiles[prIndex].data.slice(0, MAX_FILES_PER_PR).map(f => {
|
|
102
|
+
var _a;
|
|
103
|
+
return ({
|
|
104
|
+
filename: f.filename,
|
|
105
|
+
status: f.status,
|
|
106
|
+
patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
|
|
107
|
+
});
|
|
108
|
+
})
|
|
109
|
+
: undefined;
|
|
110
|
+
return {
|
|
111
|
+
number: item.number,
|
|
112
|
+
title: item.title,
|
|
113
|
+
html_url: item.html_url,
|
|
114
|
+
state: item.state,
|
|
115
|
+
isPullRequest: isPR,
|
|
116
|
+
body: item.body,
|
|
117
|
+
user: {
|
|
118
|
+
email: (_b = (_a = item.user) === null || _a === void 0 ? void 0 : _a.email) !== null && _b !== void 0 ? _b : undefined,
|
|
119
|
+
name: (_d = (_c = item.user) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : undefined,
|
|
120
|
+
},
|
|
121
|
+
score: item.score,
|
|
122
|
+
files,
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
return {
|
|
126
|
+
code: codeResults,
|
|
127
|
+
commits: enrichedCommits,
|
|
128
|
+
issuesAndPullRequests: issuesAndPRs,
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
export default searchRepository;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
11
|
+
// Limits on the number of results to return
|
|
12
|
+
const MAX_CODE_RESULTS = 15;
|
|
13
|
+
const MAX_COMMITS = 10;
|
|
14
|
+
const MAX_FILES_PER_COMMIT = 5;
|
|
15
|
+
const MAX_ISSUES_OR_PRS = 10;
|
|
16
|
+
const MAX_FILES_PER_PR = 5;
|
|
17
|
+
const MAX_PATCH_LINES = 20;
|
|
18
|
+
const MAX_FRAGMENT_LINES = 20;
|
|
19
|
+
const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
20
|
+
const { Octokit } = yield import("octokit");
|
|
21
|
+
if (!authParams.authToken) {
|
|
22
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
23
|
+
}
|
|
24
|
+
const octokit = new Octokit({ auth: authParams.authToken });
|
|
25
|
+
const { organization, repository, query } = params;
|
|
26
|
+
// Search CODE with text match metadata
|
|
27
|
+
const codeResultsResponse = yield octokit.rest.search.code({
|
|
28
|
+
q: `${query} in:file,path repo:${organization}/${repository}`,
|
|
29
|
+
text_match: true,
|
|
30
|
+
headers: {
|
|
31
|
+
accept: "application/vnd.github.v3.text-match+json",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const commitResults = yield octokit.rest.repos.getCommit({ owner: organization, repo: repository, ref: sha });
|
|
35
|
+
return {
|
|
36
|
+
code: codeResults,
|
|
37
|
+
commits: enrichedCommits,
|
|
38
|
+
issuesAndPullRequests: issuesAndPRs,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
export default searchRepository;
|
|
@@ -9,14 +9,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { WebClient } from "@slack/web-api";
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
+
import { getSlackChannels } from "./helpers.js";
|
|
12
13
|
const archiveChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
14
|
if (!authParams.authToken) {
|
|
14
15
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
15
16
|
}
|
|
16
17
|
try {
|
|
17
18
|
const client = new WebClient(authParams.authToken);
|
|
18
|
-
const {
|
|
19
|
-
const
|
|
19
|
+
const { channelName } = params;
|
|
20
|
+
const allChannels = yield getSlackChannels(client);
|
|
21
|
+
const channel = allChannels.find(channel => channel.name == channelName);
|
|
22
|
+
if (!channel || !channel.id) {
|
|
23
|
+
throw Error(`Channel with name ${channelName} not found`);
|
|
24
|
+
}
|
|
25
|
+
yield client.conversations.join({ channel: channel.id });
|
|
26
|
+
const result = yield client.conversations.archive({ channel: channel.id });
|
|
20
27
|
if (!result.ok) {
|
|
21
28
|
return {
|
|
22
29
|
success: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@credal/actions",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.174",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI Actions by Credal AI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"typescript-eslint": "^8.18.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@credal/sdk": "^0.
|
|
50
|
+
"@credal/sdk": "^0.1.14",
|
|
51
51
|
"@mendable/firecrawl-js": "^4.3.4",
|
|
52
52
|
"@microsoft/microsoft-graph-client": "^3.0.7",
|
|
53
53
|
"@octokit/core": "^6.1.6",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const sdk_1 = require("@credal/sdk");
|
|
13
|
-
const callCopilot = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
-
var _b;
|
|
15
|
-
const requestBody = {
|
|
16
|
-
agentId: params.agentId,
|
|
17
|
-
query: params.query,
|
|
18
|
-
userEmail: params.userEmail,
|
|
19
|
-
};
|
|
20
|
-
const baseUrl = (_b = authParams.baseUrl) !== null && _b !== void 0 ? _b : "https://app.credal.ai/api";
|
|
21
|
-
const client = new sdk_1.CredalClient({ environment: baseUrl, apiKey: authParams.apiKey });
|
|
22
|
-
const response = yield client.copilots.sendMessage({
|
|
23
|
-
agentId: requestBody.agentId,
|
|
24
|
-
message: requestBody.query,
|
|
25
|
-
userEmail: requestBody.userEmail,
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
response: response.sendChatResult.type === "ai_response_result"
|
|
29
|
-
? response.sendChatResult.response.message
|
|
30
|
-
: "Error getting response",
|
|
31
|
-
referencedSources: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.referencedSources : [],
|
|
32
|
-
sourcesInDataContext: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.sourcesInDataContext : [],
|
|
33
|
-
webSearchResults: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.webSearchResults : [],
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
exports.default = callCopilot;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * as add from "./add";
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.add = void 0;
|
|
37
|
-
exports.add = __importStar(require("./add"));
|