@scheduler-systems/gal-run 0.0.454 → 0.0.455

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 +124 -8
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3970,7 +3970,7 @@ var cliVersion, defaultApiUrl, BUILD_CONSTANTS, constants_default;
3970
3970
  var init_constants = __esm({
3971
3971
  "src/constants.ts"() {
3972
3972
  "use strict";
3973
- cliVersion = true ? "0.0.454" : "0.0.0-dev";
3973
+ cliVersion = true ? "0.0.455" : "0.0.0-dev";
3974
3974
  defaultApiUrl = true ? "https://api.gal.run" : "http://localhost:3000";
3975
3975
  BUILD_CONSTANTS = Object.freeze([cliVersion, defaultApiUrl]);
3976
3976
  constants_default = BUILD_CONSTANTS;
@@ -4880,7 +4880,7 @@ function detectEnvironment() {
4880
4880
  return "dev";
4881
4881
  }
4882
4882
  try {
4883
- const version2 = true ? "0.0.454" : void 0;
4883
+ const version2 = true ? "0.0.455" : void 0;
4884
4884
  if (version2 && version2.includes("-local")) {
4885
4885
  return "dev";
4886
4886
  }
@@ -5249,7 +5249,7 @@ function getId() {
5249
5249
  }
5250
5250
  function getCliVersion() {
5251
5251
  try {
5252
- return true ? "0.0.454" : "0.0.0-dev";
5252
+ return true ? "0.0.455" : "0.0.0-dev";
5253
5253
  } catch {
5254
5254
  return "0.0.0-dev";
5255
5255
  }
@@ -5693,7 +5693,8 @@ var init_feature_flags = __esm({
5693
5693
  "enforcement-security",
5694
5694
  "enforcement-tools",
5695
5695
  "enforcement-system",
5696
- "browser-profiles"
5696
+ "browser-profiles",
5697
+ "governance-playground"
5697
5698
  ];
5698
5699
  }
5699
5700
  });
@@ -6079,7 +6080,7 @@ var CREDENTIAL_PROVIDERS, CREDENTIAL_PROVIDER_CONFIGS;
6079
6080
  var init_credentials = __esm({
6080
6081
  "../../packages/types/dist/credentials.js"() {
6081
6082
  "use strict";
6082
- CREDENTIAL_PROVIDERS = ["claude", "codex", "gemini", "cursor", "oss"];
6083
+ CREDENTIAL_PROVIDERS = ["claude", "codex", "gemini", "cursor", "oss", "firebase"];
6083
6084
  CREDENTIAL_PROVIDER_CONFIGS = [
6084
6085
  {
6085
6086
  id: "claude",
@@ -6111,6 +6112,16 @@ var init_credentials = __esm({
6111
6112
  // Google OAuth access tokens start with ya29.
6112
6113
  accessTokenPattern: /^ya29\./
6113
6114
  },
6115
+ {
6116
+ id: "firebase",
6117
+ displayName: "Firebase CLI",
6118
+ icon: "\u{1F525}",
6119
+ instructions: "Run `gal auth firebase` after authenticating with Firebase CLI (`firebase login`)",
6120
+ tokenHint: "Google OAuth refresh token starting with 1//...",
6121
+ refreshTokenRequired: true,
6122
+ accessTokenPattern: /^ya29\./,
6123
+ refreshTokenPattern: /^1\/\//
6124
+ },
6114
6125
  {
6115
6126
  id: "cursor",
6116
6127
  displayName: "Cursor",
@@ -6202,7 +6213,7 @@ function calculateUsagePercent(currentUsage, limit) {
6202
6213
  return null;
6203
6214
  return Math.min(100, currentUsage / limit * 100);
6204
6215
  }
6205
- var DEFAULT_USAGE_THRESHOLDS;
6216
+ var DEFAULT_USAGE_THRESHOLDS, DEFAULT_USAGE_THRESHOLD_PERCENT;
6206
6217
  var init_provider_usage = __esm({
6207
6218
  "../../packages/types/dist/provider-usage.js"() {
6208
6219
  "use strict";
@@ -6210,6 +6221,7 @@ var init_provider_usage = __esm({
6210
6221
  warningThreshold: 70,
6211
6222
  criticalThreshold: 90
6212
6223
  };
6224
+ DEFAULT_USAGE_THRESHOLD_PERCENT = 70;
6213
6225
  }
6214
6226
  });
6215
6227
 
@@ -6235,7 +6247,8 @@ function mapProviderToAgent(provider) {
6235
6247
  claude: "claude",
6236
6248
  codex: "codex",
6237
6249
  gemini: "gemini",
6238
- oss: "oss"
6250
+ oss: "oss",
6251
+ firebase: "claude"
6239
6252
  };
6240
6253
  return mapping[provider];
6241
6254
  }
@@ -6773,6 +6786,7 @@ __export(dist_exports, {
6773
6786
  DEFAULT_SESSION_AGENT: () => DEFAULT_SESSION_AGENT,
6774
6787
  DEFAULT_TEAM_ASSIGNMENT_CONFIG: () => DEFAULT_TEAM_ASSIGNMENT_CONFIG,
6775
6788
  DEFAULT_USAGE_THRESHOLDS: () => DEFAULT_USAGE_THRESHOLDS,
6789
+ DEFAULT_USAGE_THRESHOLD_PERCENT: () => DEFAULT_USAGE_THRESHOLD_PERCENT,
6776
6790
  ERROR_CODE_CATEGORIES: () => ERROR_CODE_CATEGORIES,
6777
6791
  ErrorCategory: () => ErrorCategory,
6778
6792
  FAILURE_REMEDIATIONS: () => FAILURE_REMEDIATIONS,
@@ -52880,6 +52894,108 @@ Source: ${credentialSource2}`));
52880
52894
  process.exit(1);
52881
52895
  }
52882
52896
  });
52897
+ auth.command("firebase").description("Sync Firebase CLI credentials to GAL for background agent sessions").option("-v, --verbose", "Show detailed credential discovery information").action(async (options) => {
52898
+ const verbose = options.verbose || false;
52899
+ console.log(source_default.yellow("\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
52900
+ console.log(source_default.yellow(" GAL CLI - Firebase Credentials Sync"));
52901
+ console.log(source_default.yellow("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n"));
52902
+ const config2 = ConfigManager.load();
52903
+ if (!config2.authToken) {
52904
+ console.log(source_default.red("Not authenticated with GAL."));
52905
+ console.log(source_default.dim("Run: gal auth login\n"));
52906
+ process.exit(1);
52907
+ }
52908
+ const spinner = ora("Reading Firebase credentials...").start();
52909
+ let credentialSource2 = "";
52910
+ try {
52911
+ let accessToken;
52912
+ let refreshToken;
52913
+ let idToken;
52914
+ let scope;
52915
+ const firebaseAuthPath = (0, import_path24.join)((0, import_os19.homedir)(), ".config", "configstore", "firebase-tools.json");
52916
+ if (verbose) {
52917
+ spinner.info(source_default.dim(` Trying ${firebaseAuthPath}...`));
52918
+ }
52919
+ if ((0, import_fs25.existsSync)(firebaseAuthPath)) {
52920
+ try {
52921
+ const content = (0, import_fs25.readFileSync)(firebaseAuthPath, "utf-8");
52922
+ const data = JSON.parse(content);
52923
+ if (verbose) {
52924
+ spinner.info(source_default.dim(` Found firebase-tools.json, checking tokens...`));
52925
+ }
52926
+ if (data.tokens?.refresh_token) {
52927
+ accessToken = data.tokens?.access_token;
52928
+ refreshToken = data.tokens?.refresh_token;
52929
+ idToken = data.tokens?.id_token;
52930
+ scope = data.tokens?.scope;
52931
+ credentialSource2 = "~/.config/configstore/firebase-tools.json";
52932
+ if (verbose) {
52933
+ const email2 = data.user?.email || "unknown";
52934
+ spinner.succeed(source_default.dim(` Found OAuth tokens in firebase-tools.json (user: ${email2})`));
52935
+ }
52936
+ }
52937
+ } catch (parseError) {
52938
+ if (verbose) {
52939
+ const err = parseError instanceof Error ? parseError : new Error(String(parseError));
52940
+ spinner.warn(source_default.dim(` Failed to parse firebase-tools.json: ${err.message}`));
52941
+ }
52942
+ }
52943
+ } else if (verbose) {
52944
+ spinner.warn(source_default.dim(` ${firebaseAuthPath} not found`));
52945
+ }
52946
+ if (!refreshToken) {
52947
+ spinner.fail(source_default.red("No Firebase credentials found"));
52948
+ console.log(source_default.dim("\nTo authenticate with Firebase:"));
52949
+ console.log(source_default.dim(" 1. Run: firebase login"));
52950
+ console.log(source_default.dim(" 2. Complete the OAuth login flow"));
52951
+ console.log(source_default.dim(" 3. Then run: gal auth firebase\n"));
52952
+ process.exit(1);
52953
+ }
52954
+ spinner.text = "Syncing to GAL...";
52955
+ const credProvider = new CoreServiceProvider({ apiUrl: config2.apiUrl || "", authToken: config2.authToken });
52956
+ const response = await credProvider.getAuthRepository().syncCredentials("firebase", {
52957
+ accessToken: accessToken || refreshToken,
52958
+ // access_token may be expired; refresh_token is the key credential
52959
+ refreshToken,
52960
+ idToken,
52961
+ scope
52962
+ });
52963
+ if (!response.success) {
52964
+ throw new Error(response.error || "Failed to store credentials");
52965
+ }
52966
+ spinner.succeed(source_default.green("Firebase credentials synced to GAL!"));
52967
+ trackAuthProvider({
52968
+ provider: "firebase",
52969
+ success: true,
52970
+ tokenType: "oauth-session",
52971
+ credentialSource: credentialSource2
52972
+ });
52973
+ if (credentialSource2) {
52974
+ console.log(source_default.dim(`
52975
+ Source: ${credentialSource2}`));
52976
+ }
52977
+ await validateAfterSync(config2, "firebase");
52978
+ console.log(source_default.green("\n\u2713 Background agent sessions can now use Firebase.\n"));
52979
+ process.exit(0);
52980
+ } catch (error3) {
52981
+ const err = error3 instanceof Error ? error3 : new Error(String(error3));
52982
+ trackAuthProvider({
52983
+ provider: "firebase",
52984
+ success: false,
52985
+ tokenType: "oauth-session",
52986
+ credentialSource: credentialSource2 || "unknown",
52987
+ error: err.message
52988
+ });
52989
+ if (err.message.includes("401") || err.message.includes("unauthorized")) {
52990
+ spinner.fail(source_default.red("GAL authentication expired"));
52991
+ console.log(source_default.dim("Run: gal auth login\n"));
52992
+ } else {
52993
+ spinner.fail(source_default.red("Failed to sync credentials"));
52994
+ console.log(source_default.red(err.message));
52995
+ }
52996
+ process.exit(1);
52997
+ }
52998
+ });
52883
52999
  auth.command("cursor").description("Sync Cursor credentials to GAL for background agent sessions").option("-v, --verbose", "Show detailed credential discovery information").option("--access-token <token>", "Use provided access token instead of reading from Cursor auth file").action(async (options) => {
52884
53000
  const verbose = options.verbose || false;
52885
53001
  console.log(source_default.cyan("\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
@@ -73167,7 +73283,7 @@ var init_index = __esm({
73167
73283
  });
73168
73284
 
73169
73285
  // src/bootstrap.ts
73170
- var cliVersion10 = true ? "0.0.454" : "0.0.0-dev";
73286
+ var cliVersion10 = true ? "0.0.455" : "0.0.0-dev";
73171
73287
  var args = process.argv.slice(2);
73172
73288
  var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
73173
73289
  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.454",
3
+ "version": "0.0.455",
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,