From 8c2ee7a501a7506912dc8dd9a833d61b1f2135da Mon Sep 17 00:00:00 2001 From: Valery Bugakov Date: Thu, 3 Oct 2024 11:22:51 +0800 Subject: [PATCH] Autocomplete: re-enable agent tests --- .../recording.har.yaml | 1745 ++++++++++++++++- .../unauthed_2245427793/recording.har.yaml | 84 + .../__tests__/autocomplete/src/bubbleSort.ts | 2 +- .../__tests__/autocomplete/src/mergeSort.ts | 29 + agent/src/autocomplete.test.ts | 82 +- .../create-inline-completion-item-provider.ts | 34 +- 6 files changed, 1808 insertions(+), 168 deletions(-) create mode 100644 agent/src/__tests__/autocomplete/src/mergeSort.ts diff --git a/agent/recordings/autocomplete_2136217965/recording.har.yaml b/agent/recordings/autocomplete_2136217965/recording.har.yaml index 3ad561a9f63..6bceb5f3973 100644 --- a/agent/recordings/autocomplete_2136217965/recording.har.yaml +++ b/agent/recordings/autocomplete_2136217965/recording.har.yaml @@ -36,19 +36,19 @@ log: queryString: [] url: https://sourcegraph.com/.api/client-config response: - bodySize: 224 + bodySize: 227 content: encoding: base64 mimeType: text/plain; charset=utf-8 - size: 224 - text: "[\"H4sIAAAAAAAAA2yOsQrCMBRF935F6Ozk2K0Eh26Fgs6v5omBvLySd4OK+O8uFZfM59zDf\ - XfOOddfNbxOmdbEoR8cSuXDDu6EJqAK9SpbYnB7WQ0qXkUoB2s3gBLXiqj5z2+U7CeY\ - UIHXDH7iEnPQR7MjGjjZOE/tSiKwYanbpgUc9tdRsy0oTDLO05mLRc394I7dp/sCAAD\ - //wMARx9M/RUBAAA=\"]" + size: 227 + text: "[\"H4sIAAAA\",\"AAAAA2yOsQrCMBRF935F6Ozo1K0Eh26Fgs6v5omBvLySd4OK+O8uFZfM\ + 59zDfXfOOddfNbxOmdbEoR8cSuXDDu6EJqAK9SpbYnB7WQ0qXkUoB2s3gBLXiqj5z2+\ + U7CeYUIHXDH7iEnPQR7MjGjjZOE/tSiKwYanbpgUc9tdRsy0oTDLO05mLRc394I7dp/\ + sCAAD//wMAm0An2BUBAAA=\"]" cookies: [] headers: - name: date - value: Thu, 19 Sep 2024 04:38:55 GMT + value: Thu, 03 Oct 2024 03:12:52 GMT - name: content-type value: text/plain; charset=utf-8 - name: transfer-encoding @@ -79,7 +79,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-09-19T04:38:55.163Z + startedDateTime: 2024-10-03T03:12:51.974Z time: 0 timings: blocked: -1 @@ -89,7 +89,1430 @@ log: send: 0 ssl: -1 wait: 0 - - _id: 7f4346cee9ec8c4bac8e5e852105f871 + - _id: 77e95c4ac59a4092c0c69958e6a57fc3 + _order: 0 + cache: {} + request: + bodySize: 494 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "494" + - name: host + value: sourcegraph.com + headersSize: 396 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: |- + #src/sum.ts + export function sum(a: number, b: number): number { + + } + + + #src/bubbleSort.ts + <|fim▁begin|>export function bubbleSort(nums: number[]) { + <|fim▁hole|> + } + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 0 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 69 + content: + mimeType: text/event-stream + size: 69 + text: |+ + event: completion + data: {"completion":"","stopReason":"stop"} + + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Wed, 02 Oct 2024 12:38:00 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-02T12:37:59.840Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 24049d4ef33e744fa5f64445144fa255 + _order: 0 + cache: {} + request: + bodySize: 504 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "504" + - name: host + value: sourcegraph.com + headersSize: 396 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: >- + #src/sum.ts + + export function sum(a: number, b: number): number { + + } + + + + #src/bubbleSort.ts + + <|fim▁begin|>export function bubbleSort(nums: number[]): number[] { + <|fim▁hole|> + } + + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 0 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 69 + content: + mimeType: text/event-stream + size: 69 + text: |+ + event: completion + data: {"completion":"","stopReason":"stop"} + + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Wed, 02 Oct 2024 12:41:14 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-02T12:41:13.610Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: b8002ff7625fcea1158064edbd37eb95 + _order: 0 + cache: {} + request: + bodySize: 505 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "505" + - name: host + value: sourcegraph.com + headersSize: 396 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: >- + #src/sum.ts + + export function sum(a: number, b: number): number { + + } + + + + #src/bubbleSort.ts + + <|fim▁begin|>export function helloNumbers(nums: number[]): number[] { + + <|fim▁hole|> + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 0 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 264 + content: + mimeType: text/event-stream + size: 264 + text: |+ + event: completion + data: {"completion":"return nums;\n}","stopReason":"stop"} + + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Wed, 02 Oct 2024 12:43:36 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-02T12:43:36.198Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 5ffc6834a9c6ae94a46e916a5edf7a78 + _order: 0 + cache: {} + request: + bodySize: 504 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "504" + - name: host + value: sourcegraph.com + headersSize: 396 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: >- + #src/sum.ts + + export function sum(a: number, b: number): number { + + } + + + + #src/bubbleSort.ts + + <|fim▁begin|>export function bubble_sort(nums: number[]): number[] { + + <|fim▁hole|> + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 0 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 179 + content: + mimeType: text/event-stream + size: 179 + text: |+ + event: completion + data: {"completion":"\n}","stopReason":"stop"} + + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Wed, 02 Oct 2024 12:44:29 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-02T12:44:29.180Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 7d0b6281a7c54ae9f985a3388f817dde + _order: 0 + cache: {} + request: + bodySize: 429 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "429" + - name: host + value: sourcegraph.com + headersSize: 396 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: >- + + + #src/bubbleSort.ts + + <|fim▁begin|>export function bubble_sort(nums: number[]): number[] { + + <|fim▁hole|> + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 0 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 207 + content: + mimeType: text/event-stream + size: 207 + text: |+ + event: completion + data: {"completion":"return nums;\n}","stopReason":"stop"} + + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Wed, 02 Oct 2024 12:45:22 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-02T12:45:21.631Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 1915b12724d61c513753013fe2508a6e + _order: 0 + cache: {} + request: + bodySize: 430 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "430" + - name: host + value: sourcegraph.com + headersSize: 396 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: >- + + + #src/bubbleSort.ts + + <|fim▁begin|>export function bubble_sort(nums: number[]): number[] { + <|fim▁hole|> + } + + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 0 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 201 + content: + mimeType: text/event-stream + size: 201 + text: |+ + event: completion + data: {"completion":"return nums;","stopReason":"stop"} + + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Thu, 03 Oct 2024 03:00:01 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-03T03:00:00.736Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: c4dc7e21eb78aaf381d66da820394ba9 + _order: 0 + cache: {} + request: + bodySize: 470 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "470" + - name: host + value: sourcegraph.com + headersSize: 396 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: |- + + + #src/bubbleSort.ts + <|fim▁begin|>// Implement bubble sort in TypeScript + export function bubble_sort(nums: number[]): number[] { + <|fim▁hole|> + } + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 0 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 201 + content: + mimeType: text/event-stream + size: 201 + text: |+ + event: completion + data: {"completion":"return nums;","stopReason":"stop"} + + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Thu, 03 Oct 2024 03:02:29 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-03T03:02:29.011Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 2063c51a7356ad55dcf1523867effc03 + _order: 0 + cache: {} + request: + bodySize: 469 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "469" + - name: host + value: sourcegraph.com + headersSize: 396 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: |- + + + #src/bubbleSort.ts + <|fim▁begin|>// Implement bubble sort in TypeScript + export function bubbleSort(nums: number[]): number[] { + <|fim▁hole|> + } + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 0 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 201 + content: + mimeType: text/event-stream + size: 201 + text: |+ + event: completion + data: {"completion":"return nums;","stopReason":"stop"} + + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Thu, 03 Oct 2024 03:03:17 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-03T03:03:17.138Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 7f2e587854ea4e5bc850890e59f8b1ee + _order: 0 + cache: {} + request: + bodySize: 470 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "470" + - name: host + value: sourcegraph.com + headersSize: 396 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: |- + + + #src/bubbleSort.ts + <|fim▁begin|>// Implement bubble sort in TypeScript + export function bubbleSort(nums: number[]): number[] { + <|fim▁hole|> + } + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 50 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 201 + content: + mimeType: text/event-stream + size: 201 + text: |+ + event: completion + data: {"completion":"return nums;","stopReason":"stop"} + + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Thu, 03 Oct 2024 03:04:00 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-03T03:04:00.459Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: d37fcecba644c8970e866cea35c6359b + _order: 0 + cache: {} + request: + bodySize: 421 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "421" + - name: host + value: sourcegraph.com + headersSize: 396 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: |- + + + #src/bubbleSort.ts + <|fim▁begin|>function bubbleSort(arr: number[]): number[] { + <|fim▁hole|> + } + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 0 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 199 + content: + mimeType: text/event-stream + size: 199 + text: |+ + event: completion + data: {"completion":"return arr;","stopReason":"stop"} + + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Thu, 03 Oct 2024 03:08:41 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-03T03:08:41.037Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: f1036717c04b557099abdd2fae57fef1 + _order: 0 + cache: {} + request: + bodySize: 1238 + cookies: [] + headers: + - _fromType: array + name: accept-encoding + value: gzip;q=0 + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: connection + value: keep-alive + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: x-timeout-ms + value: "7000" + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "1238" + - name: host + value: sourcegraph.com + headersSize: 397 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + maxTokensToSample: 256 + messages: + - speaker: human + text: >- + #src/mergeSort.ts + + function mergeSort(arr: number[]): number[] { + if (arr.length <= 1) { + return arr + } + + const mid = Math.floor(arr.length / 2) + const left = arr.slice(0, mid) + const right = arr.slice(mid) + + return merge(mergeSort(left), mergeSort(right)) + } + + + function merge(left: number[], right: number[]): number[] { + let result: number[] = [] + let leftIndex = 0 + let rightIndex = 0 + + while (leftIndex < left.length && rightIndex < right.length) { + if (left[leftIndex] < right[rightIndex]) { + result.push(left[leftIndex]) + leftIndex++ + } else { + result.push(right[rightIndex]) + rightIndex++ + } + } + + return result.concat(left.slice(leftIndex)).concat(right.slice(rightIndex)) + } + + + + #src/bubbleSort.ts + + <|fim▁begin|>function bubbleSort(arr: number[]): number[] { + <|fim▁hole|> + } + + <|fim▁end|> + model: fireworks/deepseek-coder-v2-lite-base + stopSequences: + - "\n\n" + - "\n\r\n" + - <|fim▁begin|> + - <|fim▁hole|> + - <|fim▁end|>, <|eos_token|> + stream: true + temperature: 0.2 + timeoutMs: 7000 + topK: 0 + queryString: + - name: client-name + value: autocomplete + - name: client-version + value: v1 + url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 + response: + bodySize: 2824 + content: + mimeType: text/event-stream + size: 2824 + text: >+ + event: completion + + data: {"completion":"const n = arr.length\n for (let i = 0; i < n - 1; i++) {\n for (let j = 0; j < n - i - 1; j++) {\n if (arr[j] > arr[j + 1]) {\n const temp = arr[j]\n arr[j] = arr[j + 1]\n arr[j + 1] = temp\n }\n }\n }\n return arr","stopReason":"stop"} + + + event: done + + data: {} + + cookies: [] + headers: + - name: date + value: Thu, 03 Oct 2024 03:10:02 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-03T03:10:01.678Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: d373616a58be0462153bc0c3b0429a7f _order: 0 cache: {} request: @@ -133,13 +1556,15 @@ log: maxTokensToSample: 256 messages: - speaker: human - text: |- + text: >- - #src/bubbleSort.ts - <|fim▁begin|>export function bubbleSort(nums: number[]) { + #src/sum.ts + + <|fim▁begin|>export function sum(a: number, b: number): number { <|fim▁hole|> } + <|fim▁end|> model: fireworks/deepseek-coder-v2-lite-base stopSequences: @@ -159,13 +1584,13 @@ log: value: v1 url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 response: - bodySize: 201 + bodySize: 203 content: mimeType: text/event-stream - size: 201 + size: 203 text: |+ event: completion - data: {"completion":"return nums;","stopReason":"stop"} + data: {"completion":"return a + b;","stopReason":"stop"} event: done data: {} @@ -173,7 +1598,7 @@ log: cookies: [] headers: - name: date - value: Thu, 19 Sep 2024 05:03:05 GMT + value: Thu, 03 Oct 2024 03:12:53 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -202,7 +1627,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-09-19T05:03:04.591Z + startedDateTime: 2024-10-03T03:12:52.742Z time: 0 timings: blocked: -1 @@ -212,11 +1637,11 @@ log: send: 0 ssl: -1 wait: 0 - - _id: 1b565ea0c36e38daa63e49879123705e + - _id: 6eaadd9d24fd743f006e5d6b5c97b416 _order: 0 cache: {} request: - bodySize: 494 + bodySize: 1317 cookies: [] headers: - _fromType: array @@ -243,10 +1668,10 @@ log: value: "*/*" - _fromType: array name: content-length - value: "494" + value: "1317" - name: host value: sourcegraph.com - headersSize: 396 + headersSize: 397 httpVersion: HTTP/1.1 method: POST postData: @@ -257,17 +1682,52 @@ log: messages: - speaker: human text: >- - #src/bubbleSort.ts + #src/sum.ts - export function bubbleSort(nums: number[]) { + export function sum(a: number, b: number): number { } - #src/sum.ts + #src/mergeSort.ts - <|fim▁begin|>export function sum(a: number, b: number): number { + function mergeSort(arr: number[]): number[] { + if (arr.length <= 1) { + return arr + } + + const mid = Math.floor(arr.length / 2) + const left = arr.slice(0, mid) + const right = arr.slice(mid) + + return merge(mergeSort(left), mergeSort(right)) + } + + + function merge(left: number[], right: number[]): number[] { + let result: number[] = [] + let leftIndex = 0 + let rightIndex = 0 + + while (leftIndex < left.length && rightIndex < right.length) { + if (left[leftIndex] < right[rightIndex]) { + result.push(left[leftIndex]) + leftIndex++ + } else { + result.push(right[rightIndex]) + rightIndex++ + } + } + + return result.concat(left.slice(leftIndex)).concat(right.slice(rightIndex)) + } + + + + #src/bubbleSort.ts + + <|fim▁begin|>function bubbleSort(arr: number[]): number[] { <|fim▁hole|> } @@ -290,21 +1750,24 @@ log: value: v1 url: https://sourcegraph.com/.api/completions/code?client-name=autocomplete&client-version=v1 response: - bodySize: 203 + bodySize: 2737 content: mimeType: text/event-stream - size: 203 - text: |+ + size: 2737 + text: >+ event: completion - data: {"completion":"return a + b;","stopReason":"stop"} + + data: {"completion":"const n = arr.length\n for (let i = 0; i < n - 1; i++) {\n for (let j = 0; j < n - i - 1; j++) {\n if (arr[j] > arr[j + 1]) {\n const temp = arr[j]\n arr[j] = arr[j + 1]\n arr[j + 1] = temp\n }\n }\n }\n return arr\n}","stopReason":"stop"} + event: done + data: {} cookies: [] headers: - name: date - value: Thu, 19 Sep 2024 05:03:07 GMT + value: Thu, 03 Oct 2024 03:12:55 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -333,7 +1796,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-09-19T05:03:07.088Z + startedDateTime: 2024-10-03T03:12:54.058Z time: 0 timings: blocked: -1 @@ -398,29 +1861,29 @@ log: value: null url: https://sourcegraph.com/.api/graphql?CurrentSiteCodyLlmConfiguration response: - bodySize: 260 + bodySize: 248 content: encoding: base64 mimeType: application/json - size: 260 - text: "[\"H4sIAAAAAAAAA3zOTQrCMBCG4bvM2tAxFcRuu7U7LzAmUxtSMyVJ/UF6d1ERxYKrgQ/eh\ - 7mBpUxQ3SC5zI9rxF6326aW0LrDGCk7Cc+9o9yI5R4qoJC7KIMzhelptKxKlSQEzkqj\ - XqHWG1h8goYuO/EcElRLjYgLaCnl+r/XkfPjiytxDT/NnDRyHHp+PPtGWxf5LNGnwjI\ - PidkrI5ajOmnVu8xqT4lhVn7RG0Scpmm6AwAA//8DAFuWIPolAQAA\"]" + size: 248 + text: "[\"H4sIAAAAAAAAA4TOTQ6CMBAF4LvMmmqDEA1btrLzAmM7QAN2SH+MhvTuBjYSNXH1ksmbL\ + 28GjQGhmsGbQEsq1s/zuanZtqaLDoNhu957DA1rGqECz9Ep6hxO/V6NGDWJw64Unq2l\ + ANm72+DjwgNZD1VRSikzaNGH+g8lejRDhI/yxjqulOLbNNKy7xemiSZPNAjFmpy452I\ + 0gcQVPcHX78bOZXFKKaUXAAAA//8DADDh/dAaAQAA\"]" textDecoded: data: site: codyLLMConfiguration: - chatModel: anthropic/claude-3-sonnet-20240229 - chatModelMaxTokens: 12000 - completionModel: fireworks/deepseek-coder-v2-lite-base - completionModelMaxTokens: 9000 - fastChatModel: anthropic/claude-3-haiku-20240307 - fastChatModelMaxTokens: 12000 + chatModel: sourcegraph/claude-3.5-sonnet + chatModelMaxTokens: 45000 + completionModel: sourcegraph/deepseek-coder-v2-lite-base + completionModelMaxTokens: 2048 + fastChatModel: sourcegraph/claude-3-haiku + fastChatModelMaxTokens: 7000 cookies: [] headers: - name: date - value: Thu, 19 Sep 2024 04:38:54 GMT + value: Thu, 03 Oct 2024 03:12:51 GMT - name: content-type value: application/json - name: transfer-encoding @@ -451,7 +1914,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-09-19T04:38:54.414Z + startedDateTime: 2024-10-03T03:12:50.813Z time: 0 timings: blocked: -1 @@ -511,22 +1974,22 @@ log: value: null url: https://sourcegraph.com/.api/graphql?CurrentSiteCodyLlmConfiguration response: - bodySize: 132 + bodySize: 136 content: encoding: base64 mimeType: application/json - size: 132 + size: 136 text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdHJ+SmVPj6+zvl5aZnppUWJJZn5eWD53MSiE\ - uf8vJLUipLwzLyU/HIlK6XUvMSknNQUpdra2loAAAAA//8DAOgINKVLAAAA\"]" + uf8vJLUipLwzLyU/HIlK6WUzOLEpJzUFKXa2tpaAAAAAP//AwArMNn0TAAAAA==\"]" textDecoded: data: site: codyLLMConfiguration: - smartContextWindow: enabled + smartContextWindow: disabled cookies: [] headers: - name: date - value: Thu, 19 Sep 2024 04:38:54 GMT + value: Thu, 03 Oct 2024 03:12:51 GMT - name: content-type value: application/json - name: transfer-encoding @@ -557,7 +2020,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-09-19T04:38:54.459Z + startedDateTime: 2024-10-03T03:12:50.857Z time: 0 timings: blocked: -1 @@ -617,17 +2080,17 @@ log: value: null url: https://sourcegraph.com/.api/graphql?CurrentSiteCodyLlmProvider response: - bodySize: 131 + bodySize: 135 content: encoding: base64 mimeType: application/json - size: 131 - text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdHJ+SmVPj6+zvl5aZnppUWJJZn5eSDxgqL8s\ - syU1CIlK6Xi/NKi5NT0osSCDKXa2tpaAAAAAP//\",\"AwAfFAXARQAAAA==\"]" + size: 135 + text: "[\"H4sIAAAAAAAAAwAAAP//\",\"qlZKSSxJVLKqVirOLEkF0cn5KZU+Pr7O+XlpmemlRYkl\ + mfl5IPGCovyyzJTUIiUrpeL80qLk1PSixIIMpdra2loAAAAA//8DAB8UBcBFAAAA\"]" cookies: [] headers: - name: date - value: Thu, 19 Sep 2024 04:38:54 GMT + value: Thu, 03 Oct 2024 03:12:51 GMT - name: content-type value: application/json - name: transfer-encoding @@ -658,7 +2121,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-09-19T04:38:54.437Z + startedDateTime: 2024-10-03T03:12:50.835Z time: 0 timings: blocked: -1 @@ -729,33 +2192,21 @@ log: value: null url: https://sourcegraph.com/.api/graphql?CurrentUser response: - bodySize: 376 + bodySize: 387 content: encoding: base64 mimeType: application/json - size: 376 - text: "[\"H4sIAAAAAAAAA2RPy07CQBT9l7tuaQ1R2klIFAQXaOMjNBjj4nZ6aaePmToPFJr+O2kwc\ - eHunJzHvaeHHC0C64E7rUnarSE9UpEDg3SXNLxSp+T+5eqp4nPwoESTkhZ7QfmqRdEA\ - s9qRB7kwXYPHBFsCBm/KaU6Fxq5cKOvHYRiCB86QlheD+TNkysa1v5ffrQMP8IAW9fb\ - 1ERiU1naGBUFTTieFUkVDYwNX0pK0E67aAIO7ZREpvlnjV/ZOblFn1XW+Xp1+omyXRj\ - gTU5Nmm2XynM4eQnc81HMT3/gcPOi0aFEff0f0QBfw77PbYhTGazB4oHSBUpzQCiXNG\ - JMqJwPs43MYhuEMAAD//wMASoyTP04BAAA=\"]" - textDecoded: - data: - currentUser: - avatarURL: https://lh3.googleusercontent.com/a/ACg8ocKFaqbYeuBkbj5dFEzx8bXV8a7i3sVbKCNPV7G0uyvk=s96-c - displayName: SourcegraphBot-9000 - hasVerifiedEmail: true - id: VXNlcjozNDQ1Mjc= - organizations: - nodes: [] - primaryEmail: - email: sourcegraphbot9k@gmail.com - username: sourcegraphbot9k-fnwmu + size: 387 + text: "[\"H4sIAAAAAAAAAwAAAP//\",\"ZE/LTsJAFP2Xu25pDVHaSUgUBBdo4yM0GOPidnppp4+Z\ + Og8Umv47aTBx4e6cnMe9p4ccLQLrgTutSdqtIT1SkQODdJc0vFKn5P7l6qnic/CgRJO\ + SFntB+apF0QCz2pEHuTBdg8cEWwIGb8ppToXGrlwo68dhGIIHzpCWF4P5M2TKxrW/l9\ + +tAw/wgBb19vURGJTWdoYFQVNOJ4VSRUNjA1fSkrQTrtoAg7tlESm+WeNX9k5uUWfVd\ + b5enX6ibJdGOBNTk2abZfKczh5CdzzUcxPf+Bw86LRoUR9/R/RAF/Dvs9tiFMZrMHig\ + dIFSnNAKJc0YkyonA+zjcxiG4QwAAP//AwBKjJM/TgEAAA==\"]" cookies: [] headers: - name: date - value: Thu, 19 Sep 2024 04:38:54 GMT + value: Thu, 03 Oct 2024 03:12:51 GMT - name: content-type value: application/json - name: transfer-encoding @@ -786,7 +2237,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-09-19T04:38:54.483Z + startedDateTime: 2024-10-03T03:12:50.879Z time: 0 timings: blocked: -1 @@ -850,28 +2301,19 @@ log: value: null url: https://sourcegraph.com/.api/graphql?CurrentUserCodySubscription response: - bodySize: 228 + bodySize: 235 content: encoding: base64 mimeType: application/json - size: 228 - text: "[\"H4sIAAAAAAAAA1zMsQrCMBSF4Xc5cwtN7GK2Ih0EwdJWB7fYZAjUJNzcDqXk3UVBRMfz8\ - 3E2GM0aasO0EFnPl2TpPYNZh+WeJnKRXfCvlljzkqDQHMbjtUWBOGsPha4/o4COcV47\ - Cr1me3IPxwmKabHF57uz5IIZWBM3DAVZybqs9qWoRymVEGonb/jTrTdfK6pfm3POTwA\ - AAP//AwAV1OF3wgAAAA==\"]" - textDecoded: - data: - currentUser: - codySubscription: - applyProRateLimits: true - currentPeriodEndAt: 2024-10-14T22:11:32Z - currentPeriodStartAt: 2024-09-14T22:11:32Z - plan: PRO - status: ACTIVE + size: 235 + text: "[\"H4sIAAAAAAAAAwAAAP//\",\"XMyxCsIwFIXhdzlzC03sYrYiHQTB0lYHt9hkCNQk3NwO\ + peTdRUFEx/PzcTYYzRpqw7QQWc+XZOk9g1mH5Z4mcpFd8K+WWPOSoNAcxuO1RYE4aw+\ + Frj+jgI5xXjsKvWZ7cg/HCYppscXnu7PkghlYEzcMBVnJuqz2pahHKZUQaidv+NOtN1\ + 8rql+bc85PAAAA//8DABXU4XfCAAAA\"]" cookies: [] headers: - name: date - value: Thu, 19 Sep 2024 04:38:55 GMT + value: Thu, 03 Oct 2024 03:12:51 GMT - name: content-type value: application/json - name: transfer-encoding @@ -902,7 +2344,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-09-19T04:38:54.814Z + startedDateTime: 2024-10-03T03:12:51.284Z time: 0 timings: blocked: -1 @@ -960,18 +2402,21 @@ log: value: null url: https://sourcegraph.com/.api/graphql?SiteProductVersion response: - bodySize: 139 + bodySize: 136 content: encoding: base64 mimeType: application/json - size: 139 - text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdEFRfkppcklYalFxZn5eUpWSkaWhqYmxvFGB\ - kYmugaWuoYW8aZ65rpJZikWRilplkap5hZKtbW1AAAAAP//\",\"AwAMQVH6SQAAAA==\ - \"]" + size: 136 + text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdEFRfkppcklYalFxZn5eUpWSkaWxiaGhvFGB\ + kYmuoYGugZG8aZ65rqpFsmWBibJRikGphZKtbW1AAAAAP//AwDgdYiKSQAAAA==\"]" + textDecoded: + data: + site: + productVersion: 293411_2024-10-02_5.7-e8c904c2d058 cookies: [] headers: - name: date - value: Thu, 19 Sep 2024 04:38:54 GMT + value: Thu, 03 Oct 2024 03:12:51 GMT - name: content-type value: application/json - name: transfer-encoding @@ -1002,7 +2447,101 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-09-19T04:38:54.344Z + startedDateTime: 2024-10-03T03:12:50.792Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: a1889526ab4ac60a56dc11d08e0510f9 + _order: 0 + cache: {} + request: + bodySize: 0 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_3dd704711f82a44ff6aba261b53b61a03fb8edba658774639148630d838c2d1d + - _fromType: array + name: user-agent + value: autocomplete / v1 + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: sourcegraph.com + headersSize: 261 + httpVersion: HTTP/1.1 + method: GET + queryString: [] + url: https://sourcegraph.com/.api/modelconfig/supported-models.json + response: + bodySize: 1103 + content: + encoding: base64 + mimeType: text/plain; charset=utf-8 + size: 1103 + text: "[\"H4sIAAA=\",\"AAAAAP/smE1P4zgYx+/9FFaui4ubtpTNDbpiF2kZ0ICYw4iD6zxtrSax\ + ZTt9EeK7j5I0YdKYJkVVURl6SuP/87fj3+PX5xZCCDmaTSGkj6A0F5HjIafTJs5JVqZ\ + gzvPXpE3a5C8f5nmhVGLOfVDa8dDP9FXyey6eUhH3k1gamakSkrN1bFHscy0DuvpGQ0\ + h0F4WukL2cbLcecwULoWa6xvqq0DW2nggxCaDG999M1NhUSIgorzG9lRBdXDc3Dbk2i\ + gY1rjdr1att+vS05hkKH4KtMFPFdxiXkHqeS9wuJmeYdDyPBTT2AXfbfaxFFIGpadMw\ + 1aNuu4/urfq0zlydu+PcHbvE7ZEzl2yGMSrpiAfccCh/UqEAn29WlkVOqfX9eiSUCp4\ + qtRqYCLVKO4ixWFG22myZNtTESZuSp1E1vwwHlSa2gkoZE5GBpfnBI18sHG+DT9ZfdH\ + kdydg8iBlESTW9PiHE8j0hXd7GpqQkhJR0Lw0ScIecwELGdcM0zwd0a9HacyFxzfLAd\ + f/ecx40pi3MFNR7UUslPhnpKeWzuCnq/2xiO+vUN4PdJYOPgq0lgP/R43pwMNjFEut5\ + 847naUMVE3413Tf43huqhjZdCe2bbvUwaWwEE6EMwMCRwXNJ77wRPLd/tk92PoDUADO\ + cdjmeuzjgBvCI6rp9zj8A8h5ghh5d9D83gC4tMSWylDERR0afahErBhNF5fQ022Sc7t\ + COrzzYRx5ke9ksCSYQ8ojjTruPLSvP5v42FaNOu4/uquIS8O2+h5qcRzSgEft4tAdcj\ + d+AOw6onjbHe2WTvwXY6v1Hrb8H5Ls+3mWAQ75M/uDz5WCEeaSNilndKesmi0Hny8Fl\ + szm7WDfyGbtRtfUJcISgD7fRyu4G0i11DxM33VJPpMG92kn67sEiKo9dq8/xH5OP7+x\ + ko8yEv8JJl2KpYM5hgQnpNLokQqKTx2w/QjWpYd/jtx7ugnITcF2ZST4/Xrcx3mTR3Z\ + ltxf6L7Va2rd++1/FhTOPA3OQ3oq/NyDrpffefzphqM2wWX7lBSSDDMDvlrG/kdzjbt\ + bJvfGn9CgAA//8QR+8r9RcAAA==\"]" + cookies: [] + headers: + - name: date + value: Thu, 03 Oct 2024 03:12:52 GMT + - name: content-type + value: text/plain; charset=utf-8 + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: content-encoding + value: gzip + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1342 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-03T03:12:52.314Z time: 0 timings: blocked: -1 diff --git a/agent/recordings/unauthed_2245427793/recording.har.yaml b/agent/recordings/unauthed_2245427793/recording.har.yaml index f5a891d39f2..aca27afe1bd 100644 --- a/agent/recordings/unauthed_2245427793/recording.har.yaml +++ b/agent/recordings/unauthed_2245427793/recording.har.yaml @@ -679,6 +679,90 @@ log: send: 0 ssl: -1 wait: 0 + - _id: acb297efb26f22ddc0ac8eb9afc73388 + _order: 0 + cache: {} + request: + bodySize: 0 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_4229eb42e0efa2f15f3e6f8843764c7f92ab8051020cc4e90802f4fc0cc91bfa + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: unauthed / v1 + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: sourcegraph.sourcegraph.com + headersSize: 362 + httpVersion: HTTP/1.1 + method: GET + queryString: [] + url: https://sourcegraph.sourcegraph.com/.api/client-config + response: + bodySize: 219 + content: + encoding: base64 + mimeType: text/plain; charset=utf-8 + size: 219 + text: "[\"H4sIAAAAAAAAA2zOsQrDMAwE0D1fYTJ37JQthA7ZAoF2VmpBDZYUrDNNKf33Lhk9v7vjv\ + l0IIfRPi5+b0pY59kNAqXw54UVo\",\"AlXYZLJnBreb1WEymQhp9PYGUNJWkUyb7kI\ + Fkyn4wCNptHczJhY5+7jMTc0Edqx1362A4/k5mfqKwiTjMt+5eDLth3Dtft0fAAD//w\ + MAwWWLOhMBAAA=\"]" + cookies: [] + headers: + - name: date + value: Wed, 02 Oct 2024 01:38:28 GMT + - name: content-type + value: text/plain; charset=utf-8 + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1258 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-10-02T01:38:28.361Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 - _id: 4e7919316b7b7a4774cfc8a9796315cf _order: 0 cache: {} diff --git a/agent/src/__tests__/autocomplete/src/bubbleSort.ts b/agent/src/__tests__/autocomplete/src/bubbleSort.ts index 205130fa15e..9421ca83d43 100644 --- a/agent/src/__tests__/autocomplete/src/bubbleSort.ts +++ b/agent/src/__tests__/autocomplete/src/bubbleSort.ts @@ -1,3 +1,3 @@ -export function bubbleSort(nums: number[]) { +function bubbleSort(arr: number[]): number[] { /* CURSOR */ } diff --git a/agent/src/__tests__/autocomplete/src/mergeSort.ts b/agent/src/__tests__/autocomplete/src/mergeSort.ts new file mode 100644 index 00000000000..34a270033f7 --- /dev/null +++ b/agent/src/__tests__/autocomplete/src/mergeSort.ts @@ -0,0 +1,29 @@ +function mergeSort(arr: number[]): number[] { + if (arr.length <= 1) { + return arr + } + + const mid = Math.floor(arr.length / 2) + const left = arr.slice(0, mid) + const right = arr.slice(mid) + + return merge(mergeSort(left), mergeSort(right)) +} + +function merge(left: number[], right: number[]): number[] { + let result: number[] = [] + let leftIndex = 0 + let rightIndex = 0 + + while (leftIndex < left.length && rightIndex < right.length) { + if (left[leftIndex] < right[rightIndex]) { + result.push(left[leftIndex]) + leftIndex++ + } else { + result.push(right[rightIndex]) + rightIndex++ + } + } + + return result.concat(left.slice(leftIndex)).concat(right.slice(rightIndex)) +} diff --git a/agent/src/autocomplete.test.ts b/agent/src/autocomplete.test.ts index 25f07e6907a..76082075af0 100644 --- a/agent/src/autocomplete.test.ts +++ b/agent/src/autocomplete.test.ts @@ -24,79 +24,95 @@ describe('Autocomplete', () => { }) // TODO: use `vi.useFakeTimers()` instead of `sleep()` once it's supported by the agent tests. - it.skip('autocomplete/execute multiline (non-empty result)', async () => { - const uri = workspace.file('src', 'bubbleSort.ts') + it('autocomplete/execute (non-empty result)', async () => { + const uri = workspace.file('src', 'sum.ts') await client.openFile(uri) - const completions = await client.request('autocomplete/execute', { uri: uri.toString(), position: { line: 1, character: 4 }, triggerKind: 'Invoke', }) - const completionID = completions.items[0].id - const texts = completions.items.map(item => item.insertText) - await client.notify('autocomplete/completionSuggested', { completionID }) - await sleep(800) // Wait for the completion visibility timeout (750ms) to elapse - await client.notify('autocomplete/completionAccepted', { completionID }) + await sleep(400) + + // Change the cursor position discarding the current completion. + // The current `COMPLETION_VISIBLE_DELAY_MS` is 750ms and since the completion was visible only 400ms + // it should not be marked as read. + await client.changeFile(uri, { + selection: { + start: { line: 0, character: 0 }, + end: { line: 0, character: 0 }, + }, + }) + + // Now the completion visibility timeout is elapsed but because we discarded it, it should not be + // marked as read. + await sleep(400) const completionEvent = await client.request('testing/autocomplete/completionEvent', { completionID, }) + expect(completionEvent?.read).toBe(false) + expect(completionEvent?.acceptedAt).toBeFalsy() - expect(completionEvent?.read).toBe(true) - expect(completionEvent?.acceptedAt).toBeTruthy() - + const texts = completions.items.map(item => item.insertText) expect(completions.items.length).toBeGreaterThan(0) expect(texts).toMatchInlineSnapshot( ` [ - " return nums;", + " return a + b;", ] ` ) }, 10_000) // TODO: use `vi.useFakeTimers()` instead of `sleep()` once it's supported by the agent tests. - it.skip('autocomplete/execute (non-empty result)', async () => { - const uri = workspace.file('src', 'sum.ts') + it('autocomplete/execute multiline (non-empty result)', async () => { + // const authStatus = await client.request('extensionConfiguration/status', null) + // console.log('authStatus', authStatus) + // expect(authStatus?.authenticated).toBe(true) + + const uri1 = workspace.file('src', 'mergeSort.ts') + await client.openFile(uri1) + const uri = workspace.file('src', 'bubbleSort.ts') await client.openFile(uri) + const completions = await client.request('autocomplete/execute', { uri: uri.toString(), position: { line: 1, character: 4 }, triggerKind: 'Invoke', }) - const completionID = completions.items[0].id - await client.notify('autocomplete/completionSuggested', { completionID }) - await sleep(400) - // Change the cursor position discarding the current completion. - // The current `COMPLETION_VISIBLE_DELAY_MS` is 750ms and since the completion was visible only 400ms - // it should not be marked as read. - await client.changeFile(uri, { - selection: { - start: { line: 0, character: 0 }, - end: { line: 0, character: 0 }, - }, - }) + const completionID = completions.items[0].id + const texts = completions.items.map(item => item.insertText) - // Now the completion visibility timeout is elapsed but because we discarded it, it should not be - // marked as read. - await sleep(400) + await client.notify('autocomplete/completionSuggested', { completionID }) + await sleep(800) // Wait for the completion visibility timeout (750ms) to elapse + await client.notify('autocomplete/completionAccepted', { completionID }) const completionEvent = await client.request('testing/autocomplete/completionEvent', { completionID, }) - expect(completionEvent?.read).toBe(false) - expect(completionEvent?.acceptedAt).toBeFalsy() - const texts = completions.items.map(item => item.insertText) + expect(completionEvent?.read).toBe(true) + expect(completionEvent?.acceptedAt).toBeTruthy() + expect(completions.items.length).toBeGreaterThan(0) expect(texts).toMatchInlineSnapshot( ` [ - " return a + b;", + " const n = arr.length + for (let i = 0; i < n - 1; i++) { + for (let j = 0; j < n - i - 1; j++) { + if (arr[j] > arr[j + 1]) { + const temp = arr[j] + arr[j] = arr[j + 1] + arr[j + 1] = temp + } + } + } + return arr", ] ` ) diff --git a/vscode/src/completions/create-inline-completion-item-provider.ts b/vscode/src/completions/create-inline-completion-item-provider.ts index 2390f6423ea..3abbe2d3495 100644 --- a/vscode/src/completions/create-inline-completion-item-provider.ts +++ b/vscode/src/completions/create-inline-completion-item-provider.ts @@ -1,3 +1,6 @@ +import { type Observable, map } from 'observable-fns' +import * as vscode from 'vscode' + import { type AuthenticatedAuthStatus, NEVER, @@ -7,14 +10,11 @@ import { promiseFactoryToObservable, skipPendingOperation, switchMap, - vscodeResource, } from '@sourcegraph/cody-shared' -import * as vscode from 'vscode' import { logDebug } from '../log' import type { CodyStatusBar } from '../services/StatusBar' -import { type Observable, map } from 'observable-fns' import type { PlatformContext } from '../extension.common' import { InlineCompletionItemProvider } from './inline-completion-item-provider' import { createProvider } from './providers/shared/create-provider' @@ -29,22 +29,6 @@ interface InlineCompletionItemProviderArgs { statusBar: CodyStatusBar } -/** - * Inline completion item providers that always returns an empty reply. - * Implemented as a class instead of anonymous function so that you can identify - * it with `console.log()` debugging. - */ -class NoopCompletionItemProvider implements vscode.InlineCompletionItemProvider { - public provideInlineCompletionItems( - _document: vscode.TextDocument, - _position: vscode.Position, - _context: vscode.InlineCompletionContext, - _token: vscode.CancellationToken - ): vscode.ProviderResult { - return { items: [] } - } -} - export function createInlineCompletionItemProvider({ config: { configuration }, authStatus, @@ -67,18 +51,6 @@ export function createInlineCompletionItemProvider({ if (!authStatus.authenticated) { logDebug('AutocompleteProvider:notSignedIn', 'You are not signed in.') - if (configuration.isRunningInsideAgent) { - // Register an empty completion provider when running inside the - // agent to avoid timeouts because it awaits for an - // `InlineCompletionItemProvider` to be registered. - return vscodeResource(() => - vscode.languages.registerInlineCompletionItemProvider( - '*', - new NoopCompletionItemProvider() - ) - ) - } - return NEVER }