Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integrations/linear/integration.definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import listable from './bp_modules/listable'
import { actions, channels, events, configuration, configurations, user, states, entities } from './definitions'

export const INTEGRATION_NAME = 'linear'
export const INTEGRATION_VERSION = '2.5.1'
export const INTEGRATION_VERSION = '2.5.2'

export default new IntegrationDefinition({
name: INTEGRATION_NAME,
Expand Down
13 changes: 13 additions & 0 deletions integrations/linear/src/misc/linear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,16 @@ export const registerWebhook = async ({
})
logger.forBot().info('Linear webhook registered successfully.')
}

export const revokeToken = async (token: string) => {
const form = new URLSearchParams({ token, token_type_hint: 'access_token' })
try {
await axios.post(`${linearEndpoint}/oauth/revoke`, form.toString(), { headers: oauthHeaders })
} catch (err: unknown) {
if (axios.isAxiosError(err)) {
const message = err.response?.data?.error_description || err.message
throw new RuntimeError(`Failed to revoke token: ${message}`)
}
throw new RuntimeError(`Failed to revoke token: ${String(err)}`)
}
}
7 changes: 2 additions & 5 deletions integrations/linear/src/oauth-wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,17 @@ const _buildAuthorizeUrl = ({
actor,
scopes,
state,
promptConsent,
}: {
clientId: string
actor: 'user' | 'app'
scopes: string
state: string
promptConsent: boolean
}) =>
'https://linear.app/oauth/authorize' +
`?client_id=${clientId}` +
`&redirect_uri=${encodeURIComponent(REDIRECT_URI)}` +
'&response_type=code' +
(promptConsent ? '&prompt=consent' : '') +
'&prompt=consent' +
`&actor=${actor}` +
`&state=${state}` +
`&scope=${scopes}`
Expand All @@ -50,7 +48,7 @@ const _startStep: oauthWizard.WizardStepHandler<bp.HandlerProps> = async ({ ctx,
const clientId = isDesk ? bp.secrets.DESK_CLIENT_ID : bp.secrets.CLIENT_ID

return responses.redirectToExternalUrl(
_buildAuthorizeUrl({ clientId, actor: 'user', scopes: ADMIN_SCOPES, state: ctx.webhookId, promptConsent: true })
_buildAuthorizeUrl({ clientId, actor: 'user', scopes: ADMIN_SCOPES, state: ctx.webhookId })
)
}

Expand Down Expand Up @@ -131,7 +129,6 @@ const _oauthCallbackStep: oauthWizard.WizardStepHandler<bp.HandlerProps> = async
actor: 'app',
scopes: APP_SCOPES,
state: ctx.webhookId,
promptConsent: false,
})
)
}
Expand Down
16 changes: 14 additions & 2 deletions integrations/linear/src/setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RuntimeError } from '@botpress/client'
import { LinearOauthClient, registerWebhook, unregisterWebhook } from './misc/linear'
import { LinearOauthClient, registerWebhook, revokeToken, unregisterWebhook } from './misc/linear'
import * as bp from '.botpress'

