@sourcegraph/amp 0.0.1748476906-g715cf0 → 0.0.1748491454-gdefe97
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 +2 -2
- package/dist/{color-BzIjJtnB.js → color-Bs5UNAQf.js} +147 -146
- package/dist/color-Bs5UNAQf.js.map +1 -0
- package/dist/{create_file.node-DChD1DjB.js → create_file.node-DhqtPKLL.js} +2 -2
- package/dist/{create_file.node-DChD1DjB.js.map → create_file.node-DhqtPKLL.js.map} +1 -1
- package/dist/{edit_file.node-B1i7Irj_.js → edit_file.node-_jUhb0Ej.js} +3 -3
- package/dist/{edit_file.node-B1i7Irj_.js.map → edit_file.node-_jUhb0Ej.js.map} +1 -1
- package/dist/{executable-BQxnlFId.js → executable-De4-Iq-q.js} +2 -2
- package/dist/{executable-BQxnlFId.js.map → executable-De4-Iq-q.js.map} +1 -1
- package/dist/{files-CkJlqXKo.js → files-Cahfcbk6.js} +2 -2
- package/dist/{files-CkJlqXKo.js.map → files-Cahfcbk6.js.map} +1 -1
- package/dist/{glob.node-1g9lAvYU.js → glob.node-DMC-mbKX.js} +3 -3
- package/dist/{glob.node-1g9lAvYU.js.map → glob.node-DMC-mbKX.js.map} +1 -1
- package/dist/{list_directory.node-BoNGYthN.js → list_directory.node-BiNTY-zJ.js} +2 -2
- package/dist/{list_directory.node-BoNGYthN.js.map → list_directory.node-BiNTY-zJ.js.map} +1 -1
- package/dist/{load-profile-DFLkW6WV.js → load-profile-Gn3gm8Ha.js} +2 -2
- package/dist/{load-profile-DFLkW6WV.js.map → load-profile-Gn3gm8Ha.js.map} +1 -1
- package/dist/{main-Cj-TDfxo.js → main-D2HRoJ1Y.js} +15 -15
- package/dist/{main-Cj-TDfxo.js.map → main-D2HRoJ1Y.js.map} +1 -1
- package/dist/{node-bkYFEYK7.js → node-B-VoRsW5.js} +2 -2
- package/dist/{node-bkYFEYK7.js.map → node-B-VoRsW5.js.map} +1 -1
- package/dist/{node-BoOCJ7th.js → node-BeQHJ-gW.js} +2 -2
- package/dist/{node-BoOCJ7th.js.map → node-BeQHJ-gW.js.map} +1 -1
- package/dist/{node-BMyzDv_R.js → node-BuLml2yb.js} +3 -3
- package/dist/{node-BMyzDv_R.js.map → node-BuLml2yb.js.map} +1 -1
- package/dist/{node-CJv9CDhh.js → node-CD0uLwWO.js} +3 -3
- package/dist/{node-CJv9CDhh.js.map → node-CD0uLwWO.js.map} +1 -1
- package/dist/{node-61NQS4s2.js → node-CQ8EKnFW.js} +3 -3
- package/dist/{node-61NQS4s2.js.map → node-CQ8EKnFW.js.map} +1 -1
- package/dist/{node-C8RVGYJn.js → node-IbYXJXx-.js} +3 -3
- package/dist/{node-C8RVGYJn.js.map → node-IbYXJXx-.js.map} +1 -1
- package/dist/{read_file.node-wkKQeHGb.js → read_file.node-D_famz3I.js} +2 -2
- package/dist/{read_file.node-wkKQeHGb.js.map → read_file.node-D_famz3I.js.map} +1 -1
- package/dist/{stdio-DQq9n086.js → stdio-Dj_ddrN9.js} +3 -3
- package/dist/{stdio-DQq9n086.js.map → stdio-Dj_ddrN9.js.map} +1 -1
- package/dist/storybook.js +1 -1
- package/dist/{undo_edit.node-zOzdRUqj.js → undo_edit.node-C8sU5262.js} +2 -2
- package/dist/{undo_edit.node-zOzdRUqj.js.map → undo_edit.node-C8sU5262.js.map} +1 -1
- package/package.json +1 -1
- package/dist/color-BzIjJtnB.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"load-profile-
|
1
|
+
{"version":3,"file":"load-profile-Gn3gm8Ha.js","sources":["../../core/src/tools/builtin/bash/load-profile.ts"],"sourcesContent":["import { catchError, Observable, tap } from '@sourcegraph/observable'\nimport { spawn } from 'node:child_process'\nimport os from 'node:os'\nimport logger from '../../../common/logger'\nimport type { ResolvedConfiguration } from '../../../configuration/resolver'\n\ninterface CachedLoginEnvironment {\n\ttimestamp: number\n\tenv: Record<string, string>\n}\nconst dailyTimeout = 24 * 60 * 60 * 1000 // Expire the login environment daily\nconst shellEnvCache = new Map<string, CachedLoginEnvironment>()\nconst defaultEnv = process.env as Record<string, string>\n\n// Adaptation of the equivalent logic from Zed here:\n// https://sourcegraph.com/github.com/zed-industries/zed/-/blob/crates/util/src/util.rs?L309\nexport function loadProfileEnvironmentVariables(\n\tdir: string,\n\tconfig: ResolvedConfiguration['settings']['terminal.commands.nodeSpawn.loadProfile'] = 'always',\n): Observable<Record<string, string>> {\n\tif (config === 'never') {\n\t\treturn Observable.of(defaultEnv)\n\t}\n\tif (import.meta.env.VITE_PLATFORM === 'node') {\n\t\t// Skipping automatic environment detection for the CLI since the user\n\t\t// is presumably already running in a shell.\n\t\treturn Observable.of(defaultEnv)\n\t}\n\tif (isNixShell()) {\n\t\t// Skip automatic detection for Nix users, because they're smart enough\n\t\t// to figure out how to run `code .`\n\t\tlogger.info(\n\t\t\t'Detected Nix Shell, skipping automatic detection of login environment. To skip this Nix detection, set the environment variable IN_NIX_SHELL=false.',\n\t\t)\n\t\treturn Observable.of(defaultEnv)\n\t}\n\tif (config === 'always') {\n\t\treturn loadProfileEnvironmentVariablesUnchached(dir)\n\t}\n\tif (config !== 'daily') {\n\t\tlogger.warn(\n\t\t\t`Unknown setting value for loadLoginShellEnvironment. Valid values are \"never\", \"always\", \"daily\". Falling back to default \"daily\"`,\n\t\t\t{\n\t\t\t\tsetting: config,\n\t\t\t},\n\t\t)\n\t}\n\n\t// Regularly clean up old cached to avoid holding onto an infinitely growing\n\t// number of cached environments.\n\tevictExpiredCache()\n\n\tconst cachedEnv = shellEnvCache.get(dir)\n\tif (cachedEnv) {\n\t\treturn Observable.of(cachedEnv.env)\n\t}\n\treturn loadProfileEnvironmentVariablesUnchached(dir).pipe(\n\t\ttap((env) => {\n\t\t\tshellEnvCache.set(dir, { timestamp: Date.now(), env })\n\t\t}),\n\t\tcatchError((error) => {\n\t\t\tlogger.error('failed to read login environment. Falling back to default environment', {\n\t\t\t\terror,\n\t\t\t})\n\t\t\treturn Observable.of(defaultEnv)\n\t\t}),\n\t)\n}\n\nfunction loadProfileEnvironmentVariablesUnchached(dir: string): Observable<Record<string, string>> {\n\t// For non-Unix systems, just return the current environment\n\tif (os.platform() !== 'darwin' && os.platform() !== 'linux') {\n\t\treturn Observable.of(defaultEnv)\n\t}\n\tconst start = Date.now()\n\n\treturn new Observable<Record<string, string>>((observer) => {\n\t\t// For Unix-like systems, get environment from login shell\n\t\tconst shell = os.userInfo().shell ?? process.env.SHELL ?? '/bin/bash'\n\t\tconst marker = 'AMP_SHELL_ENV_MARKER'\n\n\t\t// Try to cd into the directory to trigger directory-specific env tools\n\t\tconst shellCmdPrefix = dir ? `cd '${dir.replace(/'/g, \"\\\\'\")}';` : ''\n\t\tconst shellCmd = `${shellCmdPrefix}printf '%s' ${marker}; /usr/bin/env;`\n\n\t\t// Set timeout to prevent hanging\n\t\tconst timeout = setTimeout(() => {\n\t\t\tlogger.error('Shell environment collection timed out')\n\t\t\tchild.kill()\n\t\t\tobserver.next(defaultEnv)\n\t\t\tobserver.complete()\n\t\t}, 5000)\n\n\t\t// Run login shell\n\t\tconst child = spawn(shell, ['-l', '-i', '-c', shellCmd], {\n\t\t\tstdio: ['ignore', 'pipe', 'pipe'],\n\t\t\tdetached: true, // Prevent shell from taking control of the terminal\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\tNONINTERACTIVE: '1',\n\t\t\t\tDEBIAN_FRONTEND: 'noninteractive',\n\t\t\t},\n\t\t})\n\n\t\tlet stdout = ''\n\t\tlet stderr = ''\n\n\t\tif (child.stdout) {\n\t\t\tchild.stdout.on('data', (data) => {\n\t\t\t\tstdout += data.toString()\n\t\t\t})\n\t\t}\n\n\t\tif (child.stderr) {\n\t\t\tchild.stderr.on('data', (data) => {\n\t\t\t\tstderr += data.toString()\n\t\t\t})\n\t\t}\n\n\t\tchild.on('error', (err) => {\n\t\t\tlogger.error('Failed to spawn shell:', { err })\n\t\t\tclearTimeout(timeout)\n\t\t\tobserver.next(defaultEnv)\n\t\t\tobserver.complete()\n\t\t})\n\n\t\tchild.on('close', (code) => {\n\t\t\tclearTimeout(timeout)\n\t\t\tconst end = Date.now()\n\t\t\tconst durationMillis = end - start\n\n\t\t\tif (code !== 0) {\n\t\t\t\tlogger.error(`Shell process exited with code ${code}`)\n\t\t\t\tobserver.next(defaultEnv)\n\t\t\t\tobserver.complete()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Parse environment variables after marker\n\t\t\tconst envVars: Record<string, string> = {}\n\t\t\tconst markerIndex = stdout.indexOf(marker)\n\n\t\t\tif (markerIndex !== -1) {\n\t\t\t\tconst envOutput = stdout.substring(markerIndex + marker.length)\n\t\t\t\t// Parse KEY=VALUE lines\n\t\t\t\tenvOutput.split('\\n').forEach((line) => {\n\t\t\t\t\tconst match = line.match(/^([^=]+)=(.*)$/)\n\t\t\t\t\tif (match && match[1] && match[2]) {\n\t\t\t\t\t\tconst key = match[1]\n\t\t\t\t\t\tconst value = match[2]\n\t\t\t\t\t\tenvVars[key] = value\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\t// Fallback to current environment\n\t\t\t\tObject.assign(envVars, defaultEnv)\n\t\t\t}\n\n\t\t\tlogger.info('Loaded login shell environment', {\n\t\t\t\tdurationMillis,\n\t\t\t\tdirectory: dir,\n\t\t\t\tloadedVariableCount: Object.keys(envVars).length,\n\t\t\t})\n\t\t\tobserver.next(envVars)\n\t\t\tobserver.complete()\n\t\t})\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeout)\n\t\t\tchild.kill()\n\t\t}\n\t})\n}\nfunction evictExpiredCache(): void {\n\tfor (const [key, value] of Object.entries(shellEnvCache)) {\n\t\tif (isExpiredCache(value)) {\n\t\t\tshellEnvCache.delete(key)\n\t\t}\n\t}\n}\n\nfunction isExpiredCache(env: CachedLoginEnvironment): boolean {\n\treturn env.timestamp + dailyTimeout > Date.now()\n}\n\nconst pathDelimeter = os.platform() === 'win32' ? ';' : ':'\nfunction isNixShell(): boolean {\n\tif (process.env.IN_NIX_SHELL === 'false') {\n\t\t// Escape hatch to disable this detection.\n\t\treturn false\n\t}\n\n\tif (process.env.IN_NIX_SHELL) {\n\t\treturn true\n\t}\n\n\t// Check for new `nix shell` using PATH using a heuristic. Borrowed from Starship:\n\t// https://github.com/starship/starship/blob/fccf4ccebf1533989234ec13c5a0f6d44e47e937/src/modules/nix_shell.rs#L14C1-L40C6\n\tconst path = process.env.PATH ?? ''\n\treturn path.split(pathDelimeter).some((p) => p.startsWith('/nix/store'))\n}\n"],"names":["defaultEnv","loadProfileEnvironmentVariables","dir","config","Observable","os"],"mappings":";;;AAYA,MAAMA,IAAa,QAAQ;AAIX,SAAAC,EACfC,GACAC,IAAuF,UAClD;AACrC,SAAIA,MAAW,UACPC,EAAW,GAAGJ,CAAU,IAKxBI,EAAW,GAAGJ,CAAU;AAyCjC;AAsHsBK,EAAG,SAAS;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
import { B as _i, O as Qt, s as fn, c as FE, a as Jn, b as Xu, f as pt, d as ta, p as es, m as Tt, e as da, g as un, h as ha, i as GO, j as $E, k as ec, M as Qn, l as WO, n as ae, N as pu, o as Nm, r as Pr, q as Dm, t as zO, u as KO, v as Fm, w as JO, x as YO, y as zy, z as Pu, A as jO, C as Sn, D as oW, E as ra, F as ZO, G as QO, H as XO, I as Qi, J as UE, K as eM, L as wi, P as qE, Q as BE, R as tM, S as rM, T as zp, U as nM, V as iM, W as oM, X as sM, Y as aM, Z as Xf, _ as lM, $ as VE, a0 as Ky, a1 as uM, a2 as cM, a3 as fM, a4 as dM, a5 as hM, a6 as HE, a7 as pM, a8 as mM, a9 as gM, aa as vM, ab as Jy, ac as yM, ad as _M, ae as wM, af as bM, ag as SM, ah as EM, ai as TM, aj as CM, ak as AM, al as PM, am as IM, an as RM, ao as xM, ap as kM, aq as OM, ar as MM, as as Iu, at as LM, au as NM, av as DM, aw as FM, ax as $M, ay as UM, az as GE, aA as Kp, aB as bt, aC as qM, aD as BM, aE as WE, aF as zE, aG as VM, aH as HM, aI as GM, aJ as WM, aK as Yy, aL as jy } from "./color-
|
2
|
+
import { B as _i, O as Qt, s as fn, c as FE, a as Jn, b as Xu, f as pt, d as ta, p as es, m as Tt, e as da, g as un, h as ha, i as GO, j as $E, k as ec, M as Qn, l as WO, n as ae, N as pu, o as Nm, r as Pr, q as Dm, t as zO, u as KO, v as Fm, w as JO, x as YO, y as zy, z as Pu, A as jO, C as Sn, D as oW, E as ra, F as ZO, G as QO, H as XO, I as Qi, J as UE, K as eM, L as wi, P as qE, Q as BE, R as tM, S as rM, T as zp, U as nM, V as iM, W as oM, X as sM, Y as aM, Z as Xf, _ as lM, $ as VE, a0 as Ky, a1 as uM, a2 as cM, a3 as fM, a4 as dM, a5 as hM, a6 as HE, a7 as pM, a8 as mM, a9 as gM, aa as vM, ab as Jy, ac as yM, ad as _M, ae as wM, af as bM, ag as SM, ah as EM, ai as TM, aj as CM, ak as AM, al as PM, am as IM, an as RM, ao as xM, ap as kM, aq as OM, ar as MM, as as Iu, at as LM, au as NM, av as DM, aw as FM, ax as $M, ay as UM, az as GE, aA as Kp, aB as bt, aC as qM, aD as BM, aE as WE, aF as zE, aG as VM, aH as HM, aI as GM, aJ as WM, aK as Yy, aL as jy } from "./color-Bs5UNAQf.js";
|
3
3
|
import * as zM from "node:fs/promises";
|
4
4
|
import Yo, { readdir as KM, stat as KE, readFile as Ji, mkdir as $m, writeFile as Um, unlink as JM, readlink as YM } from "node:fs/promises";
|
5
5
|
import * as jM from "node:path";
|
@@ -17,7 +17,7 @@ import oL from "node:zlib";
|
|
17
17
|
import sL from "node:string_decoder";
|
18
18
|
import aL, { createServer as jE } from "node:http";
|
19
19
|
import lL from "node:https";
|
20
|
-
import { r as uL } from "./executable-
|
20
|
+
import { r as uL } from "./executable-De4-Iq-q.js";
|
21
21
|
function cL() {
|
22
22
|
const i = /* @__PURE__ */ new Set(), e = new _i(i);
|
23
23
|
return {
|
@@ -7752,10 +7752,10 @@ async function l2(i, e, t) {
|
|
7752
7752
|
if ("url" in i)
|
7753
7753
|
n = new s2(new URL(i.url));
|
7754
7754
|
else {
|
7755
|
-
const { loadProfileEnvironmentVariables: r } = await import("./load-profile-
|
7755
|
+
const { loadProfileEnvironmentVariables: r } = await import("./load-profile-Gn3gm8Ha.js"), o = t.loadProfile === "never" || !t.workingDirectory ? process.env : await pt(
|
7756
7756
|
r(t.workingDirectory, t.loadProfile)
|
7757
7757
|
);
|
7758
|
-
n = await import("./stdio-
|
7758
|
+
n = await import("./stdio-Dj_ddrN9.js").then(
|
7759
7759
|
({ StdioClientTransport: s }) => new s({
|
7760
7760
|
...i,
|
7761
7761
|
stderr: "pipe",
|
@@ -8055,7 +8055,7 @@ This tool converts web content to markdown format for better readability.`,
|
|
8055
8055
|
requiresNetwork: !0
|
8056
8056
|
}
|
8057
8057
|
},
|
8058
|
-
fn: import("./node-
|
8058
|
+
fn: import("./node-B-VoRsW5.js").then(({ nodeReadWebPageTool: i }) => i)
|
8059
8059
|
}, m2 = "web_search", g2 = `Search the web for information.
|
8060
8060
|
|
8061
8061
|
Returns search result titles, associated URLs, and a small summary of the
|
@@ -8103,7 +8103,7 @@ the \`${um}\` with the url.
|
|
8103
8103
|
requiresNetwork: !0
|
8104
8104
|
}
|
8105
8105
|
},
|
8106
|
-
fn: import("./node-
|
8106
|
+
fn: import("./node-BuLml2yb.js").then(({ nodeWebSearchTool: i }) => i)
|
8107
8107
|
};
|
8108
8108
|
function y2(i) {
|
8109
8109
|
const { interval: e, fn: t, cacheKey: n } = i, r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
@@ -24941,7 +24941,7 @@ async function n4(i, e) {
|
|
24941
24941
|
}
|
24942
24942
|
}
|
24943
24943
|
async function i4(i, e) {
|
24944
|
-
return (await import("./list_directory.node-
|
24944
|
+
return (await import("./list_directory.node-BiNTY-zJ.js")).resolveArgumentDirectoryNode(i, e);
|
24945
24945
|
}
|
24946
24946
|
function o4(i) {
|
24947
24947
|
if (!i._regex)
|
@@ -26109,7 +26109,7 @@ async function h4({
|
|
26109
26109
|
fileMentions: void 0,
|
26110
26110
|
userState: void 0
|
26111
26111
|
};
|
26112
|
-
const o = (await import("./files-
|
26112
|
+
const o = (await import("./files-Cahfcbk6.js").then(
|
26113
26113
|
({ getFileMentions: a }) => a(
|
26114
26114
|
BE(t.content),
|
26115
26115
|
r,
|
@@ -26939,7 +26939,7 @@ IMPORTANT: The result of this tool (if any) should be displayed directly to the
|
|
26939
26939
|
},
|
26940
26940
|
source: "builtin"
|
26941
26941
|
},
|
26942
|
-
fn: import("./node-
|
26942
|
+
fn: import("./node-CQ8EKnFW.js").then(({ runRoutine: i }) => i)
|
26943
26943
|
};
|
26944
26944
|
let Fw = !1;
|
26945
26945
|
async function JC(i, e = !1) {
|
@@ -29503,7 +29503,7 @@ function Cu(i) {
|
|
29503
29503
|
changes: t
|
29504
29504
|
};
|
29505
29505
|
}
|
29506
|
-
const k4 = import("./node-
|
29506
|
+
const k4 = import("./node-BeQHJ-gW.js").then(
|
29507
29507
|
({ nodeFileSystem: i }) => i
|
29508
29508
|
);
|
29509
29509
|
class O4 {
|
@@ -39321,7 +39321,7 @@ async function Au(i, e) {
|
|
39321
39321
|
Ag({
|
39322
39322
|
logLevel: e.logLevel || process.env.AMP_LOG_LEVEL,
|
39323
39323
|
logFile: e.logFile || process.env.AMP_LOG_FILE
|
39324
|
-
}), GM("0.0.
|
39324
|
+
}), GM("0.0.1748491454-gdefe97");
|
39325
39325
|
const t = e.settingsFile ?? process.env.AMP_SETTINGS_FILE;
|
39326
39326
|
ae.info("Using settings file", { settingsFile: t });
|
39327
39327
|
const n = Cu(), r = XC({ settingsFile: t }), o = process.env.AMP_API_KEY;
|
@@ -39418,7 +39418,7 @@ Login failed: ${r instanceof Error ? r.message : String(r)}
|
|
39418
39418
|
}
|
39419
39419
|
}
|
39420
39420
|
function jG(i) {
|
39421
|
-
const e = new E4().name("amp").description("AI-powered coding assistant").version("0.0.
|
39421
|
+
const e = new E4().name("amp").description("AI-powered coding assistant").version("0.0.1748491454-gdefe97").option("--thread-id [THREAD_ID]", "ID of the thread to continue running", void 0);
|
39422
39422
|
e.addHelpText(
|
39423
39423
|
"after",
|
39424
39424
|
(() => {
|
@@ -40612,7 +40612,7 @@ function Tr() {
|
|
40612
40612
|
}
|
40613
40613
|
async function tW(i, e) {
|
40614
40614
|
try {
|
40615
|
-
const t = await qG("0.0.
|
40615
|
+
const t = await qG("0.0.1748491454-gdefe97");
|
40616
40616
|
t.hasUpdate && t.latestVersion ? e ? (i.next({ type: "update-start-updating" }), setTimeout(async () => {
|
40617
40617
|
try {
|
40618
40618
|
await GG(t.latestVersion), i.next({
|
@@ -40627,7 +40627,7 @@ async function tW(i, e) {
|
|
40627
40627
|
version: t.latestVersion
|
40628
40628
|
});
|
40629
40629
|
}
|
40630
|
-
}, 100)) : ae.info(`New version available: 0.0.
|
40630
|
+
}, 100)) : ae.info(`New version available: 0.0.1748491454-gdefe97 → ${t.latestVersion}`) : ae.info("No update available");
|
40631
40631
|
} catch (t) {
|
40632
40632
|
ae.debug("Update check failed", t);
|
40633
40633
|
}
|
@@ -40682,4 +40682,4 @@ export {
|
|
40682
40682
|
ve as s,
|
40683
40683
|
lr as u
|
40684
40684
|
};
|
40685
|
-
//# sourceMappingURL=main-
|
40685
|
+
//# sourceMappingURL=main-D2HRoJ1Y.js.map
|