Langsanity lives on.

Point guard Langston Galloway — one of the bright developments of an otherwise historically miserable campaign — and the Knicks agreed to terms on a contract for the remainder of this season and a partially guaranteed pact for 2015-16, according to sources. The rookie’s second 10-day contract expired Tuesday.

Negotiations hit an impasse the past few days over whether the Knicks were willing to give Galloway guaranteed money for next season. The Knicks initially offered only a non-guaranteed pact for 2015-16 while Galloway sought the $845,000 minimum for second-year players.

A compromise was reached between Knicks general manager Steve Mills, who did the hardballing, and Galloway’s reps.

According to a source, if Galloway is still with the Knicks July 1, he is guaranteed to receive $275,000. If he is not waived by the start of training camp, he will be guaranteed well more than half of the $845,000.

Galloway was briefly a free agent Tuesday morning, technically, and may have gained leverage because some other teams were interested in him after a breakout month of January. Galloway was a natural fit for the Sixers and Pelicans after starring at St. Joseph’s and hailing from Baton Rouge, La., respectively.

Galloway already has become a favorite of his teammates and received congratulations via Twitter from fellow point guards Jose Calderon and Pablo Prigioni.

Prigioni has been on the trading block, especially since Galloway’s emergence. Prigioni has one year and $1.7 million left on his pact next season but only $275,000 is guaranteed. The Pistons reportedly have expressed interest.

Knicks president Phil Jackson is very protective of his cap space, with potentially $32 million available to spend on free agents this offseason. Jackson didn’t exercise the $2 million option on Shane Larkin’s pact for next season — which indicates he does not believe the undersized, speedy point guard is part of the Knicks’ future.

Galloway, with his grit on defense and clutch shooting, has become a fan favorite since joining the team three weeks ago from the team’s D-League affiliate in Westchester. It would have been a public-relations black eye had he signed elsewhere, with so little else for the fans to cheer. The 6-foot-2 Galloway, who has started the past four games, is averaging 12.1 points, 4.1 rebounds and 3.0 assists and hit two game-sealing 3-pointers last week.

The Knicks inquired Wednesday about power forward JaMychal Green, who was not re-signed by the Spurs, but don’t have a roster spot available. Green has two firm offers on the table.

It appears the Knicks won’t consider waiving Andrea Bargnani until after the trade deadline to see if he’s needed to make any deal. The Knicks are trying to use their two trade exceptions gained in their three-way deal three weeks ago.