@sourcegraph/amp 0.0.1748330494-g3f0084 → 0.0.1748332886-g724284
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-DcfjDd4A.js → client-Brt5PSmQ.js} +2 -2
- package/dist/{client-DcfjDd4A.js.map → client-Brt5PSmQ.js.map} +1 -1
- package/dist/{color-CXy0Mt1O.js → color-BESHF9Kn.js} +21 -18
- package/dist/color-BESHF9Kn.js.map +1 -0
- package/dist/{create_file.node-Cnd4Nn8b.js → create_file.node-DzdShAEK.js} +2 -2
- package/dist/{create_file.node-Cnd4Nn8b.js.map → create_file.node-DzdShAEK.js.map} +1 -1
- package/dist/{edit_file.node-Be3medtb.js → edit_file.node-CGjz-CjQ.js} +3 -3
- package/dist/{edit_file.node-Be3medtb.js.map → edit_file.node-CGjz-CjQ.js.map} +1 -1
- package/dist/{executable-BbAHdBVY.js → executable-BgLDvAH0.js} +2 -2
- package/dist/{executable-BbAHdBVY.js.map → executable-BgLDvAH0.js.map} +1 -1
- package/dist/{files--1Q-a1ZV.js → files-wO0_dqdF.js} +2 -2
- package/dist/{files--1Q-a1ZV.js.map → files-wO0_dqdF.js.map} +1 -1
- package/dist/{glob.node-CA1MWD1b.js → glob.node-w_rvEIQN.js} +3 -3
- package/dist/{glob.node-CA1MWD1b.js.map → glob.node-w_rvEIQN.js.map} +1 -1
- package/dist/{list_directory.node-C_O--JLs.js → list_directory.node-CWGn90hA.js} +2 -2
- package/dist/{list_directory.node-C_O--JLs.js.map → list_directory.node-CWGn90hA.js.map} +1 -1
- package/dist/{load-profile-0CuSgiWr.js → load-profile-D-dFWVzT.js} +2 -2
- package/dist/{load-profile-0CuSgiWr.js.map → load-profile-D-dFWVzT.js.map} +1 -1
- package/dist/{main-NdzEy1DN.js → main-B-Pg2140.js} +14 -14
- package/dist/{main-NdzEy1DN.js.map → main-B-Pg2140.js.map} +1 -1
- package/dist/{node-B029Told.js → node-B0jbn8t2.js} +3 -3
- package/dist/{node-B029Told.js.map → node-B0jbn8t2.js.map} +1 -1
- package/dist/{node-BRttyTrh.js → node-BM8mGi3n.js} +3 -3
- package/dist/{node-BRttyTrh.js.map → node-BM8mGi3n.js.map} +1 -1
- package/dist/{node-Dc7OwtlA.js → node-BgA31Dpt.js} +3 -3
- package/dist/{node-Dc7OwtlA.js.map → node-BgA31Dpt.js.map} +1 -1
- package/dist/{node-aMyd1IN4.js → node-DKVVBako.js} +3 -3
- package/dist/{node-aMyd1IN4.js.map → node-DKVVBako.js.map} +1 -1
- package/dist/{node-CS0yja_J.js → node-Dr8IF45b.js} +2 -2
- package/dist/{node-CS0yja_J.js.map → node-Dr8IF45b.js.map} +1 -1
- package/dist/{node-DJQHHl-X.js → node-PqFeF2rU.js} +2 -2
- package/dist/{node-DJQHHl-X.js.map → node-PqFeF2rU.js.map} +1 -1
- package/dist/{read_file.node-BjBOaIme.js → read_file.node-IpcUo_BE.js} +2 -2
- package/dist/{read_file.node-BjBOaIme.js.map → read_file.node-IpcUo_BE.js.map} +1 -1
- package/dist/{stdio-Cb3rNj8D.js → stdio-CbHLN4-D.js} +3 -3
- package/dist/{stdio-Cb3rNj8D.js.map → stdio-CbHLN4-D.js.map} +1 -1
- package/dist/storybook.js +1 -1
- package/dist/{undo_edit.node-DB9rujSj.js → undo_edit.node-CKgcVuoz.js} +2 -2
- package/dist/{undo_edit.node-DB9rujSj.js.map → undo_edit.node-CKgcVuoz.js.map} +1 -1
- package/package.json +1 -1
- package/dist/color-CXy0Mt1O.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"load-profile-
|
1
|
+
{"version":3,"file":"load-profile-D-dFWVzT.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.node-spawn.load-profile'] = '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,IAAyF,UACpD;AACrC,SAAIA,MAAW,UACPC,EAAW,GAAGJ,CAAU,IAKxBI,EAAW,GAAGJ,CAAU;AAyCjC;AAsHsBK,EAAG,SAAS;"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
import { B as Or, O as It, s as Gn, c as nb, a as lr, b as Yl, f as rt, d as es, p as ds, m as st, e as hs, g as kn, h as ps, i as FM, j as rb, M as hr, l as $M, k as oe, N as dl, n as Bh, r as wn, o as Vh, t as UM, q as Hh, u as qM, v as cy, w as Sl, x as BM, y as qn, z as HG, A as ts, C as VM, D as HM, H as GM, E as io, F as ib, G as WM, I as Qi, J as ob, K as sb, L as KM, P as JM, Q as th, R as zM, S as YM, T as ZM, U as jM, V as QM, W as Zc, X as XM, Y as ab, Z as fy, _ as ek, $ as tk, a0 as nk, a1 as rk, a2 as ik, a3 as lb, a4 as ok, a5 as sk, a6 as ak, a7 as lk, a8 as dy, a9 as uk, aa as ck, ab as fk, ac as dk, ad as hk, ae as pk, af as mk, ag as gk, ah as yk, ai as vk, aj as _k, ak as wk, al as bk, am as Tk, an as Ck, ao as Sk, ap as Ek, aq as Ak, ar as xk, as as Gh, at as Wh, au as Rk, av as Ik, aw as Mk, ax as kk, ay as ub, az as nh, aA as ot, aB as cb, aC as Pk, aD as Ok, aE as Lk, aF as Nk, aG as Dk, aH as Fk, aI as $k, aJ as Uk, aK as qk } from "./color-
|
3
|
-
import { ripgrepFiles as Bk } from "./glob.node-
|
4
|
-
import { f as ns, i as Vk } from "./client-
|
2
|
+
import { B as Or, O as It, s as Gn, c as nb, a as lr, b as Yl, f as rt, d as es, p as ds, m as st, e as hs, g as kn, h as ps, i as FM, j as rb, M as hr, l as $M, k as oe, N as dl, n as Bh, r as wn, o as Vh, t as UM, q as Hh, u as qM, v as cy, w as Sl, x as BM, y as qn, z as HG, A as ts, C as VM, D as HM, H as GM, E as io, F as ib, G as WM, I as Qi, J as ob, K as sb, L as KM, P as JM, Q as th, R as zM, S as YM, T as ZM, U as jM, V as QM, W as Zc, X as XM, Y as ab, Z as fy, _ as ek, $ as tk, a0 as nk, a1 as rk, a2 as ik, a3 as lb, a4 as ok, a5 as sk, a6 as ak, a7 as lk, a8 as dy, a9 as uk, aa as ck, ab as fk, ac as dk, ad as hk, ae as pk, af as mk, ag as gk, ah as yk, ai as vk, aj as _k, ak as wk, al as bk, am as Tk, an as Ck, ao as Sk, ap as Ek, aq as Ak, ar as xk, as as Gh, at as Wh, au as Rk, av as Ik, aw as Mk, ax as kk, ay as ub, az as nh, aA as ot, aB as cb, aC as Pk, aD as Ok, aE as Lk, aF as Nk, aG as Dk, aH as Fk, aI as $k, aJ as Uk, aK as qk } from "./color-BESHF9Kn.js";
|
3
|
+
import { ripgrepFiles as Bk } from "./glob.node-w_rvEIQN.js";
|
4
|
+
import { f as ns, i as Vk } from "./client-Brt5PSmQ.js";
|
5
5
|
import * as Hk from "node:child_process";
|
6
6
|
import Gk, { exec as hl, spawn as Zl } from "node:child_process";
|
7
7
|
import Kh from "node:events";
|
@@ -4818,10 +4818,10 @@ async function rL(r, e, t) {
|
|
4818
4818
|
if ("url" in r)
|
4819
4819
|
n = new tL(new URL(r.url));
|
4820
4820
|
else {
|
4821
|
-
const { loadProfileEnvironmentVariables: i } = await import("./load-profile-
|
4821
|
+
const { loadProfileEnvironmentVariables: i } = await import("./load-profile-D-dFWVzT.js"), o = t.loadProfile === "never" || !t.workingDirectory ? process.env : await rt(
|
4822
4822
|
i(t.workingDirectory, t.loadProfile)
|
4823
4823
|
);
|
4824
|
-
n = await import("./stdio-
|
4824
|
+
n = await import("./stdio-CbHLN4-D.js").then(
|
4825
4825
|
({ StdioClientTransport: s }) => new s({
|
4826
4826
|
...r,
|
4827
4827
|
stderr: "pipe",
|
@@ -21897,7 +21897,7 @@ async function KB(r, e) {
|
|
21897
21897
|
}
|
21898
21898
|
}
|
21899
21899
|
async function JB(r, e) {
|
21900
|
-
return (await import("./list_directory.node-
|
21900
|
+
return (await import("./list_directory.node-CWGn90hA.js")).resolveArgumentDirectoryNode(r, e);
|
21901
21901
|
}
|
21902
21902
|
function zB(r, e) {
|
21903
21903
|
r["~debug"] = {
|
@@ -22278,7 +22278,7 @@ async function XB({
|
|
22278
22278
|
fileMentions: void 0,
|
22279
22279
|
userState: void 0
|
22280
22280
|
};
|
22281
|
-
const o = (await import("./files
|
22281
|
+
const o = (await import("./files-wO0_dqdF.js").then(
|
22282
22282
|
({ getFileMentions: u }) => u(
|
22283
22283
|
sb(t.content),
|
22284
22284
|
i,
|
@@ -23105,7 +23105,7 @@ IMPORTANT: The result of this tool (if any) should be displayed directly to the
|
|
23105
23105
|
},
|
23106
23106
|
source: "builtin"
|
23107
23107
|
},
|
23108
|
-
fn: import("./node-
|
23108
|
+
fn: import("./node-B0jbn8t2.js").then(({ runRoutine: r }) => r)
|
23109
23109
|
};
|
23110
23110
|
let r_ = !1;
|
23111
23111
|
async function aC(r, e = !1) {
|
@@ -25668,7 +25668,7 @@ function Sp(r) {
|
|
25668
25668
|
changes: t
|
25669
25669
|
};
|
25670
25670
|
}
|
25671
|
-
const _V = import("./node-
|
25671
|
+
const _V = import("./node-PqFeF2rU.js").then(
|
25672
25672
|
({ nodeFileSystem: r }) => r
|
25673
25673
|
);
|
25674
25674
|
class wV {
|
@@ -35345,7 +35345,7 @@ async function eS(r, e) {
|
|
35345
35345
|
Op({
|
35346
35346
|
logLevel: e.logLevel || process.env.AMP_LOG_LEVEL,
|
35347
35347
|
logFile: e.logFile || process.env.AMP_LOG_FILE
|
35348
|
-
}), Nk("0.0.
|
35348
|
+
}), Nk("0.0.1748332886-g724284");
|
35349
35349
|
const t = e.settingsFile ?? process.env.AMP_SETTINGS_FILE;
|
35350
35350
|
oe.info("Using settings file", { settingsFile: t });
|
35351
35351
|
const n = Sp(), i = vV({ settingsFile: t }), o = process.env.AMP_API_KEY;
|
@@ -35442,7 +35442,7 @@ Login failed: ${i instanceof Error ? i.message : String(i)}
|
|
35442
35442
|
}
|
35443
35443
|
}
|
35444
35444
|
function DG(r) {
|
35445
|
-
const e = new cV().name("amp").description("AI-powered coding assistant").version("0.0.
|
35445
|
+
const e = new cV().name("amp").description("AI-powered coding assistant").version("0.0.1748332886-g724284").option("--thread-id [THREAD_ID]", "ID of the thread to continue running", void 0);
|
35446
35446
|
e.addHelpText(
|
35447
35447
|
"after",
|
35448
35448
|
(() => {
|
@@ -36265,7 +36265,7 @@ function _n() {
|
|
36265
36265
|
}
|
36266
36266
|
async function BG(r, e) {
|
36267
36267
|
try {
|
36268
|
-
const t = await AG("0.0.
|
36268
|
+
const t = await AG("0.0.1748332886-g724284");
|
36269
36269
|
t.hasUpdate && t.latestVersion && (e ? (r.next({ type: "update-start-updating" }), setTimeout(async () => {
|
36270
36270
|
try {
|
36271
36271
|
await MG(), r.next({
|
@@ -36280,7 +36280,7 @@ async function BG(r, e) {
|
|
36280
36280
|
version: t.latestVersion
|
36281
36281
|
});
|
36282
36282
|
}
|
36283
|
-
}, 100)) : oe.info(`New version available: 0.0.
|
36283
|
+
}, 100)) : oe.info(`New version available: 0.0.1748332886-g724284 → ${t.latestVersion}`));
|
36284
36284
|
} catch (t) {
|
36285
36285
|
oe.debug("Update check failed", t);
|
36286
36286
|
}
|
@@ -36303,4 +36303,4 @@ export {
|
|
36303
36303
|
ue as s,
|
36304
36304
|
Ft as u
|
36305
36305
|
};
|
36306
|
-
//# sourceMappingURL=main-
|
36306
|
+
//# sourceMappingURL=main-B-Pg2140.js.map
|