@sourcegraph/amp 0.0.1748877319-g69d2be → 0.0.1748880131-g73e573
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-CEMYqypS.js → client-Byn34k3j.js} +2 -2
- package/dist/{client-CEMYqypS.js.map → client-Byn34k3j.js.map} +1 -1
- package/dist/{console-Dz8kjLXq.js → console-DU9kM8bt.js} +16 -21
- package/dist/console-DU9kM8bt.js.map +1 -0
- package/dist/{create_file.node-Dkg9a9qS.js → create_file.node-ClSLp2zA.js} +2 -2
- package/dist/{create_file.node-Dkg9a9qS.js.map → create_file.node-ClSLp2zA.js.map} +1 -1
- package/dist/{edit_file.node-BzmJeIBM.js → edit_file.node-sQFRZtsD.js} +3 -3
- package/dist/{edit_file.node-BzmJeIBM.js.map → edit_file.node-sQFRZtsD.js.map} +1 -1
- package/dist/{executable-BfvtWYTF.js → executable-2OB-i_QC.js} +2 -2
- package/dist/{executable-BfvtWYTF.js.map → executable-2OB-i_QC.js.map} +1 -1
- package/dist/{files-DLJqtzT7.js → files-BhysNTQv.js} +2 -2
- package/dist/{files-DLJqtzT7.js.map → files-BhysNTQv.js.map} +1 -1
- package/dist/{glob.node-D18uhtO0.js → glob.node-cVUTfljn.js} +4 -4
- package/dist/{glob.node-D18uhtO0.js.map → glob.node-cVUTfljn.js.map} +1 -1
- package/dist/{index-DDEnF9L5.js → index-Cb59cjjj.js} +2 -2
- package/dist/{index-DDEnF9L5.js.map → index-Cb59cjjj.js.map} +1 -1
- package/dist/{list_directory.node-ldHqnCmb.js → list_directory.node-B8Oj3ncW.js} +2 -2
- package/dist/{list_directory.node-ldHqnCmb.js.map → list_directory.node-B8Oj3ncW.js.map} +1 -1
- package/dist/{load-profile-2hKEWJfV.js → load-profile-CV3b6-Nj.js} +2 -2
- package/dist/{load-profile-2hKEWJfV.js.map → load-profile-CV3b6-Nj.js.map} +1 -1
- package/dist/{main-BnHTihL6.js → main-CZ7RS9Yt.js} +16 -16
- package/dist/{main-BnHTihL6.js.map → main-CZ7RS9Yt.js.map} +1 -1
- package/dist/{node-CUTKGt9Y.js → node-B45lZe2M.js} +3 -3
- package/dist/{node-CUTKGt9Y.js.map → node-B45lZe2M.js.map} +1 -1
- package/dist/{node-CzSXw-Xz.js → node-B4WUHHZd.js} +2 -2
- package/dist/{node-CzSXw-Xz.js.map → node-B4WUHHZd.js.map} +1 -1
- package/dist/{node-BMzC1GPN.js → node-BPXlKmtc.js} +2 -2
- package/dist/{node-BMzC1GPN.js.map → node-BPXlKmtc.js.map} +1 -1
- package/dist/{node-BHe5RJPs.js → node-B_G-Clj6.js} +3 -3
- package/dist/{node-BHe5RJPs.js.map → node-B_G-Clj6.js.map} +1 -1
- package/dist/{node-BRxAOe2b.js → node-DujrrqQo.js} +4 -4
- package/dist/{node-BRxAOe2b.js.map → node-DujrrqQo.js.map} +1 -1
- package/dist/{node-DcXu8fEU.js → node-UKopbCpJ.js} +3 -3
- package/dist/{node-DcXu8fEU.js.map → node-UKopbCpJ.js.map} +1 -1
- package/dist/{read_file.node-6DnwIJAn.js → read_file.node-gXffR6jB.js} +2 -2
- package/dist/{read_file.node-6DnwIJAn.js.map → read_file.node-gXffR6jB.js.map} +1 -1
- package/dist/{stdio-B_076PGB.js → stdio-B7u3y1kB.js} +3 -3
- package/dist/{stdio-B_076PGB.js.map → stdio-B7u3y1kB.js.map} +1 -1
- package/dist/storybook.js +1 -1
- package/dist/{undo_edit.node-WsSsWWo7.js → undo_edit.node-BQSDe2Ll.js} +2 -2
- package/dist/{undo_edit.node-WsSsWWo7.js.map → undo_edit.node-BQSDe2Ll.js.map} +1 -1
- package/package.json +1 -1
- package/dist/console-Dz8kjLXq.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-DU9kM8bt.js";
|
3
|
+
import "./main-CZ7RS9Yt.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-Byn34k3j.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, aQ as n, s as p, p as c } from "./console-
|
2
|
+
import { f as i, E as o, aQ as n, s as p, p as c } from "./console-DU9kM8bt.js";
|
3
3
|
const u = o.pipe(
|
4
4
|
p(({ settings: e, secrets: t }) => c(async () => await t.getToken("apiKey", e.url) !== void 0))
|
5
5
|
);
|
@@ -32,4 +32,4 @@ export {
|
|
32
32
|
w as f,
|
33
33
|
u as i
|
34
34
|
};
|
35
|
-
//# sourceMappingURL=client-
|
35
|
+
//# sourceMappingURL=client-Byn34k3j.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client-
|
1
|
+
{"version":3,"file":"client-Byn34k3j.js","sources":["../../core/src/server-api/client.ts"],"sourcesContent":["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'\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\tconst response = await fetchFromAmpServer('/api/internal/share-thread-with-operator', {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t},\n\t\tbody: JSON.stringify({ threadData: thread } as Pick<ThreadOperatorShare, 'threadData'>),\n\t})\n\tif (!response.ok) {\n\t\tconst text = await response.text()\n\t\tthrow new Error(`Failed to share thread: ${response.status} ${text}`)\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\tif (!apiKey) {\n\t\tthrow new Error('Amp API key is not set')\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":["isAmpServerConfigured","resolvedConfig","switchMap","settings","secrets","promiseFactoryToObservable","fetchFromAmpServer","pathAndQuery","init","config","firstValueFrom","fetchFromAmpServerWithConfig","baseURL","apiKey","clientIdentificationHeaders"],"mappings":";;AAiBO,MAAMA,IAAwBC,EAAe;AAAA,EACnDC,EAAU,CAAC,EAAE,UAAAC,GAAU,SAAAC,QACfC,EAA2B,YAClB,MAAMD,EAAQ,SAAS,UAAUD,EAAS,GAAG,MAC1C,MAClB,CACD;AACF;AAYsB,eAAAG,EACrBC,GACAC,GACoB;AACpB,QAAMC,IAAS,MAAMC,EAAeT,GAAgBO,GAAM,UAAU,MAAS;AACtE,SAAAG,EAA6BF,GAAQF,GAAcC,CAAI;AAC/D;AAgHA,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;AAC9D,MAAI,CAACC;AACE,UAAA,IAAI,MAAM,wBAAwB;AAGzC,SAAO,MAAM,IAAI,IAAIN,GAAcK,CAAO,GAAG;AAAA,IAC5C,GAAGJ;AAAA,IACH,SAAS;AAAA,MACR,GAAGA,GAAM;AAAA,MACT,GAAGM,EAA4B;AAAA,MAC/B,gBAAgB;AAAA,MAChB,eAAe,UAAUD,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-DujrrqQo.js").then(({ nodeGrepTool: n }) => n)
|
1049
1049
|
};
|
1050
1050
|
var Vc = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
1051
1051
|
function fs(n) {
|
@@ -1717,7 +1717,8 @@ class CN {
|
|
1717
1717
|
// UNC paths like \\server\share
|
1718
1718
|
de.regexp(/[a-zA-Z0-9_\-:/.*~@=\\]+/)
|
1719
1719
|
// Regular paths with backslashes
|
1720
|
-
).desc("unquoted string") : de.regexp(/[a-zA-Z0-9_
|
1720
|
+
).desc("unquoted string") : de.regexp(/[a-zA-Z0-9_\-:/.*~@=+]+/).desc("unquoted string"));
|
1721
|
+
compositeString = de.lazy(() => de.alt(this.doubleQuotedString, this.singleQuotedString, this.unquotedString).sepBy1(de.string("")).map((e) => e.join("")));
|
1721
1722
|
// Environment variable
|
1722
1723
|
envVariable = de.regexp(
|
1723
1724
|
/\$([A-Za-z_][A-Za-z0-9_]*|\{[A-Za-z_][A-Za-z0-9_]*\})/
|
@@ -1733,13 +1734,7 @@ class CN {
|
|
1733
1734
|
).map((e) => {
|
1734
1735
|
});
|
1735
1736
|
argument = de.lazy(
|
1736
|
-
() => de.alt(
|
1737
|
-
this.doubleQuotedString,
|
1738
|
-
this.singleQuotedString,
|
1739
|
-
this.unquotedString,
|
1740
|
-
this.envVariable,
|
1741
|
-
this.commandSubstitution
|
1742
|
-
)
|
1737
|
+
() => de.alt(this.compositeString, this.envVariable, this.commandSubstitution)
|
1743
1738
|
).node("argument");
|
1744
1739
|
redirect = de.lazy(() => {
|
1745
1740
|
const e = de.alt(de.string(">"), de.string(">>")), t = de.alt(de.string("&>"), de.string("&>>")), r = de.string("<"), a = de.regexp(/\d+>(&\d+|\S+)/);
|
@@ -1900,7 +1895,7 @@ It's VERY IMPORTANT to use specific tools when searching for files, instead of i
|
|
1900
1895
|
},
|
1901
1896
|
source: "builtin"
|
1902
1897
|
},
|
1903
|
-
fn: import("./node-
|
1898
|
+
fn: import("./node-UKopbCpJ.js").then(({ nodeBashTool: n }) => n),
|
1904
1899
|
preprocessArgs: (n) => {
|
1905
1900
|
if (!n.cwd)
|
1906
1901
|
try {
|
@@ -1953,7 +1948,7 @@ Prefer this tool over \`edit_file\` when you want to ovewrite the entire content
|
|
1953
1948
|
},
|
1954
1949
|
source: "builtin"
|
1955
1950
|
},
|
1956
|
-
fn: import("./create_file.node-
|
1951
|
+
fn: import("./create_file.node-ClSLp2zA.js").then(
|
1957
1952
|
({ nodeCreateFileTool: n }) => n
|
1958
1953
|
)
|
1959
1954
|
};
|
@@ -4785,7 +4780,7 @@ Returns the contents of the file with each line prefixed by its line number. For
|
|
4785
4780
|
switch ("node") {
|
4786
4781
|
case "node":
|
4787
4782
|
case "vscode":
|
4788
|
-
return import("./read_file.node-
|
4783
|
+
return import("./read_file.node-gXffR6jB.js").then(({ nodeReadFileTool: n }) => n);
|
4789
4784
|
}
|
4790
4785
|
})()
|
4791
4786
|
}, iB = L8({
|
@@ -4814,7 +4809,7 @@ If you need to replace the entire contents of a file, use \`${qu}\` instead, sin
|
|
4814
4809
|
inputSchema: X4(iB),
|
4815
4810
|
source: "builtin"
|
4816
4811
|
},
|
4817
|
-
fn: import("./edit_file.node-
|
4812
|
+
fn: import("./edit_file.node-sQFRZtsD.js").then(({ nodeEditFileTool: n }) => n)
|
4818
4813
|
};
|
4819
4814
|
async function cAe(n, e, t, r) {
|
4820
4815
|
e = yl(e);
|
@@ -4981,7 +4976,7 @@ Note: Results are sorted by modification time with the most recently modified fi
|
|
4981
4976
|
},
|
4982
4977
|
source: "builtin"
|
4983
4978
|
},
|
4984
|
-
fn: import("./glob.node-
|
4979
|
+
fn: import("./glob.node-cVUTfljn.js").then(({ nodeGlobTool: n }) => n)
|
4985
4980
|
}, Vu = "list_directory", vE = {
|
4986
4981
|
spec: {
|
4987
4982
|
name: Vu,
|
@@ -5002,7 +4997,7 @@ Note: Results are sorted by modification time with the most recently modified fi
|
|
5002
4997
|
switch ("node") {
|
5003
4998
|
case "node":
|
5004
4999
|
case "vscode":
|
5005
|
-
return import("./list_directory.node-
|
5000
|
+
return import("./list_directory.node-B8Oj3ncW.js").then(
|
5006
5001
|
({ nodeListDirectoryTool: n }) => n
|
5007
5002
|
);
|
5008
5003
|
}
|
@@ -5089,7 +5084,7 @@ This tool converts web content to markdown format for better readability.`,
|
|
5089
5084
|
requiresNetwork: !0
|
5090
5085
|
}
|
5091
5086
|
},
|
5092
|
-
fn: import("./node-
|
5087
|
+
fn: import("./node-BPXlKmtc.js").then(({ nodeReadWebPageTool: n }) => n)
|
5093
5088
|
}, YN = "think", _B = (n, e) => fo(async () => ({ status: "done", result: "Thoughts have been logged." })), fB = {
|
5094
5089
|
spec: {
|
5095
5090
|
name: YN,
|
@@ -5154,7 +5149,7 @@ the \`${I1}\` with the url.
|
|
5154
5149
|
requiresNetwork: !0
|
5155
5150
|
}
|
5156
5151
|
},
|
5157
|
-
fn: import("./node-
|
5152
|
+
fn: import("./node-B45lZe2M.js").then(({ nodeWebSearchTool: n }) => n)
|
5158
5153
|
};
|
5159
5154
|
function HN({ onlyFirst: n = !1 } = {}) {
|
5160
5155
|
const t = [
|
@@ -28362,7 +28357,7 @@ async function sV(n, e) {
|
|
28362
28357
|
}
|
28363
28358
|
}
|
28364
28359
|
async function oV(n, e) {
|
28365
|
-
return (await import("./list_directory.node-
|
28360
|
+
return (await import("./list_directory.node-B8Oj3ncW.js")).resolveArgumentDirectoryNode(n, e);
|
28366
28361
|
}
|
28367
28362
|
class lV extends Dd {
|
28368
28363
|
#e = new AbortController();
|
@@ -30310,7 +30305,7 @@ async function wV({
|
|
30310
30305
|
fileMentions: void 0,
|
30311
30306
|
userState: void 0
|
30312
30307
|
};
|
30313
|
-
const i = (await import("./files-
|
30308
|
+
const i = (await import("./files-BhysNTQv.js").then(
|
30314
30309
|
({ getFileMentions: o }) => o(
|
30315
30310
|
VN(t.content),
|
30316
30311
|
a,
|
@@ -31379,7 +31374,7 @@ Returns a git-style diff showing the changes that were undone as formatted markd
|
|
31379
31374
|
},
|
31380
31375
|
source: "builtin"
|
31381
31376
|
},
|
31382
|
-
fn: import("./undo_edit.node-
|
31377
|
+
fn: import("./undo_edit.node-BQSDe2Ll.js").then(({ nodeUndoEditTool: n }) => n)
|
31383
31378
|
}, jE = globalThis.window?.document !== void 0;
|
31384
31379
|
globalThis.process?.versions?.node;
|
31385
31380
|
globalThis.process?.versions?.bun;
|
@@ -75636,4 +75631,4 @@ export {
|
|
75636
75631
|
wAe as y,
|
75637
75632
|
fs as z
|
75638
75633
|
};
|
75639
|
-
//# sourceMappingURL=console-
|
75634
|
+
//# sourceMappingURL=console-DU9kM8bt.js.map
|