@sourcegraph/cody-web 0.18.0 → 0.20.0
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-BdO3dQ4H.mjs → agent.worker-C43kSzdJ.mjs} +263 -154
- package/dist/agent.worker.js +2 -2
- package/dist/{browser-CSavJDeQ.mjs → browser-C8qAwvsz.mjs} +321 -309
- package/dist/{git-log-BrfMXsI3.mjs → git-log-CMMJVHUP.mjs} +2 -2
- package/dist/{index-BbjC2_76.mjs → index-CnAmRHEe.mjs} +2 -2
- package/dist/index.js +912 -630
- package/dist/style.css +145 -79
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -17,8 +17,8 @@ var __privateWrapper = (obj, member, setter2, getter) => ({
|
|
|
17
17
|
return __privateGet(obj, member, getter);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
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, _constructing2,
|
|
21
|
-
import {
|
|
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, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
21
|
+
import { aY as Observable, b_ as unsubscribe, b$ as AsyncSerialScheduler, c0 as authStatus, c1 as debounceTime, c2 as switchMapReplayOperation, c3 as interval, c4 as map$1, c5 as filter$3, c6 as startWith$1, c7 as switchMap$1, c8 as promiseFactoryToObservable, bm as isError$3, c9 as distinctUntilChanged$1, bM as firstValueFrom$1, bN as skipPendingOperation, ca as logDebug$1, cb as graphqlClient, cc as isAbortError, cd as logError$2, ce as semver, cf as pendingOperation, cg as pick, bw as ModelTag, ch as getModelInfo, bS as CHAT_INPUT_TOKEN_BUDGET, ci as CHAT_OUTPUT_TOKEN_BUDGET, cj as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, ck as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, cl as createSubscriber, cm as fromVSCodeEvent, b3 as isEqual, cn as cenv, bF as isDotCom, co as currentAuthStatus, cp as isFileURI, w as wrapInActiveSpan, cq as INCLUDE_EVERYTHING_CONTEXT_FILTERS, cr as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, cs as onAbort, ct as addCodyClientIdentificationHeaders, cu as addTraceparent, cv as fetch$3, cw as verifyResponseCode, bf as FeatureFlag, cx as combineLatest$1, cy as take$2, cz as clientCapabilities, cA as shareReplay$1, cB as tap$2, cC as featureFlagProvider, cD as getEnterpriseContextWindow, cE as ANSWER_TOKENS, cF as storeLastValue, cG as resolvedConfig, cH as userProductSubscription, bK as firstResultFromOperation, cI as isEnterpriseUser, bh as isCodyProUser, p as ps, cJ as currentResolvedConfig, bY as PromptString, cK as isCustomModel, cL as recordErrorToSpan, cM as addClientInfoParams, cN as dependentAbortController, am as FILE_CONTEXT_MENTION_PROVIDER, an as SYMBOL_CONTEXT_MENTION_PROVIDER, ao as REMOTE_REPOSITORY_PROVIDER_URI, ap as REMOTE_FILE_PROVIDER_URI, aq as REMOTE_DIRECTORY_PROVIDER_URI, ar as WEB_PROVIDER_URI, at as WORKSPACE_REPOSITORY_PROVIDER_URI, as as WORKSPACE_DIRECTORY_PROVIDER_URI, t as telemetryRecorder, C as ContextItemSource, br as lodashExports, cO as truncatePromptString, cP as isS2, cQ as GIT_OPENCTX_PROVIDER_URI, bl as cryptoJsExports, bj as CodyIDE, cR as openCtx, aO as URI, cS as MulticastSubject, cT as AsyncSerialScheduler_1, g as getDefaultExportFromCjs, cU as Utils$1, cV as toString_1, cW as upperFirst_1, cX as _, cY as extensionForLanguage, cZ as setClientNameVersion, c_ as base64Js, bi as commonjsGlobal, c$ as _baseAssignValue, d0 as eq_1, d1 as isArrayLike_1, d2 as isObjectLike_1, d3 as _copyObject, d4 as keysIn_1, d5 as _cloneBufferExports, d6 as _cloneTypedArray, d7 as _copyArray, d8 as _initCloneObject, d9 as isArguments_1, da as isArray_1, db as isBufferExports, dc as isFunction_1, dd as isObject_1, de as isPlainObject_1, df as isTypedArray_1, dg as _Stack, dh as identity_1, di as _overRest, dj as _setToString, dk as _isIndex, bb as isSourcegraphToken, dl as setExtensionVersion, dm as withLatestFrom, dn as NEVER, dp as abortableOperation, dq as disposableSubscription, dr as setAuthStatusObservable, ds as DOTCOM_URL, dt as normalizeServerEndpointURL, du as SourcegraphGraphQLAPIClient, dv as isNetworkLikeError, dw as getAuthErrorMessage, dx as SUPPORTED_URI_SCHEMAS, dy as _baseIsEqual, dz as keys_1, dA as _baseGet, dB as _castPath, dC as isLength_1, dD as _toKey, dE as _isKey, dF as toNumber_1, dG as _baseFindIndex, dH as require$$0$2, dI as NetworkError, dJ as isRateLimitError, dK as isAuthError, d as dedent$1, dL as convertGitCloneURLToCodebaseName, bp as isDefined, dM as pluck, dN as TokenCounterUtils, dO as toRangeData, dP as DefaultChatCommands, dQ as pathFunctionsForURI, dR as uriParseNameAndExtension, dS as uriDirname, dT as uriExtname, dU as uriBasename, dV as DefaultEditCommands, dW as subscriptionDisposable, dX as NoOpTelemetryRecorderProvider, dY as TimestampTelemetryProcessor_1, dZ as updateGlobalTelemetryInstances, d_ as TelemetryRecorderProvider, d$ as telemetryRecorderProvider, e0 as createGitDiff, e1 as catchError$1, e2 as omit$1, e3 as displayPathWithoutWorkspaceFolderPrefix, e4 as getEditorInsertSpaces, e5 as escapeRegExp$1, e6 as isNetworkError, bD as isCodyProModel, e7 as http, bk as CodyTaskState, aZ as createExtensionAPI, a_ as createMessageAPIForWebview, e8 as getAugmentedNamespace, e9 as main$1, ea as firstNonPendingAuthStatus, eb as TESTING_TELEMETRY_EXPORTER, ec as dist, ed as checkIfEnterpriseUser, ee as currentAuthStatusAuthed, ef as waitUntilComplete, bJ as isMacOS, bB as CustomCommandType, bZ as setDisplayPathEnvInfo, eg as isWindows, eh as currentAuthStatusOrNotReadyYet, ei as currentUserProductSubscription, bG as ACCOUNT_USAGE_URL, a$ as debounce$1, au as displayPath, ej as structuredPatch, ek as isDotComAuthed, el as dedupeWith$1, em as AbortError$1, en as TimeoutError, eo as createDisposables, ep as getClientInfoQueryParams, eq as tracer, er as getClientIdentificationHeaders, es as logResponseHeadersToSpan, et as getActiveTraceAndSpanId, eu as TracedError, ev as isNodeResponse, be as SpanStatusCode, bn as RateLimitError$1, ew as createTwoFilesPatch, ex as getEditorTabSize$1, ax as displayPathBasename, ey as debounce_1, bX as isErrorLike, ez as mentionProvidersMetadata, eA as editorStateFromPromptString, eB as assertFileURI, eC as setOpenCtx, eD as createCodeSearchProvider, bt as CODE_SEARCH_PROVIDER_URI, eE as _baseGetTag, eF as truncateTextNearestLine, eG as MAX_BYTES_PER_FILE, eH as expandToLineRange, av as displayLineRange, aV as parseMentionQuery, eI as TokenCounter, eJ as PromptMode, eK as skip$1, bd as context$1, eL as extractContextFromTraceparent, eM as getTokenCounterUtils, eN as inputTextWithoutContextChipsFromPromptEditorState, bP as inputTextWithMappedContextChipsFromPromptEditorState, bv as isAbortErrorOrSocketHangUp, eO as isContextWindowLimitError, b9 as forceHydration, bu as reformatBotMessageForChat, ba as hydrateAfterPostMessage, eP as addMessageListenersForExtensionAPI, eQ as createMessageAPIForExtension, bC as View, eR as CODY_BLOG_URL_o1_WAITLIST, eS as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, bA as pluralize, bH as ACCOUNT_UPGRADE_URL, b4 as scanForMentionTriggerInUserTextInput, az as LARGE_FILE_WARNING_LABEL, eT as GENERAL_HELP_LABEL, eU as diffLines, eV as psDedent, eW as languageFromFilename, eX as ProgrammingLanguage, eY as truncatePromptStringStart, eZ as MAX_CURRENT_FILE_TOKENS, e_ as posixFilePaths, e$ as SURROUNDING_LINES, f0 as CODY_SUPPORT_URL, f1 as CODY_DOC_URL, bo as CODY_FEEDBACK_URL, f2 as DISCORD_URL, bI as getRelativeChatPeriod, f3 as globalAgentRef, f4 as VSCODE_CHANGELOG_URL, f5 as SG_CHANGELOG_URL, f6 as ACCOUNT_LIMITS_INFO_URL, f7 as assertUnreachable, f8 as promise, f9 as setLogger, fa as setClientCapabilities, fb as setResolvedConfigurationObservable, fc as CODY_OLLAMA_DOCS_URL, bW as browser$3 } from "./browser-C8qAwvsz.mjs";
|
|
22
22
|
function _mergeNamespaces(n, m) {
|
|
23
23
|
for (var i = 0; i < m.length; i++) {
|
|
24
24
|
const e = m[i];
|
|
@@ -11619,8 +11619,8 @@ const events$3 = [
|
|
|
11619
11619
|
source: { chat: 1 },
|
|
11620
11620
|
provider: {
|
|
11621
11621
|
[fallbackValue]: 0,
|
|
11622
|
-
[FILE_CONTEXT_MENTION_PROVIDER.id]: 1,
|
|
11623
|
-
[SYMBOL_CONTEXT_MENTION_PROVIDER.id]: 2,
|
|
11622
|
+
[(_e = FILE_CONTEXT_MENTION_PROVIDER) == null ? void 0 : _e.id]: 1,
|
|
11623
|
+
[(_f = SYMBOL_CONTEXT_MENTION_PROVIDER) == null ? void 0 : _f.id]: 2,
|
|
11624
11624
|
[REMOTE_REPOSITORY_PROVIDER_URI]: 3,
|
|
11625
11625
|
[REMOTE_FILE_PROVIDER_URI]: 4,
|
|
11626
11626
|
[REMOTE_DIRECTORY_PROVIDER_URI]: 5,
|
|
@@ -11637,7 +11637,9 @@ const events$3 = [
|
|
|
11637
11637
|
"https://openctx.org/npm/@openctx/provider-notion": 7,
|
|
11638
11638
|
"https://openctx.org/npm/@openctx/provider-hello-world": 7,
|
|
11639
11639
|
"https://openctx.org/npm/@openctx/provider-devdocs": 7,
|
|
11640
|
-
"https://openctx.org/npm/@openctx/provider-sourcegraph-search": 7
|
|
11640
|
+
"https://openctx.org/npm/@openctx/provider-sourcegraph-search": 7,
|
|
11641
|
+
[WORKSPACE_REPOSITORY_PROVIDER_URI]: 8,
|
|
11642
|
+
[WORKSPACE_DIRECTORY_PROVIDER_URI]: 8
|
|
11641
11643
|
}
|
|
11642
11644
|
}
|
|
11643
11645
|
)
|
|
@@ -12806,7 +12808,7 @@ if (typeof AC === "undefined") {
|
|
|
12806
12808
|
(_b2 = (_a3 = this.signal).onabort) == null ? void 0 : _b2.call(_a3, reason);
|
|
12807
12809
|
}
|
|
12808
12810
|
};
|
|
12809
|
-
let printACPolyfillWarning = ((
|
|
12811
|
+
let printACPolyfillWarning = ((_g = PROCESS.env) == null ? void 0 : _g.LRU_CACHE_IGNORE_AC_WARNING) !== "1";
|
|
12810
12812
|
const warnACPolyfill = () => {
|
|
12811
12813
|
if (!printACPolyfillWarning)
|
|
12812
12814
|
return;
|
|
@@ -12823,11 +12825,11 @@ class ZeroArray extends Array {
|
|
|
12823
12825
|
this.fill(0);
|
|
12824
12826
|
}
|
|
12825
12827
|
}
|
|
12826
|
-
let Stack$2 = (
|
|
12828
|
+
let Stack$2 = (_h = class {
|
|
12827
12829
|
constructor(max, HeapCls) {
|
|
12828
12830
|
__publicField2(this, "heap");
|
|
12829
12831
|
__publicField2(this, "length");
|
|
12830
|
-
if (!__privateGet(
|
|
12832
|
+
if (!__privateGet(_h, _constructing2)) {
|
|
12831
12833
|
throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
12832
12834
|
}
|
|
12833
12835
|
this.heap = new HeapCls(max);
|
|
@@ -12837,9 +12839,9 @@ let Stack$2 = (_f = class {
|
|
|
12837
12839
|
const HeapCls = getUintArray(max);
|
|
12838
12840
|
if (!HeapCls)
|
|
12839
12841
|
return [];
|
|
12840
|
-
__privateSet(
|
|
12841
|
-
const s = new
|
|
12842
|
-
__privateSet(
|
|
12842
|
+
__privateSet(_h, _constructing2, true);
|
|
12843
|
+
const s = new _h(max, HeapCls);
|
|
12844
|
+
__privateSet(_h, _constructing2, false);
|
|
12843
12845
|
return s;
|
|
12844
12846
|
}
|
|
12845
12847
|
push(n) {
|
|
@@ -12849,7 +12851,7 @@ let Stack$2 = (_f = class {
|
|
|
12849
12851
|
return this.heap[--this.length];
|
|
12850
12852
|
}
|
|
12851
12853
|
}, _constructing2 = new WeakMap(), // private constructor
|
|
12852
|
-
__privateAdd(
|
|
12854
|
+
__privateAdd(_h, _constructing2, false), _h);
|
|
12853
12855
|
const _LRUCache = class _LRUCache {
|
|
12854
12856
|
constructor(options) {
|
|
12855
12857
|
__privateAdd(this, _LRUCache_instances2);
|
|
@@ -12962,7 +12964,7 @@ const _LRUCache = class _LRUCache {
|
|
|
12962
12964
|
* A String value that is used in the creation of the default string description of an object.
|
|
12963
12965
|
* Called by the built-in method Object.prototype.toString.
|
|
12964
12966
|
*/
|
|
12965
|
-
__publicField2(this,
|
|
12967
|
+
__publicField2(this, _i, "LRUCache");
|
|
12966
12968
|
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
|
|
12967
12969
|
if (max !== 0 && !isPosInt(max)) {
|
|
12968
12970
|
throw new TypeError("max option must be a nonnegative integer");
|
|
@@ -13235,7 +13237,7 @@ const _LRUCache = class _LRUCache {
|
|
|
13235
13237
|
* Iterating over the cache itself yields the same results as
|
|
13236
13238
|
* {@link LRUCache.entries}
|
|
13237
13239
|
*/
|
|
13238
|
-
[(
|
|
13240
|
+
[(_j = Symbol.iterator, _i = Symbol.toStringTag, _j)]() {
|
|
13239
13241
|
return this.entries();
|
|
13240
13242
|
}
|
|
13241
13243
|
/**
|
|
@@ -21741,16 +21743,16 @@ const _commands = {
|
|
|
21741
21743
|
return Promise.resolve(void 0);
|
|
21742
21744
|
}
|
|
21743
21745
|
};
|
|
21744
|
-
(
|
|
21746
|
+
(_k = _commands == null ? void 0 : _commands.registerCommand) == null ? void 0 : _k.call(_commands, "workbench.action.reloadWindow", () => {
|
|
21745
21747
|
});
|
|
21746
|
-
(
|
|
21748
|
+
(_l = _commands == null ? void 0 : _commands.registerCommand) == null ? void 0 : _l.call(_commands, "setContext", (key, value) => {
|
|
21747
21749
|
if (typeof key !== "string") {
|
|
21748
21750
|
throw new TypeError(`setContext: first argument must be string. Got: ${key}`);
|
|
21749
21751
|
}
|
|
21750
21752
|
context.set(key, value);
|
|
21751
21753
|
agent$1 == null ? void 0 : agent$1.notify("window/didChangeContext", { key, value: value.toString() });
|
|
21752
21754
|
});
|
|
21753
|
-
(
|
|
21755
|
+
(_m = _commands == null ? void 0 : _commands.registerCommand) == null ? void 0 : _m.call(_commands, "vscode.executeFoldingRangeProvider", async (uri2) => {
|
|
21754
21756
|
const promises = [];
|
|
21755
21757
|
const document2 = await _workspace.openTextDocument(uri2);
|
|
21756
21758
|
const token = new CancellationTokenSource().token;
|
|
@@ -21762,16 +21764,16 @@ const _commands = {
|
|
|
21762
21764
|
}
|
|
21763
21765
|
return promises;
|
|
21764
21766
|
});
|
|
21765
|
-
(
|
|
21767
|
+
(_n = _commands == null ? void 0 : _commands.registerCommand) == null ? void 0 : _n.call(_commands, "vscode.executeDocumentSymbolProvider", (uri2) => {
|
|
21766
21768
|
return Promise.resolve([]);
|
|
21767
21769
|
});
|
|
21768
|
-
(
|
|
21770
|
+
(_o = _commands == null ? void 0 : _commands.registerCommand) == null ? void 0 : _o.call(_commands, "vscode.executeWorkspaceSymbolProvider", (query2) => {
|
|
21769
21771
|
return Promise.resolve([]);
|
|
21770
21772
|
});
|
|
21771
|
-
(
|
|
21773
|
+
(_p = _commands == null ? void 0 : _commands.registerCommand) == null ? void 0 : _p.call(_commands, "vscode.executeFormatDocumentProvider", (uri2) => {
|
|
21772
21774
|
return Promise.resolve([]);
|
|
21773
21775
|
});
|
|
21774
|
-
(
|
|
21776
|
+
(_q = _commands == null ? void 0 : _commands.registerCommand) == null ? void 0 : _q.call(
|
|
21775
21777
|
_commands,
|
|
21776
21778
|
"vscode.open",
|
|
21777
21779
|
async (uri2, options) => {
|
|
@@ -21790,7 +21792,7 @@ const _env = {
|
|
|
21790
21792
|
uriScheme: "file",
|
|
21791
21793
|
appName: void 0,
|
|
21792
21794
|
shell: void 0,
|
|
21793
|
-
appRoot: (
|
|
21795
|
+
appRoot: (_r = define_process_default$g.cwd) == null ? void 0 : _r.call(define_process_default$g),
|
|
21794
21796
|
uiKind: UIKind.Desktop,
|
|
21795
21797
|
language: "en-US",
|
|
21796
21798
|
clipboard: {
|
|
@@ -30358,7 +30360,7 @@ const maybeStartInteractiveTutorial = async () => {
|
|
|
30358
30360
|
}
|
|
30359
30361
|
return commands$1.executeCommand("cody.tutorial.start");
|
|
30360
30362
|
};
|
|
30361
|
-
const version = ((
|
|
30363
|
+
const version = ((_t = (_s = extensions.getExtension("sourcegraph.cody-ai")) == null ? void 0 : _s.packageJSON) == null ? void 0 : _t.version) ?? version$1;
|
|
30362
30364
|
setExtensionVersion(version);
|
|
30363
30365
|
const HAS_AUTHENTICATED_BEFORE_KEY = "has-authenticated-before";
|
|
30364
30366
|
class AuthProvider {
|
|
@@ -44623,7 +44625,7 @@ class AgentWorkspaceDocuments {
|
|
|
44623
44625
|
__publicField2(this, "agentDocuments", /* @__PURE__ */ new Map());
|
|
44624
44626
|
__publicField2(this, "workspaceRootUri");
|
|
44625
44627
|
__publicField2(this, "activeDocumentFilePath", null);
|
|
44626
|
-
__publicField2(this, "doPanic", ((
|
|
44628
|
+
__publicField2(this, "doPanic", ((_u = this.params) == null ? void 0 : _u.doPanic) ? { doPanic: this.params.doPanic } : void 0);
|
|
44627
44629
|
this.params = params;
|
|
44628
44630
|
}
|
|
44629
44631
|
openUri(uri2) {
|
|
@@ -48737,7 +48739,7 @@ class CommandsProvider {
|
|
|
48737
48739
|
if (!isFileURI(uri2)) {
|
|
48738
48740
|
throw new Error("history only supported on local file paths");
|
|
48739
48741
|
}
|
|
48740
|
-
const { getContextFileFromGitLog } = await import("./git-log-
|
|
48742
|
+
const { getContextFileFromGitLog } = await import("./git-log-CMMJVHUP.mjs");
|
|
48741
48743
|
return getContextFileFromGitLog(uri2, options);
|
|
48742
48744
|
}
|
|
48743
48745
|
dispose() {
|
|
@@ -150746,18 +150748,14 @@ class TwoStageUnifiedDiffStrategy {
|
|
|
150746
150748
|
};
|
|
150747
150749
|
}
|
|
150748
150750
|
}
|
|
150749
|
-
class
|
|
150750
|
-
constructor(
|
|
150751
|
+
class RecentEditsTracker {
|
|
150752
|
+
constructor(maxAgeMs, workspace$1 = workspace) {
|
|
150751
150753
|
// We use a map from the document URI to the set of tracked completions inside that document to
|
|
150752
150754
|
// improve performance of the `onDidChangeTextDocument` event handler.
|
|
150753
150755
|
__publicField2(this, "trackedDocuments", /* @__PURE__ */ new Map());
|
|
150754
|
-
__publicField2(this, "identifier", RetrieverIdentifier.RecentEditsRetriever);
|
|
150755
150756
|
__publicField2(this, "disposables", []);
|
|
150756
|
-
|
|
150757
|
-
__publicField2(this, "diffStrategyList");
|
|
150757
|
+
this.maxAgeMs = maxAgeMs;
|
|
150758
150758
|
this.workspace = workspace$1;
|
|
150759
|
-
this.maxAgeMs = options.maxAgeMs;
|
|
150760
|
-
this.diffStrategyList = options.diffStrategyList;
|
|
150761
150759
|
for (const document2 of workspace.textDocuments) {
|
|
150762
150760
|
this.trackDocument(document2);
|
|
150763
150761
|
}
|
|
@@ -150768,6 +150766,93 @@ class RecentEditsRetriever {
|
|
|
150768
150766
|
workspace$1.onDidOpenTextDocument(this.onDidOpenTextDocument.bind(this))
|
|
150769
150767
|
);
|
|
150770
150768
|
}
|
|
150769
|
+
getTrackedDocumentForUri(uri2) {
|
|
150770
|
+
return this.trackedDocuments.get(uri2.toString());
|
|
150771
|
+
}
|
|
150772
|
+
getTrackedDocumentsMapping() {
|
|
150773
|
+
return this.trackedDocuments;
|
|
150774
|
+
}
|
|
150775
|
+
onDidChangeTextDocument(event2) {
|
|
150776
|
+
const trackedDocument = this.trackedDocuments.get(event2.document.uri.toString());
|
|
150777
|
+
if (!trackedDocument) {
|
|
150778
|
+
return;
|
|
150779
|
+
}
|
|
150780
|
+
const now = Date.now();
|
|
150781
|
+
for (const change of event2.contentChanges) {
|
|
150782
|
+
const insertedRange = new Range(
|
|
150783
|
+
change.range.start,
|
|
150784
|
+
getPositionAfterTextInsertion(change.range.start, change.text)
|
|
150785
|
+
);
|
|
150786
|
+
trackedDocument.changes.push({
|
|
150787
|
+
timestamp: now,
|
|
150788
|
+
change,
|
|
150789
|
+
insertedRange
|
|
150790
|
+
});
|
|
150791
|
+
}
|
|
150792
|
+
this.reconcileOutdatedChanges();
|
|
150793
|
+
}
|
|
150794
|
+
onDidOpenTextDocument(document2) {
|
|
150795
|
+
if (!this.trackedDocuments.has(document2.uri.toString())) {
|
|
150796
|
+
this.trackDocument(document2);
|
|
150797
|
+
}
|
|
150798
|
+
}
|
|
150799
|
+
onDidRenameFiles(event2) {
|
|
150800
|
+
for (const file of event2.files) {
|
|
150801
|
+
const trackedDocument = this.trackedDocuments.get(file.oldUri.toString());
|
|
150802
|
+
if (trackedDocument) {
|
|
150803
|
+
this.trackedDocuments.set(file.newUri.toString(), trackedDocument);
|
|
150804
|
+
this.trackedDocuments.delete(file.oldUri.toString());
|
|
150805
|
+
}
|
|
150806
|
+
}
|
|
150807
|
+
}
|
|
150808
|
+
onDidDeleteFiles(event2) {
|
|
150809
|
+
for (const uri2 of event2.files) {
|
|
150810
|
+
this.trackedDocuments.delete(uri2.toString());
|
|
150811
|
+
}
|
|
150812
|
+
}
|
|
150813
|
+
trackDocument(document2) {
|
|
150814
|
+
if (document2.uri.scheme !== "file") {
|
|
150815
|
+
return;
|
|
150816
|
+
}
|
|
150817
|
+
const trackedDocument = {
|
|
150818
|
+
content: document2.getText(),
|
|
150819
|
+
languageId: document2.languageId,
|
|
150820
|
+
uri: document2.uri,
|
|
150821
|
+
changes: []
|
|
150822
|
+
};
|
|
150823
|
+
this.trackedDocuments.set(document2.uri.toString(), trackedDocument);
|
|
150824
|
+
}
|
|
150825
|
+
reconcileOutdatedChanges() {
|
|
150826
|
+
const now = Date.now();
|
|
150827
|
+
for (const [, trackedDocument] of this.trackedDocuments) {
|
|
150828
|
+
const firstNonOutdatedChangeIndex = trackedDocument.changes.findIndex(
|
|
150829
|
+
(c) => now - c.timestamp < this.maxAgeMs
|
|
150830
|
+
);
|
|
150831
|
+
const outdatedChanges = trackedDocument.changes.slice(0, firstNonOutdatedChangeIndex);
|
|
150832
|
+
trackedDocument.content = applyTextDocumentChanges(
|
|
150833
|
+
trackedDocument.content,
|
|
150834
|
+
outdatedChanges.map((c) => c.change)
|
|
150835
|
+
);
|
|
150836
|
+
trackedDocument.changes = trackedDocument.changes.slice(firstNonOutdatedChangeIndex);
|
|
150837
|
+
}
|
|
150838
|
+
}
|
|
150839
|
+
dispose() {
|
|
150840
|
+
this.trackedDocuments.clear();
|
|
150841
|
+
for (const disposable of this.disposables) {
|
|
150842
|
+
disposable.dispose();
|
|
150843
|
+
}
|
|
150844
|
+
}
|
|
150845
|
+
}
|
|
150846
|
+
class RecentEditsRetriever {
|
|
150847
|
+
constructor(options, workspace$1 = workspace) {
|
|
150848
|
+
// We use a map from the document URI to the set of tracked completions inside that document to
|
|
150849
|
+
// improve performance of the `onDidChangeTextDocument` event handler.
|
|
150850
|
+
__publicField2(this, "identifier", RetrieverIdentifier.RecentEditsRetriever);
|
|
150851
|
+
__publicField2(this, "diffStrategyList");
|
|
150852
|
+
__publicField2(this, "recentEditsTracker");
|
|
150853
|
+
this.recentEditsTracker = new RecentEditsTracker(options.maxAgeMs, workspace$1);
|
|
150854
|
+
this.diffStrategyList = options.diffStrategyList;
|
|
150855
|
+
}
|
|
150771
150856
|
async retrieve(options) {
|
|
150772
150857
|
const rawDiffs = await this.getDiffAcrossDocuments();
|
|
150773
150858
|
const diffs = this.filterCandidateDiffs(rawDiffs, options.document);
|
|
@@ -150791,7 +150876,8 @@ class RecentEditsRetriever {
|
|
|
150791
150876
|
}
|
|
150792
150877
|
async getDiffAcrossDocuments() {
|
|
150793
150878
|
const diffs = [];
|
|
150794
|
-
const
|
|
150879
|
+
const trackedDocuments = this.recentEditsTracker.getTrackedDocumentsMapping();
|
|
150880
|
+
const diffPromises = Array.from(trackedDocuments.entries()).map(
|
|
150795
150881
|
async ([uri2, trackedDocument]) => {
|
|
150796
150882
|
if (trackedDocument.changes.length === 0) {
|
|
150797
150883
|
return null;
|
|
@@ -150833,8 +150919,8 @@ class RecentEditsRetriever {
|
|
|
150833
150919
|
if (await contextFiltersProvider.isUriIgnored(uri2)) {
|
|
150834
150920
|
return null;
|
|
150835
150921
|
}
|
|
150836
|
-
const trackedDocument = this.
|
|
150837
|
-
if (!trackedDocument) {
|
|
150922
|
+
const trackedDocument = this.recentEditsTracker.getTrackedDocumentForUri(uri2);
|
|
150923
|
+
if (!trackedDocument || trackedDocument.changes.length === 0) {
|
|
150838
150924
|
return null;
|
|
150839
150925
|
}
|
|
150840
150926
|
const diffHunks = [];
|
|
@@ -150856,75 +150942,8 @@ class RecentEditsRetriever {
|
|
|
150856
150942
|
isSupportedForLanguageId() {
|
|
150857
150943
|
return true;
|
|
150858
150944
|
}
|
|
150859
|
-
onDidChangeTextDocument(event2) {
|
|
150860
|
-
const trackedDocument = this.trackedDocuments.get(event2.document.uri.toString());
|
|
150861
|
-
if (!trackedDocument) {
|
|
150862
|
-
return;
|
|
150863
|
-
}
|
|
150864
|
-
const now = Date.now();
|
|
150865
|
-
for (const change of event2.contentChanges) {
|
|
150866
|
-
const insertedRange = new Range(
|
|
150867
|
-
change.range.start,
|
|
150868
|
-
getPositionAfterTextInsertion(change.range.start, change.text)
|
|
150869
|
-
);
|
|
150870
|
-
trackedDocument.changes.push({
|
|
150871
|
-
timestamp: now,
|
|
150872
|
-
change,
|
|
150873
|
-
insertedRange
|
|
150874
|
-
});
|
|
150875
|
-
}
|
|
150876
|
-
this.reconcileOutdatedChanges();
|
|
150877
|
-
}
|
|
150878
|
-
onDidOpenTextDocument(document2) {
|
|
150879
|
-
if (!this.trackedDocuments.has(document2.uri.toString())) {
|
|
150880
|
-
this.trackDocument(document2);
|
|
150881
|
-
}
|
|
150882
|
-
}
|
|
150883
|
-
onDidRenameFiles(event2) {
|
|
150884
|
-
for (const file of event2.files) {
|
|
150885
|
-
const trackedDocument = this.trackedDocuments.get(file.oldUri.toString());
|
|
150886
|
-
if (trackedDocument) {
|
|
150887
|
-
this.trackedDocuments.set(file.newUri.toString(), trackedDocument);
|
|
150888
|
-
this.trackedDocuments.delete(file.oldUri.toString());
|
|
150889
|
-
}
|
|
150890
|
-
}
|
|
150891
|
-
}
|
|
150892
|
-
onDidDeleteFiles(event2) {
|
|
150893
|
-
for (const uri2 of event2.files) {
|
|
150894
|
-
this.trackedDocuments.delete(uri2.toString());
|
|
150895
|
-
}
|
|
150896
|
-
}
|
|
150897
|
-
trackDocument(document2) {
|
|
150898
|
-
if (document2.uri.scheme !== "file") {
|
|
150899
|
-
return;
|
|
150900
|
-
}
|
|
150901
|
-
const trackedDocument = {
|
|
150902
|
-
content: document2.getText(),
|
|
150903
|
-
languageId: document2.languageId,
|
|
150904
|
-
uri: document2.uri,
|
|
150905
|
-
changes: []
|
|
150906
|
-
};
|
|
150907
|
-
this.trackedDocuments.set(document2.uri.toString(), trackedDocument);
|
|
150908
|
-
}
|
|
150909
|
-
reconcileOutdatedChanges() {
|
|
150910
|
-
const now = Date.now();
|
|
150911
|
-
for (const [, trackedDocument] of this.trackedDocuments) {
|
|
150912
|
-
const firstNonOutdatedChangeIndex = trackedDocument.changes.findIndex(
|
|
150913
|
-
(c) => now - c.timestamp < this.maxAgeMs
|
|
150914
|
-
);
|
|
150915
|
-
const outdatedChanges = trackedDocument.changes.slice(0, firstNonOutdatedChangeIndex);
|
|
150916
|
-
trackedDocument.content = applyTextDocumentChanges(
|
|
150917
|
-
trackedDocument.content,
|
|
150918
|
-
outdatedChanges.map((c) => c.change)
|
|
150919
|
-
);
|
|
150920
|
-
trackedDocument.changes = trackedDocument.changes.slice(firstNonOutdatedChangeIndex);
|
|
150921
|
-
}
|
|
150922
|
-
}
|
|
150923
150945
|
dispose() {
|
|
150924
|
-
this.
|
|
150925
|
-
for (const disposable of this.disposables) {
|
|
150926
|
-
disposable.dispose();
|
|
150927
|
-
}
|
|
150946
|
+
this.recentEditsTracker.dispose();
|
|
150928
150947
|
}
|
|
150929
150948
|
}
|
|
150930
150949
|
class RecentViewPortRetriever {
|
|
@@ -150954,7 +150973,7 @@ class RecentViewPortRetriever {
|
|
|
150954
150973
|
const snippetPromises = sortedViewPorts.map(async (viewPort) => {
|
|
150955
150974
|
const document22 = await workspace.openTextDocument(viewPort.uri);
|
|
150956
150975
|
const content = document22.getText(viewPort.visibleRange);
|
|
150957
|
-
|
|
150976
|
+
const snippet = {
|
|
150958
150977
|
uri: viewPort.uri,
|
|
150959
150978
|
content,
|
|
150960
150979
|
startLine: viewPort.visibleRange.start.line,
|
|
@@ -150964,8 +150983,10 @@ class RecentViewPortRetriever {
|
|
|
150964
150983
|
timeSinceActionMs: Date.now() - viewPort.lastAccessTimestamp
|
|
150965
150984
|
}
|
|
150966
150985
|
};
|
|
150986
|
+
return snippet;
|
|
150967
150987
|
});
|
|
150968
|
-
|
|
150988
|
+
const viewPortSnippets = await Promise.all(snippetPromises);
|
|
150989
|
+
return viewPortSnippets;
|
|
150969
150990
|
}
|
|
150970
150991
|
getValidViewPorts(document2) {
|
|
150971
150992
|
const currentFileUri = document2.uri.toString();
|
|
@@ -152856,6 +152877,74 @@ class SourcegraphCompletionsAdapter {
|
|
|
152856
152877
|
}
|
|
152857
152878
|
}
|
|
152858
152879
|
}
|
|
152880
|
+
const MAX_FILTER_AGE_MS = 1e3 * 30;
|
|
152881
|
+
class FilterPredictionBasedOnRecentEdits {
|
|
152882
|
+
constructor(workspace$1 = workspace) {
|
|
152883
|
+
__publicField2(this, "recentEditsTracker");
|
|
152884
|
+
this.recentEditsTracker = new RecentEditsTracker(MAX_FILTER_AGE_MS, workspace$1);
|
|
152885
|
+
}
|
|
152886
|
+
/**
|
|
152887
|
+
* Filters out predictions from auto-edit suggestion which undo the latest recent edits made by the user.
|
|
152888
|
+
* The function compares diffs between document states and the prediction vs code to re-write
|
|
152889
|
+
* to determine if the same edit was recently reverted.
|
|
152890
|
+
*/
|
|
152891
|
+
shouldFilterPrediction(uri2, prediction, codeToRewrite) {
|
|
152892
|
+
const trackedDocument = this.recentEditsTracker.getTrackedDocumentForUri(uri2);
|
|
152893
|
+
if (!trackedDocument) {
|
|
152894
|
+
return false;
|
|
152895
|
+
}
|
|
152896
|
+
const finalDocumentSnapshot = applyTextDocumentChanges(
|
|
152897
|
+
trackedDocument.content,
|
|
152898
|
+
trackedDocument.changes.map((c) => c.change)
|
|
152899
|
+
);
|
|
152900
|
+
let documentSnapshot = trackedDocument.content;
|
|
152901
|
+
for (const change of trackedDocument.changes) {
|
|
152902
|
+
if (this.isTextDocumentChangeReverted(
|
|
152903
|
+
finalDocumentSnapshot,
|
|
152904
|
+
documentSnapshot,
|
|
152905
|
+
prediction,
|
|
152906
|
+
codeToRewrite
|
|
152907
|
+
)) {
|
|
152908
|
+
return true;
|
|
152909
|
+
}
|
|
152910
|
+
documentSnapshot = applyTextDocumentChanges(documentSnapshot, [change.change]);
|
|
152911
|
+
}
|
|
152912
|
+
return false;
|
|
152913
|
+
}
|
|
152914
|
+
/**
|
|
152915
|
+
* Checks if a text document change has been reverted by comparing diffs.
|
|
152916
|
+
* @param finalDocumentSnapshot The final state of the document
|
|
152917
|
+
* @param documentSnapshot The current snapshot of the document
|
|
152918
|
+
* @param prediction The predicted code change
|
|
152919
|
+
* @param codeToRewrite The original code being rewritten
|
|
152920
|
+
* @returns True if the change has been reverted, false otherwise
|
|
152921
|
+
*/
|
|
152922
|
+
isTextDocumentChangeReverted(finalDocumentSnapshot, documentSnapshot, prediction, codeToRewrite) {
|
|
152923
|
+
const diff1 = this.createGitDiffForSnapshotComparison(documentSnapshot, finalDocumentSnapshot);
|
|
152924
|
+
const diff2 = this.createGitDiffForSnapshotComparison(prediction, codeToRewrite);
|
|
152925
|
+
if (diff1 === diff2) {
|
|
152926
|
+
if (diff1.length > 0) {
|
|
152927
|
+
autoeditsLogger.logDebug(
|
|
152928
|
+
"Autoedits",
|
|
152929
|
+
"Filtered the prediction based on recent edits match",
|
|
152930
|
+
"Diff calculated for filtering based on recent edits\n",
|
|
152931
|
+
diff1
|
|
152932
|
+
);
|
|
152933
|
+
}
|
|
152934
|
+
return true;
|
|
152935
|
+
}
|
|
152936
|
+
return false;
|
|
152937
|
+
}
|
|
152938
|
+
createGitDiffForSnapshotComparison(oldContent, newContent) {
|
|
152939
|
+
const diff2 = createTwoFilesPatch("a/file", "b/file", oldContent, newContent, "", "", {
|
|
152940
|
+
context: 0
|
|
152941
|
+
});
|
|
152942
|
+
return diff2.split("\n").slice(4).join("\n");
|
|
152943
|
+
}
|
|
152944
|
+
dispose() {
|
|
152945
|
+
this.recentEditsTracker.dispose();
|
|
152946
|
+
}
|
|
152947
|
+
}
|
|
152859
152948
|
const LINT_ERRORS_TAG_OPEN = ps`<lint_errors>`;
|
|
152860
152949
|
const LINT_ERRORS_TAG_CLOSE = ps`</lint_errors>`;
|
|
152861
152950
|
const EXTRACTED_CODE_SNIPPETS_TAG_OPEN = ps`<extracted_code_snippets>`;
|
|
@@ -152906,7 +152995,7 @@ function adjustPredictionIfInlineCompletionPossible(originalPrediction, prefix,
|
|
|
152906
152995
|
const suffixWithoutNewLine = trimNewLineCharsFromString(suffix);
|
|
152907
152996
|
const indexPrefix = originalPrediction.indexOf(prefixWithoutNewLine);
|
|
152908
152997
|
const indexSuffix = originalPrediction.lastIndexOf(suffixWithoutNewLine);
|
|
152909
|
-
if (indexPrefix === -1 || indexSuffix === -1) {
|
|
152998
|
+
if (indexPrefix === -1 || indexSuffix === -1 || indexPrefix + prefixWithoutNewLine.length > indexSuffix) {
|
|
152910
152999
|
return originalPrediction;
|
|
152911
153000
|
}
|
|
152912
153001
|
const predictionBeforePrefixMatch = originalPrediction.slice(0, indexPrefix);
|
|
@@ -153976,10 +154065,6 @@ class InlineDiffDecorator {
|
|
|
153976
154065
|
currentInsertPosition = null;
|
|
153977
154066
|
currentInsertText = "";
|
|
153978
154067
|
}
|
|
153979
|
-
if (removed.length > 0) {
|
|
153980
|
-
this.editor.setDecorations(this.removedTextDecorationType, removed);
|
|
153981
|
-
removed.length = 0;
|
|
153982
|
-
}
|
|
153983
154068
|
}
|
|
153984
154069
|
return { added, removed };
|
|
153985
154070
|
}
|
|
@@ -154511,6 +154596,11 @@ class AutoEditsInlineRendererManager extends AutoEditsDefaultRendererManager {
|
|
|
154511
154596
|
});
|
|
154512
154597
|
await this.dismissEdit();
|
|
154513
154598
|
}
|
|
154599
|
+
async onDidChangeTextEditorSelection(event2) {
|
|
154600
|
+
if (isFileURI(event2.textEditor.document.uri)) {
|
|
154601
|
+
this.dismissEdit();
|
|
154602
|
+
}
|
|
154603
|
+
}
|
|
154514
154604
|
async maybeRenderDecorationsAndTryMakeInlineCompletionResponse(prediction, codeToReplaceData, document2, position, docContext, decorationInfo) {
|
|
154515
154605
|
const { insertText, usedChangeIds } = getCompletionText({
|
|
154516
154606
|
prediction,
|
|
@@ -154716,40 +154806,6 @@ function getTextBetweenMarkers({
|
|
|
154716
154806
|
}
|
|
154717
154807
|
return void 0;
|
|
154718
154808
|
}
|
|
154719
|
-
function shrinkPredictionUntilSuffix(prediction, codeToReplaceData) {
|
|
154720
|
-
const newLineChar = getNewLineChar(prediction);
|
|
154721
|
-
const suffix = codeToReplaceData.suffixInArea + codeToReplaceData.suffixAfterArea;
|
|
154722
|
-
const predictionLines = lines(prediction);
|
|
154723
|
-
const suffixLines = lines(suffix);
|
|
154724
|
-
const originalLines = lines(codeToReplaceData.codeToRewrite.trimEnd());
|
|
154725
|
-
const maxOverlap = Math.min(predictionLines.length, suffixLines.length);
|
|
154726
|
-
let overlap2 = 0;
|
|
154727
|
-
for (let i = 1; i <= maxOverlap; i++) {
|
|
154728
|
-
const predictionSlice = predictionLines.slice(-i);
|
|
154729
|
-
const suffixSlice = suffixLines.slice(0, i);
|
|
154730
|
-
let matches = true;
|
|
154731
|
-
for (let j = 0; j < i; j++) {
|
|
154732
|
-
if (!suffixSlice[j].trim().startsWith(predictionSlice[j].trim())) {
|
|
154733
|
-
matches = false;
|
|
154734
|
-
break;
|
|
154735
|
-
}
|
|
154736
|
-
}
|
|
154737
|
-
if (matches) {
|
|
154738
|
-
overlap2 = i;
|
|
154739
|
-
}
|
|
154740
|
-
}
|
|
154741
|
-
if (overlap2 > 0) {
|
|
154742
|
-
predictionLines.splice(-overlap2, overlap2);
|
|
154743
|
-
}
|
|
154744
|
-
const originalLineCount = originalLines.length;
|
|
154745
|
-
const adjustedPredictionLineCount = predictionLines.length;
|
|
154746
|
-
if (adjustedPredictionLineCount < originalLineCount) {
|
|
154747
|
-
const missingLineCount = originalLineCount - adjustedPredictionLineCount;
|
|
154748
|
-
const linesToAppend = originalLines.slice(0, missingLineCount);
|
|
154749
|
-
predictionLines.push(...linesToAppend);
|
|
154750
|
-
}
|
|
154751
|
-
return predictionLines.join(newLineChar) + newLineChar;
|
|
154752
|
-
}
|
|
154753
154809
|
const AUTOEDITS_CONTEXT_STRATEGY = "auto-edits";
|
|
154754
154810
|
const INLINE_COMPLETION_DEFAULT_DEBOUNCE_INTERVAL_MS = 150;
|
|
154755
154811
|
const ON_SELECTION_CHANGE_DEFAULT_DEBOUNCE_INTERVAL_MS = 150;
|
|
@@ -154764,6 +154820,7 @@ class AutoeditsProvider {
|
|
|
154764
154820
|
/** Keeps track of the last time the text was changed in the editor. */
|
|
154765
154821
|
__publicField2(this, "lastTextChangeTimeStamp");
|
|
154766
154822
|
__publicField2(this, "promptProvider", new ShortTermPromptStrategy());
|
|
154823
|
+
__publicField2(this, "filterPrediction", new FilterPredictionBasedOnRecentEdits());
|
|
154767
154824
|
__publicField2(this, "isMockResponseFromCurrentDocumentTemplateEnabled", workspace.getConfiguration().get("cody.experimental.autoedits.use-mock-responses", false));
|
|
154768
154825
|
this.chatClient = chatClient;
|
|
154769
154826
|
this.contextMixer = new ContextMixer({
|
|
@@ -154857,8 +154914,15 @@ class AutoeditsProvider {
|
|
|
154857
154914
|
if (abortSignal.aborted || !autoeditResponse) {
|
|
154858
154915
|
return null;
|
|
154859
154916
|
}
|
|
154860
|
-
|
|
154861
|
-
|
|
154917
|
+
const { prediction, codeToReplaceData } = autoeditResponse;
|
|
154918
|
+
const shouldFilterPredictionBasedRecentEdits = this.filterPrediction.shouldFilterPrediction(
|
|
154919
|
+
document2.uri,
|
|
154920
|
+
prediction,
|
|
154921
|
+
codeToReplaceData.codeToRewrite
|
|
154922
|
+
);
|
|
154923
|
+
if (shouldFilterPredictionBasedRecentEdits) {
|
|
154924
|
+
return null;
|
|
154925
|
+
}
|
|
154862
154926
|
if (prediction === codeToReplaceData.codeToRewrite) {
|
|
154863
154927
|
return null;
|
|
154864
154928
|
}
|
|
@@ -240631,6 +240695,25 @@ function createRemoteRepositoryProvider(customTitle) {
|
|
|
240631
240695
|
}
|
|
240632
240696
|
};
|
|
240633
240697
|
}
|
|
240698
|
+
const RemoteWorkspaceDirectoryProvider = createRemoteWorkspaceProvider("directory");
|
|
240699
|
+
const RemoteWorkspaceRepositoryProvider = createRemoteWorkspaceProvider("repository");
|
|
240700
|
+
function createRemoteWorkspaceProvider(type2) {
|
|
240701
|
+
return {
|
|
240702
|
+
providerUri: type2 === "directory" ? WORKSPACE_DIRECTORY_PROVIDER_URI : WORKSPACE_REPOSITORY_PROVIDER_URI,
|
|
240703
|
+
meta() {
|
|
240704
|
+
return {
|
|
240705
|
+
name: type2 === "directory" ? "Remote Directory" : "Remote Repository",
|
|
240706
|
+
mentions: {}
|
|
240707
|
+
};
|
|
240708
|
+
},
|
|
240709
|
+
async mentions() {
|
|
240710
|
+
return [];
|
|
240711
|
+
},
|
|
240712
|
+
async items() {
|
|
240713
|
+
return [];
|
|
240714
|
+
}
|
|
240715
|
+
};
|
|
240716
|
+
}
|
|
240634
240717
|
function createWebProvider(useProxy) {
|
|
240635
240718
|
return {
|
|
240636
240719
|
providerUri: WEB_PROVIDER_URI,
|
|
@@ -240789,9 +240872,10 @@ function getOpenCtxProviders(authStatusChanges, isValidSiteVersion) {
|
|
|
240789
240872
|
resolvedConfig.pipe(pluck("configuration"), distinctUntilChanged$1()),
|
|
240790
240873
|
authStatusChanges,
|
|
240791
240874
|
featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.GitMentionProvider),
|
|
240792
|
-
featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyExperimentalOneBox)
|
|
240875
|
+
featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyExperimentalOneBox),
|
|
240876
|
+
featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.SourcegraphTeamsUpgradeCTA)
|
|
240793
240877
|
).map(
|
|
240794
|
-
([config, authStatus2, gitMentionProvider, enableOneBox]) => {
|
|
240878
|
+
([config, authStatus2, gitMentionProvider, enableOneBox, showRemoteWorkspaceUpgrade]) => {
|
|
240795
240879
|
const providers = [
|
|
240796
240880
|
{
|
|
240797
240881
|
settings: true,
|
|
@@ -240799,7 +240883,20 @@ function getOpenCtxProviders(authStatusChanges, isValidSiteVersion) {
|
|
|
240799
240883
|
providerUri: WEB_PROVIDER_URI
|
|
240800
240884
|
}
|
|
240801
240885
|
];
|
|
240802
|
-
if (
|
|
240886
|
+
if (isDotCom(authStatus2)) {
|
|
240887
|
+
if (showRemoteWorkspaceUpgrade) {
|
|
240888
|
+
providers.push({
|
|
240889
|
+
settings: false,
|
|
240890
|
+
provider: RemoteWorkspaceRepositoryProvider,
|
|
240891
|
+
providerUri: RemoteWorkspaceRepositoryProvider.providerUri
|
|
240892
|
+
});
|
|
240893
|
+
providers.push({
|
|
240894
|
+
settings: false,
|
|
240895
|
+
provider: RemoteWorkspaceDirectoryProvider,
|
|
240896
|
+
providerUri: RemoteWorkspaceDirectoryProvider.providerUri
|
|
240897
|
+
});
|
|
240898
|
+
}
|
|
240899
|
+
} else {
|
|
240803
240900
|
providers.push({
|
|
240804
240901
|
settings: true,
|
|
240805
240902
|
provider: RemoteRepositorySearch,
|
|
@@ -243689,7 +243786,10 @@ class ChatController {
|
|
|
243689
243786
|
return response2;
|
|
243690
243787
|
}).catch(() => void 0);
|
|
243691
243788
|
if (response) {
|
|
243692
|
-
return {
|
|
243789
|
+
return {
|
|
243790
|
+
intent: response.intent,
|
|
243791
|
+
intentScores: response.allScores
|
|
243792
|
+
};
|
|
243693
243793
|
}
|
|
243694
243794
|
return { intent: "chat", intentScores: [] };
|
|
243695
243795
|
}
|
|
@@ -243884,12 +243984,22 @@ class ChatController {
|
|
|
243884
243984
|
mentions,
|
|
243885
243985
|
signal: signal2
|
|
243886
243986
|
}) {
|
|
243987
|
+
var _a3, _b2, _c2;
|
|
243887
243988
|
signal2.throwIfAborted();
|
|
243888
243989
|
this.chatBuilder.setLastMessageIntent("search");
|
|
243889
243990
|
const scopes = await this.getSearchScopesFromMentions(mentions);
|
|
243890
|
-
const
|
|
243991
|
+
const currentFile = (_c2 = (_b2 = (_a3 = getEditor()) == null ? void 0 : _a3.active) == null ? void 0 : _b2.document) == null ? void 0 : _c2.uri;
|
|
243992
|
+
const repoName = currentFile ? await getFirstRepoNameContainingUri(currentFile) : void 0;
|
|
243993
|
+
const boostParameter = repoName ? `boost:repo(${repoName})` : "";
|
|
243994
|
+
const query2 = `content:"${inputTextWithoutContextChips.replaceAll(
|
|
243995
|
+
'"',
|
|
243996
|
+
'\\"'
|
|
243997
|
+
)}" ${boostParameter} ${scopes.length ? `(${scopes.join(" OR ")})` : ""}`;
|
|
243891
243998
|
try {
|
|
243892
|
-
const response = await graphqlClient.nlsSearchQuery({
|
|
243999
|
+
const response = await graphqlClient.nlsSearchQuery({
|
|
244000
|
+
query: query2,
|
|
244001
|
+
signal: signal2
|
|
244002
|
+
});
|
|
243893
244003
|
this.chatBuilder.addSearchResultAsBotMessage({
|
|
243894
244004
|
query: query2,
|
|
243895
244005
|
response
|
|
@@ -244116,7 +244226,6 @@ class ChatController {
|
|
|
244116
244226
|
...assistantMessage,
|
|
244117
244227
|
search: {
|
|
244118
244228
|
...assistantMessage.search,
|
|
244119
|
-
response: void 0,
|
|
244120
244229
|
selectedFilters
|
|
244121
244230
|
},
|
|
244122
244231
|
text: void 0
|
|
@@ -254604,7 +254713,7 @@ async function registerDebugCommands(context2, disposables) {
|
|
|
254604
254713
|
}
|
|
254605
254714
|
async function tryRegisterTutorial(context2, disposables) {
|
|
254606
254715
|
if (!isRunningInsideAgent()) {
|
|
254607
|
-
const { registerInteractiveTutorial } = await import("./index-
|
|
254716
|
+
const { registerInteractiveTutorial } = await import("./index-CnAmRHEe.mjs");
|
|
254608
254717
|
registerInteractiveTutorial(context2).then((disposable) => disposables.push(...disposable));
|
|
254609
254718
|
}
|
|
254610
254719
|
}
|