@sourcegraph/amp 0.0.1749182771-gb19aef → 0.0.1749211345-g16cdfc
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/amp.js +3 -3
- package/dist/{client-DQvLVO0y.js → client-Dd8T5Ydk.js} +2 -2
- package/dist/{client-DQvLVO0y.js.map → client-Dd8T5Ydk.js.map} +1 -1
- package/dist/{console-B2SF1aqQ.js → console-D_ZxbRrA.js} +14 -14
- package/dist/{console-B2SF1aqQ.js.map → console-D_ZxbRrA.js.map} +1 -1
- package/dist/{create_file.node-CTYL8XSm.js → create_file.node-D_xwgdhJ.js} +2 -2
- package/dist/{create_file.node-CTYL8XSm.js.map → create_file.node-D_xwgdhJ.js.map} +1 -1
- package/dist/{edit_file.node-Bsj3aCak.js → edit_file.node-Cv9nC-uR.js} +3 -3
- package/dist/{edit_file.node-Bsj3aCak.js.map → edit_file.node-Cv9nC-uR.js.map} +1 -1
- package/dist/{executable-DdVPivLU.js → executable-BTpHtmPV.js} +2 -2
- package/dist/{executable-DdVPivLU.js.map → executable-BTpHtmPV.js.map} +1 -1
- package/dist/{files-DgmPJSHS.js → files-CNmw2a6V.js} +2 -2
- package/dist/{files-DgmPJSHS.js.map → files-CNmw2a6V.js.map} +1 -1
- package/dist/{glob.node-CvxhbXXV.js → glob.node-Dbygwo7q.js} +4 -4
- package/dist/{glob.node-CvxhbXXV.js.map → glob.node-Dbygwo7q.js.map} +1 -1
- package/dist/{index-DG5uxXfG.js → index-DGuVA6oK.js} +2 -2
- package/dist/{index-DG5uxXfG.js.map → index-DGuVA6oK.js.map} +1 -1
- package/dist/{list_directory.node-D7kWIPfS.js → list_directory.node-DJCJkqLg.js} +2 -2
- package/dist/{list_directory.node-D7kWIPfS.js.map → list_directory.node-DJCJkqLg.js.map} +1 -1
- package/dist/{load-profile-DD55GCpN.js → load-profile-CXHBU_AI.js} +2 -2
- package/dist/{load-profile-DD55GCpN.js.map → load-profile-CXHBU_AI.js.map} +1 -1
- package/dist/{main-CnaIlgJ-.js → main-CtHA5Ylu.js} +409 -398
- package/dist/{main-CnaIlgJ-.js.map → main-CtHA5Ylu.js.map} +1 -1
- package/dist/{node-CDbBRzSe.js → node-BOIz1I5S.js} +728 -673
- package/dist/node-BOIz1I5S.js.map +1 -0
- package/dist/{node-q5EJWNpV.js → node-C2cKbj9k.js} +3 -3
- package/dist/{node-q5EJWNpV.js.map → node-C2cKbj9k.js.map} +1 -1
- package/dist/{node-CBGz4YST.js → node-D9dPV0eu.js} +4 -4
- package/dist/{node-CBGz4YST.js.map → node-D9dPV0eu.js.map} +1 -1
- package/dist/{node-BHadfrnF.js → node-DPPbAAw0.js} +2 -2
- package/dist/{node-BHadfrnF.js.map → node-DPPbAAw0.js.map} +1 -1
- package/dist/{node-DExO0xPV.js → node-DZCyuAqY.js} +2 -2
- package/dist/{node-DExO0xPV.js.map → node-DZCyuAqY.js.map} +1 -1
- package/dist/{node-BcF9KV_p.js → node-DaL4eJRQ.js} +3 -3
- package/dist/{node-BcF9KV_p.js.map → node-DaL4eJRQ.js.map} +1 -1
- package/dist/{read_file.node-CpfHdJYY.js → read_file.node-CAD-I3qI.js} +2 -2
- package/dist/{read_file.node-CpfHdJYY.js.map → read_file.node-CAD-I3qI.js.map} +1 -1
- package/dist/{stdio-Clxnyx58.js → stdio-7mSc8Mj0.js} +3 -3
- package/dist/{stdio-Clxnyx58.js.map → stdio-7mSc8Mj0.js.map} +1 -1
- package/dist/storybook.js +1 -1
- package/dist/{undo_edit.node-DDFebFdr.js → undo_edit.node-BYH1ok_y.js} +2 -2
- package/dist/{undo_edit.node-DDFebFdr.js.map → undo_edit.node-BYH1ok_y.js.map} +1 -1
- package/package.json +1 -1
- package/dist/node-CDbBRzSe.js.map +0 -1
package/dist/amp.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
import "./console-
|
3
|
-
import "./main-
|
2
|
+
import "./console-D_ZxbRrA.js";
|
3
|
+
import "./main-CtHA5Ylu.js";
|
4
4
|
import "node:crypto";
|
5
5
|
import "node:fs/promises";
|
6
6
|
import "node:path";
|
7
7
|
import "node:process";
|
8
|
-
import "./client-
|
8
|
+
import "./client-Dd8T5Ydk.js";
|
9
9
|
//# sourceMappingURL=amp.js.map
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
import { f as i, E as o, aS as c, s as p, p as u } from "./console-
|
2
|
+
import { f as i, E as o, aS as c, s as p, p as u } from "./console-D_ZxbRrA.js";
|
3
3
|
const m = !0;
|
4
4
|
function f() {
|
5
5
|
return new Proxy(
|
@@ -54,4 +54,4 @@ export {
|
|
54
54
|
h as f,
|
55
55
|
y as i
|
56
56
|
};
|
57
|
-
//# sourceMappingURL=client-
|
57
|
+
//# sourceMappingURL=client-Dd8T5Ydk.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client-DQvLVO0y.js","sources":["../../core/src/server-api/internal-api-client.ts","../../core/src/server-api/client.ts"],"sourcesContent":["import type { InternalAPI } from '@sourcegraph/amp-api-types/src/internal-api'\nimport { fetchFromAmpServer } from './client'\n\n/**\n * The new POST /api/internal API was deployed on 2025-06-01. Until we are confident that the server\n * side of the new API is deployed *and* we will NOT need to roll back to a version prior to it, we\n * still fall back to the old API if the new API does not work. (Of course, this assumes that\n * operations are idempotent.)\n *\n * TODO(sqs): Remove this after we are sure that we will not need to roll back ampcode.com to a\n * version prior to the new POST /api/internal API. Then we can remove dead client code. Still need\n * to keep the server code for these API endpoints for older clients.\n */\nexport const FALLBACK_TO_OLD_INTERNAL_API: boolean = true\n\n/**\n * Transform the server-side InternalAPI into a client-side interface by:\n * 1. Removing the first 'ctx' parameter\n * 2. Adding an optional 'options' parameter with AbortSignal support\n */\ntype TransformToClientAPI<T> = {\n\t[K in keyof T]: T[K] extends (ctx: never, params: infer Params) => infer Return\n\t\t? (params: Params, options?: Options) => Return\n\t\t: T[K]\n}\n\ninterface Options {\n\tsignal?: AbortSignal\n}\n\n/**\n * Client-side interface for the InternalAPI that includes client-specific features like AbortSignal.\n * This interface omits the 'ctx' parameter which is handled server-side.\n */\nexport type InternalAPIClient = TransformToClientAPI<InternalAPI<never>>\n\n/**\n * Create a client for the InternalAPI interface that sends requests to the Amp server. Uses a\n * Proxy to dynamically call the appropriate API methods.\n */\nfunction createInternalAPIClient(): InternalAPIClient {\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, method: string) => {\n\t\t\t\treturn async (...args: any[]) => {\n\t\t\t\t\tconst options = args.at(1) as Options\n\t\t\t\t\tconst params = args.at(0)\n\n\t\t\t\t\t// Send request to the server.\n\t\t\t\t\tconst resp = await fetchFromAmpServer('/api/internal', {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tbody: JSON.stringify({ method, params }),\n\t\t\t\t\t\tsignal: options?.signal,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (!resp.ok) {\n\t\t\t\t\t\tthrow new Error(`API request failed: ${resp.status}`)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn await resp.json()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t) as InternalAPIClient\n}\n\n/**\n * Singleton instance of the internal API client.\n */\nexport const internalAPIClient: InternalAPIClient = createInternalAPIClient()\n","import type { ThreadOperatorShare } from '@sourcegraph/amp-api-types'\nimport type { Observable } from '@sourcegraph/observable'\nimport {\n\tdistinctUntilChanged,\n\tfirstValueFrom,\n\tmap,\n\ttype pendingOperation,\n\tpromiseFactoryToObservable,\n\tswitchMap,\n\tswitchMapReplayOperation,\n} from '@sourcegraph/observable'\nimport { isEqualJSON } from '../common/isEqualJSON'\nimport { type PickResolvedConfiguration, resolvedConfig } from '../configuration/resolver'\nimport { clientIdentificationHeaders } from '../misc/known-clients'\nimport type { ThreadID } from '../threads/thread'\nimport type { ThreadService } from '../threads/thread-service'\nimport { FALLBACK_TO_OLD_INTERNAL_API, internalAPIClient } from './internal-api-client'\n\nexport const isAmpServerConfigured = resolvedConfig.pipe(\n\tswitchMap(({ settings, secrets }) => {\n\t\treturn promiseFactoryToObservable(async () => {\n\t\t\tconst apiKey = await secrets.getToken('apiKey', settings.url)\n\t\t\treturn apiKey !== undefined\n\t\t})\n\t}),\n)\n\n/**\n * Returns the URL to a thread on the Amp server.\n */\nexport function threadURL(ampURL: URL, threadID: ThreadID): URL {\n\treturn new URL(`/threads/${threadID}`, ampURL)\n}\n\n/**\n * Makes a request to the Amp API with the proper configuration\n */\nexport async function fetchFromAmpServer(\n\tpathAndQuery: string,\n\tinit?: RequestInit,\n): Promise<Response> {\n\tconst config = await firstValueFrom(resolvedConfig, init?.signal ?? undefined)\n\treturn fetchFromAmpServerWithConfig(config, pathAndQuery, init)\n}\n\nexport function watchOnAmpServer<T>(\n\tpathAndQuery: string,\n\tinit?: Omit<RequestInit, 'signal'>,\n): Observable<T | typeof pendingOperation | Error> {\n\treturn resolvedConfig.pipe(\n\t\tmap(\n\t\t\t({ settings, secrets }) =>\n\t\t\t\t({\n\t\t\t\t\tsettings: {\n\t\t\t\t\t\turl: settings.url,\n\t\t\t\t\t},\n\t\t\t\t\tsecrets,\n\t\t\t\t}) satisfies PickResolvedConfiguration<{\n\t\t\t\t\tsettings: 'url'\n\t\t\t\t\tsecrets: true\n\t\t\t\t}>,\n\t\t),\n\t\tdistinctUntilChanged(\n\t\t\t(a, b) => isEqualJSON(a.settings, b.settings) && a.secrets === b.secrets,\n\t\t),\n\t\tswitchMapReplayOperation((config) =>\n\t\t\tpromiseFactoryToObservable(async (signal) => {\n\t\t\t\tconst resp = await fetchFromAmpServerWithConfig(config, pathAndQuery, {\n\t\t\t\t\t...init,\n\t\t\t\t\tsignal,\n\t\t\t\t})\n\t\t\t\tif (!resp.ok) {\n\t\t\t\t\tconst text = await resp.text()\n\t\t\t\t\tif (text) {\n\t\t\t\t\t\tthrow new Error(`HTTP ${resp.status}: ${text}`)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(`HTTP ${resp.status}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn (await resp.json()) as T\n\t\t\t}),\n\t\t),\n\t)\n}\n\n/**\n * Share a thread with the operator (i.e., the Amp team).\n */\nexport async function shareThreadWithOperator(\n\tthreadService: ThreadService,\n\tthreadID: ThreadID,\n): Promise<void> {\n\tconst thread = await firstValueFrom(threadService.observe(threadID))\n\tif (!thread) {\n\t\tthrow new Error(`Thread not found: ${threadID}`)\n\t}\n\n\ttry {\n\t\tconst resp = await internalAPIClient.shareThreadWithOperator({ threadData: thread })\n\t\tif (!resp.ok) {\n\t\t\tthrow new Error(`Failed to share thread: ${resp.error.message}`)\n\t\t}\n\t} catch (error) {\n\t\tif (FALLBACK_TO_OLD_INTERNAL_API) {\n\t\t\tconst response = await fetchFromAmpServer('/api/internal/share-thread-with-operator', {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: {\n\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t},\n\t\t\t\tbody: JSON.stringify({ threadData: thread } as Pick<\n\t\t\t\t\tThreadOperatorShare,\n\t\t\t\t\t'threadData'\n\t\t\t\t>),\n\t\t\t})\n\t\t\tif (!response.ok) {\n\t\t\t\tconst text = await response.text()\n\t\t\t\tthrow new Error(`Failed to share thread: ${response.status} ${text}`)\n\t\t\t}\n\t\t} else {\n\t\t\tthrow error\n\t\t}\n\t}\n}\n\n/**\n * Submit autoedit feedback to the server.\n */\nexport async function submitAutoeditFeedback(feedbackData: {\n\tfile_path: string\n\tprefix: string\n\tsuffix: string\n\tcode_to_replace_prefix: string\n\tcode_to_replace_suffix: string\n\tcontext: Array<{\n\t\tidentifier: string\n\t\tcontent: string\n\t\tfile_path: string\n\t\tstart_line?: number\n\t\tend_line?: number\n\t\tmetadata?: {\n\t\t\ttime_since_action_ms?: number\n\t\t\tretriever_metadata?: Record<string, number | string>\n\t\t}\n\t}>\n\tchosen: string\n\trejected: string\n\tassertions: string\n}): Promise<void> {\n\tconst response = await fetchFromAmpServer('/api/tab/feedback', {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t},\n\t\tbody: JSON.stringify(feedbackData),\n\t})\n\n\tif (!response.ok) {\n\t\tconst text = await response.text()\n\t\tlet errorMessage: string\n\t\ttry {\n\t\t\tconst errorData = JSON.parse(text)\n\t\t\terrorMessage = errorData.error || `HTTP ${response.status}`\n\t\t} catch {\n\t\t\terrorMessage = text || `HTTP ${response.status}`\n\t\t}\n\t\tthrow new Error(`Failed to submit feedback: ${errorMessage}`)\n\t}\n}\n\nasync function fetchFromAmpServerWithConfig(\n\tconfig: PickResolvedConfiguration<{\n\t\tsettings: 'url'\n\t\tsecrets: true\n\t}>,\n\tpathAndQuery: string,\n\tinit?: RequestInit,\n): Promise<Response> {\n\tif (pathAndQuery.startsWith('http:') || pathAndQuery.startsWith('https:')) {\n\t\tthrow new Error('input must be a path, not an absolute URL')\n\t}\n\tif (!pathAndQuery.startsWith('/')) {\n\t\tthrow new Error('pathAndQuery must start with /')\n\t}\n\n\tconst baseURL = config.settings.url\n\tif (!baseURL) {\n\t\tthrow new Error('amp.url is not set')\n\t}\n\n\tconst apiKey = await config.secrets.getToken('apiKey', baseURL)\n\n\tif (!apiKey || apiKey.trim() === '') {\n\t\tconst error = new Error('Amp API key is not set')\n\t\terror.name = 'MissingApiKeyError'\n\t\tthrow error\n\t}\n\n\treturn fetch(new URL(pathAndQuery, baseURL), {\n\t\t...init,\n\t\theaders: {\n\t\t\t...init?.headers,\n\t\t\t...clientIdentificationHeaders(),\n\t\t\t'Content-Type': 'application/json',\n\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t},\n\t})\n}\n"],"names":["FALLBACK_TO_OLD_INTERNAL_API","createInternalAPIClient","_target","method","args","options","params","resp","fetchFromAmpServer","internalAPIClient","isAmpServerConfigured","resolvedConfig","switchMap","settings","secrets","promiseFactoryToObservable","pathAndQuery","init","config","firstValueFrom","fetchFromAmpServerWithConf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AAE9D,MAAI,CAACC,KAAUA,EAAO,KAAA,MAAW,IAAI;AAC9B,UAAAC,IAAQ,IAAI,MAAM,wBAAwB;AAChD,UAAAA,EAAM,OAAO,sBACPA;AAAA,EAAA;AAGP,SAAO,MAAM,IAAI,IAAIP,GAAcK,CAAO,GAAG;AAAA,IAC5C,GAAGJ;AAAA,IACH,SAAS;AAAA,MACR,GAAGA,GAAM;AAAA,MACT,GAAGO,EAA4B;AAAA,MAC/B,gBAAgB;AAAA,MAChB,eAAe,UAAUF,CAAM;AAAA,IAAA;AAAA,EAChC,CACA;AACF;"}
|
1
|
+
{"version":3,"file":"client-Dd8T5Ydk.js","sources":["../../core/src/server-api/internal-api-client.ts","../../core/src/server-api/client.ts"],"sourcesContent":["import type { InternalAPI } from '@sourcegraph/amp-api-types/src/internal-api'\nimport { fetchFromAmpServer } from './client'\n\n/**\n * The new POST /api/internal API was deployed on 2025-06-01. Until we are confident that the server\n * side of the new API is deployed *and* we will NOT need to roll back to a version prior to it, we\n * still fall back to the old API if the new API does not work. (Of course, this assumes that\n * operations are idempotent.)\n *\n * TODO(sqs): Remove this after we are sure that we will not need to roll back ampcode.com to a\n * version prior to the new POST /api/internal API. Then we can remove dead client code. Still need\n * to keep the server code for these API endpoints for older clients.\n */\nexport const FALLBACK_TO_OLD_INTERNAL_API: boolean = true\n\n/**\n * Transform the server-side InternalAPI into a client-side interface by:\n * 1. Removing the first 'ctx' parameter\n * 2. Adding an optional 'options' parameter with AbortSignal support\n */\ntype TransformToClientAPI<T> = {\n\t[K in keyof T]: T[K] extends (ctx: never, params: infer Params) => infer Return\n\t\t? (params: Params, options?: Options) => Return\n\t\t: T[K]\n}\n\ninterface Options {\n\tsignal?: AbortSignal\n}\n\n/**\n * Client-side interface for the InternalAPI that includes client-specific features like AbortSignal.\n * This interface omits the 'ctx' parameter which is handled server-side.\n */\nexport type InternalAPIClient = TransformToClientAPI<InternalAPI<never>>\n\n/**\n * Create a client for the InternalAPI interface that sends requests to the Amp server. Uses a\n * Proxy to dynamically call the appropriate API methods.\n */\nfunction createInternalAPIClient(): InternalAPIClient {\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, method: string) => {\n\t\t\t\treturn async (...args: any[]) => {\n\t\t\t\t\tconst options = args.at(1) as Options\n\t\t\t\t\tconst params = args.at(0)\n\n\t\t\t\t\t// Send request to the server.\n\t\t\t\t\tconst resp = await fetchFromAmpServer('/api/internal', {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tbody: JSON.stringify({ method, params }),\n\t\t\t\t\t\tsignal: options?.signal,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (!resp.ok) {\n\t\t\t\t\t\tthrow new Error(`API request failed: ${resp.status}`)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn await resp.json()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t) as InternalAPIClient\n}\n\n/**\n * Singleton instance of the internal API client.\n */\nexport const internalAPIClient: InternalAPIClient = createInternalAPIClient()\n","import type { ThreadOperatorShare } from '@sourcegraph/amp-api-types'\nimport type { Observable } from '@sourcegraph/observable'\nimport {\n\tdistinctUntilChanged,\n\tfirstValueFrom,\n\tmap,\n\ttype pendingOperation,\n\tpromiseFactoryToObservable,\n\tswitchMap,\n\tswitchMapReplayOperation,\n} from '@sourcegraph/observable'\nimport { isEqualJSON } from '../common/isEqualJSON'\nimport { type PickResolvedConfiguration, resolvedConfig } from '../configuration/resolver'\nimport { clientIdentificationHeaders } from '../misc/known-clients'\nimport type { ThreadID } from '../threads/thread'\nimport type { ThreadService } from '../threads/thread-service'\nimport { FALLBACK_TO_OLD_INTERNAL_API, internalAPIClient } from './internal-api-client'\n\nexport const isAmpServerConfigured = resolvedConfig.pipe(\n\tswitchMap(({ settings, secrets }) => {\n\t\treturn promiseFactoryToObservable(async () => {\n\t\t\tconst apiKey = await secrets.getToken('apiKey', settings.url)\n\t\t\treturn apiKey !== undefined\n\t\t})\n\t}),\n)\n\n/**\n * Returns the URL to a thread on the Amp server.\n */\nexport function threadURL(ampURL: URL, threadID: ThreadID): URL {\n\treturn new URL(`/threads/${threadID}`, ampURL)\n}\n\n/**\n * Makes a request to the Amp API with the proper configuration\n */\nexport async function fetchFromAmpServer(\n\tpathAndQuery: string,\n\tinit?: RequestInit,\n): Promise<Response> {\n\tconst config = await firstValueFrom(resolvedConfig, init?.signal ?? undefined)\n\treturn fetchFromAmpServerWithConfig(config, pathAndQuery, init)\n}\n\nexport function watchOnAmpServer<T>(\n\tpathAndQuery: string,\n\tinit?: Omit<RequestInit, 'signal'>,\n): Observable<T | typeof pendingOperation | Error> {\n\treturn resolvedConfig.pipe(\n\t\tmap(\n\t\t\t({ settings, secrets }) =>\n\t\t\t\t({\n\t\t\t\t\tsettings: {\n\t\t\t\t\t\turl: settings.url,\n\t\t\t\t\t},\n\t\t\t\t\tsecrets,\n\t\t\t\t}) satisfies PickResolvedConfiguration<{\n\t\t\t\t\tsettings: 'url'\n\t\t\t\t\tsecrets: true\n\t\t\t\t}>,\n\t\t),\n\t\tdistinctUntilChanged(\n\t\t\t(a, b) => isEqualJSON(a.settings, b.settings) && a.secrets === b.secrets,\n\t\t),\n\t\tswitchMapReplayOperation((config) =>\n\t\t\tpromiseFactoryToObservable(async (signal) => {\n\t\t\t\tconst resp = await fetchFromAmpServerWithConfig(config, pathAndQuery, {\n\t\t\t\t\t...init,\n\t\t\t\t\tsignal,\n\t\t\t\t})\n\t\t\t\tif (!resp.ok) {\n\t\t\t\t\tconst text = await resp.text()\n\t\t\t\t\tif (text) {\n\t\t\t\t\t\tthrow new Error(`HTTP ${resp.status}: ${text}`)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(`HTTP ${resp.status}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn (await resp.json()) as T\n\t\t\t}),\n\t\t),\n\t)\n}\n\n/**\n * Share a thread with the operator (i.e., the Amp team).\n */\nexport async function shareThreadWithOperator(\n\tthreadService: ThreadService,\n\tthreadID: ThreadID,\n): Promise<void> {\n\tconst thread = await firstValueFrom(threadService.observe(threadID))\n\tif (!thread) {\n\t\tthrow new Error(`Thread not found: ${threadID}`)\n\t}\n\n\ttry {\n\t\tconst resp = await internalAPIClient.shareThreadWithOperator({ threadData: thread })\n\t\tif (!resp.ok) {\n\t\t\tthrow new Error(`Failed to share thread: ${resp.error.message}`)\n\t\t}\n\t} catch (error) {\n\t\tif (FALLBACK_TO_OLD_INTERNAL_API) {\n\t\t\tconst response = await fetchFromAmpServer('/api/internal/share-thread-with-operator', {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: {\n\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t},\n\t\t\t\tbody: JSON.stringify({ threadData: thread } as Pick<\n\t\t\t\t\tThreadOperatorShare,\n\t\t\t\t\t'threadData'\n\t\t\t\t>),\n\t\t\t})\n\t\t\tif (!response.ok) {\n\t\t\t\tconst text = await response.text()\n\t\t\t\tthrow new Error(`Failed to share thread: ${response.status} ${text}`)\n\t\t\t}\n\t\t} else {\n\t\t\tthrow error\n\t\t}\n\t}\n}\n\n/**\n * Submit autoedit feedback to the server.\n */\nexport async function submitAutoeditFeedback(feedbackData: {\n\tfile_path: string\n\tprefix: string\n\tsuffix: string\n\tcode_to_replace_prefix: string\n\tcode_to_replace_suffix: string\n\tcontext: Array<{\n\t\tidentifier: string\n\t\tcontent: string\n\t\tfile_path: string\n\t\tstart_line?: number\n\t\tend_line?: number\n\t\tmetadata?: {\n\t\t\ttime_since_action_ms?: number\n\t\t\tretriever_metadata?: Record<string, number | string>\n\t\t}\n\t}>\n\tchosen: string\n\trejected: string\n\tassertions: string\n}): Promise<void> {\n\tconst response = await fetchFromAmpServer('/api/tab/feedback', {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t},\n\t\tbody: JSON.stringify(feedbackData),\n\t})\n\n\tif (!response.ok) {\n\t\tconst text = await response.text()\n\t\tlet errorMessage: string\n\t\ttry {\n\t\t\tconst errorData = JSON.parse(text)\n\t\t\terrorMessage = errorData.error || `HTTP ${response.status}`\n\t\t} catch {\n\t\t\terrorMessage = text || `HTTP ${response.status}`\n\t\t}\n\t\tthrow new Error(`Failed to submit feedback: ${errorMessage}`)\n\t}\n}\n\nasync function fetchFromAmpServerWithConfig(\n\tconfig: PickResolvedConfiguration<{\n\t\tsettings: 'url'\n\t\tsecrets: true\n\t}>,\n\tpathAndQuery: string,\n\tinit?: RequestInit,\n): Promise<Response> {\n\tif (pathAndQuery.startsWith('http:') || pathAndQuery.startsWith('https:')) {\n\t\tthrow new Error('input must be a path, not an absolute URL')\n\t}\n\tif (!pathAndQuery.startsWith('/')) {\n\t\tthrow new Error('pathAndQuery must start with /')\n\t}\n\n\tconst baseURL = config.settings.url\n\tif (!baseURL) {\n\t\tthrow new Error('amp.url is not set')\n\t}\n\n\tconst apiKey = await config.secrets.getToken('apiKey', baseURL)\n\n\tif (!apiKey || apiKey.trim() === '') {\n\t\tconst error = new Error('Amp API key is not set')\n\t\terror.name = 'MissingApiKeyError'\n\t\tthrow error\n\t}\n\n\treturn fetch(new URL(pathAndQuery, baseURL), {\n\t\t...init,\n\t\theaders: {\n\t\t\t...init?.headers,\n\t\t\t...clientIdentificationHeaders(),\n\t\t\t'Content-Type': 'application/json',\n\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t},\n\t})\n}\n"],"names":["FALLBACK_TO_OLD_INTERNAL_API","createInternalAPIClient","_target","method","args","options","params","resp","fetchFromAmpServer","internalAPIClient","isAmpServerConfigured","resolvedConfig","switchMap","settings","secrets","promiseFactoryToObservable","pathAndQuery","init","config","firstValueFrom","fetchFromAmpServerWithConfig","baseURL","apiKey","error","clientIdentificationHeaders"],"mappings":";;AAaO,MAAMA,IAAwC;AA2BrD,SAASC,IAA6C;AACrD,SAAO,IAAI;AAAA,IACV,CAAC;AAAA,IACD;AAAA,MACC,KAAK,CAACC,GAASC,MACP,UAAUC,MAAgB;AAC1B,cAAAC,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A,IAC5C,GAAGJ;AAAA,IACH,SAAS;AAAA,MACR,GAAGA,GAAM;AAAA,MACT,GAAGO,EAA4B;AAAA,MAC/B,gBAAgB;AAAA,MAChB,eAAe,UAAUF,CAAM;AAAA,IAAA;AAAA,EAChC,CACA;AACF;"}
|
@@ -1045,7 +1045,7 @@ COMPLEMENTARY USE WITH CODEBASE_SEARCH:
|
|
1045
1045
|
},
|
1046
1046
|
source: "builtin"
|
1047
1047
|
},
|
1048
|
-
fn: import("./node-
|
1048
|
+
fn: import("./node-D9dPV0eu.js").then(({ nodeGrepTool: n }) => n)
|
1049
1049
|
};
|
1050
1050
|
var Wc = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
1051
1051
|
function ms(n) {
|
@@ -1952,7 +1952,7 @@ It's VERY IMPORTANT to use specific tools when searching for files, instead of i
|
|
1952
1952
|
},
|
1953
1953
|
source: "builtin"
|
1954
1954
|
},
|
1955
|
-
fn: import("./node-
|
1955
|
+
fn: import("./node-BOIz1I5S.js").then(({ nodeBashTool: n }) => n),
|
1956
1956
|
preprocessArgs: (n) => {
|
1957
1957
|
if (!n.cwd)
|
1958
1958
|
try {
|
@@ -2011,7 +2011,7 @@ Prefer this tool over \`edit_file\` when you want to ovewrite the entire content
|
|
2011
2011
|
content: n.content + `
|
2012
2012
|
`
|
2013
2013
|
},
|
2014
|
-
fn: import("./create_file.node-
|
2014
|
+
fn: import("./create_file.node-D_xwgdhJ.js").then(
|
2015
2015
|
({ nodeCreateFileTool: n }) => n
|
2016
2016
|
)
|
2017
2017
|
};
|
@@ -4843,7 +4843,7 @@ Returns the contents of the file with each line prefixed by its line number. For
|
|
4843
4843
|
switch ("node") {
|
4844
4844
|
case "node":
|
4845
4845
|
case "vscode":
|
4846
|
-
return import("./read_file.node-
|
4846
|
+
return import("./read_file.node-CAD-I3qI.js").then(({ nodeReadFileTool: n }) => n);
|
4847
4847
|
}
|
4848
4848
|
})()
|
4849
4849
|
}, oB = F8({
|
@@ -4872,7 +4872,7 @@ If you need to replace the entire contents of a file, use \`${Yu}\` instead, sin
|
|
4872
4872
|
inputSchema: j4(oB),
|
4873
4873
|
source: "builtin"
|
4874
4874
|
},
|
4875
|
-
fn: import("./edit_file.node-
|
4875
|
+
fn: import("./edit_file.node-Cv9nC-uR.js").then(({ nodeEditFileTool: n }) => n)
|
4876
4876
|
};
|
4877
4877
|
function $S(n) {
|
4878
4878
|
return n.replace(/\\\\n/g, "\\n").replace(/\\\\t/g, "\\t").replace(/\\\\/g, "\\").replace(/\\"/g, '"').replace(/\\'/g, "'").replace(/\\n/g, `
|
@@ -5053,7 +5053,7 @@ Note: Results are sorted by modification time with the most recently modified fi
|
|
5053
5053
|
},
|
5054
5054
|
source: "builtin"
|
5055
5055
|
},
|
5056
|
-
fn: import("./glob.node-
|
5056
|
+
fn: import("./glob.node-Dbygwo7q.js").then(({ nodeGlobTool: n }) => n)
|
5057
5057
|
}, Wu = "list_directory", RE = {
|
5058
5058
|
spec: {
|
5059
5059
|
name: Wu,
|
@@ -5074,7 +5074,7 @@ Note: Results are sorted by modification time with the most recently modified fi
|
|
5074
5074
|
switch ("node") {
|
5075
5075
|
case "node":
|
5076
5076
|
case "vscode":
|
5077
|
-
return import("./list_directory.node-
|
5077
|
+
return import("./list_directory.node-DJCJkqLg.js").then(
|
5078
5078
|
({ nodeListDirectoryTool: n }) => n
|
5079
5079
|
);
|
5080
5080
|
}
|
@@ -5161,7 +5161,7 @@ This tool converts web content to markdown format for better readability.`,
|
|
5161
5161
|
requiresNetwork: !0
|
5162
5162
|
}
|
5163
5163
|
},
|
5164
|
-
fn: import("./node-
|
5164
|
+
fn: import("./node-DPPbAAw0.js").then(({ nodeReadWebPageTool: n }) => n)
|
5165
5165
|
}, pB = "web_search", mB = `Search the web for information.
|
5166
5166
|
|
5167
5167
|
Returns search result titles, associated URLs, and a small summary of the
|
@@ -5209,7 +5209,7 @@ the \`${k1}\` with the url.
|
|
5209
5209
|
requiresNetwork: !0
|
5210
5210
|
}
|
5211
5211
|
},
|
5212
|
-
fn: import("./node-
|
5212
|
+
fn: import("./node-DaL4eJRQ.js").then(({ nodeWebSearchTool: n }) => n)
|
5213
5213
|
};
|
5214
5214
|
function $N({ onlyFirst: n = !1 } = {}) {
|
5215
5215
|
const t = [
|
@@ -8397,7 +8397,7 @@ const SU = {
|
|
8397
8397
|
instructions: "npm install -g @sourcegraph/amp"
|
8398
8398
|
},
|
8399
8399
|
configure: {
|
8400
|
-
url: "https://
|
8400
|
+
url: "https://www.npmjs.com/package/@sourcegraph/amp"
|
8401
8401
|
}
|
8402
8402
|
}
|
8403
8403
|
};
|
@@ -28427,7 +28427,7 @@ async function lV(n, e) {
|
|
28427
28427
|
}
|
28428
28428
|
}
|
28429
28429
|
async function cV(n, e) {
|
28430
|
-
return (await import("./list_directory.node-
|
28430
|
+
return (await import("./list_directory.node-DJCJkqLg.js")).resolveArgumentDirectoryNode(n, e);
|
28431
28431
|
}
|
28432
28432
|
class uV extends vd {
|
28433
28433
|
#e = new AbortController();
|
@@ -30415,7 +30415,7 @@ async function OV({
|
|
30415
30415
|
fileMentions: void 0,
|
30416
30416
|
userState: void 0
|
30417
30417
|
};
|
30418
|
-
const i = (await import("./files-
|
30418
|
+
const i = (await import("./files-CNmw2a6V.js").then(
|
30419
30419
|
({ getFileMentions: o }) => o(
|
30420
30420
|
QN(t.content),
|
30421
30421
|
a,
|
@@ -31559,7 +31559,7 @@ Returns a git-style diff showing the changes that were undone as formatted markd
|
|
31559
31559
|
switch ("node") {
|
31560
31560
|
case "node":
|
31561
31561
|
case "vscode":
|
31562
|
-
return import("./undo_edit.node-
|
31562
|
+
return import("./undo_edit.node-BYH1ok_y.js").then(({ nodeUndoEditTool: n }) => n);
|
31563
31563
|
}
|
31564
31564
|
})()
|
31565
31565
|
}, ey = globalThis.window?.document !== void 0;
|
@@ -75884,4 +75884,4 @@ export {
|
|
75884
75884
|
IAe as y,
|
75885
75885
|
ms as z
|
75886
75886
|
};
|
75887
|
-
//# sourceMappingURL=console-
|
75887
|
+
//# sourceMappingURL=console-D_ZxbRrA.js.map
|