@sourcegraph/cody-web 0.30.0 → 0.31.1
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/{agent.worker-DFfKh9n_.mjs → agent.worker-f0xW2blH.mjs} +954 -496
- package/dist/agent.worker.js +2 -2
- package/dist/{git-log-mAummXPq.mjs → git-log-lMMNBgcI.mjs} +1 -1
- package/dist/{index-ByWBq8cv.mjs → index-CvHu3t7y.mjs} +2 -2
- package/dist/index.js +590 -533
- package/dist/style.css +163 -68
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{util-DYm6oJqS.mjs → util-DVisVv7-.mjs} +1 -1
- package/dist/{vscode-shim-D5fSC1mv.mjs → vscode-shim-BMQfq1RF.mjs} +13143 -13148
- package/package.json +4 -4
|
@@ -18,8 +18,8 @@ var __privateWrapper = (obj, member, setter2, getter) => ({
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
var _a2, _b, _constructing, _max, _maxSize, _dispose, _disposeAfter, _fetchMethod, _size, _calculatedSize, _keyMap, _keyList, _valList, _next, _prev, _head, _tail, _free, _disposed, _sizes, _starts, _ttls, _hasDispose, _hasFetchMethod, _hasDisposeAfter, _LRUCache_instances, initializeTTLTracking_fn, _updateItemAge, _statusTTL, _setItemTTL, _isStale, initializeSizeTracking_fn, _removeItemSize, _addItemSize, _requireSize, indexes_fn, rindexes_fn, isValidIndex_fn, evict_fn, backgroundFetch_fn, isBackgroundFetch_fn, connect_fn, moveToTail_fn, _c, _d, _e, _f, _g, _h, _constructing2, _i, _j, _max2, _maxSize2, _dispose2, _disposeAfter2, _fetchMethod2, _size2, _calculatedSize2, _keyMap2, _keyList2, _valList2, _next2, _prev2, _head2, _tail2, _free2, _disposed2, _sizes2, _starts2, _ttls2, _hasDispose2, _hasFetchMethod2, _hasDisposeAfter2, _LRUCache_instances2, initializeTTLTracking_fn2, _updateItemAge2, _statusTTL2, _setItemTTL2, _isStale2, initializeSizeTracking_fn2, _removeItemSize2, _addItemSize2, _requireSize2, indexes_fn2, rindexes_fn2, isValidIndex_fn2, evict_fn2, backgroundFetch_fn2, isBackgroundFetch_fn2, connect_fn2, moveToTail_fn2, _k, _l, _m, _n, _o;
|
|
21
|
-
import {
|
|
22
|
-
import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-
|
|
21
|
+
import { b9 as Observable, ck as unsubscribe, cl as AsyncSerialScheduler, cm as authStatus, cn as debounceTime, co as switchMapReplayOperation, cp as interval, cq as map$1, cr as filter$2, cs as startWith$1, ct as switchMap$1, cu as promiseFactoryToObservable, cv as retry$1, bH as isError$3, cw as distinctUntilChanged$1, c5 as firstValueFrom$1, c6 as skipPendingOperation, cx as logDebug$1, cy as graphqlClient, cz as isAbortError, cA as logError$2, cB as semver, cC as pendingOperation, cD as pick, bQ as ModelTag, cE as getModelInfo, cF as CHAT_INPUT_TOKEN_BUDGET, cG as CHAT_OUTPUT_TOKEN_BUDGET, cH as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, cI as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, cJ as TRANSIENT_REFETCH_INTERVAL_HINT, cK as createSubscriber, cL as fromVSCodeEvent, bg as isEqual, cM as cenv, bK as lodashExports, cN as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bo as isDotCom, cO as currentAuthStatus, cP as isFileURI, w as wrapInActiveSpan, cQ as INCLUDE_EVERYTHING_CONTEXT_FILTERS, cR as onAbort, cS as addCodyClientIdentificationHeaders, cT as addTraceparent, cU as addAuthHeaders, cV as fetch$3, cW as verifyResponseCode, cX as combineLatest$1, cY as take$2, cZ as clientCapabilities, c_ as shareReplay$1, c$ as tap$2, d0 as featureFlagProvider, bv as FeatureFlag, d1 as getExperimentalClientModelByFeatureFlag, bY as ToolCodyModelName, d2 as TOOL_CODY_MODEL, d3 as getEnterpriseContextWindow, d4 as ANSWER_TOKENS, d5 as storeLastValue, d6 as resolvedConfig, d7 as userProductSubscription, b$ as firstResultFromOperation, d8 as isEnterpriseUser, bD as isCodyProUser, d as ps, d9 as currentResolvedConfig, cg as PromptString, bE as CodyIDE, da as CORPUS_CONTEXT_ALLOCATION, db as isCustomModel, dc as recordErrorToSpan, dd as addClientInfoParams, de as dependentAbortController, az as FILE_CONTEXT_MENTION_PROVIDER, aA as SYMBOL_CONTEXT_MENTION_PROVIDER, aB as REMOTE_REPOSITORY_PROVIDER_URI, aC as REMOTE_FILE_PROVIDER_URI, aD as REMOTE_DIRECTORY_PROVIDER_URI, aE as WEB_PROVIDER_URI, t as telemetryRecorder, C as ContextItemSource, df as isS2, dg as GIT_OPENCTX_PROVIDER_URI, dh as CODE_SEARCH_PROVIDER_URI, bG as cryptoJsExports, di as currentOpenCtxController, aX as URI, dj as MulticastSubject, dk as AsyncSerialScheduler_1, i as getDefaultExportFromCjs, b as workspace, p as path, dl as vscode, R as Range, c as commands$1, a as window$1, dm as Selection, U as Uri, dn as AgentEventEmitter, dp as MarkdownString, g as Disposable, dq as TextEditorRevealType, dr as ThemeIcon, ds as StatusBarAlignment, dt as readFile, du as env, dv as UIKind, l as languages$1, h as commonjsGlobal, dw as InvalidAccessTokenError, dx as _baseAssignValue, dy as eq_1, dz as isArrayLike_1, dA as isObjectLike_1, dB as _copyObject, dC as keysIn_1, dD as _cloneBufferExports, dE as _cloneTypedArray, dF as _copyArray, dG as _initCloneObject, dH as isArguments_1, dI as isArray_1, dJ as isBufferExports, dK as isFunction_1, dL as isObject_1, dM as isPlainObject_1, dN as isTypedArray_1, dO as _Stack, dP as identity_1, dQ as _overRest, dR as _setToString, dS as _isIndex, br as isSourcegraphToken, dT as v4, dU as CONFIG_KEY, ce as CodyAutoSuggestionMode, dV as ConfigurationTarget, dW as pathBrowserify, dX as stat, dY as extensions, dZ as version$2, d_ as setExtensionVersion, d$ as withLatestFrom, e0 as NEVER, e1 as abortableOperation, e2 as isNeedsAuthChallengeError, e3 as EMPTY$1, e4 as disposableSubscription, e5 as setAuthStatusObservable, e6 as DOTCOM_URL, bq as isAvailabilityError, e7 as isInvalidAccessTokenError, e8 as normalizeServerEndpointURL, e9 as isEnterpriseUserDotComError, ea as ProgressLocation, eb as AuthConfigError, ec as SourcegraphGraphQLAPIClient, ed as isExternalProviderAuthError, ee as isNetworkLikeError, ef as NeedsAuthChallengeError, eg as AvailabilityError, eh as EnterpriseUserDotComError, ei as resolveAuth, ej as QuickPickItemKind, ek as isWorkspaceInstance, el as getAuthHeaders, em as SUPPORTED_URI_SCHEMAS, en as _baseIsEqual, eo as keys_1, ep as _baseGet, eq as _castPath, er as isLength_1, es as _toKey, et as _isKey, eu as toNumber_1, ev as _baseFindIndex, ew as require$$0$2, ex as NetworkError, ey as isRateLimitError, bp as isAuthError, ez as FileType, e as dedent$1, eA as FoldingRange, eB as CancellationTokenSource, eC as SymbolKind, bM as isDefined, eD as convertGitCloneURLToCodebaseName, eE as pluck, eF as toRangeData, P as Position, eG as DefaultChatCommands, eH as pathFunctionsForURI, eI as uriParseNameAndExtension, eJ as uriDirname, eK as Utils$1, eL as uriExtname, eM as uriBasename, eN as DefaultEditCommands, eO as subscriptionDisposable, eP as NoOpTelemetryRecorderProvider, eQ as TimestampTelemetryProcessor_1, eR as updateGlobalTelemetryInstances, eS as TelemetryRecorderProvider, eT as telemetryRecorderProvider, eU as createGitDiff, eV as catchError$1, eW as AgentWorkspaceEdit, eX as TextDocumentChangeReason, eY as omit$1, eZ as displayPathWithoutWorkspaceFolderPrefix, e_ as getEditorInsertSpaces, e$ as escapeRegExp$1, f0 as isNetworkError, bX as isCodyProModel, f1 as http, f2 as open, bF as CodyTaskState, f as CodeLens, f3 as defaultWebviewPanel, ba as createExtensionAPI, bb as createMessageAPIForWebview, f4 as EndOfLine, f5 as ViewColumn, f6 as Location, f7 as onDidChangeActiveTextEditor, f8 as tabGroups, f9 as workspaceTextDocuments, fa as visibleTextEditors, fb as onDidChangeVisibleTextEditors, fc as fs, fd as onDidCloseTextDocument, fe as setCreateWebviewPanel, ff as getAugmentedNamespace, fg as extensionConfiguration, fh as main$1, fi as setAgent, fj as setWorkspaceDocuments, fk as onDidRegisterNewCodeActionProvider, fl as onDidUnregisterNewCodeActionProvider, fm as onDidRegisterNewCodeLensProvider, fn as onDidUnregisterNewCodeLensProvider, fo as setClientInfo, fp as AgentWorkspaceConfiguration, fq as firstNonPendingAuthStatus, fr as setWorkspaceFolders, fs as onDidChangeWorkspaceFolders, ft as onDidChangeWindowState, fu as onDidOpenTextDocument, fv as onDidSaveTextDocument, fw as packageJson, fx as progressBars, fy as CodeActionTriggerKind, fz as CodeAction, fA as UriString, D as DiagnosticSeverity, fB as diagnostics, fC as isIntegrationTesting, fD as TESTING_TELEMETRY_EXPORTER, fE as dist, fF as completionProvider, fG as InlineCompletionTriggerKind, fH as checkIfEnterpriseUser, fI as currentAuthStatusAuthed, fJ as waitUntilComplete, fK as setExtensionConfiguration, fL as onDidChangeConfiguration, fM as onDidChangeTextDocument, fN as onDidChangeTextEditorSelection, fO as workspaceFolders$1, fP as isTokenOrEndpointChange, b_ as isMacOS, fQ as QuickInputButtons, bV as CustomCommandType, fR as RelativePattern, ch as setDisplayPathEnvInfo, fS as isWindows, fT as currentAuthStatusOrNotReadyYet, fU as currentUserProductSubscription, c2 as ACCOUNT_USAGE_URL, bc as debounce$1, aG as displayPath, fV as structuredPatch, fW as isDotComAuthed, fX as dedupeWith$1, fY as AbortError, fZ as TimeoutError, f_ as createDisposables, f$ as getClientInfoQueryParams, g0 as tracer, g1 as getClientIdentificationHeaders, g2 as setJSONAcceptContentTypeHeaders, g3 as logResponseHeadersToSpan, g4 as getActiveTraceAndSpanId, g5 as isCustomAuthChallengeResponse, g6 as TracedError, g7 as isNodeResponse, bu as SpanStatusCode, bI as RateLimitError$2, g8 as capitalize, g9 as createTwoFilesPatch, T as ThemeColor, ga as getEditorTabSize$1, by as whitespace, bw as svg, bz as find$1, bA as stringify$1, bB as stringify$2, bC as ccount, bx as html$4, gb as InlineCompletionItem, gc as isFreeUser, gd as exec, ge as _baseGetTag, gf as MAX_BYTES_PER_FILE, gg as debounce_1, cf as isErrorLike, gh as mentionProvidersMetadata, aJ as displayPathBasename, gi as expandToLineRange, aH as displayLineRange, gj as openctxController, bR as DeepCodyAgentID, b6 as parseMentionQuery, gk as openCtxProviderMetadata, gl as editorStateFromPromptString, gm as inputTextWithoutContextChipsFromPromptEditorState, bP as isAbortErrorOrSocketHangUp, s as spawn, gn as ToolCodyModelRef, go as PromptMode, gp as skip$1, bt as context, gq as extractContextFromTraceparent, gr as isContextWindowLimitError, bm as forceHydration, bO as reformatBotMessageForChat, bn as hydrateAfterPostMessage, gs as addMessageListenersForExtensionAPI, gt as createMessageAPIForExtension, bW as View, gu as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, gv as CodeActionKind, c9 as pluralize, gw as assertFileURI, gx as defer$2, gy as merge$2, gz as ruleSearchPaths, gA as isRuleFilename, gB as parseRuleFile, gC as languageFromFilename, aF as RULES_PROVIDER_URI, gD as ruleTitle, gE as createCodeSearchProvider, gF as psDedent, gG as DecorationRangeBehavior, gH as ProgrammingLanguage, gI as MAX_CURRENT_FILE_TOKENS, gJ as formatRuleForPrompt, gK as posixFilePaths, gL as SURROUNDING_LINES, gM as ACCOUNT_UPGRADE_URL, bh as scanForMentionTriggerInUserTextInput, aL as LARGE_FILE_WARNING_LABEL, gN as GENERAL_HELP_LABEL, gO as diffLines, gP as CODY_SUPPORT_URL, gQ as CODY_DOC_URL, gR as CODY_FEEDBACK_URL, gS as DISCORD_URL, bZ as getRelativeChatPeriod, gT as globalAgentRef, gU as VSCODE_CHANGELOG_URL, gV as SG_CHANGELOG_URL, gW as ACCOUNT_LIMITS_INFO_URL, gX as assertUnreachable, gY as promise, gZ as ExtensionMode, g_ as setLogger, g$ as setClientCapabilities, h0 as setResolvedConfigurationObservable, h1 as _, h2 as setClientNameVersion, h3 as setOpenCtxControllerObservable, h4 as CODY_OLLAMA_DOCS_URL, cd as browser$2 } from "./vscode-shim-BMQfq1RF.mjs";
|
|
22
|
+
import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-DVisVv7-.mjs";
|
|
23
23
|
var NOTHING = Symbol.for("immer-nothing");
|
|
24
24
|
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
25
25
|
var DRAFT_STATE = Symbol.for("immer-state");
|
|
@@ -811,15 +811,11 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
|
|
|
811
811
|
]).then(([viewerSettings, codeSearchEnabled]) => {
|
|
812
812
|
const config = {
|
|
813
813
|
...clientConfig,
|
|
814
|
-
intentDetection: "enabled",
|
|
815
814
|
notices: [],
|
|
816
815
|
omniBoxEnabled,
|
|
817
816
|
codeSearchEnabled: isError$3(codeSearchEnabled) ? true : codeSearchEnabled
|
|
818
817
|
};
|
|
819
818
|
if (!isError$3(viewerSettings)) {
|
|
820
|
-
config.intentDetection = ["disabled", "enabled"].includes(
|
|
821
|
-
viewerSettings["omnibox.intentDetection"]
|
|
822
|
-
) ? viewerSettings["omnibox.intentDetection"] : "enabled";
|
|
823
819
|
config.notices = Array.from(
|
|
824
820
|
viewerSettings["cody.notices"] ?? [],
|
|
825
821
|
(notice, index2) => ({
|
|
@@ -829,9 +825,6 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
|
|
|
829
825
|
})
|
|
830
826
|
);
|
|
831
827
|
}
|
|
832
|
-
if (codeSearchEnabled === false) {
|
|
833
|
-
config.intentDetection = "disabled";
|
|
834
|
-
}
|
|
835
828
|
return config;
|
|
836
829
|
});
|
|
837
830
|
}).catch((e) => {
|
|
@@ -853,7 +846,6 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
|
|
|
853
846
|
attributionEnabled: features2.attribution,
|
|
854
847
|
smartContextWindowEnabled: smartContextWindow,
|
|
855
848
|
// Things that did not exist before logically default to disabled.
|
|
856
|
-
intentDetection: "disabled",
|
|
857
849
|
modelsAPIEnabled: false,
|
|
858
850
|
userShouldUseEnterprise: false,
|
|
859
851
|
notices: [],
|
|
@@ -7661,18 +7653,6 @@ __publicField2(_RE2JS, "DISABLE_UNICODE_GROUPS", 8);
|
|
|
7661
7653
|
*/
|
|
7662
7654
|
__publicField2(_RE2JS, "LONGEST_MATCH", 16);
|
|
7663
7655
|
let RE2JS = _RE2JS;
|
|
7664
|
-
const REFETCH_INTERVAL_MAP = {
|
|
7665
|
-
durable: {
|
|
7666
|
-
initialInterval: 60 * 60 * 1e3,
|
|
7667
|
-
// 1 hour
|
|
7668
|
-
backoff: 1
|
|
7669
|
-
},
|
|
7670
|
-
ephemeral: {
|
|
7671
|
-
initialInterval: 7 * 1e3,
|
|
7672
|
-
// 7 seconds
|
|
7673
|
-
backoff: 1.5
|
|
7674
|
-
}
|
|
7675
|
-
};
|
|
7676
7656
|
const allowedSchemes = /* @__PURE__ */ new Set(["http", "https"]);
|
|
7677
7657
|
function canonicalizeContextFilters(filters) {
|
|
7678
7658
|
if (isEqual(filters, INCLUDE_EVERYTHING_CONTEXT_FILTERS)) {
|
|
@@ -7693,30 +7673,28 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
7693
7673
|
__publicField2(this, "parsedContextFilters", null);
|
|
7694
7674
|
__publicField2(this, "cache", new LRUCache$1({ max: 128 }));
|
|
7695
7675
|
__publicField2(this, "lastFetchDelay", 0);
|
|
7696
|
-
__publicField2(this, "
|
|
7697
|
-
__publicField2(this, "
|
|
7676
|
+
__publicField2(this, "lastFetchTimestamp", 0);
|
|
7677
|
+
__publicField2(this, "lastResultLifetime", Promise.resolve(
|
|
7678
|
+
TRANSIENT_REFETCH_INTERVAL_HINT
|
|
7679
|
+
));
|
|
7698
7680
|
__publicField2(this, "contextFiltersSubscriber", createSubscriber());
|
|
7699
7681
|
__publicField2(this, "onContextFiltersChanged", this.contextFiltersSubscriber.subscribe);
|
|
7700
|
-
__publicField2(this, "isTesting", false);
|
|
7701
7682
|
}
|
|
7702
7683
|
// Visible for testing.
|
|
7703
7684
|
get timerStateForTest() {
|
|
7704
7685
|
return { delay: this.lastFetchDelay, lifetime: this.lastResultLifetime };
|
|
7705
7686
|
}
|
|
7706
|
-
// Fetches context filters and updates the cached filter results
|
|
7707
|
-
// 'ephemeral' if the results should be re-queried sooner because they
|
|
7708
|
-
// are transient results arising from, say, a network error; or 'durable'
|
|
7709
|
-
// if the results can be cached for a while.
|
|
7687
|
+
// Fetches context filters and updates the cached filter results
|
|
7710
7688
|
async fetchContextFilters() {
|
|
7711
7689
|
try {
|
|
7712
|
-
const { filters,
|
|
7690
|
+
const { filters, refetchIntervalHint } = await graphqlClient.contextFilters();
|
|
7713
7691
|
this.setContextFilters(filters);
|
|
7714
|
-
return
|
|
7692
|
+
return refetchIntervalHint;
|
|
7715
7693
|
} catch (error) {
|
|
7716
7694
|
logError$2("ContextFiltersProvider", "fetchContextFilters", {
|
|
7717
7695
|
verbose: error
|
|
7718
7696
|
});
|
|
7719
|
-
return
|
|
7697
|
+
return TRANSIENT_REFETCH_INTERVAL_HINT;
|
|
7720
7698
|
}
|
|
7721
7699
|
}
|
|
7722
7700
|
get changes() {
|
|
@@ -7729,7 +7707,6 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
7729
7707
|
);
|
|
7730
7708
|
}
|
|
7731
7709
|
setContextFilters(contextFilters) {
|
|
7732
|
-
var _a3, _b2;
|
|
7733
7710
|
if (isEqual(contextFilters, this.lastContextFiltersResponse)) {
|
|
7734
7711
|
return;
|
|
7735
7712
|
}
|
|
@@ -7741,40 +7718,43 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
7741
7718
|
verbose: contextFilters
|
|
7742
7719
|
});
|
|
7743
7720
|
}
|
|
7744
|
-
this.parsedContextFilters =
|
|
7721
|
+
this.parsedContextFilters = this.parseContextFilter(
|
|
7722
|
+
lodashExports.isError(contextFilters) ? EXCLUDE_EVERYTHING_CONTEXT_FILTERS : contextFilters
|
|
7723
|
+
);
|
|
7724
|
+
this.contextFiltersSubscriber.notify(this.lastContextFiltersResponse);
|
|
7725
|
+
}
|
|
7726
|
+
parseContextFilter(contextFilters) {
|
|
7727
|
+
var _a3, _b2;
|
|
7728
|
+
return {
|
|
7745
7729
|
include: ((_a3 = contextFilters.include) == null ? void 0 : _a3.map(parseContextFilterItem)) || null,
|
|
7746
7730
|
exclude: ((_b2 = contextFilters.exclude) == null ? void 0 : _b2.map(parseContextFilterItem)) || null
|
|
7747
7731
|
};
|
|
7748
|
-
this.contextFiltersSubscriber.notify(contextFilters);
|
|
7749
7732
|
}
|
|
7750
7733
|
/**
|
|
7751
7734
|
* Overrides context filters for testing.
|
|
7752
7735
|
*/
|
|
7753
7736
|
setTestingContextFilters(contextFilters) {
|
|
7754
7737
|
if (contextFilters === null) {
|
|
7755
|
-
this.isTesting = false;
|
|
7756
7738
|
this.reset();
|
|
7757
7739
|
} else {
|
|
7758
|
-
this.isTesting = true;
|
|
7759
7740
|
this.setContextFilters(contextFilters);
|
|
7760
7741
|
}
|
|
7761
7742
|
}
|
|
7762
|
-
startRefetchTimer(intervalHint) {
|
|
7763
|
-
if (this.lastResultLifetime === intervalHint) {
|
|
7764
|
-
this.lastFetchDelay *= REFETCH_INTERVAL_MAP[intervalHint].backoff;
|
|
7765
|
-
} else {
|
|
7766
|
-
this.lastFetchDelay = REFETCH_INTERVAL_MAP[intervalHint].initialInterval;
|
|
7767
|
-
this.lastResultLifetime = intervalHint;
|
|
7768
|
-
}
|
|
7769
|
-
this.fetchIntervalId = setTimeout(async () => {
|
|
7770
|
-
this.startRefetchTimer(await this.fetchContextFilters());
|
|
7771
|
-
}, this.lastFetchDelay);
|
|
7772
|
-
}
|
|
7773
7743
|
async fetchIfNeeded() {
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7744
|
+
this.lastResultLifetime = this.lastResultLifetime.then(async (intervalHint) => {
|
|
7745
|
+
if (this.lastFetchTimestamp + this.lastFetchDelay < Date.now()) {
|
|
7746
|
+
this.lastFetchTimestamp = Date.now();
|
|
7747
|
+
const nextIntervalHint = await this.fetchContextFilters();
|
|
7748
|
+
if (isEqual(intervalHint, nextIntervalHint)) {
|
|
7749
|
+
this.lastFetchDelay *= nextIntervalHint.backoff;
|
|
7750
|
+
} else {
|
|
7751
|
+
this.lastFetchDelay = nextIntervalHint.initialInterval;
|
|
7752
|
+
}
|
|
7753
|
+
return nextIntervalHint;
|
|
7754
|
+
}
|
|
7755
|
+
return intervalHint;
|
|
7756
|
+
});
|
|
7757
|
+
await this.lastResultLifetime;
|
|
7778
7758
|
}
|
|
7779
7759
|
async isRepoNameIgnored(repoName) {
|
|
7780
7760
|
if (isDotCom(currentAuthStatus())) {
|
|
@@ -7816,6 +7796,10 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
7816
7796
|
if (this.hasIgnoreEverythingFilters()) {
|
|
7817
7797
|
return "has-ignore-everything-filters";
|
|
7818
7798
|
}
|
|
7799
|
+
const maybeError = this.lastContextFiltersResponse;
|
|
7800
|
+
if (lodashExports.isError(maybeError)) {
|
|
7801
|
+
return maybeError;
|
|
7802
|
+
}
|
|
7819
7803
|
if (!isFileURI(uri)) {
|
|
7820
7804
|
logDebug$1("ContextFiltersProvider", "isUriIgnored", `non-file URI ${uri.scheme}`);
|
|
7821
7805
|
return "non-file-uri";
|
|
@@ -7841,15 +7825,12 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
7841
7825
|
return false;
|
|
7842
7826
|
}
|
|
7843
7827
|
reset() {
|
|
7828
|
+
this.lastFetchTimestamp = 0;
|
|
7829
|
+
this.lastResultLifetime = Promise.resolve(TRANSIENT_REFETCH_INTERVAL_HINT);
|
|
7844
7830
|
this.lastFetchDelay = 0;
|
|
7845
|
-
this.lastResultLifetime = void 0;
|
|
7846
7831
|
this.lastContextFiltersResponse = null;
|
|
7847
7832
|
this.parsedContextFilters = null;
|
|
7848
7833
|
this.cache.clear();
|
|
7849
|
-
if (this.fetchIntervalId) {
|
|
7850
|
-
clearTimeout(this.fetchIntervalId);
|
|
7851
|
-
this.fetchIntervalId = void 0;
|
|
7852
|
-
}
|
|
7853
7834
|
}
|
|
7854
7835
|
dispose() {
|
|
7855
7836
|
this.reset();
|
|
@@ -8594,6 +8575,9 @@ class ModelsService {
|
|
|
8594
8575
|
const modelsList = this.models.map((m) => m.id).join(", ");
|
|
8595
8576
|
throw new Error(`${errorMessage} Available models: ${modelsList}`);
|
|
8596
8577
|
}
|
|
8578
|
+
getModelsByTag(tag2) {
|
|
8579
|
+
return this.models.filter((m) => m.tags.includes(tag2));
|
|
8580
|
+
}
|
|
8597
8581
|
isStreamDisabled(modelID) {
|
|
8598
8582
|
const model2 = this.getModelByID(modelID);
|
|
8599
8583
|
return (model2 == null ? void 0 : model2.tags.includes(ModelTag.StreamDisabled)) ?? false;
|
|
@@ -8780,7 +8764,7 @@ async function currentSiteVersion() {
|
|
|
8780
8764
|
}
|
|
8781
8765
|
async function isValidVersion({ minimumVersion }) {
|
|
8782
8766
|
const currentVersion = await currentSiteVersion();
|
|
8783
|
-
if (currentVersion
|
|
8767
|
+
if (isError$3(currentVersion)) {
|
|
8784
8768
|
return false;
|
|
8785
8769
|
}
|
|
8786
8770
|
return checkVersion({ minimumVersion, currentVersion: currentVersion.siteVersion });
|
|
@@ -8845,6 +8829,9 @@ class ChatClient {
|
|
|
8845
8829
|
currentSiteVersion(),
|
|
8846
8830
|
await firstValueFrom$1(authStatus)
|
|
8847
8831
|
]);
|
|
8832
|
+
if (lodashExports.isError(versions)) {
|
|
8833
|
+
throw versions;
|
|
8834
|
+
}
|
|
8848
8835
|
if (!authStatus_.authenticated) {
|
|
8849
8836
|
throw new Error("not authenticated");
|
|
8850
8837
|
}
|
|
@@ -8855,10 +8842,10 @@ class ChatClient {
|
|
|
8855
8842
|
const isLastMessageFromHuman = messages.length > 0 && messages.at(-1).speaker === "human";
|
|
8856
8843
|
const isFireworks = ((_d2 = params == null ? void 0 : params.model) == null ? void 0 : _d2.startsWith("fireworks/")) || ((_e2 = params == null ? void 0 : params.model) == null ? void 0 : _e2.startsWith("fireworks::"));
|
|
8857
8844
|
const augmentedMessages = isFireworks || useApiV1 ? sanitizeMessages(messages) : isLastMessageFromHuman ? messages.concat([{ speaker: "assistant" }]) : messages;
|
|
8858
|
-
const messagesToSend = augmentedMessages.map(({ speaker, text: text2,
|
|
8845
|
+
const messagesToSend = augmentedMessages.map(({ speaker, text: text2, cacheEnabled }) => ({
|
|
8859
8846
|
text: text2,
|
|
8860
8847
|
speaker,
|
|
8861
|
-
|
|
8848
|
+
cacheEnabled
|
|
8862
8849
|
}));
|
|
8863
8850
|
const completionParams = {
|
|
8864
8851
|
...DEFAULT_CHAT_COMPLETION_PARAMETERS,
|
|
@@ -8902,6 +8889,9 @@ function sanitizeMessages(messages) {
|
|
|
8902
8889
|
return sanitizedMessages;
|
|
8903
8890
|
}
|
|
8904
8891
|
const DEFAULT_PREAMBLE = ps`You are Cody, an AI coding assistant from Sourcegraph.`;
|
|
8892
|
+
function getDefaultSystemPrompt() {
|
|
8893
|
+
return DEFAULT_PREAMBLE;
|
|
8894
|
+
}
|
|
8905
8895
|
const SMART_APPLY_PREAMBLE = ps`If your answer contains fenced code blocks in Markdown, include the relevant full file path in the code block tag using this structure: \`\`\`$LANGUAGE:$FILEPATH\`\`\`
|
|
8906
8896
|
For executable terminal commands: enclose each command in individual "bash" language code block without comments and new lines inside.`;
|
|
8907
8897
|
const CHAT_PREAMBLE = DEFAULT_PREAMBLE.concat(SMART_APPLY_PREAMBLE);
|
|
@@ -9671,7 +9661,7 @@ async function getBytes$2(stream, onChunk) {
|
|
|
9671
9661
|
onChunk(result.value);
|
|
9672
9662
|
}
|
|
9673
9663
|
}
|
|
9674
|
-
function getLines(onLine) {
|
|
9664
|
+
function getLines$1(onLine) {
|
|
9675
9665
|
let buffer2;
|
|
9676
9666
|
let position;
|
|
9677
9667
|
let fieldLength;
|
|
@@ -9818,7 +9808,7 @@ function fetchEventSource(input, _a3) {
|
|
|
9818
9808
|
try {
|
|
9819
9809
|
const response = await fetch2(input, Object.assign(Object.assign({}, rest), { headers, signal: curRequestController.signal }));
|
|
9820
9810
|
await onopen(response);
|
|
9821
|
-
await getBytes$2(response.body, getLines(getMessages((id) => {
|
|
9811
|
+
await getBytes$2(response.body, getLines$1(getMessages((id) => {
|
|
9822
9812
|
if (id) {
|
|
9823
9813
|
headers[LastEventId] = id;
|
|
9824
9814
|
} else {
|
|
@@ -9855,15 +9845,42 @@ function defaultOnOpen(response) {
|
|
|
9855
9845
|
class CompletionsResponseBuilder {
|
|
9856
9846
|
constructor(apiVersion) {
|
|
9857
9847
|
__publicField2(this, "totalCompletion", "");
|
|
9848
|
+
__publicField2(this, "thinkingBuffer", []);
|
|
9858
9849
|
this.apiVersion = apiVersion;
|
|
9859
9850
|
}
|
|
9860
9851
|
nextCompletion(completion, deltaText) {
|
|
9852
|
+
const thinkingText = this.getThinkingText();
|
|
9861
9853
|
if (this.apiVersion >= 2) {
|
|
9862
9854
|
this.totalCompletion += deltaText ?? "";
|
|
9863
|
-
|
|
9855
|
+
} else {
|
|
9856
|
+
this.totalCompletion = completion ?? "";
|
|
9864
9857
|
}
|
|
9865
|
-
this.totalCompletion
|
|
9866
|
-
|
|
9858
|
+
return thinkingText + this.totalCompletion;
|
|
9859
|
+
}
|
|
9860
|
+
/**
|
|
9861
|
+
* Processes and accumulates thinking steps during the completion stream.
|
|
9862
|
+
* Thinking steps must start at the beginning of completion and are enclosed in <think> tags.
|
|
9863
|
+
* When the completion starts streaming, the previous <think> tag is closed.
|
|
9864
|
+
*
|
|
9865
|
+
* @param deltaThinking - The incremental thinking text to be added
|
|
9866
|
+
* @returns The formatted thinking text wrapped in XML tags
|
|
9867
|
+
*/
|
|
9868
|
+
nextThinking(deltaThinking) {
|
|
9869
|
+
if (deltaThinking) {
|
|
9870
|
+
this.thinkingBuffer.push(deltaThinking);
|
|
9871
|
+
}
|
|
9872
|
+
return this.getThinkingText();
|
|
9873
|
+
}
|
|
9874
|
+
/**
|
|
9875
|
+
* Generates the formatted thinking text by combining all thinking steps.
|
|
9876
|
+
* Wraps the combined thinking text in <think> tags and adds a newline if content exists.
|
|
9877
|
+
*
|
|
9878
|
+
* @returns Formatted thinking text with XML tags, or empty string if no thinking steps exist
|
|
9879
|
+
*/
|
|
9880
|
+
getThinkingText() {
|
|
9881
|
+
const thinking = this.thinkingBuffer.join("");
|
|
9882
|
+
return thinking ? `<think>${thinking}</think>
|
|
9883
|
+
` : "";
|
|
9867
9884
|
}
|
|
9868
9885
|
static fromUrl(url) {
|
|
9869
9886
|
const apiVersion = Number.parseInt(new URL(url).searchParams.get("api-version") ?? "0", 10);
|
|
@@ -11887,7 +11904,7 @@ async function serializePrompts(messages, modelID) {
|
|
|
11887
11904
|
messages.map(async (m) => {
|
|
11888
11905
|
var _a4;
|
|
11889
11906
|
const text2 = await ((_a4 = m.text) == null ? void 0 : _a4.toFilteredString(contextFiltersProvider));
|
|
11890
|
-
if (serverSupportsPromptCaching() && m.
|
|
11907
|
+
if (serverSupportsPromptCaching() && m.cacheEnabled) {
|
|
11891
11908
|
return {
|
|
11892
11909
|
speaker: m.speaker,
|
|
11893
11910
|
content: [
|
|
@@ -11949,15 +11966,7 @@ class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
|
|
|
11949
11966
|
// otherwise tries to call document.addEventListener
|
|
11950
11967
|
async onopen(response) {
|
|
11951
11968
|
if (!response.ok && response.headers.get("content-type") !== "text/event-stream") {
|
|
11952
|
-
|
|
11953
|
-
try {
|
|
11954
|
-
errorMessage = await response.text();
|
|
11955
|
-
} catch (error2) {
|
|
11956
|
-
console.error(error2);
|
|
11957
|
-
}
|
|
11958
|
-
const error = new Error(
|
|
11959
|
-
errorMessage === null || errorMessage.length === 0 ? `Request failed with status code ${response.status}` : errorMessage
|
|
11960
|
-
);
|
|
11969
|
+
const error = await verifyResponseCode(response).catch((err2) => err2);
|
|
11961
11970
|
cb.onError(error, response.status);
|
|
11962
11971
|
abort2.abort();
|
|
11963
11972
|
return;
|
|
@@ -12007,6 +12016,7 @@ class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
|
|
|
12007
12016
|
const { url, serializedParams } = await this.prepareRequest(params, requestParams);
|
|
12008
12017
|
const headersInstance = new Headers({
|
|
12009
12018
|
"Content-Type": "application/json; charset=utf-8",
|
|
12019
|
+
Accept: "text/event-stream",
|
|
12010
12020
|
...configuration.customHeaders,
|
|
12011
12021
|
...requestParams.customHeaders
|
|
12012
12022
|
});
|
|
@@ -12021,13 +12031,7 @@ class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
|
|
|
12021
12031
|
headers: headersInstance,
|
|
12022
12032
|
body: JSON.stringify(serializedParams),
|
|
12023
12033
|
signal: signal2
|
|
12024
|
-
});
|
|
12025
|
-
if (!response.ok) {
|
|
12026
|
-
const errorMessage = await response.text();
|
|
12027
|
-
throw new Error(
|
|
12028
|
-
errorMessage.length === 0 ? `Request failed with status code ${response.status}` : errorMessage
|
|
12029
|
-
);
|
|
12030
|
-
}
|
|
12034
|
+
}).then(verifyResponseCode);
|
|
12031
12035
|
const data2 = await response.json();
|
|
12032
12036
|
if (data2 == null ? void 0 : data2.completion) {
|
|
12033
12037
|
cb.onChange(data2.completion);
|
|
@@ -12199,7 +12203,6 @@ const events$2 = [
|
|
|
12199
12203
|
event(
|
|
12200
12204
|
"cody.chat-question/executed",
|
|
12201
12205
|
({ feature: feature2, action, map: map2 }) => (params, spans, tokenCounterUtils) => {
|
|
12202
|
-
var _a3;
|
|
12203
12206
|
const recordTranscript = params.authStatus.endpoint && (isDotCom(params.authStatus) || isS2(params.authStatus));
|
|
12204
12207
|
const gitMetadata = recordTranscript && params.repoIsPublic && lodashExports.isArray(params.repoMetadata) ? params.repoMetadata : void 0;
|
|
12205
12208
|
const metadata2 = lodashExports.isArray(params.context) ? publicContextSummary("context", params.context) : {
|
|
@@ -12212,22 +12215,12 @@ const events$2 = [
|
|
|
12212
12215
|
const telemetryData = {
|
|
12213
12216
|
metadata: pickDefined({
|
|
12214
12217
|
userSpecifiedIntent: params.userSpecifiedIntent ? map2.intent(params.userSpecifiedIntent) : void 0,
|
|
12215
|
-
detectedIntent: params.detectedIntent ? map2.intent(params.detectedIntent) : void 0,
|
|
12216
|
-
// Each intent is mapped to a `detectedIntentScores.{intent}` field inside the metadata
|
|
12217
|
-
...(_a3 = params.detectedIntentScores) == null ? void 0 : _a3.reduce(
|
|
12218
|
-
(scores, intentScore) => {
|
|
12219
|
-
scores["detectedIntentScores." + intentScore.intent] = intentScore.score;
|
|
12220
|
-
return scores;
|
|
12221
|
-
},
|
|
12222
|
-
{}
|
|
12223
|
-
),
|
|
12224
12218
|
// TODO: Remove this field when the transition from commands to prompts is complete
|
|
12225
12219
|
isCommand: params.command ? 1 : 0,
|
|
12226
12220
|
...metadata2,
|
|
12227
12221
|
recordsPrivateMetadataTranscript: recordTranscript ? 1 : 0
|
|
12228
12222
|
}),
|
|
12229
12223
|
privateMetadata: {
|
|
12230
|
-
detectedIntent: params.detectedIntent,
|
|
12231
12224
|
// TODO: Remove this field when the transition from commands to prompts is complete
|
|
12232
12225
|
command: params.command,
|
|
12233
12226
|
userSpecifiedIntent: params.userSpecifiedIntent,
|
|
@@ -12875,30 +12868,32 @@ The Markdown body is an LLM prompt that is included in AI code chat and editing
|
|
|
12875
12868
|
};
|
|
12876
12869
|
function ruleAppliesToFile(rule, file) {
|
|
12877
12870
|
if (rule.repo_filters) {
|
|
12878
|
-
if (!
|
|
12871
|
+
if (!regExpMatch(rule.repo_filters, file.repo)) {
|
|
12879
12872
|
return false;
|
|
12880
12873
|
}
|
|
12881
12874
|
}
|
|
12882
12875
|
if (rule.path_filters) {
|
|
12883
|
-
if (!
|
|
12876
|
+
if (!regExpMatch(rule.path_filters, file.path)) {
|
|
12884
12877
|
return false;
|
|
12885
12878
|
}
|
|
12886
12879
|
}
|
|
12887
12880
|
const language_filters = rule.language_filters;
|
|
12888
12881
|
if (language_filters) {
|
|
12889
|
-
const anyMatch = file.languages.some(
|
|
12882
|
+
const anyMatch = file.languages.some(
|
|
12883
|
+
(language) => stringMatch(language_filters, language, { caseInsensitive: true })
|
|
12884
|
+
);
|
|
12890
12885
|
if (!anyMatch) {
|
|
12891
12886
|
return false;
|
|
12892
12887
|
}
|
|
12893
12888
|
}
|
|
12894
12889
|
if (rule.text_content_filters) {
|
|
12895
|
-
if (!
|
|
12890
|
+
if (!regExpMatch(rule.text_content_filters, file.textContent)) {
|
|
12896
12891
|
return false;
|
|
12897
12892
|
}
|
|
12898
12893
|
}
|
|
12899
12894
|
return true;
|
|
12900
12895
|
}
|
|
12901
|
-
function
|
|
12896
|
+
function regExpMatch(filters, value) {
|
|
12902
12897
|
var _a3;
|
|
12903
12898
|
if (filters.include && !filters.include.some((pattern) => new RegExp(pattern).test(value))) {
|
|
12904
12899
|
return false;
|
|
@@ -12908,6 +12903,17 @@ function match$1(filters, value) {
|
|
|
12908
12903
|
}
|
|
12909
12904
|
return true;
|
|
12910
12905
|
}
|
|
12906
|
+
function stringMatch(filters, value, options = {}) {
|
|
12907
|
+
var _a3;
|
|
12908
|
+
const compare = (a, b) => options.caseInsensitive ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
12909
|
+
if (filters.include && !filters.include.some((pattern) => compare(pattern, value))) {
|
|
12910
|
+
return false;
|
|
12911
|
+
}
|
|
12912
|
+
if ((_a3 = filters.exclude) == null ? void 0 : _a3.some((pattern) => compare(pattern, value))) {
|
|
12913
|
+
return false;
|
|
12914
|
+
}
|
|
12915
|
+
return true;
|
|
12916
|
+
}
|
|
12911
12917
|
function isRulesEnabled(configuration) {
|
|
12912
12918
|
return configuration.rulesEnabled || configuration.internalUnstable;
|
|
12913
12919
|
}
|
|
@@ -22050,7 +22056,7 @@ function newAuthStatus(options) {
|
|
|
22050
22056
|
return {
|
|
22051
22057
|
authenticated: false,
|
|
22052
22058
|
endpoint: options.endpoint,
|
|
22053
|
-
error:
|
|
22059
|
+
error: new InvalidAccessTokenError(),
|
|
22054
22060
|
pendingValidation: false
|
|
22055
22061
|
};
|
|
22056
22062
|
}
|
|
@@ -22360,6 +22366,7 @@ class LocalStorage {
|
|
|
22360
22366
|
__publicField2(this, "MODEL_PREFERENCES_KEY", "cody-model-preferences");
|
|
22361
22367
|
__publicField2(this, "CODY_CHAT_MEMORY", "cody-chat-memory");
|
|
22362
22368
|
__publicField2(this, "AUTO_EDITS_ONBOARDING_NOTIFICATION_COUNT", "cody-auto-edit-notification-info");
|
|
22369
|
+
__publicField2(this, "DEVICE_PIXEL_RATIO", "device-pixel-ratio");
|
|
22363
22370
|
__publicField2(this, "keys", {
|
|
22364
22371
|
deepCodyLastUsedDate: "DEEP_CODY_LAST_USED_DATE",
|
|
22365
22372
|
deepCodyDailyUsageCount: "DEEP_CODY_DAILY_CHAT_USAGE"
|
|
@@ -22612,6 +22619,12 @@ class LocalStorage {
|
|
|
22612
22619
|
await this.set(this.keys.deepCodyDailyUsageCount, newQuota);
|
|
22613
22620
|
await this.set(this.keys.deepCodyLastUsedDate, lastUsed);
|
|
22614
22621
|
}
|
|
22622
|
+
getDevicePixelRatio() {
|
|
22623
|
+
return this.get(this.DEVICE_PIXEL_RATIO);
|
|
22624
|
+
}
|
|
22625
|
+
async setDevicePixelRatio(ratio) {
|
|
22626
|
+
await this.set(this.DEVICE_PIXEL_RATIO, ratio);
|
|
22627
|
+
}
|
|
22615
22628
|
get(key2) {
|
|
22616
22629
|
return this.storage.get(key2, null);
|
|
22617
22630
|
}
|
|
@@ -22754,7 +22767,6 @@ function getConfiguration(config = workspace.getConfiguration()) {
|
|
|
22754
22767
|
internalDebugState: getHiddenSetting("internal.debug.state", false),
|
|
22755
22768
|
autocompleteAdvancedModel: getHiddenSetting("autocomplete.advanced.model", null),
|
|
22756
22769
|
autocompleteExperimentalGraphContext: getHiddenSetting("autocomplete.experimental.graphContext", null),
|
|
22757
|
-
experimentalCommitMessage: getHiddenSetting("experimental.commitMessage", true),
|
|
22758
22770
|
experimentalNoodle: getHiddenSetting("experimental.noodle", false),
|
|
22759
22771
|
experimentalTracing: getHiddenSetting("experimental.tracing", false),
|
|
22760
22772
|
experimentalSupercompletions: getHiddenSetting("experimental.supercompletions", false),
|
|
@@ -22965,6 +22977,8 @@ function getFeatureFlagEventName(key2) {
|
|
|
22965
22977
|
return "interactiveTutorial";
|
|
22966
22978
|
case FeatureFlag.DeepCody:
|
|
22967
22979
|
return "deepCody";
|
|
22980
|
+
case FeatureFlag.CodyPromptCachingOnMessages:
|
|
22981
|
+
return "promptCachingOnMessages";
|
|
22968
22982
|
default:
|
|
22969
22983
|
return "UnregisteredFeature";
|
|
22970
22984
|
}
|
|
@@ -23019,13 +23033,12 @@ class AuthProvider {
|
|
|
23019
23033
|
this.subscriptions.push(
|
|
23020
23034
|
ClientConfigSingleton.getInstance().updates.pipe(
|
|
23021
23035
|
abortableOperation(async (config, signal2) => {
|
|
23022
|
-
var _a3;
|
|
23023
23036
|
const nextAuthStatus = await validateCredentials(
|
|
23024
23037
|
await currentResolvedConfig(),
|
|
23025
23038
|
signal2,
|
|
23026
23039
|
config
|
|
23027
23040
|
);
|
|
23028
|
-
if (!nextAuthStatus.authenticated && (
|
|
23041
|
+
if (!nextAuthStatus.authenticated && isEnterpriseUserDotComError(nextAuthStatus.error)) {
|
|
23029
23042
|
this.status.next(nextAuthStatus);
|
|
23030
23043
|
}
|
|
23031
23044
|
})
|
|
@@ -23034,16 +23047,29 @@ class AuthProvider {
|
|
|
23034
23047
|
this.subscriptions.push(
|
|
23035
23048
|
combineLatest$1(
|
|
23036
23049
|
credentialsChangesNeedingValidation,
|
|
23037
|
-
this.refreshRequests.pipe(startWith$1(
|
|
23050
|
+
this.refreshRequests.pipe(startWith$1(true))
|
|
23038
23051
|
).pipe(
|
|
23039
|
-
abortableOperation(async ([config], signal2) => {
|
|
23052
|
+
abortableOperation(async ([config, resetInitialAuthStatus], signal2) => {
|
|
23040
23053
|
if (clientCapabilities().isCodyWeb) {
|
|
23041
23054
|
return;
|
|
23042
23055
|
}
|
|
23043
|
-
await this.validateAndUpdateAuthStatus(config, signal2);
|
|
23056
|
+
await this.validateAndUpdateAuthStatus(config, signal2, resetInitialAuthStatus);
|
|
23044
23057
|
})
|
|
23045
23058
|
).subscribe({})
|
|
23046
23059
|
);
|
|
23060
|
+
this.subscriptions.push(
|
|
23061
|
+
authStatus.pipe(
|
|
23062
|
+
switchMap$1((authStatus2) => {
|
|
23063
|
+
if (!authStatus2.authenticated && isNeedsAuthChallengeError(authStatus2.error)) {
|
|
23064
|
+
const intervalMsec = 2500;
|
|
23065
|
+
return interval(intervalMsec);
|
|
23066
|
+
}
|
|
23067
|
+
return EMPTY$1;
|
|
23068
|
+
})
|
|
23069
|
+
).subscribe(() => {
|
|
23070
|
+
this.refreshRequests.next(false);
|
|
23071
|
+
})
|
|
23072
|
+
);
|
|
23047
23073
|
this.subscriptions.push(
|
|
23048
23074
|
authStatus.subscribe((authStatus2) => {
|
|
23049
23075
|
try {
|
|
@@ -23070,14 +23096,16 @@ class AuthProvider {
|
|
|
23070
23096
|
)
|
|
23071
23097
|
);
|
|
23072
23098
|
}
|
|
23073
|
-
async validateAndUpdateAuthStatus(credentials, signal2) {
|
|
23074
|
-
|
|
23075
|
-
|
|
23076
|
-
|
|
23077
|
-
|
|
23078
|
-
|
|
23099
|
+
async validateAndUpdateAuthStatus(credentials, signal2, resetInitialAuthStatus) {
|
|
23100
|
+
if (resetInitialAuthStatus ?? true) {
|
|
23101
|
+
this.status.next({
|
|
23102
|
+
authenticated: false,
|
|
23103
|
+
pendingValidation: true,
|
|
23104
|
+
endpoint: credentials.auth.serverEndpoint
|
|
23105
|
+
});
|
|
23106
|
+
}
|
|
23079
23107
|
try {
|
|
23080
|
-
const authStatus2 = await validateCredentials(credentials, signal2);
|
|
23108
|
+
const authStatus2 = await validateCredentials(credentials, signal2, void 0);
|
|
23081
23109
|
signal2 == null ? void 0 : signal2.throwIfAborted();
|
|
23082
23110
|
this.status.next(authStatus2);
|
|
23083
23111
|
await this.handleAuthTelemetry(authStatus2, signal2);
|
|
@@ -23105,9 +23133,9 @@ class AuthProvider {
|
|
|
23105
23133
|
/**
|
|
23106
23134
|
* Refresh the auth status.
|
|
23107
23135
|
*/
|
|
23108
|
-
refresh() {
|
|
23136
|
+
refresh(resetInitialAuthStatus = true) {
|
|
23109
23137
|
this.lastValidatedAndStoredCredentials.next(null);
|
|
23110
|
-
this.refreshRequests.next();
|
|
23138
|
+
this.refreshRequests.next(resetInitialAuthStatus);
|
|
23111
23139
|
}
|
|
23112
23140
|
signout(endpoint) {
|
|
23113
23141
|
if (this.lastEndpoint !== endpoint) {
|
|
@@ -23199,12 +23227,11 @@ function startAuthTelemetryReporter() {
|
|
|
23199
23227
|
});
|
|
23200
23228
|
}
|
|
23201
23229
|
function reportAuthTelemetryEvent(authStatus2) {
|
|
23202
|
-
var _a3, _b2;
|
|
23203
23230
|
if (authStatus2.pendingValidation) {
|
|
23204
23231
|
return;
|
|
23205
23232
|
}
|
|
23206
23233
|
let eventValue;
|
|
23207
|
-
if (!authStatus2.authenticated && ((
|
|
23234
|
+
if (!authStatus2.authenticated && (isAvailabilityError(authStatus2.error) || isInvalidAccessTokenError(authStatus2.error))) {
|
|
23208
23235
|
eventValue = "failed";
|
|
23209
23236
|
} else if (authStatus2.authenticated) {
|
|
23210
23237
|
eventValue = "connected";
|
|
@@ -23307,7 +23334,7 @@ async function showSignInMenu(type, uri) {
|
|
|
23307
23334
|
const { configuration } = await currentResolvedConfig();
|
|
23308
23335
|
const auth = await resolveAuth(selectedEndpoint, configuration, secretStorage);
|
|
23309
23336
|
let authStatus22 = await authProvider.validateAndStoreCredentials(auth, "store-if-valid");
|
|
23310
|
-
if (!(authStatus22 == null ? void 0 : authStatus22.authenticated)) {
|
|
23337
|
+
if (!(authStatus22 == null ? void 0 : authStatus22.authenticated) && isInvalidAccessTokenError(authStatus22.error)) {
|
|
23311
23338
|
const token = await showAccessTokenInputBox(selectedEndpoint);
|
|
23312
23339
|
if (!token) {
|
|
23313
23340
|
return;
|
|
@@ -23467,7 +23494,7 @@ async function showAuthResultMessage(endpoint, authStatus2) {
|
|
|
23467
23494
|
}
|
|
23468
23495
|
async function showAuthFailureMessage(endpoint, authStatus2) {
|
|
23469
23496
|
if (authStatus2 == null ? void 0 : authStatus2.error) {
|
|
23470
|
-
await window$1.showErrorMessage(
|
|
23497
|
+
await window$1.showErrorMessage(authStatus2.error.message);
|
|
23471
23498
|
}
|
|
23472
23499
|
}
|
|
23473
23500
|
async function tokenCallbackHandler(uri) {
|
|
@@ -23557,10 +23584,7 @@ async function validateCredentials(config, signal2, clientConfig) {
|
|
|
23557
23584
|
authenticated: false,
|
|
23558
23585
|
endpoint: config.auth.serverEndpoint,
|
|
23559
23586
|
pendingValidation: false,
|
|
23560
|
-
error:
|
|
23561
|
-
type: "auth-config-error",
|
|
23562
|
-
message: ((_a3 = config.auth.error) == null ? void 0 : _a3.message) ?? config.auth.error
|
|
23563
|
-
}
|
|
23587
|
+
error: new AuthConfigError(((_a3 = config.auth.error) == null ? void 0 : _a3.message) ?? config.auth.error)
|
|
23564
23588
|
};
|
|
23565
23589
|
}
|
|
23566
23590
|
if (!config.auth.credentials && !clientCapabilities().isCodyWeb) {
|
|
@@ -23584,20 +23608,21 @@ async function validateCredentials(config, signal2, clientConfig) {
|
|
|
23584
23608
|
logDebug("auth", userInfo.message);
|
|
23585
23609
|
return {
|
|
23586
23610
|
authenticated: false,
|
|
23587
|
-
error:
|
|
23611
|
+
error: userInfo,
|
|
23588
23612
|
endpoint: config.auth.serverEndpoint,
|
|
23589
23613
|
pendingValidation: false
|
|
23590
23614
|
};
|
|
23591
23615
|
}
|
|
23592
|
-
|
|
23616
|
+
const needsAuthChallenge = isNeedsAuthChallengeError(userInfo);
|
|
23617
|
+
if (isNetworkLikeError(userInfo) || needsAuthChallenge) {
|
|
23593
23618
|
logDebug(
|
|
23594
23619
|
"auth",
|
|
23595
|
-
`Failed to authenticate to ${config.auth.serverEndpoint} due to likely network error`,
|
|
23620
|
+
`Failed to authenticate to ${config.auth.serverEndpoint} due to likely network or endpoint availability error`,
|
|
23596
23621
|
userInfo.message
|
|
23597
23622
|
);
|
|
23598
23623
|
return {
|
|
23599
23624
|
authenticated: false,
|
|
23600
|
-
error:
|
|
23625
|
+
error: needsAuthChallenge ? new NeedsAuthChallengeError() : new AvailabilityError(),
|
|
23601
23626
|
endpoint: config.auth.serverEndpoint,
|
|
23602
23627
|
pendingValidation: false
|
|
23603
23628
|
};
|
|
@@ -23612,7 +23637,7 @@ async function validateCredentials(config, signal2, clientConfig) {
|
|
|
23612
23637
|
return {
|
|
23613
23638
|
authenticated: false,
|
|
23614
23639
|
endpoint: config.auth.serverEndpoint,
|
|
23615
|
-
error:
|
|
23640
|
+
error: new InvalidAccessTokenError(),
|
|
23616
23641
|
pendingValidation: false
|
|
23617
23642
|
};
|
|
23618
23643
|
}
|
|
@@ -23628,10 +23653,9 @@ async function validateCredentials(config, signal2, clientConfig) {
|
|
|
23628
23653
|
authenticated: false,
|
|
23629
23654
|
endpoint: config.auth.serverEndpoint,
|
|
23630
23655
|
pendingValidation: false,
|
|
23631
|
-
error:
|
|
23632
|
-
|
|
23633
|
-
|
|
23634
|
-
}
|
|
23656
|
+
error: new EnterpriseUserDotComError(
|
|
23657
|
+
getEnterpriseName(((_b2 = userInfo.primaryEmail) == null ? void 0 : _b2.email) || "")
|
|
23658
|
+
)
|
|
23635
23659
|
};
|
|
23636
23660
|
}
|
|
23637
23661
|
}
|
|
@@ -23651,6 +23675,30 @@ function getEnterpriseName(email) {
|
|
|
23651
23675
|
const name = domain.split(".")[0];
|
|
23652
23676
|
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
23653
23677
|
}
|
|
23678
|
+
async function requestEndpointSettingsDeliveryToSearchPlugin() {
|
|
23679
|
+
const searchExtension = extensions.all.find(
|
|
23680
|
+
({ packageJSON }) => ["sourcegraph.@sourcegraph/vscode", "sourcegraph.sourcegraph"].includes(packageJSON.id)
|
|
23681
|
+
);
|
|
23682
|
+
const config = await firstResultFromOperation(resolvedConfig);
|
|
23683
|
+
searchExtension == null ? void 0 : searchExtension.activate().then(async () => {
|
|
23684
|
+
var _a3;
|
|
23685
|
+
const commandId = "sourcegraph.setEndpointSettings";
|
|
23686
|
+
const commands2 = (_a3 = searchExtension.packageJSON.contributes) == null ? void 0 : _a3.commands;
|
|
23687
|
+
if (Array.isArray(commands2)) {
|
|
23688
|
+
if (commands2.find(({ command }) => command === commandId)) {
|
|
23689
|
+
const authHeaders = await getAuthHeaders(
|
|
23690
|
+
config.auth,
|
|
23691
|
+
new URL(config.auth.serverEndpoint)
|
|
23692
|
+
);
|
|
23693
|
+
commands$1.executeCommand(commandId, {
|
|
23694
|
+
instanceUrl: config.auth.serverEndpoint,
|
|
23695
|
+
headers: authHeaders
|
|
23696
|
+
});
|
|
23697
|
+
}
|
|
23698
|
+
}
|
|
23699
|
+
});
|
|
23700
|
+
return config.auth.serverEndpoint;
|
|
23701
|
+
}
|
|
23654
23702
|
class ChatHistoryManager {
|
|
23655
23703
|
constructor() {
|
|
23656
23704
|
__publicField2(this, "disposables", []);
|
|
@@ -23731,15 +23779,34 @@ function getEditor() {
|
|
|
23731
23779
|
};
|
|
23732
23780
|
return get2();
|
|
23733
23781
|
}
|
|
23734
|
-
|
|
23735
|
-
|
|
23736
|
-
|
|
23737
|
-
|
|
23782
|
+
function ignoreReason(isIgnore) {
|
|
23783
|
+
if (lodashExports.isError(isIgnore)) {
|
|
23784
|
+
return isIgnore.message;
|
|
23785
|
+
}
|
|
23786
|
+
switch (isIgnore) {
|
|
23787
|
+
case false:
|
|
23788
|
+
return null;
|
|
23789
|
+
case "non-file-uri":
|
|
23790
|
+
return "This current file is ignored as it does not have a valid file URI.";
|
|
23791
|
+
case "no-repo-found":
|
|
23792
|
+
return "This current file is ignored as it is not in known git repository.";
|
|
23793
|
+
case "has-ignore-everything-filters":
|
|
23794
|
+
return "Your administrator has disabled Cody for this file.";
|
|
23795
|
+
default:
|
|
23796
|
+
if (isIgnore.startsWith("repo:")) {
|
|
23797
|
+
return `Your administrator has disabled Cody for '${isIgnore.replace("repo:", "")}'.`;
|
|
23798
|
+
}
|
|
23799
|
+
return "The current file is ignored by Cody.";
|
|
23800
|
+
}
|
|
23801
|
+
}
|
|
23802
|
+
async function showCodyIgnoreNotification(feature2, isIgnored) {
|
|
23803
|
+
const prefix = feature2 === "autocomplete" ? "Failed to generate autocomplete" : feature2 === "edit" ? "Edit failed to run" : feature2 === "test" ? "Failed to generate test" : "Command failed to run";
|
|
23804
|
+
window$1.showErrorMessage(`${prefix}: ${ignoreReason(isIgnored)}`);
|
|
23738
23805
|
}
|
|
23739
23806
|
async function isUriIgnoredByContextFilterWithNotification(uri, feature2) {
|
|
23740
23807
|
const isIgnored = await contextFiltersProvider.isUriIgnored(uri);
|
|
23741
23808
|
if (isIgnored) {
|
|
23742
|
-
showCodyIgnoreNotification(feature2);
|
|
23809
|
+
showCodyIgnoreNotification(feature2, isIgnored);
|
|
23743
23810
|
}
|
|
23744
23811
|
return isIgnored;
|
|
23745
23812
|
}
|
|
@@ -32334,12 +32401,27 @@ class RepoNameResolver {
|
|
|
32334
32401
|
if (remoteUrls.length === 0) {
|
|
32335
32402
|
return Observable.of([]);
|
|
32336
32403
|
}
|
|
32337
|
-
|
|
32338
|
-
|
|
32339
|
-
)
|
|
32340
|
-
|
|
32341
|
-
|
|
32342
|
-
|
|
32404
|
+
const remoteUrlsAndRepoNames = remoteUrls.map(
|
|
32405
|
+
(url) => this.getRepoNameCached(url).map((repoName) => [url, repoName])
|
|
32406
|
+
);
|
|
32407
|
+
return combineLatest$1(...remoteUrlsAndRepoNames).pipe(
|
|
32408
|
+
map$1((remoteUrlsAndRepoNames2) => {
|
|
32409
|
+
const repoNames = [];
|
|
32410
|
+
for (const [url, repoName] of remoteUrlsAndRepoNames2) {
|
|
32411
|
+
if (repoName === pendingOperation) {
|
|
32412
|
+
return pendingOperation;
|
|
32413
|
+
}
|
|
32414
|
+
if (!repoName) {
|
|
32415
|
+
const convertedName = convertGitCloneURLToCodebaseName(url);
|
|
32416
|
+
if (convertedName) {
|
|
32417
|
+
repoNames.push(convertedName);
|
|
32418
|
+
}
|
|
32419
|
+
} else {
|
|
32420
|
+
repoNames.push(repoName);
|
|
32421
|
+
}
|
|
32422
|
+
}
|
|
32423
|
+
return repoNames;
|
|
32424
|
+
})
|
|
32343
32425
|
);
|
|
32344
32426
|
}),
|
|
32345
32427
|
map$1((value) => {
|
|
@@ -42544,6 +42626,10 @@ class Agent extends MessageHandler {
|
|
|
42544
42626
|
contextFiltersProvider.setTestingContextFilters(contextFilters);
|
|
42545
42627
|
return null;
|
|
42546
42628
|
});
|
|
42629
|
+
this.registerAuthenticatedRequest("internal/getAuthHeaders", async (url) => {
|
|
42630
|
+
const config = await firstResultFromOperation(resolvedConfig);
|
|
42631
|
+
return await getAuthHeaders(config.auth, new URL(url));
|
|
42632
|
+
});
|
|
42547
42633
|
}
|
|
42548
42634
|
pushPendingPromise(pendingPromise) {
|
|
42549
42635
|
if (isIntegrationTesting) {
|
|
@@ -42853,8 +42939,7 @@ const CodyCommandMenuItems = [
|
|
|
42853
42939
|
description: "Generate Commit Message (Experimental)",
|
|
42854
42940
|
icon: "git-commit",
|
|
42855
42941
|
command: { command: "cody.command.generate-commit" },
|
|
42856
|
-
keybinding: ""
|
|
42857
|
-
requires: { setting: "cody.experimental.commitMessage" }
|
|
42942
|
+
keybinding: ""
|
|
42858
42943
|
},
|
|
42859
42944
|
{
|
|
42860
42945
|
key: "custom",
|
|
@@ -43920,7 +44005,7 @@ class CommandsProvider {
|
|
|
43920
44005
|
if (!isFileURI(uri)) {
|
|
43921
44006
|
throw new Error("history only supported on local file paths");
|
|
43922
44007
|
}
|
|
43923
|
-
const { getContextFileFromGitLog } = await import("./git-log-
|
|
44008
|
+
const { getContextFileFromGitLog } = await import("./git-log-lMMNBgcI.mjs");
|
|
43924
44009
|
return getContextFileFromGitLog(uri, options);
|
|
43925
44010
|
}
|
|
43926
44011
|
dispose() {
|
|
@@ -148067,7 +148152,7 @@ class DefaultCodeCompletionsClient {
|
|
|
148067
148152
|
...providerOptions == null ? void 0 : providerOptions.customHeaders,
|
|
148068
148153
|
...getClientIdentificationHeaders()
|
|
148069
148154
|
});
|
|
148070
|
-
headers
|
|
148155
|
+
setJSONAcceptContentTypeHeaders(headers);
|
|
148071
148156
|
addCodyClientIdentificationHeaders(headers);
|
|
148072
148157
|
if (tracingFlagEnabled) {
|
|
148073
148158
|
headers.set("X-Sourcegraph-Should-Trace", "1");
|
|
@@ -148117,7 +148202,7 @@ class DefaultCodeCompletionsClient {
|
|
|
148117
148202
|
if (!response.ok) {
|
|
148118
148203
|
throw recordErrorToSpan(
|
|
148119
148204
|
span2,
|
|
148120
|
-
new NetworkError(response, await response.text(), traceId)
|
|
148205
|
+
isCustomAuthChallengeResponse(response) ? new NeedsAuthChallengeError() : new NetworkError(response, await response.text(), traceId)
|
|
148121
148206
|
);
|
|
148122
148207
|
}
|
|
148123
148208
|
if (response.body === null) {
|
|
@@ -148637,6 +148722,14 @@ function getDecorationStats({
|
|
|
148637
148722
|
unchangedChars: charsStats.unchanged
|
|
148638
148723
|
};
|
|
148639
148724
|
}
|
|
148725
|
+
function isOnlyAddingTextForModifiedLines(modifiedLines) {
|
|
148726
|
+
for (const modifiedLine of modifiedLines) {
|
|
148727
|
+
if (modifiedLine.changes.some((change) => change.type === "delete")) {
|
|
148728
|
+
return false;
|
|
148729
|
+
}
|
|
148730
|
+
}
|
|
148731
|
+
return true;
|
|
148732
|
+
}
|
|
148640
148733
|
class AutoeditSuggestionIdRegistry {
|
|
148641
148734
|
constructor() {
|
|
148642
148735
|
__publicField2(this, "suggestionIdCache", new LRUCache$1({ max: 50 }));
|
|
@@ -149699,7 +149792,7 @@ function getSymbolDecorationPadding(document2, insertionLine, symbolRange) {
|
|
|
149699
149792
|
return Math.max(symbolAnchorCharacter2 - insertionEndCharacter2, 2);
|
|
149700
149793
|
}
|
|
149701
149794
|
const tabSize = getEditorTabSize$1(document2.uri, workspace, window$1);
|
|
149702
|
-
const tabAsSpace = UNICODE_SPACE$
|
|
149795
|
+
const tabAsSpace = UNICODE_SPACE$3.repeat(tabSize);
|
|
149703
149796
|
const insertionEndCharacter = insertionLine.text.slice(0, insertionLine.range.end.character).replaceAll(/\t/g, tabAsSpace).length;
|
|
149704
149797
|
const symbolAnchorPosition = symbolRange.start.character > insertionEndCharacter ? symbolRange.start.character : symbolRange.end.character;
|
|
149705
149798
|
const symbolAnchorCharacter = document2.lineAt(symbolRange.start.line).text.slice(0, symbolAnchorPosition).replaceAll(/\t/g, tabAsSpace).length;
|
|
@@ -149716,7 +149809,7 @@ async function getGhostHintEnablement() {
|
|
|
149716
149809
|
};
|
|
149717
149810
|
}
|
|
149718
149811
|
const GHOST_TEXT_COLOR$1 = new ThemeColor("editorGhostText.foreground");
|
|
149719
|
-
const UNICODE_SPACE$
|
|
149812
|
+
const UNICODE_SPACE$3 = " ";
|
|
149720
149813
|
const HINT_DECORATIONS = {
|
|
149721
149814
|
EditOrChat: {
|
|
149722
149815
|
text: `${EDIT_SHORTCUT_LABEL} to Edit, ${CHAT_SHORTCUT_LABEL} to Chat`,
|
|
@@ -149884,7 +149977,7 @@ class GhostHintDecorator {
|
|
|
149884
149977
|
}
|
|
149885
149978
|
this.fireThrottledDisplayEvent(variant);
|
|
149886
149979
|
const decorationHint = HINT_DECORATIONS[variant];
|
|
149887
|
-
const decorationText = UNICODE_SPACE$
|
|
149980
|
+
const decorationText = UNICODE_SPACE$3.repeat(textPadding) + decorationHint.text;
|
|
149888
149981
|
this.activeDecorationRange = new Range(position, position);
|
|
149889
149982
|
editor.setDecorations(HINT_DECORATIONS[variant].decoration, [
|
|
149890
149983
|
{
|
|
@@ -155808,9 +155901,14 @@ var canvaskit = { exports: {} };
|
|
|
155808
155901
|
})(canvaskit);
|
|
155809
155902
|
var canvaskitExports = canvaskit.exports;
|
|
155810
155903
|
const CanvasKitInit = /* @__PURE__ */ getDefaultExportFromCjs(canvaskitExports);
|
|
155811
|
-
let canvasKit = null;
|
|
155812
155904
|
let canvasKitInitPromise = null;
|
|
155905
|
+
let canvasKit = null;
|
|
155813
155906
|
let fontCache = null;
|
|
155907
|
+
async function initFont() {
|
|
155908
|
+
const fontPath = path.join("/tmp/__dirname", "DejaVuSansMono.ttf");
|
|
155909
|
+
const buffer2 = await fs.readFile(fontPath);
|
|
155910
|
+
return new Uint8Array(buffer2).buffer;
|
|
155911
|
+
}
|
|
155814
155912
|
async function initCanvas() {
|
|
155815
155913
|
if (!fontCache) {
|
|
155816
155914
|
fontCache = await initFont();
|
|
@@ -155822,13 +155920,73 @@ async function initCanvas() {
|
|
|
155822
155920
|
}
|
|
155823
155921
|
await canvasKitInitPromise;
|
|
155824
155922
|
}
|
|
155825
|
-
|
|
155826
|
-
|
|
155827
|
-
|
|
155828
|
-
|
|
155923
|
+
const DEFAULT_HIGHLIGHT_COLORS = {
|
|
155924
|
+
dark: "#ffffff",
|
|
155925
|
+
light: "#000000"
|
|
155926
|
+
};
|
|
155927
|
+
const GOLDEN_LINE_HEIGHT_RATIO = isMacOS() ? 1.5 : 1.35;
|
|
155928
|
+
const DEFAULT_FONT_SIZE = isMacOS() ? 12 : 14;
|
|
155929
|
+
const DEFAULT_PIXEL_RATIO = 1.95;
|
|
155930
|
+
function getUserLineHeight(fontSize) {
|
|
155931
|
+
return Math.round(GOLDEN_LINE_HEIGHT_RATIO * fontSize);
|
|
155932
|
+
}
|
|
155933
|
+
function getUserFontSize() {
|
|
155934
|
+
const userFontSize = Number(workspace.getConfiguration("editor").get("fontSize"));
|
|
155935
|
+
if (Number.isNaN(userFontSize) || userFontSize <= 0) {
|
|
155936
|
+
return;
|
|
155937
|
+
}
|
|
155938
|
+
return userFontSize;
|
|
155939
|
+
}
|
|
155940
|
+
function getUserPixelRatio() {
|
|
155941
|
+
const devicePixelRatio = localStorage.getDevicePixelRatio();
|
|
155942
|
+
if (!devicePixelRatio) {
|
|
155943
|
+
return;
|
|
155944
|
+
}
|
|
155945
|
+
return Math.max(devicePixelRatio, 1);
|
|
155946
|
+
}
|
|
155947
|
+
const DEFAULT_DIFF_COLORS = {
|
|
155948
|
+
inserted: {
|
|
155949
|
+
line: "rgba(155, 185, 85, 0.1)",
|
|
155950
|
+
text: "rgba(155, 185, 85, 0.15)"
|
|
155951
|
+
},
|
|
155952
|
+
removed: {
|
|
155953
|
+
line: "rgba(255, 0, 0, 0.1)",
|
|
155954
|
+
text: "rgba(255, 0, 0, 0.15)"
|
|
155955
|
+
}
|
|
155956
|
+
};
|
|
155957
|
+
function getRenderConfig(userProvidedConfig) {
|
|
155958
|
+
const pixelRatio = (userProvidedConfig == null ? void 0 : userProvidedConfig.pixelRatio) || getUserPixelRatio() || DEFAULT_PIXEL_RATIO;
|
|
155959
|
+
const fontSize = (userProvidedConfig == null ? void 0 : userProvidedConfig.fontSize) || getUserFontSize() || DEFAULT_FONT_SIZE;
|
|
155960
|
+
const lineHeight = (userProvidedConfig == null ? void 0 : userProvidedConfig.lineHeight) || getUserLineHeight(fontSize);
|
|
155961
|
+
return {
|
|
155962
|
+
fontSize,
|
|
155963
|
+
lineHeight,
|
|
155964
|
+
padding: { x: 6, y: 2 },
|
|
155965
|
+
maxWidth: 1200,
|
|
155966
|
+
pixelRatio,
|
|
155967
|
+
diffColors: DEFAULT_DIFF_COLORS,
|
|
155968
|
+
backgroundColor: userProvidedConfig == null ? void 0 : userProvidedConfig.backgroundColor
|
|
155969
|
+
};
|
|
155970
|
+
}
|
|
155971
|
+
function getRangesToHighlight(line) {
|
|
155972
|
+
switch (line.type) {
|
|
155973
|
+
case "removed":
|
|
155974
|
+
return [[0, line.text.length]];
|
|
155975
|
+
case "added":
|
|
155976
|
+
return [[0, line.text.length]];
|
|
155977
|
+
case "modified-removed":
|
|
155978
|
+
return line.changes.filter((change) => change.type === "delete").map(({ originalRange }) => [originalRange.start.character, originalRange.end.character]);
|
|
155979
|
+
case "modified-added":
|
|
155980
|
+
return line.changes.filter((change) => change.type === "insert").map((change) => [
|
|
155981
|
+
change.modifiedRange.start.character,
|
|
155982
|
+
change.modifiedRange.end.character
|
|
155983
|
+
]);
|
|
155984
|
+
default:
|
|
155985
|
+
return [];
|
|
155986
|
+
}
|
|
155829
155987
|
}
|
|
155830
155988
|
function createCanvas(options, context2) {
|
|
155831
|
-
const { width, height, fontSize, scale } = options;
|
|
155989
|
+
const { width, height, fontSize, scale, backgroundColor } = options;
|
|
155832
155990
|
const canvas = context2.CanvasKit.MakeCanvas(width, height);
|
|
155833
155991
|
canvas.loadFont(context2.font, { family: "DejaVuSansMono" });
|
|
155834
155992
|
const ctx = canvas.getContext("2d");
|
|
@@ -155839,48 +155997,50 @@ function createCanvas(options, context2) {
|
|
|
155839
155997
|
if (scale) {
|
|
155840
155998
|
ctx.scale(scale, scale);
|
|
155841
155999
|
}
|
|
156000
|
+
if (backgroundColor) {
|
|
156001
|
+
ctx.fillStyle = backgroundColor;
|
|
156002
|
+
ctx.fillRect(0, 0, width, height);
|
|
156003
|
+
}
|
|
155842
156004
|
return { canvas, ctx };
|
|
155843
156005
|
}
|
|
155844
156006
|
function drawText(ctx, line, position, mode, config) {
|
|
155845
|
-
const
|
|
155846
|
-
|
|
155847
|
-
|
|
155848
|
-
|
|
155849
|
-
ctx.
|
|
155850
|
-
ctx.fillText(line.lineText, position.x, position.y + config.fontSize);
|
|
155851
|
-
return ctx.measureText(line.lineText).width;
|
|
156007
|
+
const highlights = line.syntaxHighlights[mode];
|
|
156008
|
+
if (highlights.length === 0) {
|
|
156009
|
+
ctx.fillStyle = DEFAULT_HIGHLIGHT_COLORS[mode];
|
|
156010
|
+
ctx.fillText(line.text, position.x, position.y + config.fontSize);
|
|
156011
|
+
return ctx.measureText(line.text).width;
|
|
155852
156012
|
}
|
|
155853
156013
|
let xPos = position.x;
|
|
155854
|
-
for (const
|
|
155855
|
-
const
|
|
155856
|
-
|
|
156014
|
+
for (const { range, color } of highlights) {
|
|
156015
|
+
const [start2, end] = range;
|
|
156016
|
+
const content = line.text.substring(start2, end);
|
|
156017
|
+
ctx.fillStyle = color;
|
|
155857
156018
|
ctx.fillText(content, xPos, position.y + config.fontSize);
|
|
155858
156019
|
xPos += ctx.measureText(content).width;
|
|
155859
156020
|
}
|
|
155860
156021
|
return xPos;
|
|
155861
156022
|
}
|
|
155862
|
-
function drawDiffColors(ctx, line, position, config) {
|
|
155863
|
-
const
|
|
155864
|
-
|
|
155865
|
-
)
|
|
155866
|
-
|
|
156023
|
+
function drawDiffColors(ctx, line, position, mode, config) {
|
|
156024
|
+
const isRemoval = line.type === "removed" || line.type === "modified-removed";
|
|
156025
|
+
const diffColors = isRemoval ? config.diffColors.removed : config.diffColors.inserted;
|
|
156026
|
+
if (mode === "unified" && line.type !== "unchanged") {
|
|
156027
|
+
const endOfLine = ctx.measureText(line.text).width;
|
|
156028
|
+
ctx.fillStyle = diffColors.line;
|
|
156029
|
+
ctx.fillRect(position.x, position.y, endOfLine, config.lineHeight);
|
|
156030
|
+
}
|
|
156031
|
+
const ranges2 = getRangesToHighlight(line);
|
|
156032
|
+
if (ranges2.length === 0) {
|
|
155867
156033
|
return;
|
|
155868
156034
|
}
|
|
155869
|
-
ctx.fillStyle =
|
|
155870
|
-
for (const
|
|
155871
|
-
const preHighlightWidth = ctx.measureText(line.
|
|
155872
|
-
const highlightWidth = ctx.measureText(line.
|
|
156035
|
+
ctx.fillStyle = diffColors.text;
|
|
156036
|
+
for (const [start2, end] of ranges2) {
|
|
156037
|
+
const preHighlightWidth = ctx.measureText(line.text.slice(0, start2)).width;
|
|
156038
|
+
const highlightWidth = ctx.measureText(line.text.slice(start2, end)).width;
|
|
155873
156039
|
ctx.fillRect(position.x + preHighlightWidth, position.y, highlightWidth, config.lineHeight);
|
|
155874
156040
|
}
|
|
155875
156041
|
}
|
|
155876
|
-
function drawDecorationsToCanvas(
|
|
155877
|
-
|
|
155878
|
-
lineHeight: 14,
|
|
155879
|
-
padding: { x: 6, y: 2 },
|
|
155880
|
-
maxWidth: 600,
|
|
155881
|
-
pixelRatio: 2,
|
|
155882
|
-
diffHighlightColor: "rgba(35, 134, 54, 0.2)"
|
|
155883
|
-
}) {
|
|
156042
|
+
function drawDecorationsToCanvas(diff2, theme, mode, userConfig) {
|
|
156043
|
+
var _a3;
|
|
155884
156044
|
if (!canvasKit || !fontCache) {
|
|
155885
156045
|
throw new Error("Canvas not initialized");
|
|
155886
156046
|
}
|
|
@@ -155888,33 +156048,37 @@ function drawDecorationsToCanvas(decorations2, mode, renderConfig = {
|
|
|
155888
156048
|
CanvasKit: canvasKit,
|
|
155889
156049
|
font: fontCache
|
|
155890
156050
|
};
|
|
155891
|
-
const
|
|
155892
|
-
|
|
156051
|
+
const config = getRenderConfig(userConfig);
|
|
156052
|
+
const { ctx: tempCtx } = createCanvas({ height: 10, width: 10, fontSize: config.fontSize }, context2);
|
|
156053
|
+
let tempYPos = config.padding.y;
|
|
155893
156054
|
let requiredWidth = 0;
|
|
155894
|
-
for (const
|
|
155895
|
-
const measure = tempCtx.measureText(
|
|
155896
|
-
requiredWidth = Math.max(requiredWidth,
|
|
155897
|
-
tempYPos +=
|
|
155898
|
-
}
|
|
155899
|
-
const canvasWidth = Math.min(requiredWidth +
|
|
155900
|
-
const canvasHeight = tempYPos +
|
|
156055
|
+
for (const line of diff2.lines) {
|
|
156056
|
+
const measure = tempCtx.measureText(line.text);
|
|
156057
|
+
requiredWidth = Math.max(requiredWidth, config.padding.x + measure.width);
|
|
156058
|
+
tempYPos += config.lineHeight;
|
|
156059
|
+
}
|
|
156060
|
+
const canvasWidth = Math.min(requiredWidth + config.padding.x, config.maxWidth);
|
|
156061
|
+
const canvasHeight = tempYPos + config.padding.y;
|
|
156062
|
+
const height = Math.round(canvasHeight * config.pixelRatio);
|
|
156063
|
+
const width = Math.round(canvasWidth * config.pixelRatio);
|
|
155901
156064
|
const { canvas, ctx } = createCanvas(
|
|
155902
156065
|
{
|
|
155903
|
-
height
|
|
155904
|
-
width
|
|
155905
|
-
fontSize:
|
|
156066
|
+
height,
|
|
156067
|
+
width,
|
|
156068
|
+
fontSize: config.fontSize,
|
|
155906
156069
|
// We upscale the canvas to improve resolution, this will be brought back to the intended size
|
|
155907
156070
|
// using the `scale` CSS property when the decoration is rendered.
|
|
155908
|
-
scale:
|
|
156071
|
+
scale: config.pixelRatio,
|
|
156072
|
+
backgroundColor: (_a3 = config.backgroundColor) == null ? void 0 : _a3[theme]
|
|
155909
156073
|
},
|
|
155910
156074
|
context2
|
|
155911
156075
|
);
|
|
155912
|
-
let yPos =
|
|
155913
|
-
for (const line of
|
|
155914
|
-
const position = { x:
|
|
155915
|
-
drawDiffColors(ctx, line, position,
|
|
155916
|
-
drawText(ctx, line, position,
|
|
155917
|
-
yPos +=
|
|
156076
|
+
let yPos = config.padding.y;
|
|
156077
|
+
for (const line of diff2.lines) {
|
|
156078
|
+
const position = { x: config.padding.x, y: yPos };
|
|
156079
|
+
drawDiffColors(ctx, line, position, mode, config);
|
|
156080
|
+
drawText(ctx, line, position, theme, config);
|
|
156081
|
+
yPos += config.lineHeight;
|
|
155918
156082
|
}
|
|
155919
156083
|
return canvas;
|
|
155920
156084
|
}
|
|
@@ -162181,56 +162345,100 @@ async function initSyntaxHighlighter() {
|
|
|
162181
162345
|
syntaxHighlighter = await getShiki();
|
|
162182
162346
|
}
|
|
162183
162347
|
}
|
|
162184
|
-
function
|
|
162348
|
+
function getLines(diff2, type) {
|
|
162349
|
+
if (type === "original") {
|
|
162350
|
+
return diff2.lines.filter(
|
|
162351
|
+
(line) => ["removed", "modified-removed", "unchanged"].includes(line.type)
|
|
162352
|
+
);
|
|
162353
|
+
}
|
|
162354
|
+
return diff2.lines.filter(
|
|
162355
|
+
(line) => ["added", "modified-added", "unchanged"].includes(line.type)
|
|
162356
|
+
);
|
|
162357
|
+
}
|
|
162358
|
+
function getCodeBlock(diff2, type) {
|
|
162359
|
+
if (type === "original") {
|
|
162360
|
+
const relevantLines2 = getLines(diff2, "original");
|
|
162361
|
+
if (relevantLines2.length === 0) {
|
|
162362
|
+
return null;
|
|
162363
|
+
}
|
|
162364
|
+
const code22 = relevantLines2.map((line) => line.text).join("\n");
|
|
162365
|
+
return { code: code22, startLine: relevantLines2[0].originalLineNumber };
|
|
162366
|
+
}
|
|
162367
|
+
const relevantLines = getLines(diff2, "incoming");
|
|
162368
|
+
if (relevantLines.length === 0) {
|
|
162369
|
+
return null;
|
|
162370
|
+
}
|
|
162371
|
+
const code18 = relevantLines.map((line) => line.text).join("\n");
|
|
162372
|
+
return { code: code18, startLine: relevantLines[0].modifiedLineNumber };
|
|
162373
|
+
}
|
|
162374
|
+
function getHighlightTokens({
|
|
162375
|
+
diff: diff2,
|
|
162376
|
+
lang,
|
|
162377
|
+
theme,
|
|
162378
|
+
type
|
|
162379
|
+
}) {
|
|
162185
162380
|
var _a3;
|
|
162186
162381
|
if (!syntaxHighlighter) {
|
|
162187
162382
|
throw new Error("Syntax highlighter not initialized");
|
|
162188
162383
|
}
|
|
162189
162384
|
const highlightLang = (_a3 = SYNTAX_HIGHLIGHTING_LANGUAGES[lang]) == null ? void 0 : _a3.name;
|
|
162190
162385
|
if (!highlightLang) {
|
|
162191
|
-
return
|
|
162386
|
+
return /* @__PURE__ */ new Map();
|
|
162192
162387
|
}
|
|
162193
|
-
const
|
|
162194
|
-
|
|
162195
|
-
|
|
162388
|
+
const codeBlock = getCodeBlock(diff2, type);
|
|
162389
|
+
if (!codeBlock) {
|
|
162390
|
+
return /* @__PURE__ */ new Map();
|
|
162391
|
+
}
|
|
162392
|
+
const { tokens } = syntaxHighlighter.codeToTokens(codeBlock.code, {
|
|
162393
|
+
theme: SYNTAX_HIGHLIGHTING_THEMES[theme].name,
|
|
162196
162394
|
lang: highlightLang
|
|
162197
162395
|
});
|
|
162198
|
-
const
|
|
162199
|
-
|
|
162200
|
-
const lineTokens = tokens[
|
|
162201
|
-
|
|
162202
|
-
|
|
162203
|
-
|
|
162204
|
-
let currentPosition = 0;
|
|
162205
|
-
for (const token of lineTokens) {
|
|
162206
|
-
const tokenLength = token.content.length;
|
|
162207
|
-
const startPos = currentPosition;
|
|
162208
|
-
const endPos = currentPosition + tokenLength;
|
|
162209
|
-
newHighlightedRanges.push({
|
|
162210
|
-
type: "syntax-highlighted",
|
|
162211
|
-
range: [startPos, endPos],
|
|
162212
|
-
color: token.color || defaultColour
|
|
162213
|
-
});
|
|
162214
|
-
currentPosition += tokenLength;
|
|
162215
|
-
}
|
|
162216
|
-
newHighlightedRanges.sort((a, b) => a.range[0] - b.range[0]);
|
|
162217
|
-
return {
|
|
162218
|
-
...decoration,
|
|
162219
|
-
highlightedRanges: newHighlightedRanges
|
|
162220
|
-
};
|
|
162221
|
-
});
|
|
162396
|
+
const result = /* @__PURE__ */ new Map();
|
|
162397
|
+
for (let i2 = 0; i2 < tokens.length; i2++) {
|
|
162398
|
+
const lineTokens = tokens[i2];
|
|
162399
|
+
result.set(i2 + codeBlock.startLine, lineTokens);
|
|
162400
|
+
}
|
|
162401
|
+
return result;
|
|
162222
162402
|
}
|
|
162223
|
-
|
|
162224
|
-
|
|
162403
|
+
function getHighlightsForLine(lineTokens, theme) {
|
|
162404
|
+
const syntaxHighlights = [];
|
|
162405
|
+
let currentPosition = 0;
|
|
162406
|
+
for (const token of lineTokens) {
|
|
162407
|
+
const tokenLength = token.content.length;
|
|
162408
|
+
const startPos = currentPosition;
|
|
162409
|
+
const endPos = currentPosition + tokenLength;
|
|
162410
|
+
syntaxHighlights.push({
|
|
162411
|
+
range: [startPos, endPos],
|
|
162412
|
+
color: token.color || DEFAULT_HIGHLIGHT_COLORS[theme]
|
|
162413
|
+
});
|
|
162414
|
+
currentPosition += tokenLength;
|
|
162415
|
+
}
|
|
162416
|
+
return syntaxHighlights;
|
|
162225
162417
|
}
|
|
162226
|
-
function
|
|
162227
|
-
const
|
|
162228
|
-
|
|
162229
|
-
|
|
162230
|
-
|
|
162231
|
-
|
|
162232
|
-
|
|
162233
|
-
|
|
162418
|
+
function syntaxHighlightDecorations(diff2, lang, theme) {
|
|
162419
|
+
const incomingHighlights = getHighlightTokens({
|
|
162420
|
+
diff: diff2,
|
|
162421
|
+
lang,
|
|
162422
|
+
theme,
|
|
162423
|
+
type: "incoming"
|
|
162424
|
+
});
|
|
162425
|
+
let originalHighlights;
|
|
162426
|
+
if (diff2.mode === "unified") {
|
|
162427
|
+
originalHighlights = getHighlightTokens({
|
|
162428
|
+
diff: diff2,
|
|
162429
|
+
lang,
|
|
162430
|
+
theme,
|
|
162431
|
+
type: "original"
|
|
162432
|
+
});
|
|
162433
|
+
}
|
|
162434
|
+
const lines2 = diff2.lines.map((line) => {
|
|
162435
|
+
const lineTokens = line.type === "removed" || line.type === "modified-removed" ? originalHighlights == null ? void 0 : originalHighlights.get(line.originalLineNumber) : incomingHighlights.get(line.modifiedLineNumber);
|
|
162436
|
+
if (lineTokens) {
|
|
162437
|
+
line.syntaxHighlights[theme] = getHighlightsForLine(lineTokens, theme);
|
|
162438
|
+
}
|
|
162439
|
+
return line;
|
|
162440
|
+
});
|
|
162441
|
+
return { mode: diff2.mode, lines: lines2 };
|
|
162234
162442
|
}
|
|
162235
162443
|
const INDENT_REGEX = /^(?:( )+|\t+)/;
|
|
162236
162444
|
const INDENT_TYPE_SPACE = "space";
|
|
@@ -162327,6 +162535,264 @@ function detectIndent(string2) {
|
|
|
162327
162535
|
indent
|
|
162328
162536
|
};
|
|
162329
162537
|
}
|
|
162538
|
+
const UNICODE_SPACE$2 = " ";
|
|
162539
|
+
function blockify$1(diff2, document2) {
|
|
162540
|
+
const spaceAdjusted = convertToSpaceIndentation$1(document2, diff2);
|
|
162541
|
+
const leadingRemoved = removeLeadingWhitespaceBlock$1(spaceAdjusted);
|
|
162542
|
+
const paddingAdded = padTrailingWhitespaceBlock$1(leadingRemoved);
|
|
162543
|
+
return paddingAdded;
|
|
162544
|
+
}
|
|
162545
|
+
const transformToUnicodeSpace = (text2) => text2.replace(/^\s+/, (match2) => UNICODE_SPACE$2.repeat(match2.length));
|
|
162546
|
+
const transformTabsToSpaces = (text2, tabSize) => text2.replace(/^(\t+)/, (match2) => UNICODE_SPACE$2.repeat(match2.length * tabSize));
|
|
162547
|
+
const countLeadingTabs = (text2) => (text2.match(/\t/g) || []).length;
|
|
162548
|
+
function convertToSpaceIndentation$1(document2, diff2) {
|
|
162549
|
+
const codeBlock = getCodeBlock(diff2, "incoming");
|
|
162550
|
+
if (!codeBlock) {
|
|
162551
|
+
return diff2;
|
|
162552
|
+
}
|
|
162553
|
+
const incomingIndentation = detectIndent(codeBlock.code).type;
|
|
162554
|
+
if (incomingIndentation === "space") {
|
|
162555
|
+
const lines22 = diff2.lines.map((line) => {
|
|
162556
|
+
return {
|
|
162557
|
+
...line,
|
|
162558
|
+
text: transformToUnicodeSpace(line.text)
|
|
162559
|
+
};
|
|
162560
|
+
});
|
|
162561
|
+
return { ...diff2, lines: lines22 };
|
|
162562
|
+
}
|
|
162563
|
+
const tabSize = getEditorTabSize$1(document2.uri, workspace, window$1);
|
|
162564
|
+
const lines2 = diff2.lines.map((line) => {
|
|
162565
|
+
const leadingTabs = countLeadingTabs(line.text);
|
|
162566
|
+
return {
|
|
162567
|
+
...line,
|
|
162568
|
+
changes: "changes" in line ? shiftChanges(line.changes, leadingTabs * (tabSize - 1)) : [],
|
|
162569
|
+
highlights: shiftHighlights(line.syntaxHighlights, leadingTabs * (tabSize - 1)),
|
|
162570
|
+
text: transformTabsToSpaces(line.text, tabSize)
|
|
162571
|
+
};
|
|
162572
|
+
});
|
|
162573
|
+
return { ...diff2, lines: lines2 };
|
|
162574
|
+
}
|
|
162575
|
+
function removeLeadingWhitespaceBlock$1(diff2) {
|
|
162576
|
+
let leastCommonWhitespacePrefix = void 0;
|
|
162577
|
+
for (const line of diff2.lines) {
|
|
162578
|
+
if (line.type === "modified-removed" || line.type === "removed") {
|
|
162579
|
+
continue;
|
|
162580
|
+
}
|
|
162581
|
+
const leadingWhitespaceMatch = line.text.match(/^\s*/);
|
|
162582
|
+
if (leadingWhitespaceMatch === null) {
|
|
162583
|
+
leastCommonWhitespacePrefix = "";
|
|
162584
|
+
break;
|
|
162585
|
+
}
|
|
162586
|
+
const leadingWhitespace = leadingWhitespaceMatch[0];
|
|
162587
|
+
if (leastCommonWhitespacePrefix === void 0) {
|
|
162588
|
+
leastCommonWhitespacePrefix = leadingWhitespace;
|
|
162589
|
+
continue;
|
|
162590
|
+
}
|
|
162591
|
+
leastCommonWhitespacePrefix = getCommonPrefix$1(leastCommonWhitespacePrefix, leadingWhitespace);
|
|
162592
|
+
}
|
|
162593
|
+
if (!leastCommonWhitespacePrefix) {
|
|
162594
|
+
return diff2;
|
|
162595
|
+
}
|
|
162596
|
+
const lines2 = diff2.lines.map((line) => {
|
|
162597
|
+
return {
|
|
162598
|
+
...line,
|
|
162599
|
+
changes: "changes" in line ? shiftChanges(line.changes, -leastCommonWhitespacePrefix.length) : [],
|
|
162600
|
+
highlights: shiftHighlights(line.syntaxHighlights, -leastCommonWhitespacePrefix.length),
|
|
162601
|
+
text: line.text.substring(leastCommonWhitespacePrefix.length)
|
|
162602
|
+
};
|
|
162603
|
+
});
|
|
162604
|
+
return { ...diff2, lines: lines2 };
|
|
162605
|
+
}
|
|
162606
|
+
function padTrailingWhitespaceBlock$1(diff2) {
|
|
162607
|
+
let maxLineWidth = 0;
|
|
162608
|
+
for (const line of diff2.lines) {
|
|
162609
|
+
maxLineWidth = Math.max(maxLineWidth, line.text.length);
|
|
162610
|
+
}
|
|
162611
|
+
const lines2 = diff2.lines.map((line) => {
|
|
162612
|
+
return {
|
|
162613
|
+
...line,
|
|
162614
|
+
text: line.text.padEnd(maxLineWidth, UNICODE_SPACE$2)
|
|
162615
|
+
};
|
|
162616
|
+
});
|
|
162617
|
+
return { ...diff2, lines: lines2 };
|
|
162618
|
+
}
|
|
162619
|
+
function shiftHighlights(highlights, offset2) {
|
|
162620
|
+
return {
|
|
162621
|
+
light: highlights.light.map(({ range: [start2, end], ...rest }) => {
|
|
162622
|
+
return {
|
|
162623
|
+
...rest,
|
|
162624
|
+
range: [start2 + offset2, end + offset2]
|
|
162625
|
+
};
|
|
162626
|
+
}),
|
|
162627
|
+
dark: highlights.dark.map(({ range: [start2, end], ...rest }) => {
|
|
162628
|
+
return {
|
|
162629
|
+
...rest,
|
|
162630
|
+
range: [start2 + offset2, end + offset2]
|
|
162631
|
+
};
|
|
162632
|
+
})
|
|
162633
|
+
};
|
|
162634
|
+
}
|
|
162635
|
+
function shiftChanges(changes, offset2) {
|
|
162636
|
+
return changes.map((change) => {
|
|
162637
|
+
return {
|
|
162638
|
+
...change,
|
|
162639
|
+
originalRange: new Range(
|
|
162640
|
+
change.originalRange.start.line,
|
|
162641
|
+
Math.max(0, change.originalRange.start.character + offset2),
|
|
162642
|
+
change.originalRange.end.line,
|
|
162643
|
+
Math.max(0, change.originalRange.end.character + offset2)
|
|
162644
|
+
),
|
|
162645
|
+
modifiedRange: new Range(
|
|
162646
|
+
change.modifiedRange.start.line,
|
|
162647
|
+
Math.max(0, change.modifiedRange.start.character + offset2),
|
|
162648
|
+
change.modifiedRange.end.line,
|
|
162649
|
+
Math.max(0, change.modifiedRange.end.character + offset2)
|
|
162650
|
+
)
|
|
162651
|
+
};
|
|
162652
|
+
});
|
|
162653
|
+
}
|
|
162654
|
+
function getCommonPrefix$1(s1, s2) {
|
|
162655
|
+
const minLength = Math.min(s1.length, s2.length);
|
|
162656
|
+
let commonPrefix = "";
|
|
162657
|
+
for (let i2 = 0; i2 < minLength; i2++) {
|
|
162658
|
+
if (s1[i2] === s2[i2]) {
|
|
162659
|
+
commonPrefix += s1[i2];
|
|
162660
|
+
} else {
|
|
162661
|
+
break;
|
|
162662
|
+
}
|
|
162663
|
+
}
|
|
162664
|
+
return commonPrefix;
|
|
162665
|
+
}
|
|
162666
|
+
function makeDecoratedDiff(decorationInfo, lang, mode, document2) {
|
|
162667
|
+
const visualDiff = makeVisualDiff(decorationInfo, mode);
|
|
162668
|
+
const blockifiedDiff = blockify$1(visualDiff, document2);
|
|
162669
|
+
return {
|
|
162670
|
+
dark: syntaxHighlightDecorations(blockifiedDiff, lang, "dark"),
|
|
162671
|
+
light: syntaxHighlightDecorations(blockifiedDiff, lang, "light")
|
|
162672
|
+
};
|
|
162673
|
+
}
|
|
162674
|
+
function makeVisualDiff(decorationInfo, mode) {
|
|
162675
|
+
const sortedDiff = [
|
|
162676
|
+
...decorationInfo.addedLines,
|
|
162677
|
+
...decorationInfo.modifiedLines,
|
|
162678
|
+
...decorationInfo.unchangedLines,
|
|
162679
|
+
...decorationInfo.removedLines
|
|
162680
|
+
].sort((a, b) => {
|
|
162681
|
+
const aLine = a.type === "removed" ? a.originalLineNumber : a.modifiedLineNumber;
|
|
162682
|
+
const bLine = b.type === "removed" ? b.originalLineNumber : b.modifiedLineNumber;
|
|
162683
|
+
return aLine - bLine;
|
|
162684
|
+
});
|
|
162685
|
+
const firstRelevantLine = sortedDiff.findIndex((line) => line.type !== "unchanged");
|
|
162686
|
+
const lastRelevantLine = sortedDiff.findLastIndex((line) => line.type !== "unchanged");
|
|
162687
|
+
const relevantDiff = sortedDiff.slice(firstRelevantLine, lastRelevantLine + 1);
|
|
162688
|
+
if (relevantDiff.length === 0 || relevantDiff.every((line) => line.type === "unchanged")) {
|
|
162689
|
+
return { mode, lines: [] };
|
|
162690
|
+
}
|
|
162691
|
+
if (mode === "additions") {
|
|
162692
|
+
const lines22 = relevantDiff.filter((line) => ["added", "modified", "unchanged"].includes(line.type)).map((line) => {
|
|
162693
|
+
if (line.type === "modified") {
|
|
162694
|
+
return {
|
|
162695
|
+
type: "modified-added",
|
|
162696
|
+
text: line.newText,
|
|
162697
|
+
changes: line.changes,
|
|
162698
|
+
originalLineNumber: line.originalLineNumber,
|
|
162699
|
+
modifiedLineNumber: line.modifiedLineNumber,
|
|
162700
|
+
syntaxHighlights: {
|
|
162701
|
+
dark: [],
|
|
162702
|
+
light: []
|
|
162703
|
+
}
|
|
162704
|
+
};
|
|
162705
|
+
}
|
|
162706
|
+
return {
|
|
162707
|
+
...line,
|
|
162708
|
+
syntaxHighlights: {
|
|
162709
|
+
dark: [],
|
|
162710
|
+
light: []
|
|
162711
|
+
}
|
|
162712
|
+
};
|
|
162713
|
+
});
|
|
162714
|
+
return { mode, lines: lines22 };
|
|
162715
|
+
}
|
|
162716
|
+
const lines2 = [];
|
|
162717
|
+
const deletions = [];
|
|
162718
|
+
const additions = [];
|
|
162719
|
+
for (let i2 = 0; i2 < relevantDiff.length; i2++) {
|
|
162720
|
+
const line = relevantDiff[i2];
|
|
162721
|
+
if (line.type === "modified") {
|
|
162722
|
+
const additionsOnly = isOnlyAddingTextForModifiedLines([line]);
|
|
162723
|
+
if (!additionsOnly) {
|
|
162724
|
+
deletions.push({
|
|
162725
|
+
type: "modified-removed",
|
|
162726
|
+
text: line.oldText,
|
|
162727
|
+
changes: line.changes,
|
|
162728
|
+
originalLineNumber: line.originalLineNumber,
|
|
162729
|
+
modifiedLineNumber: line.modifiedLineNumber,
|
|
162730
|
+
syntaxHighlights: {
|
|
162731
|
+
dark: [],
|
|
162732
|
+
light: []
|
|
162733
|
+
}
|
|
162734
|
+
});
|
|
162735
|
+
}
|
|
162736
|
+
additions.push({
|
|
162737
|
+
type: "modified-added",
|
|
162738
|
+
text: line.newText,
|
|
162739
|
+
changes: line.changes,
|
|
162740
|
+
originalLineNumber: line.originalLineNumber,
|
|
162741
|
+
modifiedLineNumber: line.modifiedLineNumber,
|
|
162742
|
+
syntaxHighlights: {
|
|
162743
|
+
dark: [],
|
|
162744
|
+
light: []
|
|
162745
|
+
}
|
|
162746
|
+
});
|
|
162747
|
+
} else if (line.type === "removed") {
|
|
162748
|
+
deletions.push({
|
|
162749
|
+
...line,
|
|
162750
|
+
syntaxHighlights: {
|
|
162751
|
+
dark: [],
|
|
162752
|
+
light: []
|
|
162753
|
+
}
|
|
162754
|
+
});
|
|
162755
|
+
} else if (line.type === "added") {
|
|
162756
|
+
additions.push({
|
|
162757
|
+
...line,
|
|
162758
|
+
syntaxHighlights: {
|
|
162759
|
+
dark: [],
|
|
162760
|
+
light: []
|
|
162761
|
+
}
|
|
162762
|
+
});
|
|
162763
|
+
} else {
|
|
162764
|
+
if (deletions.length > 0 || additions.length > 0) {
|
|
162765
|
+
lines2.push(...deletions, ...additions);
|
|
162766
|
+
deletions.length = 0;
|
|
162767
|
+
additions.length = 0;
|
|
162768
|
+
}
|
|
162769
|
+
lines2.push({
|
|
162770
|
+
...line,
|
|
162771
|
+
syntaxHighlights: {
|
|
162772
|
+
dark: [],
|
|
162773
|
+
light: []
|
|
162774
|
+
}
|
|
162775
|
+
});
|
|
162776
|
+
}
|
|
162777
|
+
}
|
|
162778
|
+
if (deletions.length > 0 || additions.length > 0) {
|
|
162779
|
+
lines2.push(...deletions, ...additions);
|
|
162780
|
+
}
|
|
162781
|
+
return { mode, lines: lines2 };
|
|
162782
|
+
}
|
|
162783
|
+
async function initImageSuggestionService() {
|
|
162784
|
+
return Promise.all([initSyntaxHighlighter(), initCanvas()]);
|
|
162785
|
+
}
|
|
162786
|
+
function generateSuggestionAsImage(options) {
|
|
162787
|
+
const { decorations: decorations2, lang, config, mode, document: document2 } = options;
|
|
162788
|
+
const diff2 = makeDecoratedDiff(decorations2, lang, mode, document2);
|
|
162789
|
+
const renderConfig = getRenderConfig(config);
|
|
162790
|
+
return {
|
|
162791
|
+
dark: drawDecorationsToCanvas(diff2.dark, "dark", mode, renderConfig).toDataURL("image/png"),
|
|
162792
|
+
light: drawDecorationsToCanvas(diff2.light, "light", mode, renderConfig).toDataURL("image/png"),
|
|
162793
|
+
pixelRatio: renderConfig.pixelRatio
|
|
162794
|
+
};
|
|
162795
|
+
}
|
|
162330
162796
|
const UNICODE_SPACE$1 = " ";
|
|
162331
162797
|
function blockify(document2, addedLines) {
|
|
162332
162798
|
const spaceAdjusted = convertToSpaceIndentation(document2, addedLines);
|
|
@@ -162518,7 +162984,7 @@ class DefaultDecorator {
|
|
|
162518
162984
|
}
|
|
162519
162985
|
if (this.options.shouldRenderImage) {
|
|
162520
162986
|
this.renderAddedLinesImageDecorations(
|
|
162521
|
-
|
|
162987
|
+
decorationInfo,
|
|
162522
162988
|
addedLinesInfo.startLine,
|
|
162523
162989
|
addedLinesInfo.replacerCol
|
|
162524
162990
|
);
|
|
@@ -162670,11 +163136,13 @@ class DefaultDecorator {
|
|
|
162670
163136
|
]);
|
|
162671
163137
|
this.editor.setDecorations(this.addedLinesDecorationType, replacerDecorations);
|
|
162672
163138
|
}
|
|
162673
|
-
renderAddedLinesImageDecorations(
|
|
162674
|
-
const
|
|
162675
|
-
const { dark, light: light2 } = generateSuggestionAsImage({
|
|
162676
|
-
decorations:
|
|
162677
|
-
lang: this.editor.document.languageId
|
|
163139
|
+
renderAddedLinesImageDecorations(decorationInfo, startLine, replacerCol) {
|
|
163140
|
+
const diffMode = "additions";
|
|
163141
|
+
const { dark, light: light2, pixelRatio } = generateSuggestionAsImage({
|
|
163142
|
+
decorations: decorationInfo,
|
|
163143
|
+
lang: this.editor.document.languageId,
|
|
163144
|
+
mode: diffMode,
|
|
163145
|
+
document: this.editor.document
|
|
162678
163146
|
});
|
|
162679
163147
|
const startLineEndColumn = this.getEndColumn(this.editor.document.lineAt(startLine));
|
|
162680
163148
|
const decorationPadding = 4;
|
|
@@ -162684,10 +163152,13 @@ class DefaultDecorator {
|
|
|
162684
163152
|
position: "absolute",
|
|
162685
163153
|
// Make sure the decoration is rendered on top of other decorations
|
|
162686
163154
|
"z-index": "9999",
|
|
162687
|
-
// Scale
|
|
162688
|
-
scale:
|
|
163155
|
+
// Scale the decoration to the correct size (upscaled to boost resolution)
|
|
163156
|
+
scale: String(1 / pixelRatio),
|
|
162689
163157
|
"transform-origin": "0px 0px",
|
|
162690
|
-
height: "auto"
|
|
163158
|
+
height: "auto",
|
|
163159
|
+
// The decoration will be entirely taken up by the image.
|
|
163160
|
+
// Setting the line-height to 0 ensures that there is no additional padding added by the decoration area.
|
|
163161
|
+
"line-height": "0"
|
|
162691
163162
|
});
|
|
162692
163163
|
this.editor.setDecorations(this.addedLinesDecorationType, [
|
|
162693
163164
|
{
|
|
@@ -162741,14 +163212,6 @@ class DefaultDecorator {
|
|
|
162741
163212
|
}
|
|
162742
163213
|
}
|
|
162743
163214
|
}
|
|
162744
|
-
function isOnlyAddingTextForModifiedLines(modifiedLines) {
|
|
162745
|
-
for (const modifiedLine of modifiedLines) {
|
|
162746
|
-
if (modifiedLine.changes.some((change) => change.type === "delete")) {
|
|
162747
|
-
return false;
|
|
162748
|
-
}
|
|
162749
|
-
}
|
|
162750
|
-
return true;
|
|
162751
|
-
}
|
|
162752
163215
|
class InlineDiffDecorator {
|
|
162753
163216
|
constructor(editor) {
|
|
162754
163217
|
__publicField2(this, "addedTextDecorationType", window$1.createTextEditorDecorationType({}));
|
|
@@ -163509,10 +163972,11 @@ function shrinkPredictionUntilSuffix({
|
|
|
163509
163972
|
}
|
|
163510
163973
|
return predictionLines.join(newLineChar) + newLineChar;
|
|
163511
163974
|
}
|
|
163512
|
-
const
|
|
163513
|
-
const
|
|
163514
|
-
const
|
|
163975
|
+
const AUTOEDIT_CONTEXT_STRATEGY = "auto-edit";
|
|
163976
|
+
const AUTOEDIT_TOTAL_DEBOUNCE_INTERVAL = 75;
|
|
163977
|
+
const AUTOEDIT_CONTEXT_FETCHING_DEBOUNCE_INTERVAL = 25;
|
|
163515
163978
|
const RESET_SUGGESTION_ON_CURSOR_CHANGE_AFTER_INTERVAL_MS = 60 * 1e3;
|
|
163979
|
+
const ON_SELECTION_CHANGE_DEFAULT_DEBOUNCE_INTERVAL_MS = 15;
|
|
163516
163980
|
class AutoeditsProvider {
|
|
163517
163981
|
constructor(chatClient, fixupController, statusBar, options) {
|
|
163518
163982
|
__publicField2(this, "disposables", []);
|
|
@@ -163529,7 +163993,7 @@ class AutoeditsProvider {
|
|
|
163529
163993
|
__publicField2(this, "promptStrategy", new ShortTermPromptStrategy());
|
|
163530
163994
|
__publicField2(this, "filterPrediction", new FilterPredictionBasedOnRecentEdits());
|
|
163531
163995
|
__publicField2(this, "contextMixer", new ContextMixer({
|
|
163532
|
-
strategyFactory: new DefaultContextStrategyFactory(Observable.of(
|
|
163996
|
+
strategyFactory: new DefaultContextStrategyFactory(Observable.of(AUTOEDIT_CONTEXT_STRATEGY)),
|
|
163533
163997
|
contextRankingStrategy: ContextRankingStrategy.TimeBased,
|
|
163534
163998
|
dataCollectionEnabled: false
|
|
163535
163999
|
}));
|
|
@@ -163582,17 +164046,18 @@ class AutoeditsProvider {
|
|
|
163582
164046
|
async provideInlineCompletionItems(document2, position, inlineCompletionContext, token) {
|
|
163583
164047
|
let stopLoading;
|
|
163584
164048
|
try {
|
|
163585
|
-
const
|
|
164049
|
+
const startedAt = getTimeNowInMillis();
|
|
163586
164050
|
const controller2 = new AbortController();
|
|
163587
164051
|
const abortSignal = controller2.signal;
|
|
163588
164052
|
token == null ? void 0 : token.onCancellationRequested(() => controller2.abort());
|
|
163589
164053
|
await new Promise(
|
|
163590
|
-
(resolve) => setTimeout(resolve,
|
|
164054
|
+
(resolve) => setTimeout(resolve, AUTOEDIT_CONTEXT_FETCHING_DEBOUNCE_INTERVAL)
|
|
163591
164055
|
);
|
|
164056
|
+
const remainingDebounceInterval = AUTOEDIT_TOTAL_DEBOUNCE_INTERVAL - AUTOEDIT_CONTEXT_FETCHING_DEBOUNCE_INTERVAL;
|
|
163592
164057
|
if (abortSignal.aborted) {
|
|
163593
164058
|
autoeditsOutputChannelLogger.logDebugIfVerbose(
|
|
163594
164059
|
"provideInlineCompletionItems",
|
|
163595
|
-
"debounce aborted
|
|
164060
|
+
"debounce aborted AUTOEDIT_CONTEXT_FETCHING_DEBOUNCE_INTERVAL"
|
|
163596
164061
|
);
|
|
163597
164062
|
return null;
|
|
163598
164063
|
}
|
|
@@ -163616,13 +164081,9 @@ class AutoeditsProvider {
|
|
|
163616
164081
|
position,
|
|
163617
164082
|
tokenBudget: autoeditsProviderConfig.tokenLimit
|
|
163618
164083
|
});
|
|
163619
|
-
autoeditsOutputChannelLogger.logDebugIfVerbose(
|
|
163620
|
-
"provideInlineCompletionItems",
|
|
163621
|
-
"Calculating context from contextMixer..."
|
|
163622
|
-
);
|
|
163623
164084
|
const { codeToRewrite } = codeToReplaceData;
|
|
163624
164085
|
const requestId = autoeditAnalyticsLogger.createRequest({
|
|
163625
|
-
startedAt
|
|
164086
|
+
startedAt,
|
|
163626
164087
|
codeToReplaceData,
|
|
163627
164088
|
position,
|
|
163628
164089
|
docContext,
|
|
@@ -163634,25 +164095,30 @@ class AutoeditsProvider {
|
|
|
163634
164095
|
triggerKind: autoeditTriggerKind.automatic
|
|
163635
164096
|
}
|
|
163636
164097
|
});
|
|
163637
|
-
|
|
163638
|
-
|
|
163639
|
-
|
|
163640
|
-
|
|
163641
|
-
|
|
163642
|
-
|
|
163643
|
-
|
|
163644
|
-
|
|
163645
|
-
|
|
163646
|
-
|
|
163647
|
-
}
|
|
163648
|
-
|
|
164098
|
+
autoeditsOutputChannelLogger.logDebugIfVerbose(
|
|
164099
|
+
"provideInlineCompletionItems",
|
|
164100
|
+
"Calculating context from contextMixer..."
|
|
164101
|
+
);
|
|
164102
|
+
const [{ context: context2, contextSummary }] = await Promise.all([
|
|
164103
|
+
this.contextMixer.getContext({
|
|
164104
|
+
document: document2,
|
|
164105
|
+
position,
|
|
164106
|
+
docContext,
|
|
164107
|
+
maxChars: 32e3
|
|
164108
|
+
}),
|
|
164109
|
+
new Promise((resolve) => setTimeout(resolve, remainingDebounceInterval))
|
|
164110
|
+
]);
|
|
163649
164111
|
if (abortSignal.aborted) {
|
|
163650
164112
|
autoeditsOutputChannelLogger.logDebugIfVerbose(
|
|
163651
164113
|
"provideInlineCompletionItems",
|
|
163652
|
-
"aborted
|
|
164114
|
+
"aborted during context fetch debounce"
|
|
163653
164115
|
);
|
|
163654
164116
|
return null;
|
|
163655
164117
|
}
|
|
164118
|
+
autoeditAnalyticsLogger.markAsContextLoaded({
|
|
164119
|
+
requestId,
|
|
164120
|
+
payload: { contextSummary }
|
|
164121
|
+
});
|
|
163656
164122
|
autoeditsOutputChannelLogger.logDebugIfVerbose(
|
|
163657
164123
|
"provideInlineCompletionItems",
|
|
163658
164124
|
"Calculating prompt from promptStrategy..."
|
|
@@ -163710,7 +164176,7 @@ class AutoeditsProvider {
|
|
|
163710
164176
|
"provideInlineCompletionItems",
|
|
163711
164177
|
`"${requestId}" ============= Response:
|
|
163712
164178
|
${initialPrediction}
|
|
163713
|
-
============= Time Taken: ${getTimeNowInMillis() -
|
|
164179
|
+
============= Time Taken: ${getTimeNowInMillis() - startedAt}ms`
|
|
163714
164180
|
);
|
|
163715
164181
|
const prediction = shrinkPredictionUntilSuffix({
|
|
163716
164182
|
prediction: initialPrediction,
|
|
@@ -163990,13 +164456,10 @@ async function getContextFileFromUri(file, range) {
|
|
|
163990
164456
|
}
|
|
163991
164457
|
const doc2 = await workspace.openTextDocument(file);
|
|
163992
164458
|
range = (range == null ? void 0 : range.isEmpty) ? void 0 : range;
|
|
163993
|
-
const fullRange =
|
|
163994
|
-
0,
|
|
163995
|
-
0,
|
|
163996
|
-
doc2.lineCount,
|
|
163997
|
-
doc2.lineAt(doc2.lineCount - 1).text.length
|
|
164459
|
+
const fullRange = doc2.validateRange(
|
|
164460
|
+
new Range(doc2.positionAt(0), doc2.positionAt(doc2.getText().length - 1))
|
|
163998
164461
|
);
|
|
163999
|
-
if (range == null ? void 0 : range.
|
|
164462
|
+
if (range == null ? void 0 : range.isEqual(fullRange)) {
|
|
164000
164463
|
range = void 0;
|
|
164001
164464
|
}
|
|
164002
164465
|
const content = doc2.getText(range);
|
|
@@ -165897,8 +166360,8 @@ async function getOpenTabsContextFile() {
|
|
|
165897
166360
|
}
|
|
165898
166361
|
async function createContextFileFromUri(uri, source, type, selectionRange, kind2, symbolName) {
|
|
165899
166362
|
const range = toRangeData(selectionRange);
|
|
165900
|
-
const repoNames = await
|
|
165901
|
-
const repoName =
|
|
166363
|
+
const repoNames = await firstResultFromOperation(repoNameResolver.getRepoNamesContainingUri(uri));
|
|
166364
|
+
const repoName = repoNames[0];
|
|
165902
166365
|
return [
|
|
165903
166366
|
type === "file" ? {
|
|
165904
166367
|
type,
|
|
@@ -166035,6 +166498,7 @@ function getChatPanelTitle(lastHumanText, truncateTitle = true) {
|
|
|
166035
166498
|
}
|
|
166036
166499
|
return text2.length > 25 ? `${text2.slice(0, 25).trim()}...` : text2;
|
|
166037
166500
|
}
|
|
166501
|
+
const isAgentTesting = false === "true";
|
|
166038
166502
|
const _ChatBuilder = class _ChatBuilder {
|
|
166039
166503
|
constructor(selectedModel, sessionID = new Date(Date.now()).toUTCString(), messages = [], customChatTitle) {
|
|
166040
166504
|
__publicField2(this, "changeNotifications", new MulticastSubject());
|
|
@@ -166242,6 +166706,13 @@ const _ChatBuilder = class _ChatBuilder {
|
|
|
166242
166706
|
const lastHumanMessage = this.getLastHumanMessage();
|
|
166243
166707
|
return getChatPanelTitle(((_a3 = lastHumanMessage == null ? void 0 : lastHumanMessage.text) == null ? void 0 : _a3.toString()) ?? "");
|
|
166244
166708
|
}
|
|
166709
|
+
setChatTitle(title) {
|
|
166710
|
+
const firstHumanMessage = this.messages[0];
|
|
166711
|
+
if ((firstHumanMessage == null ? void 0 : firstHumanMessage.speaker) === "human" && this.messages.length === 1) {
|
|
166712
|
+
this.customChatTitle = title;
|
|
166713
|
+
this.changeNotifications.next();
|
|
166714
|
+
}
|
|
166715
|
+
}
|
|
166245
166716
|
/**
|
|
166246
166717
|
* Serializes to the transcript JSON format.
|
|
166247
166718
|
*/
|
|
@@ -166259,7 +166730,7 @@ const _ChatBuilder = class _ChatBuilder {
|
|
|
166259
166730
|
}
|
|
166260
166731
|
const result = {
|
|
166261
166732
|
id: this.sessionID,
|
|
166262
|
-
chatTitle: void 0,
|
|
166733
|
+
chatTitle: this.customChatTitle ?? void 0,
|
|
166263
166734
|
lastInteractionTimestamp: this.sessionID,
|
|
166264
166735
|
interactions
|
|
166265
166736
|
};
|
|
@@ -167490,7 +167961,6 @@ function getCurrentFileOrSelection({
|
|
|
167490
167961
|
const items = [];
|
|
167491
167962
|
const contextFile = selectionOrFileContext2[0];
|
|
167492
167963
|
if (contextFile) {
|
|
167493
|
-
const range = contextFile.range ? expandToLineRange(contextFile.range) : void 0;
|
|
167494
167964
|
items.push({
|
|
167495
167965
|
...contextFile,
|
|
167496
167966
|
type: "file",
|
|
@@ -167501,17 +167971,20 @@ function getCurrentFileOrSelection({
|
|
|
167501
167971
|
source: ContextItemSource.Initial,
|
|
167502
167972
|
icon: "file"
|
|
167503
167973
|
});
|
|
167974
|
+
const range = contextFile.range ? expandToLineRange(contextFile.range) : void 0;
|
|
167504
167975
|
if (range) {
|
|
167505
167976
|
items.push({
|
|
167506
167977
|
...contextFile,
|
|
167507
|
-
type: "
|
|
167978
|
+
type: "current-selection",
|
|
167508
167979
|
title: "Current Selection",
|
|
167509
167980
|
description: `${displayPathBasename(contextFile.uri)}:${displayLineRange(
|
|
167510
167981
|
range
|
|
167511
167982
|
)}`,
|
|
167512
167983
|
range,
|
|
167513
167984
|
isTooLarge: userContextSize !== void 0 && contextFile.size !== void 0 && contextFile.size > userContextSize,
|
|
167514
|
-
|
|
167985
|
+
// NOTE: Do not set source to initial, this is used for
|
|
167986
|
+
// picking the correct prompt template for selection during prompt building.
|
|
167987
|
+
source: ContextItemSource.Selection,
|
|
167515
167988
|
icon: "list-selection"
|
|
167516
167989
|
});
|
|
167517
167990
|
}
|
|
@@ -167823,6 +168296,13 @@ class PromptBuilder {
|
|
|
167823
168296
|
* A list of context items that are used to build context messages.
|
|
167824
168297
|
*/
|
|
167825
168298
|
__publicField2(this, "contextItems", []);
|
|
168299
|
+
__publicField2(this, "hasCacheFeatureFlag", storeLastValue(
|
|
168300
|
+
featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyPromptCachingOnMessages)
|
|
168301
|
+
));
|
|
168302
|
+
__publicField2(this, "_isCacheEnabled", {
|
|
168303
|
+
featureFlag: false,
|
|
168304
|
+
isEnrolled: false
|
|
168305
|
+
});
|
|
167826
168306
|
this.tokenCounter = tokenCounter;
|
|
167827
168307
|
}
|
|
167828
168308
|
/**
|
|
@@ -167831,13 +168311,49 @@ class PromptBuilder {
|
|
|
167831
168311
|
static async create(contextWindow) {
|
|
167832
168312
|
return new PromptBuilder(await TokenCounter.create(contextWindow));
|
|
167833
168313
|
}
|
|
168314
|
+
get isCacheEnabled() {
|
|
168315
|
+
var _a3, _b2;
|
|
168316
|
+
const isFlagEnabled = Boolean(((_b2 = (_a3 = this.hasCacheFeatureFlag) == null ? void 0 : _a3.value) == null ? void 0 : _b2.last) ?? false);
|
|
168317
|
+
if (!this._isCacheEnabled.isEnrolled) {
|
|
168318
|
+
this._isCacheEnabled.isEnrolled = logFirstEnrollmentEvent(
|
|
168319
|
+
FeatureFlag.CodyPromptCachingOnMessages,
|
|
168320
|
+
isFlagEnabled
|
|
168321
|
+
);
|
|
168322
|
+
}
|
|
168323
|
+
return isFlagEnabled;
|
|
168324
|
+
}
|
|
167834
168325
|
build() {
|
|
167835
168326
|
if (this.contextItems.length > 0) {
|
|
167836
168327
|
this.buildContextMessages();
|
|
167837
168328
|
}
|
|
167838
168329
|
return this.prefixMessages.concat([...this.reverseMessages].reverse());
|
|
167839
168330
|
}
|
|
168331
|
+
/**
|
|
168332
|
+
* Create context messages for each context item, where
|
|
168333
|
+
* assistant messages come first because the transcript is in reversed order.
|
|
168334
|
+
*/
|
|
167840
168335
|
buildContextMessages() {
|
|
168336
|
+
if (this.isCacheEnabled) {
|
|
168337
|
+
const messages = [];
|
|
168338
|
+
for (const item of this.contextItems) {
|
|
168339
|
+
const contextMessage = renderContextItem(item);
|
|
168340
|
+
if (contextMessage) {
|
|
168341
|
+
messages.push(contextMessage);
|
|
168342
|
+
}
|
|
168343
|
+
}
|
|
168344
|
+
const groupedText = PromptString.join(
|
|
168345
|
+
messages.map((m) => m.text),
|
|
168346
|
+
ps`\n\n`
|
|
168347
|
+
);
|
|
168348
|
+
const groupedContextMessage = {
|
|
168349
|
+
speaker: "human",
|
|
168350
|
+
text: groupedText,
|
|
168351
|
+
cacheEnabled: true
|
|
168352
|
+
};
|
|
168353
|
+
const messagePair = [ASSISTANT_MESSAGE, groupedContextMessage];
|
|
168354
|
+
messagePair && this.reverseMessages.push(...messagePair);
|
|
168355
|
+
return;
|
|
168356
|
+
}
|
|
167841
168357
|
for (const item of this.contextItems) {
|
|
167842
168358
|
const contextMessage = renderContextItem(item);
|
|
167843
168359
|
const messagePair = contextMessage && [ASSISTANT_MESSAGE, contextMessage];
|
|
@@ -168978,6 +169494,7 @@ const _CodyToolProvider = class _CodyToolProvider {
|
|
|
168978
169494
|
}
|
|
168979
169495
|
static initialize(contextRetriever) {
|
|
168980
169496
|
_CodyToolProvider.instance = new _CodyToolProvider(contextRetriever);
|
|
169497
|
+
_CodyToolProvider.setupOpenCtxProviderListener();
|
|
168981
169498
|
}
|
|
168982
169499
|
static getTools() {
|
|
168983
169500
|
var _a3;
|
|
@@ -169074,7 +169591,7 @@ async function getContextFileFromTabs() {
|
|
|
169074
169591
|
try {
|
|
169075
169592
|
const tabGroups2 = window$1.tabGroups.all;
|
|
169076
169593
|
const openTabs = tabGroups2.flatMap(
|
|
169077
|
-
(group) => group.tabs.map((tab2) => tab2.input)
|
|
169594
|
+
(group) => group.tabs.map((tab2) => tab2.input).filter(Boolean)
|
|
169078
169595
|
);
|
|
169079
169596
|
return (await Promise.all(
|
|
169080
169597
|
openTabs.map(async (tab2) => {
|
|
@@ -169940,8 +170457,9 @@ class ChatHandler {
|
|
|
169940
170457
|
const { explicitMentions, implicitMentions } = getCategorizedMentions(corpusContext);
|
|
169941
170458
|
const prompter2 = new DefaultPrompter(explicitMentions, implicitMentions, false);
|
|
169942
170459
|
const versions = await currentSiteVersion();
|
|
169943
|
-
if (versions
|
|
169944
|
-
|
|
170460
|
+
if (lodashExports.isError(versions)) {
|
|
170461
|
+
delegate.postError(versions, "transcript");
|
|
170462
|
+
return;
|
|
169945
170463
|
}
|
|
169946
170464
|
const { prompt } = await this.buildPrompt(prompter2, chatBuilder, signal2, versions.codyAPIVersion);
|
|
169947
170465
|
recorder2.recordChatQuestionExecuted(corpusContext, { addMetadata: true, current: span2 });
|
|
@@ -170932,7 +171450,6 @@ class ChatController {
|
|
|
170932
171450
|
editor,
|
|
170933
171451
|
guardrails,
|
|
170934
171452
|
startTokenReceiver,
|
|
170935
|
-
chatIntentAPIClient,
|
|
170936
171453
|
contextRetriever,
|
|
170937
171454
|
extensionClient
|
|
170938
171455
|
}) {
|
|
@@ -170943,11 +171460,13 @@ class ChatController {
|
|
|
170943
171460
|
__publicField2(this, "extensionClient");
|
|
170944
171461
|
__publicField2(this, "guardrails");
|
|
170945
171462
|
__publicField2(this, "startTokenReceiver");
|
|
170946
|
-
__publicField2(this, "chatIntentAPIClient");
|
|
170947
171463
|
__publicField2(this, "disposables", []);
|
|
170948
171464
|
__publicField2(this, "clientBroadcast", new MulticastSubject());
|
|
170949
171465
|
__publicField2(this, "initDoer", new InitDoer());
|
|
170950
171466
|
__publicField2(this, "submitOrEditOperation");
|
|
171467
|
+
__publicField2(this, "isAutoChatTitleEnabled", storeLastValue(
|
|
171468
|
+
featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.ChatTitleAutoGeneration)
|
|
171469
|
+
));
|
|
170951
171470
|
// #endregion
|
|
170952
171471
|
// =======================================================================
|
|
170953
171472
|
// #region webview container management
|
|
@@ -170962,7 +171481,6 @@ class ChatController {
|
|
|
170962
171481
|
this.chatBuilder = new ChatBuilder(void 0);
|
|
170963
171482
|
this.guardrails = guardrails;
|
|
170964
171483
|
this.startTokenReceiver = startTokenReceiver;
|
|
170965
|
-
this.chatIntentAPIClient = chatIntentAPIClient;
|
|
170966
171484
|
if (TestSupport.instance) {
|
|
170967
171485
|
TestSupport.instance.chatPanelProvider.set(this);
|
|
170968
171486
|
}
|
|
@@ -171020,8 +171538,6 @@ class ChatController {
|
|
|
171020
171538
|
editorState: message.editorState,
|
|
171021
171539
|
signal: await this.startNewSubmitOrEditOperation(),
|
|
171022
171540
|
source: "chat",
|
|
171023
|
-
preDetectedIntent: message.preDetectedIntent,
|
|
171024
|
-
preDetectedIntentScores: message.preDetectedIntentScores,
|
|
171025
171541
|
manuallySelectedIntent: message.manuallySelectedIntent,
|
|
171026
171542
|
traceparent: message.traceparent
|
|
171027
171543
|
});
|
|
@@ -171035,8 +171551,6 @@ class ChatController {
|
|
|
171035
171551
|
index: message.index ?? void 0,
|
|
171036
171552
|
contextFiles: message.contextItems ?? [],
|
|
171037
171553
|
editorState: message.editorState,
|
|
171038
|
-
preDetectedIntent: message.preDetectedIntent,
|
|
171039
|
-
preDetectedIntentScores: message.preDetectedIntentScores,
|
|
171040
171554
|
manuallySelectedIntent: message.manuallySelectedIntent
|
|
171041
171555
|
});
|
|
171042
171556
|
break;
|
|
@@ -171077,7 +171591,9 @@ class ChatController {
|
|
|
171077
171591
|
await commands$1.executeCommand("cody.fixup.codelens.undo", message.id);
|
|
171078
171592
|
break;
|
|
171079
171593
|
case "openURI":
|
|
171080
|
-
commands$1.executeCommand("vscode.open", message.uri
|
|
171594
|
+
commands$1.executeCommand("vscode.open", message.uri, {
|
|
171595
|
+
selection: message.range
|
|
171596
|
+
});
|
|
171081
171597
|
break;
|
|
171082
171598
|
case "links": {
|
|
171083
171599
|
void openExternalLinks(message.value);
|
|
@@ -171138,6 +171654,10 @@ class ChatController {
|
|
|
171138
171654
|
);
|
|
171139
171655
|
break;
|
|
171140
171656
|
case "auth": {
|
|
171657
|
+
if (message.authKind === "refresh") {
|
|
171658
|
+
authProvider.refresh();
|
|
171659
|
+
break;
|
|
171660
|
+
}
|
|
171141
171661
|
if (message.authKind === "simplified-onboarding") {
|
|
171142
171662
|
const endpoint = DOTCOM_URL.href;
|
|
171143
171663
|
let tokenReceiverUrl = void 0;
|
|
@@ -171243,6 +171763,10 @@ class ChatController {
|
|
|
171243
171763
|
logger2(message.filterLabel, message.message);
|
|
171244
171764
|
break;
|
|
171245
171765
|
}
|
|
171766
|
+
case "devicePixelRatio": {
|
|
171767
|
+
localStorage.setDevicePixelRatio(message.devicePixelRatio);
|
|
171768
|
+
break;
|
|
171769
|
+
}
|
|
171246
171770
|
}
|
|
171247
171771
|
}
|
|
171248
171772
|
isSmartApplyEnabled() {
|
|
@@ -171256,6 +171780,9 @@ class ChatController {
|
|
|
171256
171780
|
async getConfigForWebview() {
|
|
171257
171781
|
var _a3, _b2, _c2;
|
|
171258
171782
|
const { configuration, auth } = await currentResolvedConfig();
|
|
171783
|
+
const experimentalPromptEditorEnabled = await firstValueFrom$1(
|
|
171784
|
+
featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyExperimentalPromptEditor)
|
|
171785
|
+
);
|
|
171259
171786
|
const sidebarViewOnly = ((_b2 = (_a3 = this.extensionClient.capabilities) == null ? void 0 : _a3.webviewNativeConfig) == null ? void 0 : _b2.view) === "single";
|
|
171260
171787
|
const isEditorViewType = ((_c2 = this.webviewPanelOrView) == null ? void 0 : _c2.viewType) === "cody.editorPanel";
|
|
171261
171788
|
const webviewType = isEditorViewType && !sidebarViewOnly ? "editor" : "sidebar";
|
|
@@ -171271,7 +171798,8 @@ class ChatController {
|
|
|
171271
171798
|
webviewType,
|
|
171272
171799
|
multipleWebviewsEnabled: !sidebarViewOnly,
|
|
171273
171800
|
internalDebugContext: configuration.internalDebugContext,
|
|
171274
|
-
allowEndpointChange: configuration.overrideServerEndpoint === void 0
|
|
171801
|
+
allowEndpointChange: configuration.overrideServerEndpoint === void 0,
|
|
171802
|
+
experimentalPromptEditorEnabled
|
|
171275
171803
|
};
|
|
171276
171804
|
}
|
|
171277
171805
|
// =======================================================================
|
|
@@ -171332,8 +171860,6 @@ class ChatController {
|
|
|
171332
171860
|
signal: signal2,
|
|
171333
171861
|
source,
|
|
171334
171862
|
command,
|
|
171335
|
-
preDetectedIntent,
|
|
171336
|
-
preDetectedIntentScores,
|
|
171337
171863
|
manuallySelectedIntent,
|
|
171338
171864
|
traceparent
|
|
171339
171865
|
}) {
|
|
@@ -171363,10 +171889,10 @@ class ChatController {
|
|
|
171363
171889
|
this.chatBuilder.addHumanMessage({
|
|
171364
171890
|
text: inputText,
|
|
171365
171891
|
editorState,
|
|
171366
|
-
intent: manuallySelectedIntent
|
|
171367
|
-
manuallySelectedIntent,
|
|
171892
|
+
intent: manuallySelectedIntent,
|
|
171368
171893
|
agent: selectedAgent
|
|
171369
171894
|
});
|
|
171895
|
+
this.setCustomChatTitle(requestID, inputText, signal2, model2);
|
|
171370
171896
|
this.postViewTranscript({ speaker: "assistant" });
|
|
171371
171897
|
await this.saveSession();
|
|
171372
171898
|
signal2.throwIfAborted();
|
|
@@ -171379,8 +171905,6 @@ class ChatController {
|
|
|
171379
171905
|
signal: signal2,
|
|
171380
171906
|
source,
|
|
171381
171907
|
command,
|
|
171382
|
-
preDetectedIntent,
|
|
171383
|
-
preDetectedIntentScores,
|
|
171384
171908
|
manuallySelectedIntent
|
|
171385
171909
|
},
|
|
171386
171910
|
span2
|
|
@@ -171388,45 +171912,6 @@ class ChatController {
|
|
|
171388
171912
|
});
|
|
171389
171913
|
});
|
|
171390
171914
|
}
|
|
171391
|
-
async isOmniBoxEnabled() {
|
|
171392
|
-
const config = await ClientConfigSingleton.getInstance().getConfig();
|
|
171393
|
-
return !!(config == null ? void 0 : config.omniBoxEnabled);
|
|
171394
|
-
}
|
|
171395
|
-
async getIntentAndScores({
|
|
171396
|
-
requestID,
|
|
171397
|
-
input,
|
|
171398
|
-
signal: signal2,
|
|
171399
|
-
preDetectedIntent,
|
|
171400
|
-
preDetectedIntentScores,
|
|
171401
|
-
manuallySelectedIntent
|
|
171402
|
-
}) {
|
|
171403
|
-
if (!await this.isOmniBoxEnabled()) {
|
|
171404
|
-
return { intent: "chat", detectedIntent: null, detectedIntentScores: [] };
|
|
171405
|
-
}
|
|
171406
|
-
const intent = manuallySelectedIntent ?? preDetectedIntent;
|
|
171407
|
-
if (intent) {
|
|
171408
|
-
return {
|
|
171409
|
-
intent,
|
|
171410
|
-
detectedIntent: preDetectedIntent,
|
|
171411
|
-
detectedIntentScores: preDetectedIntentScores || []
|
|
171412
|
-
};
|
|
171413
|
-
}
|
|
171414
|
-
const response = await this.detectChatIntent({
|
|
171415
|
-
requestID,
|
|
171416
|
-
text: input
|
|
171417
|
-
}).then(async (response2) => {
|
|
171418
|
-
signal2.throwIfAborted();
|
|
171419
|
-
return response2;
|
|
171420
|
-
}).catch(() => void 0);
|
|
171421
|
-
if (response) {
|
|
171422
|
-
return {
|
|
171423
|
-
intent: response.intent,
|
|
171424
|
-
detectedIntent: response.intent,
|
|
171425
|
-
detectedIntentScores: response.allScores
|
|
171426
|
-
};
|
|
171427
|
-
}
|
|
171428
|
-
return { intent: "chat", detectedIntent: null, detectedIntentScores: [] };
|
|
171429
|
-
}
|
|
171430
171915
|
async sendChat({
|
|
171431
171916
|
requestID,
|
|
171432
171917
|
inputText,
|
|
@@ -171435,8 +171920,6 @@ class ChatController {
|
|
|
171435
171920
|
signal: signal2,
|
|
171436
171921
|
source,
|
|
171437
171922
|
command,
|
|
171438
|
-
preDetectedIntent,
|
|
171439
|
-
preDetectedIntentScores,
|
|
171440
171923
|
manuallySelectedIntent
|
|
171441
171924
|
}, span2) {
|
|
171442
171925
|
span2.addEvent("ChatController.sendChat");
|
|
@@ -171463,28 +171946,17 @@ class ChatController {
|
|
|
171463
171946
|
chatAgent
|
|
171464
171947
|
});
|
|
171465
171948
|
recorder2.recordChatQuestionSubmitted(mentions);
|
|
171466
|
-
const { intent, detectedIntent, detectedIntentScores } = await this.getIntentAndScores({
|
|
171467
|
-
requestID,
|
|
171468
|
-
input: editorState ? inputTextWithMappedContextChipsFromPromptEditorState(editorState) : inputText.toString(),
|
|
171469
|
-
preDetectedIntent,
|
|
171470
|
-
preDetectedIntentScores,
|
|
171471
|
-
manuallySelectedIntent,
|
|
171472
|
-
signal: signal2
|
|
171473
|
-
});
|
|
171474
171949
|
signal2.throwIfAborted();
|
|
171475
|
-
this.chatBuilder.setLastMessageIntent(
|
|
171950
|
+
this.chatBuilder.setLastMessageIntent(manuallySelectedIntent);
|
|
171476
171951
|
this.postEmptyMessageInProgress(model2);
|
|
171477
|
-
const agentName = ["search", "edit", "insert"].includes(
|
|
171952
|
+
const agentName = ["search", "edit", "insert"].includes(manuallySelectedIntent ?? "") ? manuallySelectedIntent : chatAgent ?? "chat";
|
|
171478
171953
|
const agent2 = getAgent(agentName, model2, {
|
|
171479
171954
|
contextRetriever: this.contextRetriever,
|
|
171480
171955
|
editor: this.editor,
|
|
171481
171956
|
chatClient: this.chatClient
|
|
171482
171957
|
});
|
|
171483
|
-
const omniBoxEnabled = await this.isOmniBoxEnabled();
|
|
171484
171958
|
recorder2.setIntentInfo({
|
|
171485
|
-
userSpecifiedIntent: manuallySelectedIntent ??
|
|
171486
|
-
detectedIntent,
|
|
171487
|
-
detectedIntentScores
|
|
171959
|
+
userSpecifiedIntent: manuallySelectedIntent ?? "chat"
|
|
171488
171960
|
});
|
|
171489
171961
|
this.postEmptyMessageInProgress(model2);
|
|
171490
171962
|
let messageInProgress = { speaker: "assistant", model: model2 };
|
|
@@ -171579,22 +172051,6 @@ class ChatController {
|
|
|
171579
172051
|
recordErrorToSpan(span2, error);
|
|
171580
172052
|
}
|
|
171581
172053
|
}
|
|
171582
|
-
async detectChatIntent({
|
|
171583
|
-
requestID,
|
|
171584
|
-
text: text2
|
|
171585
|
-
}) {
|
|
171586
|
-
const response = await wrapInActiveSpan("chat.detectChatIntent", () => {
|
|
171587
|
-
var _a3;
|
|
171588
|
-
return (_a3 = this.chatIntentAPIClient) == null ? void 0 : _a3.detectChatIntent(requestID || "", text2).catch(() => null);
|
|
171589
|
-
});
|
|
171590
|
-
if (response && !isError$3(response)) {
|
|
171591
|
-
return {
|
|
171592
|
-
intent: response.intent === "search" ? "search" : "chat",
|
|
171593
|
-
allScores: response.allScores || []
|
|
171594
|
-
};
|
|
171595
|
-
}
|
|
171596
|
-
return;
|
|
171597
|
-
}
|
|
171598
172054
|
async openRemoteFile(uri, tryLocal) {
|
|
171599
172055
|
if (tryLocal) {
|
|
171600
172056
|
try {
|
|
@@ -171744,8 +172200,6 @@ class ChatController {
|
|
|
171744
172200
|
index: index2,
|
|
171745
172201
|
contextFiles,
|
|
171746
172202
|
editorState,
|
|
171747
|
-
preDetectedIntent,
|
|
171748
|
-
preDetectedIntentScores,
|
|
171749
172203
|
manuallySelectedIntent
|
|
171750
172204
|
}) {
|
|
171751
172205
|
const abortSignal = this.startNewSubmitOrEditOperation();
|
|
@@ -171768,8 +172222,6 @@ class ChatController {
|
|
|
171768
172222
|
editorState,
|
|
171769
172223
|
signal: abortSignal,
|
|
171770
172224
|
source: "chat",
|
|
171771
|
-
preDetectedIntent,
|
|
171772
|
-
preDetectedIntentScores,
|
|
171773
172225
|
manuallySelectedIntent
|
|
171774
172226
|
});
|
|
171775
172227
|
} catch (error) {
|
|
@@ -171796,8 +172248,8 @@ class ChatController {
|
|
|
171796
172248
|
});
|
|
171797
172249
|
}
|
|
171798
172250
|
async handleGetUserEditorContext(uri) {
|
|
171799
|
-
var _a3;
|
|
171800
|
-
const selection = (_a3 =
|
|
172251
|
+
var _a3, _b2;
|
|
172252
|
+
const selection = (_b2 = (_a3 = getEditor()) == null ? void 0 : _a3.active) == null ? void 0 : _b2.selection;
|
|
171801
172253
|
const contextItem = uri ? await getContextFileFromUri(uri, selection) : await getContextFileFromCursor();
|
|
171802
172254
|
const { input, context: context2 } = await firstResultFromOperation(
|
|
171803
172255
|
ChatBuilder.contextWindowForChat(this.chatBuilder)
|
|
@@ -171812,7 +172264,7 @@ class ChatController {
|
|
|
171812
172264
|
// Remove content to avoid sending large data to the webview
|
|
171813
172265
|
content: void 0,
|
|
171814
172266
|
isTooLarge: contextItem.size ? contextItem.size > userContextSize : void 0,
|
|
171815
|
-
source: ContextItemSource.
|
|
172267
|
+
source: ContextItemSource.Selection,
|
|
171816
172268
|
range: contextItem.range
|
|
171817
172269
|
}
|
|
171818
172270
|
] : []
|
|
@@ -171893,6 +172345,58 @@ class ChatController {
|
|
|
171893
172345
|
this._webviewPanelOrView.title = this.chatBuilder.getChatTitle();
|
|
171894
172346
|
}
|
|
171895
172347
|
}
|
|
172348
|
+
/**
|
|
172349
|
+
* Sets the custom chat title based on the first message in the interaction.
|
|
172350
|
+
*/
|
|
172351
|
+
async setCustomChatTitle(requestID, inputText, signal2, chatModel) {
|
|
172352
|
+
return tracer.startActiveSpan("chat.setCustomChatTitle", async (span2) => {
|
|
172353
|
+
var _a3;
|
|
172354
|
+
const speeds = modelsService.getModelsByTag(ModelTag.Speed);
|
|
172355
|
+
const model2 = ((_a3 = speeds.find((m) => m.id.includes("flash")) || (speeds == null ? void 0 : speeds[0])) == null ? void 0 : _a3.id) ?? chatModel;
|
|
172356
|
+
const messages = this.chatBuilder.getMessages();
|
|
172357
|
+
if (messages.length > 1 || !this.isAutoChatTitleEnabled || !model2 || isAgentTesting) {
|
|
172358
|
+
return;
|
|
172359
|
+
}
|
|
172360
|
+
const prompt = ps`${getDefaultSystemPrompt()} Your task is to generate a concise title (in about 10 words without quotation) for <codyUserInput>${inputText}</codyUserInput>.
|
|
172361
|
+
RULE: Your response should only contain the concise title and nothing else.`;
|
|
172362
|
+
let title = "";
|
|
172363
|
+
try {
|
|
172364
|
+
const stream = await this.chatClient.chat(
|
|
172365
|
+
[{ speaker: "human", text: prompt }],
|
|
172366
|
+
{ model: model2, maxTokensToSample: 100 },
|
|
172367
|
+
signal2,
|
|
172368
|
+
requestID
|
|
172369
|
+
);
|
|
172370
|
+
for await (const message of stream) {
|
|
172371
|
+
if (message.type === "change") {
|
|
172372
|
+
title = message.text;
|
|
172373
|
+
} else if (message.type === "complete") {
|
|
172374
|
+
if (title) {
|
|
172375
|
+
this.chatBuilder.setChatTitle(title);
|
|
172376
|
+
await this.saveSession();
|
|
172377
|
+
}
|
|
172378
|
+
break;
|
|
172379
|
+
}
|
|
172380
|
+
}
|
|
172381
|
+
} catch (error) {
|
|
172382
|
+
logDebug("ChatController", "setCustomChatTitle", { verbose: error });
|
|
172383
|
+
}
|
|
172384
|
+
telemetryRecorder.recordEvent("cody.chat.customTitle", "generated", {
|
|
172385
|
+
privateMetadata: {
|
|
172386
|
+
requestID,
|
|
172387
|
+
model: model2,
|
|
172388
|
+
traceId: span2.spanContext().traceId
|
|
172389
|
+
},
|
|
172390
|
+
metadata: {
|
|
172391
|
+
length: title.length
|
|
172392
|
+
},
|
|
172393
|
+
billingMetadata: {
|
|
172394
|
+
product: "cody",
|
|
172395
|
+
category: "billable"
|
|
172396
|
+
}
|
|
172397
|
+
});
|
|
172398
|
+
});
|
|
172399
|
+
}
|
|
171896
172400
|
/**
|
|
171897
172401
|
* Display error message in webview as part of the chat transcript, or as a system banner alongside the chat.
|
|
171898
172402
|
*/
|
|
@@ -172154,7 +172658,6 @@ class ChatController {
|
|
|
172154
172658
|
});
|
|
172155
172659
|
},
|
|
172156
172660
|
defaultContext: () => defaultContext.pipe(skipPendingOperation()),
|
|
172157
|
-
detectIntent: (text2) => promiseFactoryToObservable(() => this.detectChatIntent({ text: text2 })),
|
|
172158
172661
|
resolvedConfig: () => resolvedConfig,
|
|
172159
172662
|
authStatus: () => authStatus,
|
|
172160
172663
|
transcript: () => this.chatBuilder.changes.pipe(map$1((chat2) => chat2.getDehydratedMessages())),
|
|
@@ -172262,7 +172765,7 @@ function manipulateWebviewHTML(html2, options) {
|
|
|
172262
172765
|
}
|
|
172263
172766
|
const CodyChatEditorViewType = "cody.editorPanel";
|
|
172264
172767
|
class ChatsController {
|
|
172265
|
-
constructor(options, chatClient, contextRetriever, guardrails,
|
|
172768
|
+
constructor(options, chatClient, contextRetriever, guardrails, extensionClient) {
|
|
172266
172769
|
// Chat view in the panel (typically in the sidebar)
|
|
172267
172770
|
__publicField2(this, "panel");
|
|
172268
172771
|
// Chat views in editor panels
|
|
@@ -172275,7 +172778,6 @@ class ChatsController {
|
|
|
172275
172778
|
this.chatClient = chatClient;
|
|
172276
172779
|
this.contextRetriever = contextRetriever;
|
|
172277
172780
|
this.guardrails = guardrails;
|
|
172278
|
-
this.chatIntentAPIClient = chatIntentAPIClient;
|
|
172279
172781
|
this.extensionClient = extensionClient;
|
|
172280
172782
|
logDebug("ChatsController:constructor", "init");
|
|
172281
172783
|
this.panel = this.createChatController();
|
|
@@ -172380,33 +172882,7 @@ class ChatsController {
|
|
|
172380
172882
|
return commands$1.executeCommand("cody.chat.newPanel", args2);
|
|
172381
172883
|
}
|
|
172382
172884
|
}),
|
|
172383
|
-
commands$1.registerCommand(
|
|
172384
|
-
"cody.chat.toggle",
|
|
172385
|
-
async (ops) => {
|
|
172386
|
-
var _a3;
|
|
172387
|
-
const modality = getNewChatLocation();
|
|
172388
|
-
if (ops.editorFocus) {
|
|
172389
|
-
if (modality === "sidebar") {
|
|
172390
|
-
await commands$1.executeCommand("cody.chat.focus");
|
|
172391
|
-
} else {
|
|
172392
|
-
const editorView = (_a3 = this.activeEditor) == null ? void 0 : _a3.webviewPanelOrView;
|
|
172393
|
-
if (editorView) {
|
|
172394
|
-
revealWebviewViewOrPanel(editorView);
|
|
172395
|
-
} else {
|
|
172396
|
-
commands$1.executeCommand("cody.chat.newEditorPanel");
|
|
172397
|
-
}
|
|
172398
|
-
}
|
|
172399
|
-
} else {
|
|
172400
|
-
if (modality === "sidebar") {
|
|
172401
|
-
await commands$1.executeCommand(
|
|
172402
|
-
"workbench.action.focusActiveEditorGroup"
|
|
172403
|
-
);
|
|
172404
|
-
} else {
|
|
172405
|
-
await commands$1.executeCommand("workbench.action.navigateEditorGroups");
|
|
172406
|
-
}
|
|
172407
|
-
}
|
|
172408
|
-
}
|
|
172409
|
-
),
|
|
172885
|
+
commands$1.registerCommand("cody.chat.toggle", async () => this.toggleChatPanel()),
|
|
172410
172886
|
commands$1.registerCommand("cody.chat.history.export", () => this.exportHistory()),
|
|
172411
172887
|
commands$1.registerCommand("cody.chat.history.clear", (arg) => this.clearHistory(arg)),
|
|
172412
172888
|
commands$1.registerCommand("cody.chat.history.delete", (item) => this.clearHistory(item)),
|
|
@@ -172670,7 +173146,6 @@ class ChatsController {
|
|
|
172670
173146
|
chatClient: this.chatClient,
|
|
172671
173147
|
guardrails: this.guardrails,
|
|
172672
173148
|
startTokenReceiver: this.options.startTokenReceiver,
|
|
172673
|
-
chatIntentAPIClient: this.chatIntentAPIClient,
|
|
172674
173149
|
contextRetriever: this.contextRetriever,
|
|
172675
173150
|
extensionClient: this.extensionClient
|
|
172676
173151
|
});
|
|
@@ -172692,6 +173167,22 @@ class ChatsController {
|
|
|
172692
173167
|
this.panel.clearAndRestartSession();
|
|
172693
173168
|
}
|
|
172694
173169
|
}
|
|
173170
|
+
async toggleChatPanel() {
|
|
173171
|
+
var _a3;
|
|
173172
|
+
if (this.activeEditor) {
|
|
173173
|
+
const isVisible = (_a3 = this.activeEditor.webviewPanelOrView) == null ? void 0 : _a3.visible;
|
|
173174
|
+
const sessionID = this.activeEditor.sessionID;
|
|
173175
|
+
if (isVisible && sessionID) {
|
|
173176
|
+
this.disposeChat(sessionID, true);
|
|
173177
|
+
} else {
|
|
173178
|
+
await this.getOrCreateEditorChatController(sessionID);
|
|
173179
|
+
}
|
|
173180
|
+
} else {
|
|
173181
|
+
await commands$1.executeCommand(
|
|
173182
|
+
this.panel.isVisible() ? "workbench.action.toggleSidebarVisibility" : "cody.chat.focus"
|
|
173183
|
+
);
|
|
173184
|
+
}
|
|
173185
|
+
}
|
|
172695
173186
|
// Dispose all open chat panels
|
|
172696
173187
|
disposeAllChats() {
|
|
172697
173188
|
this.activeEditor = void 0;
|
|
@@ -173319,7 +173810,7 @@ class CodySourceControl {
|
|
|
173319
173810
|
commands$1.registerCommand("cody.command.abort-commit", () => this.statusUpdate()),
|
|
173320
173811
|
subscriptionDisposable(
|
|
173321
173812
|
modelsService.getModels(ModelUsage.Chat).pipe(skipPendingOperation()).subscribe((models) => {
|
|
173322
|
-
const preferredModel = models.find((p2) => p2.id.includes("
|
|
173813
|
+
const preferredModel = models.find((p2) => p2.id.includes("gemini-2.0-flash-lite"));
|
|
173323
173814
|
this.model = preferredModel ?? models.at(0);
|
|
173324
173815
|
})
|
|
173325
173816
|
)
|
|
@@ -173693,8 +174184,8 @@ function parseMentionURI(uri) {
|
|
|
173693
174184
|
}
|
|
173694
174185
|
}
|
|
173695
174186
|
async function execFileAsync(program2, args2, { cwd }) {
|
|
173696
|
-
const { promisify } = await import("./util-
|
|
173697
|
-
const { execFile } = await import("./vscode-shim-
|
|
174187
|
+
const { promisify } = await import("./util-DVisVv7-.mjs").then((n) => n.u);
|
|
174188
|
+
const { execFile } = await import("./vscode-shim-BMQfq1RF.mjs").then((n) => n.h5);
|
|
173698
174189
|
return promisify(execFile)(program2, args2, { cwd });
|
|
173699
174190
|
}
|
|
173700
174191
|
var __create = Object.create;
|
|
@@ -176123,7 +176614,6 @@ function observeOpenCtxController(context2, createOpenCtxController) {
|
|
|
176123
176614
|
),
|
|
176124
176615
|
mergeConfiguration
|
|
176125
176616
|
});
|
|
176126
|
-
CodyToolProvider.setupOpenCtxProviderListener();
|
|
176127
176617
|
return controller2;
|
|
176128
176618
|
} catch (error) {
|
|
176129
176619
|
logDebug("openctx", `Failed to load OpenCtx client: ${error}`);
|
|
@@ -177008,11 +177498,18 @@ const MARKDOWN_CODE_BLOCK_REGEX = new RegExp(
|
|
|
177008
177498
|
);
|
|
177009
177499
|
const LEADING_SPACES_AND_NEW_LINES = /^\s*\n/;
|
|
177010
177500
|
const LEADING_SPACES = /^[ ]+/;
|
|
177011
|
-
function
|
|
177012
|
-
const strippedText = text2.replaceAll(PROMPT_TOPIC_REGEX, "")
|
|
177501
|
+
function stripText(text2, task) {
|
|
177502
|
+
const strippedText = text2.replaceAll(PROMPT_TOPIC_REGEX, "");
|
|
177503
|
+
if (task.document.languageId === "markdown") {
|
|
177504
|
+
return strippedText;
|
|
177505
|
+
}
|
|
177506
|
+
return strippedText.replaceAll(
|
|
177013
177507
|
MARKDOWN_CODE_BLOCK_REGEX,
|
|
177014
177508
|
(block) => block.replace(MARKDOWN_CODE_BLOCK_START, "").replace(MARKDOWN_CODE_BLOCK_END, "")
|
|
177015
177509
|
);
|
|
177510
|
+
}
|
|
177511
|
+
function responseTransformer(text2, task, isMessageInProgress) {
|
|
177512
|
+
const strippedText = stripText(text2, task);
|
|
177016
177513
|
const trimmedText = task.intent === "add" ? strippedText.replace(LEADING_SPACES, "") : strippedText.replace(LEADING_SPACES_AND_NEW_LINES, "");
|
|
177017
177514
|
const decodedText = heExports.decode(trimmedText);
|
|
177018
177515
|
if (!isMessageInProgress) {
|
|
@@ -177491,8 +177988,9 @@ class EditProvider {
|
|
|
177491
177988
|
const model2 = this.config.task.model;
|
|
177492
177989
|
const contextWindow = modelsService.getContextWindowByID(model2);
|
|
177493
177990
|
const versions = await currentSiteVersion();
|
|
177494
|
-
if (versions
|
|
177495
|
-
|
|
177991
|
+
if (lodashExports.isError(versions)) {
|
|
177992
|
+
this.handleError(versions);
|
|
177993
|
+
return;
|
|
177496
177994
|
}
|
|
177497
177995
|
const {
|
|
177498
177996
|
messages,
|
|
@@ -177985,8 +178483,8 @@ class EditManager {
|
|
|
177985
178483
|
editor.setDecorations(SMART_APPLY_FILE_DECORATION, [documentRange]);
|
|
177986
178484
|
const replacementCode = PromptString.unsafe_fromLLMResponse(configuration.replacement);
|
|
177987
178485
|
const versions = await currentSiteVersion();
|
|
177988
|
-
if (versions
|
|
177989
|
-
throw new Error("
|
|
178486
|
+
if (lodashExports.isError(versions)) {
|
|
178487
|
+
throw new Error("Unable to determine site version", versions);
|
|
177990
178488
|
}
|
|
177991
178489
|
const contextloggerRequestId = await this.smartApplyContextLogger.createSmartApplyLoggingRequest({
|
|
177992
178490
|
model: model2,
|
|
@@ -178320,15 +178818,16 @@ class VSCodeEditor {
|
|
|
178320
178818
|
return this.createActiveTextEditorSelection(activeEditor, selection);
|
|
178321
178819
|
}
|
|
178322
178820
|
async getTextEditorContentForFile(fileUri, selectionRange) {
|
|
178323
|
-
var _a3, _b2;
|
|
178821
|
+
var _a3, _b2, _c2;
|
|
178324
178822
|
let range;
|
|
178325
178823
|
if (selectionRange) {
|
|
178326
178824
|
const startLine = (_a3 = selectionRange == null ? void 0 : selectionRange.start) == null ? void 0 : _a3.line;
|
|
178327
178825
|
let endLine = (_b2 = selectionRange == null ? void 0 : selectionRange.end) == null ? void 0 : _b2.line;
|
|
178826
|
+
const endChar = (_c2 = selectionRange == null ? void 0 : selectionRange.end) == null ? void 0 : _c2.character;
|
|
178328
178827
|
if (startLine === endLine) {
|
|
178329
178828
|
endLine++;
|
|
178330
178829
|
}
|
|
178331
|
-
range = new Range(startLine, 0, endLine,
|
|
178830
|
+
range = new Range(startLine, 0, endLine, endChar);
|
|
178332
178831
|
}
|
|
178333
178832
|
const doc2 = await workspace.openTextDocument(fileUri);
|
|
178334
178833
|
return doc2.getText(range);
|
|
@@ -178428,14 +178927,6 @@ class VSCodeEditor {
|
|
|
178428
178927
|
await window$1.showWarningMessage(message);
|
|
178429
178928
|
}
|
|
178430
178929
|
}
|
|
178431
|
-
class ChatIntentAPIClient {
|
|
178432
|
-
constructor(apiClient) {
|
|
178433
|
-
this.apiClient = apiClient;
|
|
178434
|
-
}
|
|
178435
|
-
async detectChatIntent(interactionID, query2) {
|
|
178436
|
-
return this.apiClient.chatIntent(interactionID, query2);
|
|
178437
|
-
}
|
|
178438
|
-
}
|
|
178439
178930
|
async function configureExternalServices(context2, platform2) {
|
|
178440
178931
|
var _a3, _b2, _c2;
|
|
178441
178932
|
const disposables = [];
|
|
@@ -178448,13 +178939,11 @@ async function configureExternalServices(context2, platform2) {
|
|
|
178448
178939
|
if (symfRunner) disposables.push(symfRunner);
|
|
178449
178940
|
const chatClient = new ChatClient(completionsClient);
|
|
178450
178941
|
const guardrails = new SourcegraphGuardrailsClient();
|
|
178451
|
-
const chatIntentAPIClient = new ChatIntentAPIClient(graphqlClient);
|
|
178452
178942
|
return {
|
|
178453
178943
|
chatClient,
|
|
178454
178944
|
completionsClient,
|
|
178455
178945
|
guardrails,
|
|
178456
178946
|
symfRunner,
|
|
178457
|
-
chatIntentAPIClient,
|
|
178458
178947
|
dispose() {
|
|
178459
178948
|
for (const d2 of disposables) {
|
|
178460
178949
|
d2 == null ? void 0 : d2.dispose();
|
|
@@ -182273,6 +182762,9 @@ const _CodyStatusBar = class _CodyStatusBar {
|
|
|
182273
182762
|
_CodyStatusBar.singleton = new _CodyStatusBar();
|
|
182274
182763
|
return _CodyStatusBar.singleton;
|
|
182275
182764
|
}
|
|
182765
|
+
clearErrors() {
|
|
182766
|
+
this.errors.mutate((draft) => /* @__PURE__ */ new Set());
|
|
182767
|
+
}
|
|
182276
182768
|
addError(args2) {
|
|
182277
182769
|
const now = Date.now();
|
|
182278
182770
|
const ttl = args2.timeout !== void 0 ? Math.min(ONE_HOUR, args2.timeout) : ONE_HOUR;
|
|
@@ -182394,7 +182886,6 @@ const _CodyStatusBar = class _CodyStatusBar {
|
|
|
182394
182886
|
}
|
|
182395
182887
|
}
|
|
182396
182888
|
buildState(authStatus2, config, errors, loaders, ignoreStatus, autoeditsFeatureFlagEnabled, userProductSubscription2) {
|
|
182397
|
-
var _a3, _b2;
|
|
182398
182889
|
const tags = /* @__PURE__ */ new Set();
|
|
182399
182890
|
if (authStatus2.authenticated) {
|
|
182400
182891
|
tags.add(InvisibleStatusBarTag.IsAuthenticated);
|
|
@@ -182419,15 +182910,6 @@ const _CodyStatusBar = class _CodyStatusBar {
|
|
|
182419
182910
|
interact: interactAuth
|
|
182420
182911
|
};
|
|
182421
182912
|
}
|
|
182422
|
-
if (!authStatus2.authenticated && ((_a3 = authStatus2.error) == null ? void 0 : _a3.type) === "invalid-access-token") {
|
|
182423
|
-
return {
|
|
182424
|
-
icon: "disabled",
|
|
182425
|
-
tooltip: "Your authentication has expired.\nSign in again to continue using Cody.",
|
|
182426
|
-
style: "warning",
|
|
182427
|
-
tags,
|
|
182428
|
-
interact: interactAuth
|
|
182429
|
-
};
|
|
182430
|
-
}
|
|
182431
182913
|
if (errors.size > 0) {
|
|
182432
182914
|
const [firstError, ...otherErrors] = [...errors.values()];
|
|
182433
182915
|
const hasDisabilitatingError = [...errors.values()].some(
|
|
@@ -182453,16 +182935,16 @@ const _CodyStatusBar = class _CodyStatusBar {
|
|
|
182453
182935
|
})
|
|
182454
182936
|
};
|
|
182455
182937
|
}
|
|
182456
|
-
if (!authStatus2.authenticated && ((_b2 = authStatus2.error) == null ? void 0 : _b2.type) === "network-error") {
|
|
182457
|
-
return {
|
|
182458
|
-
icon: "disabled",
|
|
182459
|
-
tooltip: "Network issues prevented Cody from signing in.",
|
|
182460
|
-
style: "error",
|
|
182461
|
-
tags,
|
|
182462
|
-
interact: interactNetworkIssues
|
|
182463
|
-
};
|
|
182464
|
-
}
|
|
182465
182938
|
if (!authStatus2.authenticated) {
|
|
182939
|
+
if (isAvailabilityError(authStatus2.error)) {
|
|
182940
|
+
return {
|
|
182941
|
+
icon: "disabled",
|
|
182942
|
+
tooltip: authStatus2.error.message,
|
|
182943
|
+
style: authStatus2.error instanceof InvalidAccessTokenError ? "error" : "warning",
|
|
182944
|
+
tags,
|
|
182945
|
+
interact: isAvailabilityError(authStatus2.error) ? interactNetworkIssues : interactAuth
|
|
182946
|
+
};
|
|
182947
|
+
}
|
|
182466
182948
|
return {
|
|
182467
182949
|
text: "Sign In",
|
|
182468
182950
|
tooltip: "Sign in to get started with Cody.",
|
|
@@ -182795,23 +183277,6 @@ async function getCurrentCodySuggestionMode(workspaceConfig) {
|
|
|
182795
183277
|
function getCodySuggestionModeKey() {
|
|
182796
183278
|
return "cody.suggestions.mode";
|
|
182797
183279
|
}
|
|
182798
|
-
function ignoreReason(isIgnore) {
|
|
182799
|
-
switch (isIgnore) {
|
|
182800
|
-
case false:
|
|
182801
|
-
return null;
|
|
182802
|
-
case "non-file-uri":
|
|
182803
|
-
return "This current file is ignored as it does not have a valid file URI.";
|
|
182804
|
-
case "no-repo-found":
|
|
182805
|
-
return "This current file is ignored as it is not in known git repository.";
|
|
182806
|
-
case "has-ignore-everything-filters":
|
|
182807
|
-
return "Your administrator has disabled Cody for this file.";
|
|
182808
|
-
default:
|
|
182809
|
-
if (isIgnore.startsWith("repo:")) {
|
|
182810
|
-
return `Your administrator has disabled Cody for '${isIgnore.replace("repo:", "")}'.`;
|
|
182811
|
-
}
|
|
182812
|
-
return "The current file is ignored by Cody.";
|
|
182813
|
-
}
|
|
182814
|
-
}
|
|
182815
183280
|
function openCodyIssueReporter() {
|
|
182816
183281
|
void commands$1.executeCommand("workbench.action.openIssueReporter", {
|
|
182817
183282
|
extensionId: `${packageJson.publisher}.${packageJson.name}`,
|
|
@@ -183577,7 +184042,6 @@ const register = async (context2, platform2, isExtensionModeDevOrTest) => {
|
|
|
183577
184042
|
completionsClient,
|
|
183578
184043
|
guardrails,
|
|
183579
184044
|
symfRunner,
|
|
183580
|
-
chatIntentAPIClient,
|
|
183581
184045
|
dispose: disposeExternalServices
|
|
183582
184046
|
} = await configureExternalServices(context2, platform2);
|
|
183583
184047
|
disposables.push({ dispose: disposeExternalServices });
|
|
@@ -183590,7 +184054,6 @@ const register = async (context2, platform2, isExtensionModeDevOrTest) => {
|
|
|
183590
184054
|
chatClient,
|
|
183591
184055
|
guardrails,
|
|
183592
184056
|
editor,
|
|
183593
|
-
chatIntentAPIClient,
|
|
183594
184057
|
contextRetriever
|
|
183595
184058
|
},
|
|
183596
184059
|
disposables
|
|
@@ -183668,7 +184131,7 @@ async function registerOtherCommands(disposables) {
|
|
|
183668
184131
|
modal: true,
|
|
183669
184132
|
detail: `${userMessage}
|
|
183670
184133
|
|
|
183671
|
-
Upgrade to Cody Pro for unlimited autocomplete suggestions, chat messages and commands.
|
|
184134
|
+
Upgrade to Cody Pro for unlimited autocomplete suggestions, and increased limits for chat messages and commands.
|
|
183672
184135
|
|
|
183673
184136
|
${retryMessage}`
|
|
183674
184137
|
},
|
|
@@ -183867,7 +184330,11 @@ function registerAuthCommands(disposables) {
|
|
|
183867
184330
|
commands$1.registerCommand("cody.auth.signin", () => showSignInMenu()),
|
|
183868
184331
|
commands$1.registerCommand("cody.auth.signout", () => showSignOutMenu()),
|
|
183869
184332
|
commands$1.registerCommand("cody.auth.account", () => showAccountMenu()),
|
|
183870
|
-
commands$1.registerCommand("cody.auth.support", () => showFeedbackSupportQuickPick())
|
|
184333
|
+
commands$1.registerCommand("cody.auth.support", () => showFeedbackSupportQuickPick()),
|
|
184334
|
+
commands$1.registerCommand(
|
|
184335
|
+
"cody.auth.requestEndpointSettings",
|
|
184336
|
+
async () => await requestEndpointSettingsDeliveryToSearchPlugin()
|
|
184337
|
+
)
|
|
183871
184338
|
);
|
|
183872
184339
|
}
|
|
183873
184340
|
function registerUpgradeHandlers(disposables) {
|
|
@@ -183941,7 +184408,7 @@ async function registerDebugCommands(context2, disposables) {
|
|
|
183941
184408
|
}
|
|
183942
184409
|
async function tryRegisterTutorial(context2, disposables) {
|
|
183943
184410
|
if (!isRunningInsideAgent()) {
|
|
183944
|
-
const { registerInteractiveTutorial } = await import("./index-
|
|
184411
|
+
const { registerInteractiveTutorial } = await import("./index-CvHu3t7y.mjs");
|
|
183945
184412
|
registerInteractiveTutorial(context2).then((disposable) => disposables.push(...disposable));
|
|
183946
184413
|
}
|
|
183947
184414
|
}
|
|
@@ -184025,15 +184492,7 @@ function registerAutocomplete(platform2, statusBar, disposables) {
|
|
|
184025
184492
|
)
|
|
184026
184493
|
);
|
|
184027
184494
|
}
|
|
184028
|
-
function registerChat({
|
|
184029
|
-
context: context2,
|
|
184030
|
-
platform: platform2,
|
|
184031
|
-
chatClient,
|
|
184032
|
-
guardrails,
|
|
184033
|
-
editor,
|
|
184034
|
-
chatIntentAPIClient,
|
|
184035
|
-
contextRetriever
|
|
184036
|
-
}, disposables) {
|
|
184495
|
+
function registerChat({ context: context2, platform: platform2, chatClient, guardrails, editor, contextRetriever }, disposables) {
|
|
184037
184496
|
const messageProviderOptions = {
|
|
184038
184497
|
chat: chatClient,
|
|
184039
184498
|
guardrails,
|
|
@@ -184048,7 +184507,6 @@ function registerChat({
|
|
|
184048
184507
|
chatClient,
|
|
184049
184508
|
contextRetriever,
|
|
184050
184509
|
guardrails,
|
|
184051
|
-
chatIntentAPIClient || null,
|
|
184052
184510
|
platform2.extensionClient
|
|
184053
184511
|
);
|
|
184054
184512
|
chatsController.registerViewsAndCommands();
|