@credal/actions 0.2.203 → 0.2.205

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.
@@ -1,4 +1,4 @@
1
- import { genericFillTemplateParamsSchema, genericFillTemplateOutputSchema, confluenceOverwritePageParamsSchema, confluenceOverwritePageOutputSchema, googlemapsValidateAddressOutputSchema, googlemapsValidateAddressParamsSchema, googleOauthCreateNewGoogleDocParamsSchema, googleOauthCreateNewGoogleDocOutputSchema, mathAddOutputSchema, mathAddParamsSchema, mongoInsertMongoDocOutputSchema, mongoInsertMongoDocParamsSchema, slackSendMessageOutputSchema, slackSendMessageParamsSchema, slackGetChannelMessagesOutputSchema, slackGetChannelMessagesParamsSchema, slackCreateChannelParamsSchema, slackCreateChannelOutputSchema, snowflakeGetRowByFieldValueOutputSchema, snowflakeGetRowByFieldValueParamsSchema, zendeskCreateZendeskTicketOutputSchema, zendeskCreateZendeskTicketParamsSchema, zendeskGetTicketDetailsOutputSchema, zendeskGetTicketDetailsParamsSchema, zendeskUpdateTicketStatusOutputSchema, zendeskUpdateTicketStatusParamsSchema, zendeskAddCommentToTicketOutputSchema, zendeskAddCommentToTicketParamsSchema, zendeskAssignTicketOutputSchema, zendeskAssignTicketParamsSchema, zendeskListZendeskTicketsOutputSchema, zendeskListZendeskTicketsParamsSchema, zendeskSearchZendeskByQueryOutputSchema, zendeskSearchZendeskByQueryParamsSchema, jiraAssignJiraTicketParamsSchema, jiraAssignJiraTicketOutputSchema, jiraCommentJiraTicketParamsSchema, jiraCommentJiraTicketOutputSchema, jiraCreateJiraTicketParamsSchema, jiraCreateJiraTicketOutputSchema, jiraGetJiraTicketDetailsParamsSchema, jiraGetJiraTicketDetailsOutputSchema, jiraGetJiraTicketHistoryParamsSchema, jiraGetJiraTicketHistoryOutputSchema, jiraMoveJiraTicketToProjectParamsSchema, jiraMoveJiraTicketToProjectOutputSchema, jiraUpdateJiraTicketDetailsParamsSchema, jiraUpdateJiraTicketDetailsOutputSchema, jiraUpdateJiraTicketStatusParamsSchema, jiraUpdateJiraTicketStatusOutputSchema, jiraCreateServiceDeskRequestParamsSchema, jiraCreateServiceDeskRequestOutputSchema, jiraLinkJiraIssuesParamsSchema, jiraLinkJiraIssuesOutputSchema, jiraLinkAndAssignJiraIssuesParamsSchema, jiraLinkAndAssignJiraIssuesOutputSchema, openstreetmapGetLatitudeLongitudeFromLocationParamsSchema, openstreetmapGetLatitudeLongitudeFromLocationOutputSchema, nwsGetForecastForLocationParamsSchema, nwsGetForecastForLocationOutputSchema, googlemapsNearbysearchRestaurantsOutputSchema, googlemapsNearbysearchRestaurantsParamsSchema, firecrawlScrapeUrlOutputSchema, firecrawlScrapeUrlParamsSchema, resendSendEmailOutputSchema, resendSendEmailHtmlParamsSchema, resendSendEmailHtmlOutputSchema, firecrawlScrapeTweetDataWithNitterParamsSchema, firecrawlScrapeTweetDataWithNitterOutputSchema, resendSendEmailParamsSchema, linkedinCreateShareLinkedinPostUrlParamsSchema, linkedinCreateShareLinkedinPostUrlOutputSchema, xCreateShareXPostUrlParamsSchema, xCreateShareXPostUrlOutputSchema, finnhubSymbolLookupParamsSchema, finnhubSymbolLookupOutputSchema, finnhubGetBasicFinancialsParamsSchema, finnhubGetBasicFinancialsOutputSchema, confluenceFetchPageContentParamsSchema, confluenceFetchPageContentOutputSchema, snowflakeRunSnowflakeQueryParamsSchema, snowflakeRunSnowflakeQueryOutputSchema, lookerEnableUserByEmailParamsSchema, lookerEnableUserByEmailOutputSchema, googleOauthUpdateDocParamsSchema, googleOauthUpdateDocOutputSchema, googleOauthAddTextToTopOfDocParamsSchema, googleOauthAddTextToTopOfDocOutputSchema, googleOauthCreateSpreadsheetParamsSchema, googleOauthCreateSpreadsheetOutputSchema, googleOauthUpdateSpreadsheetParamsSchema, googleOauthUpdateSpreadsheetOutputSchema, googleOauthAppendRowsToSpreadsheetParamsSchema, googleOauthAppendRowsToSpreadsheetOutputSchema, googleOauthDeleteRowFromSpreadsheetParamsSchema, googleOauthDeleteRowFromSpreadsheetOutputSchema, googleOauthScheduleCalendarMeetingParamsSchema, googleOauthScheduleCalendarMeetingOutputSchema, googleOauthListCalendarsParamsSchema, googleOauthListCalendarsOutputSchema, googleOauthListCalendarEventsParamsSchema, googleOauthListCalendarEventsOutputSchema, googleOauthUpdateCalendarEventParamsSchema, googleOauthUpdateCalendarEventOutputSchema, googleOauthDeleteCalendarEventParamsSchema, googleOauthDeleteCalendarEventOutputSchema, googleOauthEditAGoogleCalendarEventParamsSchema, googleOauthEditAGoogleCalendarEventOutputSchema, googleOauthCreatePresentationParamsSchema, googleOauthCreatePresentationOutputSchema, googleOauthUpdatePresentationParamsSchema, googleOauthUpdatePresentationOutputSchema, googleOauthGetPresentationParamsSchema, googleOauthGetPresentationOutputSchema, googleOauthSearchDriveByKeywordsParamsSchema, googleOauthSearchDriveByKeywordsOutputSchema, googleOauthListGroupsOutputSchema, googleOauthListGroupsParamsSchema, googleOauthGetGroupOutputSchema, googleOauthGetGroupParamsSchema, googleOauthListGroupMembersOutputSchema, googleOauthListGroupMembersParamsSchema, googleOauthHasGroupMemberOutputSchema, googleOauthHasGroupMemberParamsSchema, googleOauthAddGroupMemberOutputSchema, googleOauthAddGroupMemberParamsSchema, googleOauthDeleteGroupMemberOutputSchema, googleOauthDeleteGroupMemberParamsSchema, salesforceUpdateRecordParamsSchema, salesforceUpdateRecordOutputSchema, salesforceCreateCaseParamsSchema, salesforceCreateCaseOutputSchema, salesforceGenerateSalesReportParamsSchema, salesforceGenerateSalesReportOutputSchema, salesforceGetRecordParamsSchema, salesforceGetRecordOutputSchema, microsoftMessageTeamsChatParamsSchema, microsoftMessageTeamsChatOutputSchema, microsoftMessageTeamsChannelParamsSchema, microsoftMessageTeamsChannelOutputSchema, salesforceGetSalesforceRecordsByQueryParamsSchema, salesforceGetSalesforceRecordsByQueryOutputSchema, asanaCommentTaskParamsSchema, asanaCommentTaskOutputSchema, asanaCreateTaskParamsSchema, asanaCreateTaskOutputSchema, asanaUpdateTaskParamsSchema, asanaUpdateTaskOutputSchema, githubCreateOrUpdateFileParamsSchema, githubCreateOrUpdateFileOutputSchema, githubCreateBranchParamsSchema, githubCreateBranchOutputSchema, githubCreatePullRequestParamsSchema, githubCreatePullRequestOutputSchema, microsoftUpdateSpreadsheetParamsSchema, microsoftUpdateSpreadsheetOutputSchema, microsoftUpdateDocumentParamsSchema, microsoftUpdateDocumentOutputSchema, microsoftGetDocumentParamsSchema, microsoftGetDocumentOutputSchema, githubListPullRequestsParamsSchema, githubListPullRequestsOutputSchema, jiraGetJiraIssuesByQueryOutputSchema, jiraGetJiraIssuesByQueryParamsSchema, salesforceCreateRecordParamsSchema, salesforceCreateRecordOutputSchema, firecrawlDeepResearchParamsSchema, firecrawlDeepResearchOutputSchema, bingGetTopNSearchResultUrlsParamsSchema, bingGetTopNSearchResultUrlsOutputSchema, microsoftCreateDocumentParamsSchema, microsoftCreateDocumentOutputSchema, asanaListAsanaTasksByProjectParamsSchema, asanaListAsanaTasksByProjectOutputSchema, asanaSearchTasksParamsSchema, asanaSearchTasksOutputSchema, asanaGetTasksDetailsParamsSchema, asanaGetTasksDetailsOutputSchema, notionSearchByTitleParamsSchema, notionSearchByTitleOutputSchema, googlemailSearchGmailMessagesOutputSchema, googlemailSearchGmailMessagesParamsSchema, googlemailListGmailThreadsOutputSchema, googlemailListGmailThreadsParamsSchema, gitlabSearchGroupOutputSchema, gitlabSearchGroupParamsSchema, githubSearchOrganizationOutputSchema, githubSearchOrganizationParamsSchema, salesforceSearchSalesforceRecordsParamsSchema, salesforceSearchSalesforceRecordsOutputSchema, googleOauthGetDriveFileContentByIdOutputSchema, googleOauthGetDriveFileContentByIdParamsSchema, googleOauthSearchDriveByQueryOutputSchema, googleOauthSearchDriveByQueryParamsSchema, googleOauthSearchDriveByQueryAndGetFileContentParamsSchema, googleOauthSearchDriveByQueryAndGetFileContentOutputSchema, googleOauthQueryGoogleBigQueryParamsSchema, googleOauthQueryGoogleBigQueryOutputSchema, githubGetFileContentParamsSchema, githubGetFileContentOutputSchema, githubListDirectoryOutputSchema, githubListDirectoryParamsSchema, githubGetBranchParamsSchema, githubGetBranchOutputSchema, githubListCommitsParamsSchema, githubListCommitsOutputSchema, githubGetPullRequestDetailsParamsSchema, githubGetPullRequestDetailsOutputSchema, linearGetIssuesParamsSchema, linearGetIssuesOutputSchema, linearGetIssueDetailsParamsSchema, linearGetIssueDetailsOutputSchema, linearGetProjectDetailsParamsSchema, linearGetProjectDetailsOutputSchema, linearGetTeamDetailsParamsSchema, linearGetTeamDetailsOutputSchema, linearGetProjectsParamsSchema, linearGetProjectsOutputSchema, linearGetTeamsParamsSchema, linearGetTeamsOutputSchema, linearCreateIssueParamsSchema, linearCreateIssueOutputSchema, hubspotGetContactsParamsSchema, hubspotGetContactsOutputSchema, hubspotGetContactDetailsParamsSchema, hubspotGetContactDetailsOutputSchema, hubspotGetCompaniesParamsSchema, hubspotGetCompaniesOutputSchema, hubspotGetCompanyDetailsParamsSchema, hubspotGetCompanyDetailsOutputSchema, hubspotGetDealsParamsSchema, hubspotGetDealsOutputSchema, hubspotGetDealDetailsParamsSchema, hubspotGetDealDetailsOutputSchema, hubspotGetTicketsParamsSchema, hubspotGetTicketsOutputSchema, hubspotGetTicketDetailsParamsSchema, hubspotGetTicketDetailsOutputSchema, gitlabGetFileContentParamsSchema, gitlabGetFileContentOutputSchema, gitlabGetMergeRequestParamsSchema, gitlabGetMergeRequestOutputSchema, jiraPublicCommentOnServiceDeskRequestParamsSchema, jiraPublicCommentOnServiceDeskRequestOutputSchema, googlemailSendGmailParamsSchema, googlemailSendGmailOutputSchema, googlemailReplyToGmailParamsSchema, googlemailReplyToGmailOutputSchema, gitlabListDirectoryParamsSchema, gitlabListDirectoryOutputSchema, firecrawlSearchAndScrapeOutputSchema, firecrawlSearchAndScrapeParamsSchema, firecrawlGetTopNSearchResultUrlsParamsSchema, firecrawlGetTopNSearchResultUrlsOutputSchema, googleOauthSearchDriveByKeywordsAndGetFileContentParamsSchema, googleOauthSearchDriveByKeywordsAndGetFileContentOutputSchema, perplexityPerplexityDeepResearchParamsSchema, perplexityPerplexityDeepResearchOutputSchema, slackUserSearchSlackParamsSchema, slackUserSearchSlackOutputSchema, slackUserSearchSlackRTSParamsSchema, slackUserSearchSlackRTSOutputSchema, oktaOrgGetOktaUserByNameParamsSchema, oktaOrgGetOktaUserByNameOutputSchema, googleSearchCustomSearchParamsSchema, googleSearchCustomSearchOutputSchema, salesforceSearchAllSalesforceRecordsParamsSchema, salesforceSearchAllSalesforceRecordsOutputSchema, salesforceListReportsParamsSchema, salesforceListReportsOutputSchema, salesforceExecuteReportParamsSchema, salesforceExecuteReportOutputSchema, slackSendDmFromBotParamsSchema, slackSendDmFromBotOutputSchema, slackGetChannelMembersParamsSchema, slackGetChannelMembersOutputSchema, salesforceGetReportMetadataParamsSchema, salesforceGetReportMetadataOutputSchema, googleOauthUpdateRowsInSpreadsheetParamsSchema, googleOauthUpdateRowsInSpreadsheetOutputSchema, } from "./autogen/types.js";
1
+ import { genericFillTemplateParamsSchema, genericFillTemplateOutputSchema, confluenceOverwritePageParamsSchema, confluenceOverwritePageOutputSchema, googlemapsValidateAddressOutputSchema, googlemapsValidateAddressParamsSchema, googleOauthCreateNewGoogleDocParamsSchema, googleOauthCreateNewGoogleDocOutputSchema, mathAddOutputSchema, mathAddParamsSchema, mongoInsertMongoDocOutputSchema, mongoInsertMongoDocParamsSchema, slackSendMessageOutputSchema, slackSendMessageParamsSchema, slackGetChannelMessagesOutputSchema, slackGetChannelMessagesParamsSchema, slackCreateChannelParamsSchema, slackCreateChannelOutputSchema, snowflakeGetRowByFieldValueOutputSchema, snowflakeGetRowByFieldValueParamsSchema, zendeskCreateZendeskTicketOutputSchema, zendeskCreateZendeskTicketParamsSchema, zendeskGetTicketDetailsOutputSchema, zendeskGetTicketDetailsParamsSchema, zendeskUpdateTicketStatusOutputSchema, zendeskUpdateTicketStatusParamsSchema, zendeskAddCommentToTicketOutputSchema, zendeskAddCommentToTicketParamsSchema, zendeskAssignTicketOutputSchema, zendeskAssignTicketParamsSchema, zendeskListZendeskTicketsOutputSchema, zendeskListZendeskTicketsParamsSchema, zendeskSearchZendeskByQueryOutputSchema, zendeskSearchZendeskByQueryParamsSchema, jiraAssignJiraTicketParamsSchema, jiraAssignJiraTicketOutputSchema, jiraCommentJiraTicketParamsSchema, jiraCommentJiraTicketOutputSchema, jiraCommentJiraTicketWithMentionsParamsSchema, jiraCommentJiraTicketWithMentionsOutputSchema, jiraCreateJiraTicketParamsSchema, jiraCreateJiraTicketOutputSchema, jiraGetJiraTicketDetailsParamsSchema, jiraGetJiraTicketDetailsOutputSchema, jiraGetJiraTicketHistoryParamsSchema, jiraGetJiraTicketHistoryOutputSchema, jiraMoveJiraTicketToProjectParamsSchema, jiraMoveJiraTicketToProjectOutputSchema, jiraUpdateJiraTicketDetailsParamsSchema, jiraUpdateJiraTicketDetailsOutputSchema, jiraUpdateJiraTicketStatusParamsSchema, jiraUpdateJiraTicketStatusOutputSchema, jiraCreateServiceDeskRequestParamsSchema, jiraCreateServiceDeskRequestOutputSchema, jiraLinkJiraIssuesParamsSchema, jiraLinkJiraIssuesOutputSchema, jiraLinkAndAssignJiraIssuesParamsSchema, jiraLinkAndAssignJiraIssuesOutputSchema, openstreetmapGetLatitudeLongitudeFromLocationParamsSchema, openstreetmapGetLatitudeLongitudeFromLocationOutputSchema, nwsGetForecastForLocationParamsSchema, nwsGetForecastForLocationOutputSchema, googlemapsNearbysearchRestaurantsOutputSchema, googlemapsNearbysearchRestaurantsParamsSchema, firecrawlScrapeUrlOutputSchema, firecrawlScrapeUrlParamsSchema, resendSendEmailOutputSchema, resendSendEmailHtmlParamsSchema, resendSendEmailHtmlOutputSchema, firecrawlScrapeTweetDataWithNitterParamsSchema, firecrawlScrapeTweetDataWithNitterOutputSchema, resendSendEmailParamsSchema, linkedinCreateShareLinkedinPostUrlParamsSchema, linkedinCreateShareLinkedinPostUrlOutputSchema, xCreateShareXPostUrlParamsSchema, xCreateShareXPostUrlOutputSchema, finnhubSymbolLookupParamsSchema, finnhubSymbolLookupOutputSchema, finnhubGetBasicFinancialsParamsSchema, finnhubGetBasicFinancialsOutputSchema, confluenceFetchPageContentParamsSchema, confluenceFetchPageContentOutputSchema, snowflakeRunSnowflakeQueryParamsSchema, snowflakeRunSnowflakeQueryOutputSchema, lookerEnableUserByEmailParamsSchema, lookerEnableUserByEmailOutputSchema, googleOauthUpdateDocParamsSchema, googleOauthUpdateDocOutputSchema, googleOauthAddTextToTopOfDocParamsSchema, googleOauthAddTextToTopOfDocOutputSchema, googleOauthCreateSpreadsheetParamsSchema, googleOauthCreateSpreadsheetOutputSchema, googleOauthUpdateSpreadsheetParamsSchema, googleOauthUpdateSpreadsheetOutputSchema, googleOauthAppendRowsToSpreadsheetParamsSchema, googleOauthAppendRowsToSpreadsheetOutputSchema, googleOauthDeleteRowFromSpreadsheetParamsSchema, googleOauthDeleteRowFromSpreadsheetOutputSchema, googleOauthScheduleCalendarMeetingParamsSchema, googleOauthScheduleCalendarMeetingOutputSchema, googleOauthListCalendarsParamsSchema, googleOauthListCalendarsOutputSchema, googleOauthListCalendarEventsParamsSchema, googleOauthListCalendarEventsOutputSchema, googleOauthUpdateCalendarEventParamsSchema, googleOauthUpdateCalendarEventOutputSchema, googleOauthDeleteCalendarEventParamsSchema, googleOauthDeleteCalendarEventOutputSchema, googleOauthEditAGoogleCalendarEventParamsSchema, googleOauthEditAGoogleCalendarEventOutputSchema, googleOauthCreatePresentationParamsSchema, googleOauthCreatePresentationOutputSchema, googleOauthUpdatePresentationParamsSchema, googleOauthUpdatePresentationOutputSchema, googleOauthGetPresentationParamsSchema, googleOauthGetPresentationOutputSchema, googleOauthSearchDriveByKeywordsParamsSchema, googleOauthSearchDriveByKeywordsOutputSchema, googleOauthListGroupsOutputSchema, googleOauthListGroupsParamsSchema, googleOauthGetGroupOutputSchema, googleOauthGetGroupParamsSchema, googleOauthListGroupMembersOutputSchema, googleOauthListGroupMembersParamsSchema, googleOauthHasGroupMemberOutputSchema, googleOauthHasGroupMemberParamsSchema, googleOauthAddGroupMemberOutputSchema, googleOauthAddGroupMemberParamsSchema, googleOauthDeleteGroupMemberOutputSchema, googleOauthDeleteGroupMemberParamsSchema, salesforceUpdateRecordParamsSchema, salesforceUpdateRecordOutputSchema, salesforceCreateCaseParamsSchema, salesforceCreateCaseOutputSchema, salesforceGenerateSalesReportParamsSchema, salesforceGenerateSalesReportOutputSchema, salesforceGetRecordParamsSchema, salesforceGetRecordOutputSchema, microsoftMessageTeamsChatParamsSchema, microsoftMessageTeamsChatOutputSchema, microsoftMessageTeamsChannelParamsSchema, microsoftMessageTeamsChannelOutputSchema, salesforceGetSalesforceRecordsByQueryParamsSchema, salesforceGetSalesforceRecordsByQueryOutputSchema, asanaCommentTaskParamsSchema, asanaCommentTaskOutputSchema, asanaCreateTaskParamsSchema, asanaCreateTaskOutputSchema, asanaUpdateTaskParamsSchema, asanaUpdateTaskOutputSchema, githubCreateOrUpdateFileParamsSchema, githubCreateOrUpdateFileOutputSchema, githubCreateBranchParamsSchema, githubCreateBranchOutputSchema, githubCreatePullRequestParamsSchema, githubCreatePullRequestOutputSchema, microsoftUpdateSpreadsheetParamsSchema, microsoftUpdateSpreadsheetOutputSchema, microsoftUpdateDocumentParamsSchema, microsoftUpdateDocumentOutputSchema, microsoftGetDocumentParamsSchema, microsoftGetDocumentOutputSchema, githubListPullRequestsParamsSchema, githubListPullRequestsOutputSchema, jiraGetJiraIssuesByQueryOutputSchema, jiraGetJiraIssuesByQueryParamsSchema, salesforceCreateRecordParamsSchema, salesforceCreateRecordOutputSchema, firecrawlDeepResearchParamsSchema, firecrawlDeepResearchOutputSchema, bingGetTopNSearchResultUrlsParamsSchema, bingGetTopNSearchResultUrlsOutputSchema, microsoftCreateDocumentParamsSchema, microsoftCreateDocumentOutputSchema, asanaListAsanaTasksByProjectParamsSchema, asanaListAsanaTasksByProjectOutputSchema, asanaSearchTasksParamsSchema, asanaSearchTasksOutputSchema, asanaGetTasksDetailsParamsSchema, asanaGetTasksDetailsOutputSchema, notionSearchByTitleParamsSchema, notionSearchByTitleOutputSchema, googlemailSearchGmailMessagesOutputSchema, googlemailSearchGmailMessagesParamsSchema, googlemailListGmailThreadsOutputSchema, googlemailListGmailThreadsParamsSchema, gitlabSearchGroupOutputSchema, gitlabSearchGroupParamsSchema, githubSearchOrganizationOutputSchema, githubSearchOrganizationParamsSchema, salesforceSearchSalesforceRecordsParamsSchema, salesforceSearchSalesforceRecordsOutputSchema, googleOauthGetDriveFileContentByIdOutputSchema, googleOauthGetDriveFileContentByIdParamsSchema, googleOauthSearchDriveByQueryOutputSchema, googleOauthSearchDriveByQueryParamsSchema, googleOauthSearchDriveByQueryAndGetFileContentParamsSchema, googleOauthSearchDriveByQueryAndGetFileContentOutputSchema, googleOauthQueryGoogleBigQueryParamsSchema, googleOauthQueryGoogleBigQueryOutputSchema, githubGetFileContentParamsSchema, githubGetFileContentOutputSchema, githubListDirectoryOutputSchema, githubListDirectoryParamsSchema, githubGetBranchParamsSchema, githubGetBranchOutputSchema, githubListCommitsParamsSchema, githubListCommitsOutputSchema, githubGetPullRequestDetailsParamsSchema, githubGetPullRequestDetailsOutputSchema, linearGetIssuesParamsSchema, linearGetIssuesOutputSchema, linearGetIssueDetailsParamsSchema, linearGetIssueDetailsOutputSchema, linearGetProjectDetailsParamsSchema, linearGetProjectDetailsOutputSchema, linearGetTeamDetailsParamsSchema, linearGetTeamDetailsOutputSchema, linearGetProjectsParamsSchema, linearGetProjectsOutputSchema, linearGetTeamsParamsSchema, linearGetTeamsOutputSchema, linearCreateIssueParamsSchema, linearCreateIssueOutputSchema, hubspotGetContactsParamsSchema, hubspotGetContactsOutputSchema, hubspotGetContactDetailsParamsSchema, hubspotGetContactDetailsOutputSchema, hubspotGetCompaniesParamsSchema, hubspotGetCompaniesOutputSchema, hubspotGetCompanyDetailsParamsSchema, hubspotGetCompanyDetailsOutputSchema, hubspotGetDealsParamsSchema, hubspotGetDealsOutputSchema, hubspotGetDealDetailsParamsSchema, hubspotGetDealDetailsOutputSchema, hubspotGetTicketsParamsSchema, hubspotGetTicketsOutputSchema, hubspotGetTicketDetailsParamsSchema, hubspotGetTicketDetailsOutputSchema, gitlabGetFileContentParamsSchema, gitlabGetFileContentOutputSchema, gitlabGetMergeRequestParamsSchema, gitlabGetMergeRequestOutputSchema, jiraPublicCommentOnServiceDeskRequestParamsSchema, jiraPublicCommentOnServiceDeskRequestOutputSchema, googlemailSendGmailParamsSchema, googlemailSendGmailOutputSchema, googlemailReplyToGmailParamsSchema, googlemailReplyToGmailOutputSchema, gitlabListDirectoryParamsSchema, gitlabListDirectoryOutputSchema, firecrawlSearchAndScrapeOutputSchema, firecrawlSearchAndScrapeParamsSchema, firecrawlGetTopNSearchResultUrlsParamsSchema, firecrawlGetTopNSearchResultUrlsOutputSchema, googleOauthSearchDriveByKeywordsAndGetFileContentParamsSchema, googleOauthSearchDriveByKeywordsAndGetFileContentOutputSchema, perplexityPerplexityDeepResearchParamsSchema, perplexityPerplexityDeepResearchOutputSchema, slackUserSearchSlackParamsSchema, slackUserSearchSlackOutputSchema, slackUserSearchSlackRTSParamsSchema, slackUserSearchSlackRTSOutputSchema, oktaOrgGetOktaUserByNameParamsSchema, oktaOrgGetOktaUserByNameOutputSchema, googleSearchCustomSearchParamsSchema, googleSearchCustomSearchOutputSchema, salesforceSearchAllSalesforceRecordsParamsSchema, salesforceSearchAllSalesforceRecordsOutputSchema, salesforceListReportsParamsSchema, salesforceListReportsOutputSchema, salesforceExecuteReportParamsSchema, salesforceExecuteReportOutputSchema, slackSendDmFromBotParamsSchema, slackSendDmFromBotOutputSchema, slackGetChannelMembersParamsSchema, slackGetChannelMembersOutputSchema, salesforceGetReportMetadataParamsSchema, salesforceGetReportMetadataOutputSchema, googleOauthUpdateRowsInSpreadsheetParamsSchema, googleOauthUpdateRowsInSpreadsheetOutputSchema, } from "./autogen/types.js";
2
2
  import validateAddress from "./providers/googlemaps/validateAddress.js";
