@scheduler-systems/gal-run 0.0.541 → 0.0.543

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.
Files changed (2) hide show
  1. package/dist/index.cjs +71 -9
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3955,7 +3955,7 @@ var cliVersion, defaultApiUrl, BUILD_CONSTANTS, constants_default;
3955
3955
  var init_constants = __esm({
3956
3956
  "module_6"() {
3957
3957
  "use strict";
3958
- cliVersion = true ? "0.0.541" : "0.0.0-dev";
3958
+ cliVersion = true ? "0.0.543" : "0.0.0-dev";
3959
3959
  defaultApiUrl = true ? "https://api.gal.run" : "http://localhost:3000";
3960
3960
  BUILD_CONSTANTS = Object.freeze([cliVersion, defaultApiUrl]);
3961
3961
  constants_default = BUILD_CONSTANTS;
@@ -3986,7 +3986,7 @@ function detectEnvironment() {
3986
3986
  return "dev";
3987
3987
  }
3988
3988
  try {
3989
- const version2 = true ? "0.0.541" : void 0;
3989
+ const version2 = true ? "0.0.543" : void 0;
3990
3990
  if (version2 && version2.includes("-local")) {
3991
3991
  return "dev";
3992
3992
  }
@@ -14406,7 +14406,7 @@ function getId() {
14406
14406
  }
14407
14407
  function getCliVersion() {
14408
14408
  try {
14409
- return true ? "0.0.541" : "0.0.0-dev";
14409
+ return true ? "0.0.543" : "0.0.0-dev";
14410
14410
  } catch {
14411
14411
  return "0.0.0-dev";
14412
14412
  }
@@ -54807,6 +54807,43 @@ var init_check = __esm({
54807
54807
  }
54808
54808
  });
54809
54809
 
54810
+ function formatErrorDetail(error3) {
54811
+ if (!(error3 instanceof Error)) {
54812
+ return String(error3);
54813
+ }
54814
+ const parts = [`${error3.name}: ${error3.message}`];
54815
+ const appendAggregateDetails = (aggregate, label) => {
54816
+ const nested = Array.from(aggregate.errors ?? []).map((nestedError, index) => {
54817
+ if (nestedError instanceof Error) {
54818
+ const nestedParts = [`${index}:${nestedError.name}: ${nestedError.message}`];
54819
+ const nestedCause = nestedError.cause;
54820
+ if (nestedCause instanceof Error) {
54821
+ nestedParts.push(`cause=${nestedCause.name}: ${nestedCause.message}`);
54822
+ } else if (nestedCause !== void 0) {
54823
+ nestedParts.push(`cause=${String(nestedCause)}`);
54824
+ }
54825
+ return nestedParts.join(" | ");
54826
+ }
54827
+ return `${index}:${String(nestedError)}`;
54828
+ });
54829
+ if (nested.length > 0) {
54830
+ parts.push(`${label}=[${nested.join("; ")}]`);
54831
+ }
54832
+ };
54833
+ const cause = error3.cause;
54834
+ if (cause instanceof Error) {
54835
+ parts.push(`cause=${cause.name}: ${cause.message}`);
54836
+ if (cause instanceof AggregateError) {
54837
+ appendAggregateDetails(cause, "cause.errors");
54838
+ }
54839
+ } else if (cause !== void 0) {
54840
+ parts.push(`cause=${String(cause)}`);
54841
+ }
54842
+ if (error3 instanceof AggregateError) {
54843
+ appendAggregateDetails(error3, "errors");
54844
+ }
54845
+ return parts.join(" | ");
54846
+ }
54810
54847
  function uniquePaths(paths) {
54811
54848
  return [...new Set(paths.filter((path8) => Boolean(path8)).map((path8) => (0, import_path28.resolve)(path8)))];
54812
54849
  }
@@ -54866,7 +54903,8 @@ function resolveGalCodeInternalEndpointConfig(env2 = process.env, apiUrl = defau
54866
54903
  const projectId = env2.GAL_CODE_VERTEX_PROJECT_ID || env2.GAL_VERTEX_PROJECT_ID || DEFAULT_GAL_CODE_PROJECT_ID;
54867
54904
  const region = env2.GAL_CODE_VERTEX_REGION || env2.GAL_VERTEX_REGION || DEFAULT_GAL_CODE_REGION;
54868
54905
  const endpointId = env2.GAL_CODE_VERTEX_ENDPOINT_ID || env2.GAL_VERTEX_ENDPOINT_ID || DEFAULT_GAL_CODE_ENDPOINT_ID;
54869
- const endpointUrl = env2.GAL_CODE_VERTEX_ENDPOINT_URL || env2.GAL_VERTEX_ENDPOINT_URL || `https://aiplatform.googleapis.com/v1/projects/${projectId}/locations/${region}/endpoints/${endpointId}`;
54906
+ const openAiEndpointBase = region === "global" ? "https://aiplatform.googleapis.com" : `https://${region}-aiplatform.googleapis.com`;
54907
+ const endpointUrl = env2.GAL_CODE_VERTEX_ENDPOINT_URL || env2.GAL_VERTEX_ENDPOINT_URL || `${openAiEndpointBase}/v1/projects/${projectId}/locations/${region}/endpoints/openapi/chat/completions`;
54870
54908
  const gatewayBaseUrl = env2.GAL_CODE_GATEWAY_BASE_URL || `${apiUrl.replace(/\/$/, "")}${DEFAULT_GAL_CODE_GATEWAY_PATH}`;
54871
54909
  return {
54872
54910
  endpointId,
@@ -55228,8 +55266,10 @@ async function assertInternalGalCodeAccess(apiUrl, authToken) {
55228
55266
  headers: { authorization: `Bearer ${authToken}` },
55229
55267
  signal: AbortSignal.timeout(5e3)
55230
55268
  });
55231
- } catch {
55232
- throw new Error("GAL Code requires a live GAL API check. Try again when api.gal.run is reachable.");
55269
+ } catch (error3) {
55270
+ throw new Error(
55271
+ `GAL Code requires a live GAL API check. Try again when api.gal.run is reachable. (${formatErrorDetail(error3)})`
55272
+ );
55233
55273
  }
55234
55274
  if (response.status === 401 || response.status === 403) {
55235
55275
  throw new Error("GAL Code requires a valid GAL session. Run: gal auth login");
@@ -55261,8 +55301,10 @@ async function syncClaudeCredentialsToGalApi(apiUrl, authToken, auth) {
55261
55301
  }),
55262
55302
  signal: AbortSignal.timeout(1e4)
55263
55303
  });
55264
- } catch {
55265
- throw new Error("GAL Code could not sync Claude credentials to GAL. Try again when api.gal.run is reachable.");
55304
+ } catch (error3) {
55305
+ throw new Error(
55306
+ `GAL Code could not sync Claude credentials to GAL. Try again when api.gal.run is reachable. (${formatErrorDetail(error3)})`
55307
+ );
55266
55308
  }
55267
55309
  if (response.ok) {
55268
55310
  return;
@@ -55422,6 +55464,26 @@ function createCodeCommand() {
55422
55464
  process.exit(1);
55423
55465
  }
55424
55466
  }
55467
+ if (isHelpOrVersionRequest(forwardedArgs)) {
55468
+ const resolution2 = await ensureGalCodeBinary();
55469
+ if (!resolution2.binaryPath) {
55470
+ printMissingBinaryGuidance(resolution2);
55471
+ }
55472
+ try {
55473
+ const exitCode = await runGalCode(resolution2.binaryPath, forwardedArgs, {
55474
+ ...process.env,
55475
+ GAL_CODE_WRAPPED_BY_GAL: "true"
55476
+ });
55477
+ if (exitCode !== 0) {
55478
+ process.exit(exitCode);
55479
+ }
55480
+ return;
55481
+ } catch (error3) {
55482
+ const message = error3 instanceof Error ? error3.message : String(error3);
55483
+ console.error(source_default.red(`Failed to launch GAL Code: ${message}`));
55484
+ process.exit(1);
55485
+ }
55486
+ }
55425
55487
  let launchContext;
55426
55488
  try {
55427
55489
  launchContext = await resolveGalCodeLaunchContext();
@@ -74784,7 +74846,7 @@ var init_index = __esm({
74784
74846
  }
74785
74847
  });
74786
74848
 
74787
- var cliVersion11 = true ? "0.0.541" : "0.0.0-dev";
74849
+ var cliVersion11 = true ? "0.0.543" : "0.0.0-dev";
74788
74850
  var args = process.argv.slice(2);
74789
74851
  var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
74790
74852
  var requestedVersion = args.length === 1 && (args[0] === "--version" || args[0] === "-V");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scheduler-systems/gal-run",
3
- "version": "0.0.541",
3
+ "version": "0.0.543",
4
4
  "description": "GAL CLI - Command-line tool for managing AI agent configurations across your organization",
5
5
  "license": "Elastic-2.0",
6
6
  "private": false,