@sourcegraph/amp 0.0.1749246959-g551fd5 → 0.0.1749256326-gf8b1cf

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 (47) hide show
  1. package/dist/amp.js +1 -2
  2. package/dist/client-D82aFqMl.js +0 -1
  3. package/dist/console-RPzEsLY0.js +0 -1
  4. package/dist/create_file.node-Dg6SfP0E.js +0 -1
  5. package/dist/edit_file.node-DOTivrdL.js +0 -1
  6. package/dist/executable-Cvv6G9ik.js +0 -1
  7. package/dist/files-DrSncnX3.js +0 -1
  8. package/dist/fuzzy-server.js +0 -1
  9. package/dist/glob.node-Betywdle.js +0 -1
  10. package/dist/index-C1JH-cfZ.js +0 -1
  11. package/dist/list_directory.node-B8bOIV1q.js +0 -1
  12. package/dist/load-profile-CgexvkzB.js +0 -1
  13. package/dist/{main-X3N3IEqE.js → main-8KUolY-x.js} +10 -11
  14. package/dist/node-BIJw0rpH.js +0 -1
  15. package/dist/{node-ChwsFdlu.js → node-BSnweH9G.js} +1 -2
  16. package/dist/node-CQsX6uby.js +0 -1
  17. package/dist/node-DeN3f1CH.js +0 -1
  18. package/dist/node-cSLqYAQI.js +0 -1
  19. package/dist/node-l0bjR3wx.js +0 -1
  20. package/dist/read_file.node-Cf-KhpsY.js +0 -1
  21. package/dist/{stdio-vZX8mSpo.js → stdio-KJwwMQUN.js} +1 -2
  22. package/dist/storybook.js +0 -1
  23. package/dist/undo_edit.node-CCYYuJ4U.js +0 -1
  24. package/package.json +2 -1
  25. package/dist/amp.js.map +0 -1
  26. package/dist/client-D82aFqMl.js.map +0 -1
  27. package/dist/console-RPzEsLY0.js.map +0 -1
  28. package/dist/create_file.node-Dg6SfP0E.js.map +0 -1
  29. package/dist/edit_file.node-DOTivrdL.js.map +0 -1
  30. package/dist/executable-Cvv6G9ik.js.map +0 -1
  31. package/dist/files-DrSncnX3.js.map +0 -1
  32. package/dist/fuzzy-server.js.map +0 -1
  33. package/dist/glob.node-Betywdle.js.map +0 -1
  34. package/dist/index-C1JH-cfZ.js.map +0 -1
  35. package/dist/list_directory.node-B8bOIV1q.js.map +0 -1
  36. package/dist/load-profile-CgexvkzB.js.map +0 -1
  37. package/dist/main-X3N3IEqE.js.map +0 -1
  38. package/dist/node-BIJw0rpH.js.map +0 -1
  39. package/dist/node-CQsX6uby.js.map +0 -1
  40. package/dist/node-ChwsFdlu.js.map +0 -1
  41. package/dist/node-DeN3f1CH.js.map +0 -1
  42. package/dist/node-cSLqYAQI.js.map +0 -1
  43. package/dist/node-l0bjR3wx.js.map +0 -1
  44. package/dist/read_file.node-Cf-KhpsY.js.map +0 -1
  45. package/dist/stdio-vZX8mSpo.js.map +0 -1
  46. package/dist/storybook.js.map +0 -1
  47. package/dist/undo_edit.node-CCYYuJ4U.js.map +0 -1
package/dist/amp.js CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import "./console-RPzEsLY0.js";
3
- import "./main-X3N3IEqE.js";
3
+ import "./main-8KUolY-x.js";
4
4
  import "node:crypto";
5
5
  import "node:fs/promises";
6
6
  import "node:path";
7
7
  import "node:process";
8
8
  import "./client-D82aFqMl.js";
9
- //# sourceMappingURL=amp.js.map
@@ -54,4 +54,3 @@ export {
54
54
  h as f,
55
55
  y as i
56
56
  };
57
- //# sourceMappingURL=client-D82aFqMl.js.map
@@ -77002,4 +77002,3 @@ export {
77002
77002
  PRe as y,
77003
77003
  Li as z
77004
77004
  };
77005
- //# sourceMappingURL=console-RPzEsLY0.js.map
@@ -19,4 +19,3 @@ const w = ({ args: t }, { dir: a, dirs: n, trackFileChange: c, filesystem: o })
19
19
  export {
20
20
  w as nodeCreateFileTool
21
21
  };