3
3
  import add from "./providers/math/add.js";
4
4
  import fillTemplate from "./providers/generic/fillTemplate.js";
@@ -16,6 +16,7 @@ import listZendeskTickets from "./providers/zendesk/listTickets.js";
16
16
  import searchZendeskByQuery from "./providers/zendesk/searchZendeskByQuery.js";
17
17
  import assignJiraTicket from "./providers/jira/assignJiraTicket.js";
18
18
  import commentJiraTicket from "./providers/jira/commentJiraTicket.js";
19
+ import commentJiraTicketWithMentions from "./providers/jira/commentJiraTicketWithMentions.js";
19
20
  import createJiraTicket from "./providers/jira/createJiraTicket.js";
20
21
  import getJiraTicketDetails from "./providers/jira/getJiraTicketDetails.js";
21
22
  import getJiraTicketHistory from "./providers/jira/getJiraTicketHistory.js";
@@ -159,6 +160,12 @@ const jiraActions = {
159
160
  outputSchema: jiraCommentJiraTicketOutputSchema,
160
161
  actionType: "write",
161
162
  },
163
+ commentJiraTicketWithMentions: {
164
+ fn: commentJiraTicketWithMentions,
165
+ paramsSchema: jiraCommentJiraTicketWithMentionsParamsSchema,
166
+ outputSchema: jiraCommentJiraTicketWithMentionsOutputSchema,
167
+ actionType: "write",
168
+ },
162
169
  publicCommentOnServiceDeskRequest: {
163
170
  fn: publicCommentOnServiceDeskRequest,
164
171
  paramsSchema: jiraPublicCommentOnServiceDeskRequestParamsSchema,
@@ -20,6 +20,7 @@ export declare const confluenceFetchPageContentDefinition: ActionTemplate;
20
20
  export declare const jiraAssignJiraTicketDefinition: ActionTemplate;
21
21
  export declare const jiraPublicCommentOnServiceDeskRequestDefinition: ActionTemplate;
22
22
  export declare const jiraCommentJiraTicketDefinition: ActionTemplate;
23
+ export declare const jiraCommentJiraTicketWithMentionsDefinition: ActionTemplate;
23
24
  export declare const jiraCreateJiraTicketDefinition: ActionTemplate;
24
25
  export declare const jiraCreateServiceDeskRequestDefinition: ActionTemplate;
25
26
  export declare const jiraGetJiraTicketDetailsDefinition: ActionTemplate;
@@ -33,6 +34,7 @@ export declare const jiraLinkAndAssignJiraIssuesDefinition: ActionTemplate;
33
34
  export declare const jiraOrgAssignJiraTicketDefinition: ActionTemplate;
34
35
  export declare const jiraOrgPublicCommentOnServiceDeskRequestDefinition: ActionTemplate;
35
36
  export declare const jiraOrgCommentJiraTicketDefinition: ActionTemplate;
37
+ export declare const jiraOrgCommentJiraTicketWithMentionsDefinition: ActionTemplate;
36
38
  export declare const jiraOrgCreateJiraTicketDefinition: ActionTemplate;
37
39
  export declare const jiraOrgCreateServiceDeskRequestDefinition: ActionTemplate;
38
40
  export declare const jiraOrgGetJiraTicketDetailsDefinition: ActionTemplate;
@@ -1464,6 +1464,51 @@ export const jiraCommentJiraTicketDefinition = {
1464
1464
  name: "commentJiraTicket",
1465
1465
  provider: "jira",
1466
1466
  };
1467
+ export const jiraCommentJiraTicketWithMentionsDefinition = {
1468
+ displayName: "Comment on a Jira ticket with @mentions",
1469
+ description: "Comments on a Jira ticket, converting [~accountid:ID] patterns into clickable @mentions (Jira Cloud only).",
1470
+ scopes: ["write:comment:jira"],
1471
+ tags: [],
1472
+ parameters: {
1473
+ type: "object",
1474
+ required: ["projectKey", "issueId", "comment"],
1475
+ properties: {
1476
+ projectKey: {
1477
+ type: "string",
1478
+ description: "The key for the project to which the ticket you want to comment on belongs.",
1479
+ tags: ["recommend-predefined"],
1480
+ },
1481
+ issueId: {
1482
+ type: "string",
1483
+ description: "The issue ID associated with the ticket to be commented on.",
1484
+ },
1485
+ comment: {
1486
+ type: "string",
1487
+ description: "The text to be commented on the ticket. Use [~accountid:ATLASSIAN_ACCOUNT_ID] to @mention users (Jira Cloud only).",
1488
+ },
1489
+ },
1490
+ },
1491
+ output: {
1492
+ type: "object",
1493
+ required: ["success"],
1494
+ properties: {
1495
+ success: {
1496
+ type: "boolean",
1497
+ description: "Whether the comment was sent successfully",
1498
+ },
1499
+ error: {
1500
+ type: "string",
1501
+ description: "The error that occurred if the comment was not sent successfully",
1502
+ },
1503
+ commentUrl: {
1504
+ type: "string",
1505
+ description: "The url to the created Jira comment",
1506
+ },
1507
+ },
1508
+ },
1509
+ name: "commentJiraTicketWithMentions",
1510
+ provider: "jira",
1511
+ };
1467
1512
  export const jiraCreateJiraTicketDefinition = {
1468
1513
  displayName: "Create a Jira ticket",
1469
1514
  description: "Create a jira ticket with new content specified",
@@ -2275,6 +2320,51 @@ export const jiraOrgCommentJiraTicketDefinition = {
2275
2320
  name: "commentJiraTicket",
2276
2321
  provider: "jiraOrg",
2277
2322
  };
2323
+ export const jiraOrgCommentJiraTicketWithMentionsDefinition = {
2324
+ displayName: "Comment on a Jira ticket with @mentions",
2325
+ description: "Comments on a Jira ticket, converting [~accountid:ID] patterns into clickable @mentions (Jira Cloud only).",
2326
+ scopes: ["write:comment:jira"],
2327
+ tags: [],
2328
+ parameters: {
2329
+ type: "object",
2330
+ required: ["projectKey", "issueId", "comment"],
2331
+ properties: {
2332
+ projectKey: {
2333
+ type: "string",
2334
+ description: "The key for the project to which the ticket you want to comment on belongs.",
2335
+ tags: ["recommend-predefined"],
2336
+ },
2337
+ issueId: {
2338
+ type: "string",
2339
+ description: "The issue ID associated with the ticket to be commented on.",
2340
+ },
2341
+ comment: {
2342
+ type: "string",
2343
+ description: "The text to be commented on the ticket. Use [~accountid:ATLASSIAN_ACCOUNT_ID] to @mention users (Jira Cloud only).",
2344
+ },
2345
+ },
2346
+ },
2347
+ output: {
2348
+ type: "object",
2349
+ required: ["success"],
2350
+ properties: {
2351
+ success: {
2352
+ type: "boolean",
2353
+ description: "Whether the comment was sent successfully",
2354
+ },
2355
+ error: {
2356
+ type: "string",
2357
+ description: "The error that occurred if the comment was not sent successfully",
2358
+ },
2359
+ commentUrl: {
2360
+ type: "string",
2361
+ description: "The url to the created Jira comment",
2362
+ },
2363
+ },
2364
+ },
2365
+ name: "commentJiraTicketWithMentions",
2366
+ provider: "jiraOrg",
2367
+ };
2278
2368
  export const jiraOrgCreateJiraTicketDefinition = {
2279
2369
  displayName: "Create a Jira ticket",
2280
2370
  description: "Create a jira ticket with new content specified",
@@ -5036,7 +5126,12 @@ export const googleOauthCreateNewGoogleDocDefinition = {
5036
5126
  },
5037
5127
  usesHtml: {
5038
5128
  type: "boolean",
5039
- description: "Whether to interpret the content as HTML",
5129
+ description: "Whether to interpret the content as HTML. Deprecated in favor of contentFormat.",
5130
+ },
5131
+ contentFormat: {
5132
+ type: "string",
5133
+ enum: ["plain", "markdown", "html"],
5134
+ description: "How to interpret the content param. Defaults to plain. When set, takes precedence over usesHtml.",
5040
5135
  },
5041
5136
  },
5042
5137
  },
@@ -5075,6 +5170,11 @@ export const googleOauthAddTextToTopOfDocDefinition = {
5075
5170
  type: "string",
5076
5171
  description: "The text to insert at the beginning of the document",
5077
5172
  },
5173
+ contentFormat: {
5174
+ type: "string",
5175
+ enum: ["plain", "markdown", "html"],
5176
+ description: "How to interpret the text param. Defaults to plain.",
5177
+ },
5078
5178
  },
