@sourcegraph/amp 0.0.1749153691-g1c99f8 → 0.0.1749182771-gb19aef

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.
Files changed (44) hide show
  1. package/dist/amp.js +3 -3
  2. package/dist/{client-dO78YbLg.js → client-DQvLVO0y.js} +2 -2
  3. package/dist/{client-dO78YbLg.js.map → client-DQvLVO0y.js.map} +1 -1
  4. package/dist/{console-EbqtUVJ9.js → console-B2SF1aqQ.js} +43 -39
  5. package/dist/{console-EbqtUVJ9.js.map → console-B2SF1aqQ.js.map} +1 -1
  6. package/dist/{create_file.node-BpunqjQ6.js → create_file.node-CTYL8XSm.js} +2 -2
  7. package/dist/{create_file.node-BpunqjQ6.js.map → create_file.node-CTYL8XSm.js.map} +1 -1
  8. package/dist/{edit_file.node-oKoJ5BpY.js → edit_file.node-Bsj3aCak.js} +3 -3
  9. package/dist/{edit_file.node-oKoJ5BpY.js.map → edit_file.node-Bsj3aCak.js.map} +1 -1
  10. package/dist/{executable-CKMskaIA.js → executable-DdVPivLU.js} +2 -2
  11. package/dist/{executable-CKMskaIA.js.map → executable-DdVPivLU.js.map} +1 -1
  12. package/dist/{files-D78rHDQ4.js → files-DgmPJSHS.js} +2 -2
  13. package/dist/{files-D78rHDQ4.js.map → files-DgmPJSHS.js.map} +1 -1
  14. package/dist/{glob.node-BpueriDu.js → glob.node-CvxhbXXV.js} +4 -4
  15. package/dist/{glob.node-BpueriDu.js.map → glob.node-CvxhbXXV.js.map} +1 -1
  16. package/dist/{index-Dvd3Q7dO.js → index-DG5uxXfG.js} +2 -2
  17. package/dist/{index-Dvd3Q7dO.js.map → index-DG5uxXfG.js.map} +1 -1
  18. package/dist/{list_directory.node-s3KvW0rS.js → list_directory.node-D7kWIPfS.js} +2 -2
  19. package/dist/{list_directory.node-s3KvW0rS.js.map → list_directory.node-D7kWIPfS.js.map} +1 -1
  20. package/dist/{load-profile-DJQRaG_k.js → load-profile-DD55GCpN.js} +2 -2
  21. package/dist/{load-profile-DJQRaG_k.js.map → load-profile-DD55GCpN.js.map} +1 -1
  22. package/dist/{main-DhAGJJRG.js → main-CnaIlgJ-.js} +21 -16
  23. package/dist/main-CnaIlgJ-.js.map +1 -0
  24. package/dist/{node-D7VCphID.js → node-BHadfrnF.js} +2 -2
  25. package/dist/{node-D7VCphID.js.map → node-BHadfrnF.js.map} +1 -1
  26. package/dist/{node-D3CcwlrL.js → node-BcF9KV_p.js} +3 -3
  27. package/dist/{node-D3CcwlrL.js.map → node-BcF9KV_p.js.map} +1 -1
  28. package/dist/{node-C3AfReqE.js → node-CBGz4YST.js} +4 -4
  29. package/dist/{node-C3AfReqE.js.map → node-CBGz4YST.js.map} +1 -1
  30. package/dist/{node-DrdEtfaD.js → node-CDbBRzSe.js} +3 -3
  31. package/dist/{node-DrdEtfaD.js.map → node-CDbBRzSe.js.map} +1 -1
  32. package/dist/{node-oFExutic.js → node-DExO0xPV.js} +2 -2
  33. package/dist/{node-oFExutic.js.map → node-DExO0xPV.js.map} +1 -1
  34. package/dist/{node-CPIVh6Ki.js → node-q5EJWNpV.js} +3 -3
  35. package/dist/{node-CPIVh6Ki.js.map → node-q5EJWNpV.js.map} +1 -1
  36. package/dist/{read_file.node-DlqCZQPO.js → read_file.node-CpfHdJYY.js} +2 -2
  37. package/dist/{read_file.node-DlqCZQPO.js.map → read_file.node-CpfHdJYY.js.map} +1 -1
  38. package/dist/{stdio-CVzWTt_v.js → stdio-Clxnyx58.js} +3 -3
  39. package/dist/{stdio-CVzWTt_v.js.map → stdio-Clxnyx58.js.map} +1 -1
  40. package/dist/storybook.js +1 -1
  41. package/dist/{undo_edit.node-sSSReN3p.js → undo_edit.node-DDFebFdr.js} +2 -2
  42. package/dist/{undo_edit.node-sSSReN3p.js.map → undo_edit.node-DDFebFdr.js.map} +1 -1
  43. package/package.json +1 -1
  44. package/dist/main-DhAGJJRG.js.map +0 -1