22
- //# sourceMappingURL=create_file.node-Dg6SfP0E.js.map
@@ -65,4 +65,3 @@ function y(e) {
65
65
  export {
66
66
  k as nodeEditFileTool
67
67
  };
68
- //# sourceMappingURL=edit_file.node-DOTivrdL.js.map
@@ -19,4 +19,3 @@ function u() {
19
19
  export {
20
20
  u as r
21
21
  };
22
- //# sourceMappingURL=executable-Cvv6G9ik.js.map
@@ -67,4 +67,3 @@ async function L(p, h, t) {
67
67
  export {
68
68
  L as getFileMentions
69
69
  };
70
- //# sourceMappingURL=files-DrSncnX3.js.map
@@ -1096,4 +1096,3 @@ class Ue {
1096
1096
  }
1097
1097
  const Xe = new Ue();
1098
1098
  Xe.start();
1099
- //# sourceMappingURL=fuzzy-server.js.map
@@ -134,4 +134,3 @@ export {
134
134
  S as nodeGlobTool,
135
135
  F as ripgrepFiles
136
136
  };
137
- //# sourceMappingURL=glob.node-Betywdle.js.map
@@ -919,4 +919,3 @@ const vt = /* @__PURE__ */ xt(Tt);
919
919
  export {
920
920
  vt as p
921
921
  };
922
- //# sourceMappingURL=index-C1JH-cfZ.js.map
@@ -53,4 +53,3 @@ export {
53
53
  D as nodeListDirectoryTool,
54
54
  y as resolveArgumentDirectoryNode
55
55
  };
56
- //# sourceMappingURL=list_directory.node-B8bOIV1q.js.map
@@ -9,4 +9,3 @@ n.platform();
9
9
  export {
10
10
  i as loadProfileEnvironmentVariables
11
11
  };
12
- //# sourceMappingURL=load-profile-CgexvkzB.js.map
@@ -4994,7 +4994,7 @@ async function Nv(t, e, n) {
4994
4994
  const { loadProfileEnvironmentVariables: r } = await import("./load-profile-CgexvkzB.js"), a = n.loadProfile === "never" || !n.workingDirectory ? process.env : await We(
4995
4995
  r(n.workingDirectory, n.loadProfile)
4996
4996
  );
4997
- i = await import("./stdio-vZX8mSpo.js").then(
4997
+ i = await import("./stdio-KJwwMQUN.js").then(
4998
4998
  ({ StdioClientTransport: s }) => new s({
4999
4999
  ...t,
5000
5000
  stderr: "pipe",
@@ -5755,7 +5755,7 @@ IMPORTANT: The result of this tool (if any) should be displayed directly to the
5755
5755
  },
5756
5756
  source: "builtin"
5757
5757
  },
5758
- fn: import("./node-ChwsFdlu.js").then(({ runRoutine: t }) => t)
5758
+ fn: import("./node-BSnweH9G.js").then(({ runRoutine: t }) => t)
5759
5759
  };
5760
5760
  let hu = !1;
5761
5761
  async function ed(t, e = !1) {
@@ -18792,7 +18792,7 @@ async function Rw({
18792
18792
  }
18793
18793
  async function xw(t) {
18794
18794
  try {
18795
- const e = await _w("0.0.1749246959-g551fd5");
18795
+ const e = await _w("0.0.1749256326-gf8b1cf");
18796
18796
  e.hasUpdate && e.latestVersion ? (t.next({ type: "update-start-updating" }), setTimeout(async () => {
18797
18797
  try {
18798
18798
  await Cw(e.latestVersion), t.next({
@@ -20550,7 +20550,7 @@ async function Un(t, e) {
20550
20550
  Yn({
20551
20551
  logLevel: e.logLevel || process.env.AMP_LOG_LEVEL,
20552
20552
  logFile: e.logFile || process.env.AMP_LOG_FILE
20553
- }), Vp("0.0.1749246959-g551fd5");
20553
+ }), Vp("0.0.1749256326-gf8b1cf");
20554
20554
  const n = e.settingsFile ?? process.env.AMP_SETTINGS_FILE;
20555
20555
  J.info("Using settings file", { settingsFile: n });
20556
20556
  const i = Hn(), r = ad({ settingsFile: n }), a = process.env.AMP_API_KEY;
@@ -20658,7 +20658,7 @@ function Zw(t) {
20658
20658
  const e = new wu().name("amp").description("AI-powered coding assistant").option("--thread-id [THREAD_ID]", "ID of the thread to continue running", void 0);
20659
20659
  e.option("-V, --version", "output the version number", () => {
20660
20660
  if (t.isTTY) {
20661
- const a = "0.0.1749246959-g551fd5".match(/^(\d+\.\d+)\.(\d+)-(.+)$/);
20661
+ const a = "0.0.1749256326-gf8b1cf".match(/^(\d+\.\d+)\.(\d+)-(.+)$/);
20662
20662
  if (a) {
20663
20663
  const [, , s] = a;
20664
20664
  try {
@@ -20669,21 +20669,21 @@ function Zw(t) {
20669
20669
  day: "numeric"
20670
20670
  });
20671
20671
  Ie.write(
20672
- `0.0.1749246959-g551fd5 ${t.printer.print(`(released ${o})`, { foreground: "gray" })}
20672
+ `0.0.1749256326-gf8b1cf ${t.printer.print(`(released ${o})`, { foreground: "gray" })}
20673
20673
  `
20674
20674
  );
20675
20675
  } else
20676
- Ie.write(`0.0.1749246959-g551fd5
20676
+ Ie.write(`0.0.1749256326-gf8b1cf
20677
20677
  `);
20678
20678
  } catch {
20679
- Ie.write(`0.0.1749246959-g551fd5
20679
+ Ie.write(`0.0.1749256326-gf8b1cf
20680
20680
  `);
20681
20681
  }
20682
20682
  } else
20683
- Ie.write(`0.0.1749246959-g551fd5
20683
+ Ie.write(`0.0.1749256326-gf8b1cf
20684
20684
  `);
20685
20685
  } else
20686
- Ie.write(`0.0.1749246959-g551fd5
20686
+ Ie.write(`0.0.1749256326-gf8b1cf
20687
20687
  `);
20688
20688
  process.exit(0);
20689
20689
  }), e.addHelpText(
@@ -21131,4 +21131,3 @@ export {
21131
21131
  Am as J,
21132
21132
  ey as r
21133
21133
  };
21134
- //# sourceMappingURL=main-X3N3IEqE.js.map
@@ -110,4 +110,3 @@ export {
110
110
  y as listFilesGit,
111
111
  b as nodeFileSystem
112
112
  };
113
- //# sourceMappingURL=node-BIJw0rpH.js.map
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { q as x, o as A, n as g, y as B, r as j, l as h, x as I, u as J, w as V, A as k, aY as z, aZ as W, a_ as Z, a$ as C, b0 as L, b1 as _, b2 as D, ax as M, f as q, b3 as G, b4 as H, b5 as F, b6 as K, O as Q, b7 as N, _ as X, av as ee, C as te } from "./console-RPzEsLY0.js";
3
- import { r as se } from "./main-X3N3IEqE.js";
3
+ import { r as se } from "./main-8KUolY-x.js";
4
4
  const v = A({
5
5
  context: V(["continue", "none"]).optional().default("continue"),
6
6
  tools: J([h("all"), x(g())]).optional(),
@@ -365,4 +365,3 @@ async function he(r, e, t, s) {
365
365
  export {
366
366
  Te as runRoutine
367
367
  };
368
- //# sourceMappingURL=node-ChwsFdlu.js.map
@@ -82,4 +82,3 @@ export {
82
82
  O as nodeGrepTool,
83
83
  P as ripgrepFiles
84
84
  };
85
- //# sourceMappingURL=node-CQsX6uby.js.map
@@ -3824,4 +3824,3 @@ function Ie(L) {
3824
3824
  export {
3825
3825
  Ne as nodeBashTool
3826
3826
  };
3827
- //# sourceMappingURL=node-DeN3f1CH.js.map
@@ -4850,4 +4850,3 @@ ${a}`
4850
4850
  export {
4851
4851
  ea as nodeReadWebPageTool
4852
4852
  };
4853
- //# sourceMappingURL=node-cSLqYAQI.js.map
@@ -40,4 +40,3 @@ const h = ({ args: e }, { threadID: o }) => m(async (s) => {
40
40
  export {
41
41
  h as nodeWebSearchTool
42
42
  };
43
- //# sourceMappingURL=node-l0bjR3wx.js.map
@@ -9,4 +9,3 @@ const s = ({ args: n }, { dir: o, dirs: r, threadID: a, filesystem: e }) => {
9
9
  export {
10
10
  s as nodeReadFileTool
11
11
  };
12
- //# sourceMappingURL=read_file.node-Cf-KhpsY.js.map
@@ -5,7 +5,7 @@ import D from "node:path";
5
5
  import L from "node:fs";
6
6
  import R from "node:process";
7
7
  import { PassThrough as te } from "node:stream";
8
- import { J as se } from "./main-X3N3IEqE.js";
8
+ import { J as se } from "./main-8KUolY-x.js";
9
9
  var S = { exports: {} }, T, k;
10
10
  function oe() {
11
11
  if (k) return T;
@@ -464,4 +464,3 @@ export {
464
464
  $e as StdioClientTransport,
465
465
  be as getDefaultEnvironment
466
466
  };
467
- //# sourceMappingURL=stdio-vZX8mSpo.js.map
package/dist/storybook.js CHANGED
@@ -2200,4 +2200,3 @@ ${i.print("Usage:", { style: "bold" })} ${i.print("pnpm cli:storybook", { color:
2200
2200
  }
2201
2201
  }
2202
2202
  F();
2203
- //# sourceMappingURL=storybook.js.map
@@ -99,4 +99,3 @@ export {
99
99
  A as nodeUndoEditTool,
100
100
  N as recordEdit
101
101
  };
102
- //# sourceMappingURL=undo_edit.node-CCYYuJ4U.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sourcegraph/amp",
3
- "version": "0.0.1749246959-g551fd5",
3
+ "version": "0.0.1749256326-gf8b1cf",
4
4
  "description": "CLI for Amp, an agentic coding tool in research preview from Sourcegraph.",
5
5
  "homepage": "https://ampcode.com/",
6
6
  "author": {
@@ -42,6 +42,7 @@
42
42
  "test:dev": "vitest",
43
43
  "watch": "pnpm run -s build --watch",
44
44
  "build": "vite build",
45
+ "build:production": "NODE_ENV=production vite build",
45
46
  "cli": "node dist/amp.js",
46
47
  "cli:storybook": "pnpm build && node dist/storybook.js"
47
48
  }
package/dist/amp.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"amp.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-D82aFqMl.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,IAAUD,EAAK,GAAG,CAAC,GACnBE,IAASF,EAAK,GAAG,CAAC,GAGlBG,IAAO,MAAMC,EAAmB,iBAAiB;AAAA,UACtD,QAAQ;AAAA,UACR,MAAM,KAAK,UAAU,EAAE,QAAAL,GAAQ,QAAAG,GAAQ;AAAA,UACvC,QAAQD,GAAS;AAAA,QAAA,CACjB;AAEG,YAAA,CAACE,EAAK;AACT,gBAAM,IAAI,MAAM,uBAAuBA,EAAK,MAAM,EAAE;AAG9C,eAAA,MAAMA,EAAK,KAAK;AAAA,MACxB;AAAA,IACD;AAAA,EAEF;AACD;AAKO,MAAME,IAAuCR,EAAwB,GCpD/DS,IAAwBC,EAAe;AAAA,EACnDC,EAAU,CAAC,EAAE,UAAAC,GAAU,SAAAC,QACfC,EAA2B,YAClB,MAAMD,EAAQ,SAAS,UAAUD,EAAS,GAAG,MAC1C,MAClB,CACD;AACF;AAYsB,eAAAL,EACrBQ,GACAC,GACoB;AACpB,QAAMC,IAAS,MAAMC,EAAeR,GAAgBM,GAAM,UAAU,MAAS;AACtE,SAAAG,EAA6BF,GAAQF,GAAcC,CAAI;AAC/D;AA8HA,eAAeG,EACdF,GAIAF,GACAC,GACoB;AACpB,MAAID,EAAa,WAAW,OAAO,KAAKA,EAAa,WAAW,QAAQ;AACjE,UAAA,IAAI,MAAM,2CAA2C;AAE5D,MAAI,CAACA,EAAa,WAAW,GAAG;AACzB,UAAA,IAAI,MAAM,gCAAgC;AAG3C,QAAAK,IAAUH,EAAO,SAAS;AAChC,MAAI,CAACG;AACE,UAAA,IAAI,MAAM,oBAAoB;AAGrC,QAAMC,IAAS,MAAMJ,EAAO,QAAQ,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;"}