const _isWebhookManuallyRegistered = (ctx: bp.HandlerProps['ctx']) =>
Expand Down Expand Up @@ -41,7 +41,19 @@ export const unregister: bp.IntegrationProps['unregister'] = async ({ client, ct
const webhookUrl = `${process.env.BP_WEBHOOK_URL}/${ctx.webhookId}`
logger.forBot().info('Unregistering Linear webhook.')
await unregisterWebhook({ linearClient, logger, url: webhookUrl })
logger.forBot().info('Linear webhook unregistration step completed.')

logger.forBot().info('Revoking Linear access tokens.')
const [{ state: appState }, { state: adminState }] = await Promise.all([
client.getState({ type: 'integration', name: 'credentials', id: ctx.integrationId }),
client.getState({ type: 'integration', name: 'adminCredentials', id: ctx.integrationId }),
])
if (appState.payload.accessToken) {
await revokeToken(appState.payload.accessToken)
}
if (adminState.payload.accessToken) {
await revokeToken(adminState.payload.accessToken)
}
logger.forBot().info('Linear integration unregistration completed.')
} catch (thrown) {
const errorMessage = thrown instanceof Error ? thrown.message : String(thrown)
logger.forBot().warn('Failed to unregister webhook:', errorMessage)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@aws-sdk/client-dynamodb": "^3.564.0",
"@botpress/api": "1.105.0",
"@botpress/api": "1.108.0",
"@botpress/cli": "workspace:*",
"@botpress/client": "workspace:*",
"@botpress/sdk": "workspace:*",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@botpress/cli",
"version": "6.8.0",
"version": "6.8.1",
"description": "Botpress CLI",
"scripts": {
"build": "pnpm run build:types && pnpm run bundle && pnpm run template:gen",
Expand All @@ -27,8 +27,8 @@
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^11.7.0",
"@botpress/chat": "0.5.5",
"@botpress/client": "1.45.0",
"@botpress/sdk": "6.11.0",
"@botpress/client": "1.46.0",
"@botpress/sdk": "6.11.1",
"@bpinternal/const": "^0.1.0",
"@bpinternal/tunnel": "^0.1.1",
"@bpinternal/verel": "^0.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/templates/empty-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
},
"private": true,
"dependencies": {
"@botpress/client": "1.45.0",
"@botpress/sdk": "6.11.0"
"@botpress/client": "1.46.0",
"@botpress/sdk": "6.11.1"
},
"devDependencies": {
"@types/node": "^22.16.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/templates/empty-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
},
"private": true,
"dependencies": {
"@botpress/client": "1.45.0",
"@botpress/sdk": "6.11.0"
"@botpress/client": "1.46.0",
"@botpress/sdk": "6.11.1"
},
"devDependencies": {
"@types/node": "^22.16.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/templates/empty-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"private": true,
"dependencies": {
"@botpress/sdk": "6.11.0"
"@botpress/sdk": "6.11.1"
},
"devDependencies": {
"@types/node": "^22.16.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/templates/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
},
"private": true,
"dependencies": {
"@botpress/client": "1.45.0",
"@botpress/sdk": "6.11.0"
"@botpress/client": "1.46.0",
"@botpress/sdk": "6.11.1"
},
"devDependencies": {
"@types/node": "^22.16.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/templates/webhook-message/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
},
"private": true,
"dependencies": {
"@botpress/client": "1.45.0",
"@botpress/sdk": "6.11.0",
"@botpress/client": "1.46.0",
"@botpress/sdk": "6.11.1",
"axios": "^1.6.8"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@botpress/client",
"version": "1.45.0",
"version": "1.46.0",
"description": "Botpress Client",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
Expand Down
4 changes: 2 additions & 2 deletions packages/llmz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "llmz",
"type": "module",
"description": "LLMz - An LLM-native Typescript VM built on top of Zui",
"version": "0.0.77",
"version": "0.0.78",
"types": "./dist/index.d.ts",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand Down Expand Up @@ -71,7 +71,7 @@
"tsx": "^4.19.2"
},
"peerDependencies": {
"@botpress/client": "1.45.0",
"@botpress/client": "1.46.0",
"@botpress/cognitive": "0.5.4",
"@bpinternal/thicktoken": "^2.0.0",
"@bpinternal/zui": "^2.1.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@botpress/sdk",
"version": "6.11.0",
"version": "6.11.1",
"description": "Botpress SDK",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
Expand All @@ -20,7 +20,7 @@
"author": "",
"license": "MIT",
"dependencies": {
"@botpress/client": "1.45.0",
"@botpress/client": "1.46.0",
"browser-or-node": "^2.1.1",
"semver": "^7.3.8"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/vai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@botpress/vai",
"version": "0.0.34",
"version": "0.0.35",
"description": "Vitest AI (vai) – a vitest extension for testing with LLMs",
"types": "./dist/index.d.ts",
"exports": {
Expand Down Expand Up @@ -40,7 +40,7 @@
"tsup": "^8.0.2"
},
"peerDependencies": {
"@botpress/client": "1.45.0",
"@botpress/client": "1.46.0",
"@bpinternal/thicktoken": "^1.0.1",
"@bpinternal/zui": "^2.1.1",
"lodash": "^4.17.21",
Expand Down
39 changes: 20 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading