@sourcegraph/amp 0.0.1748293852-g856a85 → 0.0.1748318678-gd9a87d
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-BIwJ12dd.js → client-ihGyvzvX.js} +2 -2
- package/dist/{client-BIwJ12dd.js.map → client-ihGyvzvX.js.map} +1 -1
- package/dist/{color-BziuaOBD.js → color-B6_clmkr.js} +4256 -4254
- package/dist/color-B6_clmkr.js.map +1 -0
- package/dist/{create_file.node-CZ1BvF9q.js → create_file.node-BZgB6ucQ.js} +2 -2
- package/dist/{create_file.node-CZ1BvF9q.js.map → create_file.node-BZgB6ucQ.js.map} +1 -1
- package/dist/{edit_file.node-3Gl6qyGH.js → edit_file.node-Dn6-bMTo.js} +3 -3
- package/dist/{edit_file.node-3Gl6qyGH.js.map → edit_file.node-Dn6-bMTo.js.map} +1 -1
- package/dist/{executable-DHTI_kQX.js → executable-CcU_JATb.js} +2 -2
- package/dist/{executable-DHTI_kQX.js.map → executable-CcU_JATb.js.map} +1 -1
- package/dist/{files-CXrPtQkr.js → files-BFh-PTQi.js} +2 -2
- package/dist/{files-CXrPtQkr.js.map → files-BFh-PTQi.js.map} +1 -1
- package/dist/{glob.node-CS8sywmd.js → glob.node-C6Q_XWT2.js} +3 -3
- package/dist/{glob.node-CS8sywmd.js.map → glob.node-C6Q_XWT2.js.map} +1 -1
- package/dist/{list_directory.node-Cyw81t_e.js → list_directory.node-DHFkmZJe.js} +2 -2
- package/dist/{list_directory.node-Cyw81t_e.js.map → list_directory.node-DHFkmZJe.js.map} +1 -1
- package/dist/{load-profile-BperfRqz.js → load-profile-BHvBvRl1.js} +2 -2
- package/dist/{load-profile-BperfRqz.js.map → load-profile-BHvBvRl1.js.map} +1 -1
- package/dist/{main-BQK5kDfu.js → main-c79NY7GF.js} +14 -14
- package/dist/main-c79NY7GF.js.map +1 -0
- package/dist/{node-DvA9CTyj.js → node--dWo_oau.js} +3 -3
- package/dist/{node-DvA9CTyj.js.map → node--dWo_oau.js.map} +1 -1
- package/dist/{node-DTRgRMya.js → node-1lU917Fh.js} +2 -2
- package/dist/{node-DTRgRMya.js.map → node-1lU917Fh.js.map} +1 -1
- package/dist/{node-jNdnfLe3.js → node-B1003M2a.js} +3 -3
- package/dist/{node-jNdnfLe3.js.map → node-B1003M2a.js.map} +1 -1
- package/dist/{node-Cx3fQSqx.js → node-BpegEIRT.js} +3 -3
- package/dist/{node-Cx3fQSqx.js.map → node-BpegEIRT.js.map} +1 -1
- package/dist/{node-63e4CyEG.js → node-CWlY3GUy.js} +3 -3
- package/dist/{node-63e4CyEG.js.map → node-CWlY3GUy.js.map} +1 -1
- package/dist/{node-C7wddHPB.js → node-DpO0JYvi.js} +2 -2
- package/dist/{node-C7wddHPB.js.map → node-DpO0JYvi.js.map} +1 -1
- package/dist/{read_file.node-C7Lv1QzO.js → read_file.node-BpKarhba.js} +2 -2
- package/dist/{read_file.node-C7Lv1QzO.js.map → read_file.node-BpKarhba.js.map} +1 -1
- package/dist/{stdio-Clvk1Gn4.js → stdio-DFXmuJyK.js} +3 -3
- package/dist/{stdio-Clvk1Gn4.js.map → stdio-DFXmuJyK.js.map} +1 -1
- package/dist/storybook.js +1 -1
- package/dist/{undo_edit.node-GIZzXSlK.js → undo_edit.node-De_mTQZH.js} +2 -2
- package/dist/{undo_edit.node-GIZzXSlK.js.map → undo_edit.node-De_mTQZH.js.map} +1 -1
- package/package.json +1 -1
- package/dist/color-BziuaOBD.js.map +0 -1
- package/dist/main-BQK5kDfu.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"load-profile-
|
1
|
+
{"version":3,"file":"load-profile-BHvBvRl1.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 rb, 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 th, M as hr, l as $M, k as oe, N as dl, n as Vh, r as wn, o as Hh, t as UM, q as Gh, u as qM, v as fy, 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 nh, 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 dy, _ 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 hy, 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 Wh, at as Kh, au as Rk, av as Ik, aw as Mk, ax as kk, ay as ub, az as rh, 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 rb, 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 th, M as hr, l as $M, k as oe, N as dl, n as Vh, r as wn, o as Hh, t as UM, q as Gh, u as qM, v as fy, 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 nh, 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 dy, _ 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 hy, 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 Wh, at as Kh, au as Rk, av as Ik, aw as Mk, ax as kk, ay as ub, az as rh, 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-B6_clmkr.js";
|
3
|
+
import { ripgrepFiles as Bk } from "./glob.node-C6Q_XWT2.js";
|
4
|
+
import { f as ns, i as Vk } from "./client-ihGyvzvX.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 Jh from "node:events";
|
@@ -4817,10 +4817,10 @@ async function rL(r, e, t) {
|
|
4817
4817
|
if ("url" in r)
|
4818
4818
|
n = new tL(new URL(r.url));
|
4819
4819
|
else {
|
4820
|
-
const { loadProfileEnvironmentVariables: i } = await import("./load-profile-
|
4820
|
+
const { loadProfileEnvironmentVariables: i } = await import("./load-profile-BHvBvRl1.js"), o = t.loadProfile === "never" || !t.workingDirectory ? process.env : await rt(
|
4821
4821
|
i(t.workingDirectory, t.loadProfile)
|
4822
4822
|
);
|
4823
|
-
n = await import("./stdio-
|
4823
|
+
n = await import("./stdio-DFXmuJyK.js").then(
|
4824
4824
|
({ StdioClientTransport: s }) => new s({
|
4825
4825
|
...r,
|
4826
4826
|
stderr: "pipe",
|
@@ -21892,7 +21892,7 @@ async function KB(r, e) {
|
|
21892
21892
|
}
|
21893
21893
|
}
|
21894
21894
|
async function JB(r, e) {
|
21895
|
-
return (await import("./list_directory.node-
|
21895
|
+
return (await import("./list_directory.node-DHFkmZJe.js")).resolveArgumentDirectoryNode(r, e);
|
21896
21896
|
}
|
21897
21897
|
function zB(r, e) {
|
21898
21898
|
r["~debug"] = {
|
@@ -22273,7 +22273,7 @@ async function XB({
|
|
22273
22273
|
fileMentions: void 0,
|
22274
22274
|
userState: void 0
|
22275
22275
|
};
|
22276
|
-
const o = (await import("./files-
|
22276
|
+
const o = (await import("./files-BFh-PTQi.js").then(
|
22277
22277
|
({ getFileMentions: u }) => u(
|
22278
22278
|
sb(t.content),
|
22279
22279
|
i,
|
@@ -23100,7 +23100,7 @@ IMPORTANT: The result of this tool (if any) should be displayed directly to the
|
|
23100
23100
|
},
|
23101
23101
|
source: "builtin"
|
23102
23102
|
},
|
23103
|
-
fn: import("./node-
|
23103
|
+
fn: import("./node-CWlY3GUy.js").then(({ runRoutine: r }) => r)
|
23104
23104
|
};
|
23105
23105
|
let i_ = !1;
|
23106
23106
|
async function aC(r, e = !1) {
|
@@ -25663,7 +25663,7 @@ function Ep(r) {
|
|
25663
25663
|
changes: t
|
25664
25664
|
};
|
25665
25665
|
}
|
25666
|
-
const _V = import("./node-
|
25666
|
+
const _V = import("./node-DpO0JYvi.js").then(
|
25667
25667
|
({ nodeFileSystem: r }) => r
|
25668
25668
|
);
|
25669
25669
|
class wV {
|
@@ -35335,7 +35335,7 @@ async function eS(r, e) {
|
|
35335
35335
|
Lp({
|
35336
35336
|
logLevel: e.logLevel || process.env.AMP_LOG_LEVEL,
|
35337
35337
|
logFile: e.logFile || process.env.AMP_LOG_FILE
|
35338
|
-
}), Nk("0.0.
|
35338
|
+
}), Nk("0.0.1748318678-gd9a87d");
|
35339
35339
|
const t = e.settingsFile ?? process.env.AMP_SETTINGS_FILE, n = Ep(), i = vV({ settingsFile: t }), o = process.env.AMP_API_KEY;
|
35340
35340
|
o && await n.set("apiKey", o, r.ampURL);
|
35341
35341
|
const s = fP({
|
@@ -35430,7 +35430,7 @@ Login failed: ${i instanceof Error ? i.message : String(i)}
|
|
35430
35430
|
}
|
35431
35431
|
}
|
35432
35432
|
function DG(r) {
|
35433
|
-
const e = new cV().name("amp").description("AI-powered coding assistant").version("0.0.
|
35433
|
+
const e = new cV().name("amp").description("AI-powered coding assistant").version("0.0.1748318678-gd9a87d").option("--thread-id [THREAD_ID]", "ID of the thread to continue running", void 0);
|
35434
35434
|
e.addHelpText(
|
35435
35435
|
"after",
|
35436
35436
|
(() => {
|
@@ -36253,7 +36253,7 @@ function _n() {
|
|
36253
36253
|
}
|
36254
36254
|
async function BG(r, e) {
|
36255
36255
|
try {
|
36256
|
-
const t = await AG("0.0.
|
36256
|
+
const t = await AG("0.0.1748318678-gd9a87d");
|
36257
36257
|
t.hasUpdate && t.latestVersion && (e ? (r.next({ type: "update-start-updating" }), setTimeout(async () => {
|
36258
36258
|
try {
|
36259
36259
|
await MG(), r.next({
|
@@ -36268,7 +36268,7 @@ async function BG(r, e) {
|
|
36268
36268
|
version: t.latestVersion
|
36269
36269
|
});
|
36270
36270
|
}
|
36271
|
-
}, 100)) : oe.info(`New version available: 0.0.
|
36271
|
+
}, 100)) : oe.info(`New version available: 0.0.1748318678-gd9a87d → ${t.latestVersion}`));
|
36272
36272
|
} catch (t) {
|
36273
36273
|
oe.debug("Update check failed", t);
|
36274
36274
|
}
|
@@ -36291,4 +36291,4 @@ export {
|
|
36291
36291
|
ue as s,
|
36292
36292
|
Ft as u
|
36293
36293
|
};
|
36294
|
-
//# sourceMappingURL=main-
|
36294
|
+
//# sourceMappingURL=main-c79NY7GF.js.map
|