package/dist/amp.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import "./console-EbqtUVJ9.js";
3
- import "./main-DhAGJJRG.js";
2
+ import "./console-B2SF1aqQ.js";
3
+ import "./main-CnaIlgJ-.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-dO78YbLg.js";
8
+ import "./client-DQvLVO0y.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-EbqtUVJ9.js";
2
+ import { f as i, E as o, aS as c, s as p, p as u } from "./console-B2SF1aqQ.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-dO78YbLg.js.map
57
+ //# sourceMappingURL=client-DQvLVO0y.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-dO78YbLg.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","firstVal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Q,SAAS,UAAUG,CAAO;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-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","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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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;"}
@@ -1045,7 +1045,7 @@ COMPLEMENTARY USE WITH CODEBASE_SEARCH:
1045
1045
  },
1046
1046
  source: "builtin"
1047
1047
  },
1048
- fn: import("./node-C3AfReqE.js").then(({ nodeGrepTool: n }) => n)
1048
+ fn: import("./node-CBGz4YST.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-DrdEtfaD.js").then(({ nodeBashTool: n }) => n),
1955
+ fn: import("./node-CDbBRzSe.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-BpunqjQ6.js").then(
2014
+ fn: import("./create_file.node-CTYL8XSm.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-DlqCZQPO.js").then(({ nodeReadFileTool: n }) => n);
4846
+ return import("./read_file.node-CpfHdJYY.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-oKoJ5BpY.js").then(({ nodeEditFileTool: n }) => n)
4875
+ fn: import("./edit_file.node-Bsj3aCak.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-BpueriDu.js").then(({ nodeGlobTool: n }) => n)
5056
+ fn: import("./glob.node-CvxhbXXV.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-s3KvW0rS.js").then(
5077
+ return import("./list_directory.node-D7kWIPfS.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-D7VCphID.js").then(({ nodeReadWebPageTool: n }) => n)
5164
+ fn: import("./node-BHadfrnF.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-D3CcwlrL.js").then(({ nodeWebSearchTool: n }) => n)
5212
+ fn: import("./node-BcF9KV_p.js").then(({ nodeWebSearchTool: n }) => n)
5213
5213
  };
5214
5214
  function $N({ onlyFirst: n = !1 } = {}) {
5215
5215
  const t = [
@@ -9035,36 +9035,38 @@ async function* WU(n, e, t, r, a) {
9035
9035
  // betas: ['token-efficient-tools-2025-02-19'],
9036
9036
  // }
9037
9037
  // : {}),
9038
- };
9039
- (i.settings["anthropic.thinking.enabled"] ?? !0) && (u.thinking = {
9038
+ }, _ = i.settings["anthropic.thinking.enabled"] ?? !0;
9039
+ _ && (u.thinking = {
9040
9040
  type: "enabled",
9041
9041
  budget_tokens: VU
9042
9042
  });
9043
- const g = s.messages.stream(u, { signal: a });
9043
+ const g = i.settings["anthropic.temperature"];
9044
+ g !== void 0 && !_ && (u.temperature = g);
9045
+ const p = s.messages.stream(u, { signal: a });
9044
9046
  try {
9045
- yield* g;
9046
- } catch (f) {
9047
- throw f instanceof sa ? new DOMException("Aborted", "AbortError") : f;
9047
+ yield* p;
9048
+ } catch (S) {
9049
+ throw S instanceof sa ? new DOMException("Aborted", "AbortError") : S;
9048
9050
  }
9049
- let p;
9051
+ let f;
9050
9052
  try {
9051
- p = await g.finalMessage();
9052
- } catch (f) {
9053
- if (f instanceof Li.AnthropicError && f.message.includes("without producing a Message"))
9054
- p = void 0;
9053
+ f = await p.finalMessage();
9054
+ } catch (S) {
9055
+ if (S instanceof Li.AnthropicError && S.message.includes("without producing a Message"))
9056
+ f = void 0;
9055
9057
  else
9056
- throw f;
9058
+ throw S;
9057
9059
  }
9058
9060
  return {
9059
- message: p,
9061
+ message: f,
9060
9062
  "~debugParamsUsed": u,
9061
- "~debugUsage": p ? {
9063
+ "~debugUsage": f ? {
9062
9064
  maxInputTokens: F1,
9063
- inputTokens: p.usage.input_tokens,
9064
- outputTokens: p.usage.output_tokens,
9065
- cacheCreationInputTokens: p.usage.cache_creation_input_tokens,
9066
- cacheReadInputTokens: p.usage.cache_read_input_tokens,
9067
- totalInputTokens: p.usage.input_tokens + (p.usage.cache_creation_input_tokens ?? 0) + (p.usage.cache_read_input_tokens ?? 0)
9065
+ inputTokens: f.usage.input_tokens,
9066
+ outputTokens: f.usage.output_tokens,
9067
+ cacheCreationInputTokens: f.usage.cache_creation_input_tokens,
9068
+ cacheReadInputTokens: f.usage.cache_read_input_tokens,
9069
+ totalInputTokens: f.usage.input_tokens + (f.usage.cache_creation_input_tokens ?? 0) + (f.usage.cache_read_input_tokens ?? 0)
9068
9070
  } : {
9069
9071
  maxInputTokens: F1,
9070
9072
  inputTokens: 0,
@@ -9107,17 +9109,19 @@ async function Fw(n, e, t, r, a) {
9107
9109
  messages: o,
9108
9110
  system: t,
9109
9111
  tools: Bw(e)
9110
- }, u = await s.messages.create(c);
9112
+ }, u = i.settings["anthropic.thinking.enabled"] ?? !0, _ = i.settings["anthropic.temperature"];
9113
+ _ !== void 0 && !u && (c.temperature = _);
9114
+ const g = await s.messages.create(c);
9111
9115
  return {
9112
- message: u,
9116
+ message: g,
9113
9117
  "~debugParamsUsed": c,
9114
9118
  "~debugUsage": {
9115
9119
  maxInputTokens: YU,
9116
- inputTokens: u.usage.input_tokens,
9117
- outputTokens: u.usage.output_tokens,
9118
- cacheCreationInputTokens: u.usage.cache_creation_input_tokens,
9119
- cacheReadInputTokens: u.usage.cache_read_input_tokens,
9120
- totalInputTokens: u.usage.input_tokens + (u.usage.cache_creation_input_tokens ?? 0) + (u.usage.cache_read_input_tokens ?? 0)
9120
+ inputTokens: g.usage.input_tokens,
9121
+ outputTokens: g.usage.output_tokens,
9122
+ cacheCreationInputTokens: g.usage.cache_creation_input_tokens,
9123
+ cacheReadInputTokens: g.usage.cache_read_input_tokens,
9124
+ totalInputTokens: g.usage.input_tokens + (g.usage.cache_creation_input_tokens ?? 0) + (g.usage.cache_read_input_tokens ?? 0)
9121
9125
  }
9122
9126
  };
9123
9127
  }
@@ -28423,7 +28427,7 @@ async function lV(n, e) {
28423
28427
  }
28424
28428
  }
28425
28429
  async function cV(n, e) {
28426
- return (await import("./list_directory.node-s3KvW0rS.js")).resolveArgumentDirectoryNode(n, e);
28430
+ return (await import("./list_directory.node-D7kWIPfS.js")).resolveArgumentDirectoryNode(n, e);
28427
28431
  }
28428
28432
  class uV extends vd {
28429
28433
  #e = new AbortController();
@@ -30411,7 +30415,7 @@ async function OV({
30411
30415
  fileMentions: void 0,
30412
30416
  userState: void 0
30413
30417
  };
30414
- const i = (await import("./files-D78rHDQ4.js").then(
30418
+ const i = (await import("./files-DgmPJSHS.js").then(
30415
30419
  ({ getFileMentions: o }) => o(
30416
30420
  QN(t.content),
30417
30421
  a,
@@ -31555,7 +31559,7 @@ Returns a git-style diff showing the changes that were undone as formatted markd
31555
31559
  switch ("node") {
31556
31560
  case "node":
31557
31561
  case "vscode":
31558
- return import("./undo_edit.node-sSSReN3p.js").then(({ nodeUndoEditTool: n }) => n);
31562
+ return import("./undo_edit.node-DDFebFdr.js").then(({ nodeUndoEditTool: n }) => n);
31559
31563
  }
31560
31564
  })()
31561
31565
  }, ey = globalThis.window?.document !== void 0;
@@ -75880,4 +75884,4 @@ export {
75880
75884
  IAe as y,
75881
75885
  ms as z
75882
75886
  };
75883
- //# sourceMappingURL=console-EbqtUVJ9.js.map
75887
+ //# sourceMappingURL=console-B2SF1aqQ.js.map