diff --git a/package.json b/package.json index e3f07baf199a..f152124d73fb 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "vitest": "^2.0.5" }, "dependencies": { - "@openctx/client": "^0.0.28", + "@openctx/client": "^0.0.29", "@sourcegraph/telemetry": "^0.18.0", "ignore": "^5.3.1", "observable-fns": "^0.6.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0156d2c7ea14..cd931e70475a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: .: dependencies: '@openctx/client': - specifier: ^0.0.28 - version: 0.0.28 + specifier: ^0.0.29 + version: 0.0.29 '@sourcegraph/telemetry': specifier: ^0.18.0 version: 0.18.0 @@ -424,8 +424,8 @@ importers: specifier: ^0.0.9 version: 0.0.9 '@openctx/vscode-lib': - specifier: ^0.0.24 - version: 0.0.24 + specifier: ^0.0.25 + version: 0.0.25 '@opentelemetry/api': specifier: ^1.7.0 version: 1.7.0 @@ -827,8 +827,8 @@ importers: web: devDependencies: '@openctx/vscode-lib': - specifier: ^0.0.24 - version: 0.0.24 + specifier: ^0.0.25 + version: 0.0.25 '@sourcegraph/cody': specifier: workspace:* version: link:../agent @@ -3363,8 +3363,8 @@ packages: which: 4.0.0 dev: true - /@openctx/client@0.0.28: - resolution: {integrity: sha512-XXaWo/Oa9XZYzhVzSntVV+LRhp/arZc3fnu2JZfVTsZeHgKXhXzKEynWxRaK6eZGI7SNnZMjc0UZUCmMAii28A==} + /@openctx/client@0.0.29: + resolution: {integrity: sha512-KTY6pPjVQ89ZLNU/DxngzNrvH08y/sk9HRYgAhohPmjjD5tEJp+t60/7QI1bjLVu0RT9ZLF3kI8Jb4OIPXJv5Q==} dependencies: '@openctx/protocol': 0.0.19 '@openctx/provider': 0.0.18 @@ -3424,10 +3424,10 @@ packages: sanitize-html: 2.13.0 xss: 1.0.15 - /@openctx/vscode-lib@0.0.24: - resolution: {integrity: sha512-CN/Flz+hDsPAnyKWiHdQLz8yUwKHTVyMgupe16s/JZdVCEb0YbWlIJrXe2CM8Ve+wVQfuyM0TEb/Wj8mi5Ligg==} + /@openctx/vscode-lib@0.0.25: + resolution: {integrity: sha512-DrhUBdiYXh+3JkuqkASept1vAD6GPvS4S+3X2725rDImtpdvrmTpWI2YYJtj6Fa33UpHxe7sch13DitV56Qe1Q==} dependencies: - '@openctx/client': 0.0.28 + '@openctx/client': 0.0.29 '@openctx/ui-common': 0.0.14 observable-fns: 0.6.1 @@ -8390,6 +8390,18 @@ packages: ms: 2.1.3 dev: true + /debug@4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: true + /debug@4.3.4(supports-color@8.1.1): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -14832,7 +14844,7 @@ packages: cosmiconfig: 8.3.6(typescript@5.5.4) css-functions-list: 3.2.2 css-tree: 2.3.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 fast-glob: 3.3.2 fastest-levenshtein: 1.0.16 file-entry-cache: 7.0.2 diff --git a/vscode/package.json b/vscode/package.json index 74862d825f18..b834d06900e2 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -1321,7 +1321,7 @@ "dependencies": { "@anthropic-ai/sdk": "^0.20.8", "@openctx/provider-linear-issues": "^0.0.9", - "@openctx/vscode-lib": "^0.0.24", + "@openctx/vscode-lib": "^0.0.25", "@opentelemetry/api": "^1.7.0", "@opentelemetry/core": "^1.18.1", "@opentelemetry/exporter-trace-otlp-http": "^0.45.1", diff --git a/vscode/src/context/openctx.ts b/vscode/src/context/openctx.ts index 9b3a9fd022d7..8dc521ffcfd6 100644 --- a/vscode/src/context/openctx.ts +++ b/vscode/src/context/openctx.ts @@ -8,6 +8,7 @@ import { authStatus, combineLatest, createDisposables, + debounceTime, distinctUntilChanged, featureFlagProvider, graphqlClient, @@ -28,7 +29,7 @@ import type { } from '@openctx/client' import type { createController } from '@openctx/vscode-lib' import { Observable, map } from 'observable-fns' -import { logDebug, outputChannel } from '../log' +import { logDebug } from '../log' import { gitMentionsProvider } from './openctx/git' import LinearIssuesProvider from './openctx/linear-issues' import RemoteDirectoryProvider, { createRemoteDirectoryProvider } from './openctx/remoteDirectorySearch' @@ -52,6 +53,7 @@ export function exposeOpenCtxClient( ), authStatus.pipe( distinctUntilChanged(), + debounceTime(0), mergeMap(auth => auth.authenticated ? promiseFactoryToObservable(signal => @@ -78,10 +80,16 @@ export function exposeOpenCtxClient( ? getMergeConfigurationFunction() : undefined + if (!openctxOutputChannel) { + // Don't dispose this, so that it stays around for easier debugging even if the + // controller (or the whole extension) is disposed. + openctxOutputChannel = vscode.window.createOutputChannel('OpenCtx') + } + const controller = createController({ extensionId: context.extension.id, secrets: context.secrets, - outputChannel, + outputChannel: openctxOutputChannel!, features: isCodyWeb ? {} : { annotations: true, statusBar: true }, providers: isCodyWeb ? Observable.of(getCodyWebOpenCtxProviders()) @@ -102,6 +110,8 @@ export function exposeOpenCtxClient( ) } +let openctxOutputChannel: vscode.OutputChannel | undefined + export function getOpenCtxProviders( authStatusChanges: Observable>, isValidSiteVersion: boolean diff --git a/web/package.json b/web/package.json index 17b56ab2e789..0bd87f231b24 100644 --- a/web/package.json +++ b/web/package.json @@ -19,7 +19,7 @@ "build-ts": "tsc --build" }, "devDependencies": { - "@openctx/vscode-lib": "^0.0.24", + "@openctx/vscode-lib": "^0.0.25", "@sourcegraph/cody": "workspace:*", "@sourcegraph/cody-shared": "workspace:*", "@sourcegraph/prompt-editor": "workspace:*",