5079
5179
  },
5080
5180
  output: {
@@ -58,6 +58,7 @@ export declare enum ActionName {
58
58
  ASSIGNJIRATICKET = "assignJiraTicket",
59
59
  PUBLICCOMMENTONSERVICEDESKREQUEST = "publicCommentOnServiceDeskRequest",
60
60
  COMMENTJIRATICKET = "commentJiraTicket",
61
+ COMMENTJIRATICKETWITHMENTIONS = "commentJiraTicketWithMentions",
61
62
  CREATEJIRATICKET = "createJiraTicket",
62
63
  CREATESERVICEDESKREQUEST = "createServiceDeskRequest",
63
64
  GETJIRATICKETDETAILS = "getJiraTicketDetails",
@@ -1640,6 +1641,35 @@ export declare const jiraCommentJiraTicketOutputSchema: z.ZodObject<{
1640
1641
  }>;
1641
1642
  export type jiraCommentJiraTicketOutputType = z.infer<typeof jiraCommentJiraTicketOutputSchema>;
1642
1643
  export type jiraCommentJiraTicketFunction = ActionFunction<jiraCommentJiraTicketParamsType, AuthParamsType, jiraCommentJiraTicketOutputType>;
1644
+ export declare const jiraCommentJiraTicketWithMentionsParamsSchema: z.ZodObject<{
1645
+ projectKey: z.ZodString;
1646
+ issueId: z.ZodString;
1647
+ comment: z.ZodString;
1648
+ }, "strip", z.ZodTypeAny, {
1649
+ projectKey: string;
1650
+ issueId: string;
1651
+ comment: string;
1652
+ }, {
1653
+ projectKey: string;
1654
+ issueId: string;
1655
+ comment: string;
1656
+ }>;
1657
+ export type jiraCommentJiraTicketWithMentionsParamsType = z.infer<typeof jiraCommentJiraTicketWithMentionsParamsSchema>;
1658
+ export declare const jiraCommentJiraTicketWithMentionsOutputSchema: z.ZodObject<{
1659
+ success: z.ZodBoolean;
1660
+ error: z.ZodOptional<z.ZodString>;
1661
+ commentUrl: z.ZodOptional<z.ZodString>;
1662
+ }, "strip", z.ZodTypeAny, {
1663
+ success: boolean;
1664
+ error?: string | undefined;
1665
+ commentUrl?: string | undefined;
1666
+ }, {
1667
+ success: boolean;
1668
+ error?: string | undefined;
1669
+ commentUrl?: string | undefined;
1670
+ }>;
1671
+ export type jiraCommentJiraTicketWithMentionsOutputType = z.infer<typeof jiraCommentJiraTicketWithMentionsOutputSchema>;
1672
+ export type jiraCommentJiraTicketWithMentionsFunction = ActionFunction<jiraCommentJiraTicketWithMentionsParamsType, AuthParamsType, jiraCommentJiraTicketWithMentionsOutputType>;
1643
1673
  export declare const jiraCreateJiraTicketParamsSchema: z.ZodObject<{
1644
1674
  projectKey: z.ZodString;
1645
1675
  summary: z.ZodString;
@@ -4900,14 +4930,17 @@ export declare const googleOauthCreateNewGoogleDocParamsSchema: z.ZodObject<{
4900
4930
  title: z.ZodString;
4901
4931
  content: z.ZodOptional<z.ZodString>;
4902
4932
  usesHtml: z.ZodOptional<z.ZodBoolean>;
4933
+ contentFormat: z.ZodOptional<z.ZodEnum<["plain", "markdown", "html"]>>;
4903
4934
  }, "strip", z.ZodTypeAny, {
4904
4935
  title: string;
4905
4936
  content?: string | undefined;
4906
4937
  usesHtml?: boolean | undefined;
4938
+ contentFormat?: "html" | "markdown" | "plain" | undefined;
4907
4939
  }, {
4908
4940
  title: string;
4909
4941
  content?: string | undefined;
4910
4942
  usesHtml?: boolean | undefined;
4943
+ contentFormat?: "html" | "markdown" | "plain" | undefined;
4911
4944
  }>;
4912
4945
  export type googleOauthCreateNewGoogleDocParamsType = z.infer<typeof googleOauthCreateNewGoogleDocParamsSchema>;
4913
4946
  export declare const googleOauthCreateNewGoogleDocOutputSchema: z.ZodObject<{
@@ -4925,12 +4958,15 @@ export type googleOauthCreateNewGoogleDocFunction = ActionFunction<googleOauthCr
4925
4958
  export declare const googleOauthAddTextToTopOfDocParamsSchema: z.ZodObject<{
4926
4959
  documentId: z.ZodString;
4927
4960
  text: z.ZodString;
4961
+ contentFormat: z.ZodOptional<z.ZodEnum<["plain", "markdown", "html"]>>;
4928
4962
  }, "strip", z.ZodTypeAny, {
4929
4963
  text: string;
4930
4964
  documentId: string;
4965
+ contentFormat?: "html" | "markdown" | "plain" | undefined;
4931
4966
  }, {
4932
4967
  text: string;
4933
4968
  documentId: string;
4969
+ contentFormat?: "html" | "markdown" | "plain" | undefined;
4934
4970
  }>;
4935
4971
  export type googleOauthAddTextToTopOfDocParamsType = z.infer<typeof googleOauthAddTextToTopOfDocParamsSchema>;
4936
4972
  export declare const googleOauthAddTextToTopOfDocOutputSchema: z.ZodObject<{
@@ -60,6 +60,7 @@ export var ActionName;
60
60
  ActionName["ASSIGNJIRATICKET"] = "assignJiraTicket";
61
61
  ActionName["PUBLICCOMMENTONSERVICEDESKREQUEST"] = "publicCommentOnServiceDeskRequest";
62
62
  ActionName["COMMENTJIRATICKET"] = "commentJiraTicket";
63
+ ActionName["COMMENTJIRATICKETWITHMENTIONS"] = "commentJiraTicketWithMentions";
63
64
  ActionName["CREATEJIRATICKET"] = "createJiraTicket";
64
65
  ActionName["CREATESERVICEDESKREQUEST"] = "createServiceDeskRequest";
65
66
  ActionName["GETJIRATICKETDETAILS"] = "getJiraTicketDetails";
@@ -654,6 +655,18 @@ export const jiraCommentJiraTicketOutputSchema = z.object({
654
655
  error: z.string().describe("The error that occurred if the comment was not sent successfully").optional(),
655
656
  commentUrl: z.string().describe("The url to the created Jira comment").optional(),
656
657
  });
658
+ export const jiraCommentJiraTicketWithMentionsParamsSchema = z.object({
659
+ projectKey: z.string().describe("The key for the project to which the ticket you want to comment on belongs."),
660
+ issueId: z.string().describe("The issue ID associated with the ticket to be commented on."),
661
+ comment: z
662
+ .string()
663
+ .describe("The text to be commented on the ticket. Use [~accountid:ATLASSIAN_ACCOUNT_ID] to @mention users (Jira Cloud only)."),
664
+ });
665
+ export const jiraCommentJiraTicketWithMentionsOutputSchema = z.object({
666
+ success: z.boolean().describe("Whether the comment was sent successfully"),
667
+ error: z.string().describe("The error that occurred if the comment was not sent successfully").optional(),
668
+ commentUrl: z.string().describe("The url to the created Jira comment").optional(),
669
+ });
657
670
  export const jiraCreateJiraTicketParamsSchema = z.object({
658
671
  projectKey: z.string().describe("The key for the project you want to add the ticket to."),
659
672
  summary: z.string().describe("The summary of the new ticket"),
@@ -1694,7 +1707,14 @@ export const resendSendEmailHtmlOutputSchema = z.object({
1694
1707
  export const googleOauthCreateNewGoogleDocParamsSchema = z.object({
1695
1708
  title: z.string().describe("The title of the new Google Doc"),
1696
1709
  content: z.string().describe("The content to add to the new Google Doc").optional(),
1697
- usesHtml: z.boolean().describe("Whether to interpret the content as HTML").optional(),
1710
+ usesHtml: z
1711
+ .boolean()
1712
+ .describe("Whether to interpret the content as HTML. Deprecated in favor of contentFormat.")
1713
+ .optional(),
1714
+ contentFormat: z
1715
+ .enum(["plain", "markdown", "html"])
1716
+ .describe("How to interpret the content param. Defaults to plain. When set, takes precedence over usesHtml.")
1717
+ .optional(),
1698
1718
  });
1699
1719
  export const googleOauthCreateNewGoogleDocOutputSchema = z.object({
1700
1720
  documentId: z.string().describe("The ID of the created Google Doc"),
@@ -1703,6 +1723,10 @@ export const googleOauthCreateNewGoogleDocOutputSchema = z.object({
1703
1723
  export const googleOauthAddTextToTopOfDocParamsSchema = z.object({
1704
1724
  documentId: z.string().describe("The ID of the Google Doc to update"),
1705
1725
  text: z.string().describe("The text to insert at the beginning of the document"),
1726
+ contentFormat: z
1727
+ .enum(["plain", "markdown", "html"])
1728
+ .describe("How to interpret the text param. Defaults to plain.")
1729
+ .optional(),
1706
1730
  });
1707
1731
  export const googleOauthAddTextToTopOfDocOutputSchema = z.object({
1708
1732
  success: z.boolean().describe("Whether the document was updated successfully"),
@@ -5042,9 +5066,6 @@ export const linearCreateIssueParamsSchema = z.object({
5042
5066
  assigneeId: z.string().describe("The ID of the user to assign the issue to").optional(),
5043
5067
  priority: z
5044
5068
  .number()
5045
- .int()
5046
- .min(0)
5047
- .max(4)
5048
5069
  .describe("The priority of the issue: 0 = No priority, 1 = Urgent, 2 = High, 3 = Medium, 4 = Low")
5049
5070
  .optional(),
5050
5071
  projectId: z.string().describe("The ID of the project to associate the issue with").optional(),
@@ -1,5 +1,6 @@
1
1
  import { axiosClient } from "../../util/axiosClient.js";
2
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
3
+ import { resolveContentFormat, contentToDocRequests } from "./utils/googleDocsMarkdown.js";
3
4
  const addTextToTopOfDoc = async ({ params, authParams, }) => {
4
5
  if (!authParams.authToken) {
5
6
  return {
@@ -8,21 +9,12 @@ const addTextToTopOfDoc = async ({ params, authParams, }) => {
8
9
  error: MISSING_AUTH_TOKEN,
9
10
  };
10
11
  }
11
- const { documentId, text } = params;
12
+ const { documentId, text, contentFormat } = params;
12
13
  const baseApiUrl = "https://docs.googleapis.com/v1/documents";
14
+ const resolvedFormat = resolveContentFormat({ contentFormat });
13
15
  try {
14
- await axiosClient.post(`${baseApiUrl}/${documentId}:batchUpdate`, {
15
- requests: [
16
- {
17
- insertText: {
18
- location: {
19
- index: 1,
20
- },
21
- text: text + "\n",
22
- },
23
- },
24
- ],
25
- }, {
16
+ const requests = contentToDocRequests({ content: text + "\n", format: resolvedFormat });
17
+ await axiosClient.post(`${baseApiUrl}/${documentId}:batchUpdate`, { requests }, {
26
18
  headers: {
27
19
  Authorization: `Bearer ${authParams.authToken}`,
28
20
  },
@@ -1,97 +1,6 @@
1
1
  import { axiosClient } from "../../util/axiosClient.js";
2
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
3
- /**
4
- * Parses HTML content and converts it to Google Docs API batch update requests
5
- */
6
- function parseHtmlToDocRequests(htmlContent) {
7
- const requests = [];
8
- let currentIndex = 1;
9
- // Strip HTML tags and extract text with basic formatting
10
- const textWithFormatting = parseHtmlContent(htmlContent);
11
- for (const item of textWithFormatting) {
12
- // Insert text
13
- requests.push({
14
- insertText: {
15
- location: { index: currentIndex },
16
- text: item.text,
17
- },
18
- });
19
- // Apply formatting if present
20
- if (item.formatting && Object.keys(item.formatting).length > 0) {
21
- const endIndex = currentIndex + item.text.length;
22
- requests.push({
23
- updateTextStyle: {
24
- range: { startIndex: currentIndex, endIndex },
25
- textStyle: item.formatting,
26
- fields: Object.keys(item.formatting).join(","),
27
- },
28
- });
29
- }
30
- currentIndex += item.text.length;
31
- }
32
- return requests;
33
- }
34
- /**
35
- * Basic HTML parser that extracts text and formatting
36
- */
37
- function parseHtmlContent(html) {
38
- const result = [];
39
- // Handle line breaks
40
- html = html.replace(/<br\s*\/?>/gi, "\n");
41
- html = html.replace(/<\/p>/gi, "\n");
42
- html = html.replace(/<p[^>]*>/gi, "");
43
- // Simple regex-based parsing for basic HTML tags
44
- const segments = html.split(/(<[^>]+>)/);
45
- const currentFormatting = {};
46
- for (let i = 0; i < segments.length; i++) {
47
- const segment = segments[i];
48
- if (segment.startsWith("<")) {
49
- // This is an HTML tag
50
- if (segment.match(/<\s*b\s*>/i) || segment.match(/<\s*strong\s*>/i)) {
51
- currentFormatting.bold = true;
52
- }
53
- else if (segment.match(/<\/\s*b\s*>/i) || segment.match(/<\/\s*strong\s*>/i)) {
54
- delete currentFormatting.bold;
55
- }
56
- else if (segment.match(/<\s*i\s*>/i) || segment.match(/<\s*em\s*>/i)) {
57
- currentFormatting.italic = true;
58
- }
59
- else if (segment.match(/<\/\s*i\s*>/i) || segment.match(/<\/\s*em\s*>/i)) {
60
- delete currentFormatting.italic;
61
- }
62
- else if (segment.match(/<\s*u\s*>/i)) {
63
- currentFormatting.underline = true;
64
- }
65
- else if (segment.match(/<\/\s*u\s*>/i)) {
66
- delete currentFormatting.underline;
67
- }
68
- else if (segment.match(/<\s*h[1-6]\s*>/i)) {
69
- const headingLevel = segment.match(/<\s*h([1-6])\s*>/i)?.[1];
70
- currentFormatting.fontSize = { magnitude: 18 - (parseInt(headingLevel || "1") - 1) * 2, unit: "PT" };
71
- currentFormatting.bold = true;
72
- }
73
- else if (segment.match(/<\/\s*h[1-6]\s*>/i)) {
74
- delete currentFormatting.fontSize;
75
- delete currentFormatting.bold;
76
- }
77
- }
78
- else if (segment.trim()) {
79
- // This is text content
80
- result.push({
81
- text: segment,
82
- formatting: Object.keys(currentFormatting).length > 0 ? { ...currentFormatting } : undefined,
83
- });
84
- }
85
- }
86
- // If no formatted content was found, return the plain text
87
- if (result.length === 0) {
88
- const plainText = html.replace(/<[^>]*>/g, "");
89
- if (plainText.trim()) {
90
- result.push({ text: plainText });
91
- }
92
- }
93
- return result;
94
- }
3
+ import { resolveContentFormat, contentToDocRequests } from "./utils/googleDocsMarkdown.js";
95
4
  /**
96
5
  * Creates a new Google Doc document using OAuth authentication
97
6
  */
@@ -99,8 +8,9 @@ const createNewGoogleDoc = async ({ params, authParams, }) => {
99
8
  if (!authParams.authToken) {
100
9
  throw new Error(MISSING_AUTH_TOKEN);
101
10
  }
102
- const { title, content, usesHtml } = params;
11
+ const { title, content, usesHtml, contentFormat } = params;
103
12
  const baseApiUrl = "https://docs.googleapis.com/v1/documents";
13
+ const resolvedContentFormat = resolveContentFormat({ contentFormat, usesHtml });
104
14
  // Create the document with the provided title
105
15
  const response = await axiosClient.post(baseApiUrl, { title }, {
106
16
  headers: {
@@ -111,36 +21,13 @@ const createNewGoogleDoc = async ({ params, authParams, }) => {
111
21
  // If content is provided, update the document body with the content
112
22
  if (content) {
113
23
  const documentId = response.data.documentId;
114
- if (usesHtml) {
115
- // Parse HTML content and create requests for rich text formatting
116
- const requests = parseHtmlToDocRequests(content);
117
- await axiosClient.post(`${baseApiUrl}/${documentId}:batchUpdate`, { requests }, {
118
- headers: {
119
- Authorization: `Bearer ${authParams.authToken}`,
120
- "Content-Type": "application/json",
121
- },
122
- });
123
- }
124
- else {
125
- // Add plain text content to the document
126
- await axiosClient.post(`${baseApiUrl}/${documentId}:batchUpdate`, {
127
- requests: [
128
- {
129
- insertText: {
130
- location: {
131
- index: 1, // Insert at the beginning of the document
132
- },
133
- text: content,
134
- },
135
- },
136
- ],
137
- }, {
138
- headers: {
139
- Authorization: `Bearer ${authParams.authToken}`,
140
- "Content-Type": "application/json",
141
- },
142
- });
143
- }
24
+ const requests = contentToDocRequests({ content, format: resolvedContentFormat });
25
+ await axiosClient.post(`${baseApiUrl}/${documentId}:batchUpdate`, { requests }, {
26
+ headers: {
27
+ Authorization: `Bearer ${authParams.authToken}`,
28
+ "Content-Type": "application/json",
29
+ },
30
+ });
144
31
  }
145
32
  return {
146
33
  documentId: response.data.documentId,
@@ -0,0 +1,88 @@
1
+ import type { docs_v1 } from "@googleapis/docs";
2
+ export type GoogleDocContentFormat = "plain" | "html" | "markdown";
3
+ /** Maps heading level (1–6) to Google Docs namedStyleType. */
4
+ declare const HEADING_STYLE_MAP: {
5
+ readonly 1: "HEADING_1";
6
+ readonly 2: "HEADING_2";
7
+ readonly 3: "HEADING_3";
8
+ readonly 4: "HEADING_4";
9
+ readonly 5: "HEADING_5";
10
+ readonly 6: "HEADING_6";
11
+ };
12
+ /** Google Docs bullet presets used by createParagraphBullets. */
13
+ declare const BULLET_PRESET: {
14
+ readonly UNORDERED: "BULLET_DISC_CIRCLE_SQUARE";
15
+ readonly ORDERED: "NUMBERED_DECIMAL_ALPHA_ROMAN";
16
+ };
17
+ type BulletPreset = (typeof BULLET_PRESET)[keyof typeof BULLET_PRESET];
18
+ type HeadingLevel = keyof typeof HEADING_STYLE_MAP;
19
+ /**
20
+ * Intermediate representation bridging HTML parsing and Google Docs API request generation.
21
+ *
22
+ * The Google Docs API doesn't accept HTML or Markdown directly — it requires explicit
23
+ * batch requests (insertText, updateTextStyle, updateParagraphStyle, createParagraphBullets).
24
+ * This IR lets us decouple the two concerns:
25
+ * 1. parseHtmlContent() walks HTML and produces an array of these segments
26
+ * 2. parseHtmlToDocRequests() transforms them into the specific API requests Google expects
27
+ */
28
+ interface TextWithFormatting {
29
+ text: string;
30
+ formatting?: docs_v1.Schema$TextStyle;
31
+ bulletPreset?: BulletPreset;
32
+ headingLevel?: HeadingLevel;
33
+ }
34
+ /** Wraps plain text in a single `insertText` request at document index 1 (start of body). */
35
+ export declare function plainTextToDocRequests(content: string): docs_v1.Schema$Request[];
36
+ /**
37
+ * Parses an HTML string into an array of `TextWithFormatting` segments.
38
+ *
39
+ * Strategy: split on HTML tags, walk segments sequentially, and maintain a mutable
40
+ * formatting state (`currentFormatting`, `listStack`, `currentHeadingLevel`).
41
+ * Opening tags push state (e.g. `<b>` sets `bold: true`), closing tags pop it.
42
+ * Non-tag segments are emitted with a snapshot of the current state.
43
+ *
44
+ * Supported elements: `<b>/<strong>`, `<i>/<em>`, `<u>`, `<code>`, `<a href>`,
45
+ * `<ul>/<ol>/<li>`, `<h1>`–`<h6>`, `<p>`, `<br>`.
46
+ *
47
+ * @example
48
+ * parseHtmlContent("<p><b>hello</b> world</p>")
49
+ * // → [{ text: "hello", formatting: { bold: true } }, { text: " world" }, { text: "\n" }]
50
+ */
51
+ export declare function parseHtmlContent(html: string): TextWithFormatting[];
52
+ /**
53
+ * Converts an HTML string into Google Docs API batch requests.
54
+ *
55
+ * Pipeline: HTML → `parseHtmlContent()` → TextWithFormatting[] → four request buckets:
56
+ * 1. `insertText` – insert each text segment sequentially starting at index 1
57
+ * 2. `updateTextStyle` – apply bold/italic/underline/link/code formatting
58
+ * 3. `updateParagraphStyle` – apply heading levels (HEADING_1–HEADING_6)
59
+ * 4. `createParagraphBullets`– apply bullet/numbered list presets
60
+ *
61
+ * Requests are ordered inserts-first so that character indices remain valid when
62
+ * style/bullet/heading requests reference them (styles are applied after all text is inserted).
63
+ */
64
+ export declare function parseHtmlToDocRequests(htmlContent: string): docs_v1.Schema$Request[];
65
+ /**
66
+ * Converts a Markdown string into Google Docs API batch requests.
67
+ *
68
+ * Two-step pipeline: Markdown → HTML (via `marked`) → Docs requests (via `parseHtmlToDocRequests`).
69
+ * Falls back to plain-text insertion if `marked` throws.
70
+ */
71
+ export declare function markdownToDocRequests(markdown: string): docs_v1.Schema$Request[];
72
+ /**
73
+ * Resolves which content format to use, with backwards-compatible `usesHtml` fallback.
74
+ * Priority: explicit `contentFormat` > legacy `usesHtml: true` → "html" > default "plain".
75
+ */
76
+ export declare function resolveContentFormat(args: {
77
+ contentFormat?: GoogleDocContentFormat;
78
+ usesHtml?: boolean;
79
+ }): GoogleDocContentFormat;
80
+ /**
81
+ * Dispatches content to the appropriate converter based on format.
82
+ * Single entry point so callers don't need to branch on format themselves.
83
+ */
84
+ export declare function contentToDocRequests(args: {
85
+ content: string;
86
+ format: GoogleDocContentFormat;
87
+ }): docs_v1.Schema$Request[];
88
+ export {};
@@ -0,0 +1,350 @@
1
+ import { marked } from "marked";
2
+ /** Maps heading level (1–6) to Google Docs namedStyleType. */
3
+ const HEADING_STYLE_MAP = {
4
+ 1: "HEADING_1",
5
+ 2: "HEADING_2",
6
+ 3: "HEADING_3",
7
+ 4: "HEADING_4",
8
+ 5: "HEADING_5",
9
+ 6: "HEADING_6",
10
+ };
11
+ /** Google Docs bullet presets used by createParagraphBullets. */
12
+ const BULLET_PRESET = {
13
+ UNORDERED: "BULLET_DISC_CIRCLE_SQUARE",
14
+ ORDERED: "NUMBERED_DECIMAL_ALPHA_ROMAN",
15
+ };
16
+ /** Replaces common HTML entities (`&amp;`, `&lt;`, `&nbsp;`, etc.) with their literal characters. */
17
+ function decodeHtmlEntities(text) {
18
+ return text
19
+ .replace(/&nbsp;/g, " ")
20
+ .replace(/&amp;/g, "&")
21
+ .replace(/&lt;/g, "<")
22
+ .replace(/&gt;/g, ">")
23
+ .replace(/&quot;/g, '"')
24
+ .replace(/&#39;/g, "'")
25
+ .replace(/&mdash;/g, "\u2014")
26
+ .replace(/&ndash;/g, "\u2013")
27
+ .replace(/&hellip;/g, "\u2026")
28
+ .replace(/&copy;/g, "\u00A9")
29
+ .replace(/&trade;/g, "\u2122")
30
+ .replace(/&#(\d+);/g, (_, code) => String.fromCharCode(Number(code)));
31
+ }
32
+ /** Maps a heading level (1–6) to the corresponding Google Docs `namedStyleType` (e.g. 3 → "HEADING_3"). */
33
+ function getNamedStyleType(level) {
34
+ return HEADING_STYLE_MAP[level] ?? "HEADING_1";
35
+ }
36
+ /**
37
+ * Builds the `fields` mask required by `updateTextStyle` from the keys present in a TextStyle.
38
+ * E.g. `{ bold: true, link: { url: "..." } }` → `"bold,link"`.
39
+ */
40
+ function fieldMaskFromTextStyle(style) {
41
+ return Object.keys(style).join(",");
42
+ }
43
+ const ALLOWED_URL_SCHEMES = /^https?:\/\//i;
44
+ /** Returns true if the URL uses a safe scheme (http/https). Rejects javascript:, data:, etc. */
45
+ function isSafeUrl(url) {
46
+ return ALLOWED_URL_SCHEMES.test(url.trim());
47
+ }
48
+ /** Removes all HTML tags and decodes entities. Used as a last-resort fallback when parsing yields no segments. */
49
+ function stripHtmlTags(content) {
50
+ return decodeHtmlEntities(content.replace(/<[^>]*>/g, ""));
51
+ }
52
+ /** Wraps plain text in a single `insertText` request at document index 1 (start of body). */
53
+ export function plainTextToDocRequests(content) {
54
+ return [
55
+ {
56
+ insertText: {
57
+ location: { index: 1 },
58
+ text: content,
59
+ },
60
+ },
61
+ ];
62
+ }
63
+ /**
64
+ * Parses an HTML string into an array of `TextWithFormatting` segments.
65
+ *
66
+ * Strategy: split on HTML tags, walk segments sequentially, and maintain a mutable
67
+ * formatting state (`currentFormatting`, `listStack`, `currentHeadingLevel`).
68
+ * Opening tags push state (e.g. `<b>` sets `bold: true`), closing tags pop it.
69
+ * Non-tag segments are emitted with a snapshot of the current state.
70
+ *
71
+ * Supported elements: `<b>/<strong>`, `<i>/<em>`, `<u>`, `<code>`, `<a href>`,
72
+ * `<ul>/<ol>/<li>`, `<h1>`–`<h6>`, `<p>`, `<br>`.
73
+ *
74
+ * @example
75
+ * parseHtmlContent("<p><b>hello</b> world</p>")
76
+ * // → [{ text: "hello", formatting: { bold: true } }, { text: " world" }, { text: "\n" }]
77
+ */
78
+ export function parseHtmlContent(html) {
79
+ // Normalize <br> to newlines, then split into alternating [text, tag, text, tag, ...] segments.
80
+ // The capturing group in the regex keeps the tags in the result array.
81
+ const segments = html
82
+ .replace(/<br\s*\/?>/gi, "\n")
83
+ .split(/(<[^>]+>)/)
84
+ .filter(segment => segment.length > 0);
85
+ const result = [];
86
+ // Mutable state that tracks currently active formatting as we walk through segments.
87
+ // Opening tags add properties, closing tags delete them.
88
+ const currentFormatting = {};
89
+ // Stack to support nested lists — top of stack is the active bullet preset
90
+ const listStack = [];
91
+ let currentHeadingLevel;
92
+ let insidePre = false;
93
+ for (const segment of segments) {
94
+ // --- Text node: emit with a snapshot of the current formatting state ---
95
+ if (!segment.startsWith("<")) {
96
+ const decodedText = decodeHtmlEntities(segment);
97
+ if (!decodedText) {
98
+ continue;
99
+ }
100
+ // Skip newline-only text nodes — these are HTML formatting artifacts
101
+ // We preserve spaces (e.g. " " between inline elements like </b> and <a>).
102
+ if (/^\n+$/.test(decodedText)) {
103
+ continue;
104
+ }
105
+ result.push({
106
+ text: decodedText,
107
+ formatting: Object.keys(currentFormatting).length > 0 ? { ...currentFormatting } : undefined,
108
+ bulletPreset: listStack[listStack.length - 1],
109
+ headingLevel: currentHeadingLevel,
110
+ });
111
+ continue;
112
+ }
113
+ // --- Character-level formatting: toggle on open, remove on close ---
114
+ if (segment.match(/<\s*b\s*>/i) || segment.match(/<\s*strong\s*>/i)) {
115
+ currentFormatting.bold = true;
116
+ continue;
117
+ }
118
+ if (segment.match(/<\/\s*b\s*>/i) || segment.match(/<\/\s*strong\s*>/i)) {
119
+ delete currentFormatting.bold;
120
+ continue;
121
+ }
122
+ if (segment.match(/<\s*i\s*>/i) || segment.match(/<\s*em\s*>/i)) {
123
+ currentFormatting.italic = true;
124
+ continue;
125
+ }
126
+ if (segment.match(/<\/\s*i\s*>/i) || segment.match(/<\/\s*em\s*>/i)) {
127
+ delete currentFormatting.italic;
128
+ continue;
129
+ }
130
+ if (segment.match(/<\s*u\s*>/i)) {
131
+ currentFormatting.underline = true;
132
+ continue;
133
+ }
134
+ if (segment.match(/<\/\s*u\s*>/i)) {
135
+ delete currentFormatting.underline;
136
+ continue;
137
+ }
138
+ // Code: rendered as Courier New
139
+ if (segment.match(/<\s*code[^>]*>/i)) {
140
+ currentFormatting.weightedFontFamily = { fontFamily: "Courier New" };
141
+ continue;
142
+ }
143
+ if (segment.match(/<\/\s*code\s*>/i)) {
144
+ // Only clear monospace if we're not inside a <pre> block —
145
+ // <pre><code>...</code>text</pre> should keep text monospaced
146
+ if (!insidePre) {
147
+ delete currentFormatting.weightedFontFamily;
148
+ }
149
+ continue;
150
+ }
151
+ // Pre-formatted blocks: same monospace treatment as <code>, with trailing newline on close
152
+ if (segment.match(/<\s*pre[^>]*>/i)) {
153
+ insidePre = true;
154
+ currentFormatting.weightedFontFamily = { fontFamily: "Courier New" };
155
+ continue;
156
+ }
157
+ if (segment.match(/<\/\s*pre\s*>/i)) {
158
+ insidePre = false;
159
+ delete currentFormatting.weightedFontFamily;
160
+ result.push({ text: "\n" });
161
+ continue;
162
+ }
163
+ // --- Lists: stack-based to handle nesting (e.g. <ul> inside <ol>) ---
164
+ if (segment.match(/<\s*ul[^>]*>/i)) {
165
+ listStack.push(BULLET_PRESET.UNORDERED);
166
+ continue;
167
+ }
168
+ if (segment.match(/<\s*ol[^>]*>/i)) {
169
+ listStack.push(BULLET_PRESET.ORDERED);
170
+ continue;
171
+ }
172
+ if (segment.match(/<\/\s*(ul|ol)\s*>/i)) {
173
+ listStack.pop();
174
+ result.push({ text: "\n" });
175
+ continue;
176
+ }
177
+ // <li> open is a no-op; </li> emits a newline tagged with the current bullet preset
178
+ // so parseHtmlToDocRequests knows which lines to apply createParagraphBullets to
179
+ if (segment.match(/<\s*li[^>]*>/i)) {
180
+ continue;
181
+ }
182
+ if (segment.match(/<\/\s*li\s*>/i)) {
183
+ result.push({
184
+ text: "\n",
185
+ bulletPreset: listStack[listStack.length - 1],
186
+ });
187
+ continue;
188
+ }
189
+ // --- Block-level elements: emit newlines for paragraph breaks ---
190
+ if (segment.match(/<\s*p[^>]*>/i)) {
191
+ continue;
192
+ }
193
+ if (segment.match(/<\/\s*p\s*>/i)) {
194
+ result.push({ text: "\n" });
195
+ continue;
196
+ }
197
+ // --- Headings: set level on open, clear on close + emit newline ---
198
+ const headingStart = segment.match(/<\s*h([1-6])[^>]*>/i);
199
+ if (headingStart) {
200
+ currentHeadingLevel = Number.parseInt(headingStart[1], 10);
201
+ continue;
202
+ }
203
+ if (segment.match(/<\/\s*h[1-6]\s*>/i)) {
204
+ currentHeadingLevel = undefined;
205
+ result.push({ text: "\n" });
206
+ continue;
207
+ }
208
+ // --- Links: extract href on open, clear on close ---
209
+ // Two regexes so a double-quoted href can contain ' and vice versa
210
+ const linkStart = segment.match(/<\s*a[^>]*href="([^"]*)"[^>]*>/i) ?? segment.match(/<\s*a[^>]*href='([^']*)'[^>]*>/i);
211
+ if (linkStart) {
212
+ const url = decodeHtmlEntities(linkStart[1]);
213
+ if (isSafeUrl(url)) {
214
+ // allow safe links only (javascript:, data:, etc. are rejected)
215
+ currentFormatting.link = { url };
216
+ }
217
+ continue;
218
+ }
219
+ if (segment.match(/<\/\s*a\s*>/i)) {
220
+ delete currentFormatting.link;
221
+ continue;
222
+ }
223
+ }
224
+ if (result.length === 0) {
225
+ const text = stripHtmlTags(html);
226
+ if (text) {
227
+ result.push({ text });
228
+ }
229
+ }
230
+ return result;
231
+ }
232
+ /**
233
+ * Converts an HTML string into Google Docs API batch requests.
234
+ *
235
+ * Pipeline: HTML → `parseHtmlContent()` → TextWithFormatting[] → four request buckets:
236
+ * 1. `insertText` – insert each text segment sequentially starting at index 1
237
+ * 2. `updateTextStyle` – apply bold/italic/underline/link/code formatting
238
+ * 3. `updateParagraphStyle` – apply heading levels (HEADING_1–HEADING_6)
239
+ * 4. `createParagraphBullets`– apply bullet/numbered list presets
240
+ *
241
+ * Requests are ordered inserts-first so that character indices remain valid when
242
+ * style/bullet/heading requests reference them (styles are applied after all text is inserted).
243
+ */
244
+ export function parseHtmlToDocRequests(htmlContent) {
245
+ const textWithFormatting = parseHtmlContent(htmlContent);
246
+ // Requests are collected into separate buckets because the Google Docs API
247
+ // processes them sequentially — all text must be inserted before styles can
248
+ // reference the resulting character indices.
249
+ const insertRequests = [];
250
+ const styleRequests = [];
251
+ const bulletRequests = [];
252
+ const paragraphStyleRequests = [];
253
+ // Google Docs body starts at index 1 (index 0 is the document root)
254
+ let currentIndex = 1;
255
+ for (const item of textWithFormatting) {
256
+ if (!item.text) {
257
+ continue;
258
+ }
259
+ // Track the character range this segment will occupy once inserted
260
+ const startIndex = currentIndex;
261
+ const endIndex = currentIndex + item.text.length;
262
+ // Always insert the raw text first
263
+ insertRequests.push({
264
+ insertText: {
265
+ location: { index: startIndex },
266
+ text: item.text,
267
+ },
268
+ });
269
+ // Apply character-level styles (bold, italic, etc.) to the range we just inserted
270
+ if (item.formatting && Object.keys(item.formatting).length > 0) {
271
+ styleRequests.push({
272
+ updateTextStyle: {
273
+ range: { startIndex, endIndex },
274
+ textStyle: item.formatting,
275
+ fields: fieldMaskFromTextStyle(item.formatting),
276
+ },
277
+ });
278
+ }
279
+ // Apply bullet/numbered list preset — skip whitespace-only segments to avoid
280
+ // creating empty bullet points
281
+ if (item.bulletPreset && item.text.trim().length > 0) {
282
+ bulletRequests.push({
283
+ createParagraphBullets: {
284
+ range: { startIndex, endIndex },
285
+ bulletPreset: item.bulletPreset,
286
+ },
287
+ });
288
+ }
289
+ // Apply heading paragraph style (HEADING_1–HEADING_6)
290
+ if (item.headingLevel) {
291
+ paragraphStyleRequests.push({
292
+ updateParagraphStyle: {
293
+ range: { startIndex, endIndex },
294
+ paragraphStyle: {
295
+ namedStyleType: getNamedStyleType(item.headingLevel),
296
+ },
297
+ fields: "namedStyleType",
298
+ },
299
+ });
300
+ }
301
+ currentIndex = endIndex;
302
+ }
303
+ // Order matters: inserts → styles → paragraph styles → bullets.
304
+ // Inserts must come first so character indices exist when later requests reference them.
305
+ return [...insertRequests, ...styleRequests, ...paragraphStyleRequests, ...bulletRequests];
306
+ }
307
+ /**
308
+ * Converts a Markdown string into Google Docs API batch requests.
309
+ *
310
+ * Two-step pipeline: Markdown → HTML (via `marked`) → Docs requests (via `parseHtmlToDocRequests`).
311
+ * Falls back to plain-text insertion if `marked` throws.
312
+ */
313
+ export function markdownToDocRequests(markdown) {
314
+ let html;
315
+ try {
316
+ html = marked.parse(markdown, { async: false });
317
+ }
318
+ catch {
319
+ // if marked.parse() throws, fallback to plain text insertion
320
+ return plainTextToDocRequests(markdown);
321
+ }
322
+ return parseHtmlToDocRequests(html);
323
+ }
324
+ /**
325
+ * Resolves which content format to use, with backwards-compatible `usesHtml` fallback.
326
+ * Priority: explicit `contentFormat` > legacy `usesHtml: true` → "html" > default "plain".
327
+ */
328
+ export function resolveContentFormat(args) {
329
+ if (args.contentFormat) {
330
+ return args.contentFormat;
331
+ }
332
+ if (args.usesHtml) {
333
+ return "html";
334
+ }
335
+ return "plain";
336
+ }
337
+ /**
338
+ * Dispatches content to the appropriate converter based on format.
339
+ * Single entry point so callers don't need to branch on format themselves.
340
+ */
341
+ export function contentToDocRequests(args) {
342
+ const { content, format } = args;
343
+ if (format === "html") {
344
+ return parseHtmlToDocRequests(content);
345
+ }
346
+ else if (format === "markdown") {
347
+ return markdownToDocRequests(content);
348
+ }
349
+ return plainTextToDocRequests(content);
350
+ }
@@ -0,0 +1,3 @@
1
+ import type { jiraCommentJiraTicketWithMentionsFunction } from "../../autogen/types.js";
2
+ declare const commentJiraTicketWithMentions: jiraCommentJiraTicketWithMentionsFunction;
3
+ export default commentJiraTicketWithMentions;
@@ -0,0 +1,39 @@
1
+ import { axiosClient } from "../../util/axiosClient.js";
2
+ import { getJiraApiConfig, getErrorMessage } from "./utils.js";
3
+ import { extractMentions, insertMentionNodes } from "./convertMentionsInAdf.js";
4
+ import { markdownToAdf } from "marklassian";
5
+ const commentJiraTicketWithMentions = async ({ params, authParams, }) => {
6
+ const { authToken } = authParams;
7
+ const { issueId, comment } = params;
8
+ try {
9
+ const { apiUrl, browseUrl, isDataCenter } = getJiraApiConfig(authParams);
10
+ if (isDataCenter) {
11
+ return {
12
+ success: false,
13
+ error: "commentJiraTicketWithMentions is only supported on Jira Cloud. Use commentJiraTicket for Jira Data Center.",
14
+ };
15
+ }
16
+ const { sanitized, mentions } = extractMentions(comment);
17
+ const adf = markdownToAdf(sanitized);
18
+ const body = insertMentionNodes(adf, mentions);
19
+ const response = await axiosClient.post(`${apiUrl}/issue/${issueId}/comment`, { body }, {
20
+ headers: {
21
+ Authorization: `Bearer ${authToken}`,
22
+ Accept: "application/json",
23
+ "Content-Type": "application/json",
24
+ },
25
+ });
26
+ return {
27
+ success: true,
28
+ commentUrl: `${browseUrl}/browse/${issueId}?focusedCommentId=${response.data.id}`,
29
+ };
30
+ }
31
+ catch (error) {
32
+ console.error("Error commenting on Jira ticket with mentions: ", error);
33
+ return {
34
+ success: false,
35
+ error: getErrorMessage(error),
36
+ };
37
+ }
38
+ };
39
+ export default commentJiraTicketWithMentions;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Extracts [~accountid:XXXXX] patterns from raw text and replaces them with
3
+ * safe placeholders that won't be mangled by markdown parsers.
4
+ *
5
+ * Use with {@link insertMentionNodes} after markdown-to-ADF conversion.
6
+ */
7
+ export declare function extractMentions(text: string): {
8
+ sanitized: string;
9
+ mentions: string[];
10
+ };
11
+ /**
12
+ * Walks an ADF tree and replaces placeholder tokens (produced by
13
+ * {@link extractMentions}) with proper ADF mention nodes.
14
+ */
15
+ export declare function insertMentionNodes(adf: unknown, mentions: string[]): unknown;
16
+ /**
17
+ * Walks an ADF tree and converts raw [~accountid:XXXXX] text patterns into
18
+ * ADF mention nodes. Works reliably for single mentions per paragraph; for
19
+ * multiple mentions use extractMentions + insertMentionNodes instead.
20
+ */
21
+ export declare function convertMentionsInAdf(adf: unknown): unknown;
@@ -0,0 +1,125 @@
1
+ const JIRA_MENTION_SOURCE = "\\[~accountid:([^\\]]+)\\]";
2
+ const JIRA_MENTION_TEST = new RegExp(JIRA_MENTION_SOURCE);
3
+ const PLACEHOLDER_PREFIX = "\uFFFCMENTION_";
4
+ const PLACEHOLDER_SUFFIX = "\uFFFC";
5
+ /**
6
+ * Extracts [~accountid:XXXXX] patterns from raw text and replaces them with
7
+ * safe placeholders that won't be mangled by markdown parsers.
8
+ *
9
+ * Use with {@link insertMentionNodes} after markdown-to-ADF conversion.
10
+ */
11
+ export function extractMentions(text) {
12
+ const mentions = [];
13
+ const sanitized = text.replace(new RegExp(JIRA_MENTION_SOURCE, "g"), (_match, id) => {
14
+ const index = mentions.length;
15
+ mentions.push(id);
16
+ return `${PLACEHOLDER_PREFIX}${index}${PLACEHOLDER_SUFFIX}`;
17
+ });
18
+ return { sanitized, mentions };
19
+ }
20
+ /**
21
+ * Walks an ADF tree and replaces placeholder tokens (produced by
22
+ * {@link extractMentions}) with proper ADF mention nodes.
23
+ */
24
+ export function insertMentionNodes(adf, mentions) {
25
+ if (mentions.length === 0)
26
+ return adf;
27
+ const placeholderRegex = new RegExp(`${escapeRegex(PLACEHOLDER_PREFIX)}(\\d+)${escapeRegex(PLACEHOLDER_SUFFIX)}`);
28
+ return walkAndReplace(adf, placeholderRegex, mentions);
29
+ }
30
+ /**
31
+ * Walks an ADF tree and converts raw [~accountid:XXXXX] text patterns into
32
+ * ADF mention nodes. Works reliably for single mentions per paragraph; for
33
+ * multiple mentions use extractMentions + insertMentionNodes instead.
34
+ */
35
+ export function convertMentionsInAdf(adf) {
36
+ if (!adf || typeof adf !== "object")
37
+ return adf;
38
+ if (Array.isArray(adf))
39
+ return adf.flatMap(item => {
40
+ const result = convertMentionsInAdf(item);
41
+ return Array.isArray(result) ? result : [result];
42
+ });
43
+ const node = adf;
44
+ if (node.type === "text" && typeof node.text === "string" && JIRA_MENTION_TEST.test(node.text)) {
45
+ return splitTextNodeWithMentions(node, new RegExp(JIRA_MENTION_SOURCE, "g"), (_match, groups) => groups[0]);
46
+ }
47
+ if (Array.isArray(node.content)) {
48
+ const newContent = [];
49
+ for (const child of node.content) {
50
+ const result = convertMentionsInAdf(child);
51
+ if (Array.isArray(result)) {
52
+ newContent.push(...result);
53
+ }
54
+ else {
55
+ newContent.push(result);
56
+ }
57
+ }
58
+ return { ...node, content: newContent };
59
+ }
60
+ return node;
61
+ }
62
+ // ---------------------------------------------------------------------------
63
+ // Internal helpers
64
+ // ---------------------------------------------------------------------------
65
+ function walkAndReplace(adf, regex, mentions) {
66
+ if (!adf || typeof adf !== "object")
67
+ return adf;
68
+ if (Array.isArray(adf))
69
+ return adf.flatMap(item => {
70
+ const result = walkAndReplace(item, regex, mentions);
71
+ return Array.isArray(result) ? result : [result];
72
+ });
73
+ const node = adf;
74
+ if (node.type === "text" && typeof node.text === "string" && regex.test(node.text)) {
75
+ return splitTextNodeWithMentions(node, new RegExp(`${escapeRegex(PLACEHOLDER_PREFIX)}(\\d+)${escapeRegex(PLACEHOLDER_SUFFIX)}`, "g"), (_match, groups) => mentions[parseInt(groups[0], 10)]);
76
+ }
77
+ if (Array.isArray(node.content)) {
78
+ const newContent = [];
79
+ for (const child of node.content) {
80
+ const result = walkAndReplace(child, regex, mentions);
81
+ if (Array.isArray(result)) {
82
+ newContent.push(...result);
83
+ }
84
+ else {
85
+ newContent.push(result);
86
+ }
87
+ }
88
+ return { ...node, content: newContent };
89
+ }
90
+ return node;
91
+ }
92
+ function splitTextNodeWithMentions(node, regex, resolveId) {
93
+ const text = node.text;
94
+ const marks = node.marks;
95
+ const results = [];
96
+ let lastIndex = 0;
97
+ let match;
98
+ while ((match = regex.exec(text)) !== null) {
99
+ if (match.index > lastIndex) {
100
+ const textNode = { type: "text", text: text.slice(lastIndex, match.index) };
101
+ if (marks)
102
+ textNode.marks = marks;
103
+ results.push(textNode);
104
+ }
105
+ results.push({
106
+ type: "mention",
107
+ attrs: {
108
+ id: resolveId(match[0], match.slice(1)),
109
+ text: `@${resolveId(match[0], match.slice(1))}`,
110
+ accessLevel: "",
111
+ },
112
+ });
113
+ lastIndex = match.index + match[0].length;
114
+ }
115
+ if (lastIndex < text.length) {
116
+ const textNode = { type: "text", text: text.slice(lastIndex) };
117
+ if (marks)
118
+ textNode.marks = marks;
119
+ results.push(textNode);
120
+ }
121
+ return results;
122
+ }
123
+ function escapeRegex(str) {
124
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
125
+ }
@@ -70,5 +70,5 @@ export declare function getUserInfoFromAccountId(accountId: string | undefined,
70
70
  name: string | undefined;
71
71
  email: string | undefined;
72
72
  } | null>;
73
+ export { convertMentionsInAdf } from "./convertMentionsInAdf.js";
73
74
  export declare function extractPlainText(adf: unknown): string;
74
- export {};
@@ -200,6 +200,7 @@ export async function getUserInfoFromAccountId(accountId, client) {
200
200
  return null;
201
201
  }
202
202
  }
203
+ export { convertMentionsInAdf } from "./convertMentionsInAdf.js";
203
204
  export function extractPlainText(adf) {
204
205
  if (!adf || typeof adf !== "object")
205
206
  return "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.203",
3
+ "version": "0.2.205",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,
@@ -51,6 +51,7 @@
51
51
  "typescript-eslint": "^8.56.0"
52
52
  },
53
53
  "dependencies": {
54
+ "@googleapis/docs": "^9.2.1",
54
55
  "@mendable/firecrawl-js": "^4.3.4",
55
56
  "@microsoft/microsoft-graph-client": "^3.0.7",
56
57
  "@octokit/core": "^6.1.6",
@@ -69,6 +70,7 @@
69
70
  "jsonwebtoken": "^9.0.2",
70
71
  "limiter": "^3.0.0",
71
72
  "mammoth": "^1.11.00",
73
+ "marked": "^16.3.0",
72
74
  "marklassian": "^1.1.0",
73
75
  "mongodb": "^6.13.1",
74
76
  "node-forge": "^1.3.3",