@base44-preview/cli 0.0.31-pr.211.1b42e07 → 0.0.31-pr.211.1c10469

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/cli/index.js CHANGED
@@ -184888,7 +184888,7 @@ var ToolConfigSchema = exports_external.union([
184888
184888
  BackendFunctionToolConfigSchema
184889
184889
  ]);
184890
184890
  var AgentConfigSchema = exports_external.looseObject({
184891
- name: exports_external.string().regex(/^[a-z0-9_]+$/, "Agent name must be lowercase alphanumeric with underscores").min(1).max(100),
184891
+ name: exports_external.string().trim().min(1).max(100),
184892
184892
  description: exports_external.string().trim().min(1, "Description is required"),
184893
184893
  instructions: exports_external.string().trim().min(1, "Instructions are required"),
184894
184894
  tool_configs: exports_external.array(ToolConfigSchema).optional().default([]),
@@ -184944,6 +184944,9 @@ async function fetchAgents() {
184944
184944
  }
184945
184945
  // src/core/resources/agent/config.ts
184946
184946
  import { join as join3 } from "node:path";
184947
+ function toFileSlug(name2) {
184948
+ return name2.toLowerCase().replace(/[^a-z0-9_]/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "");
184949
+ }
184947
184950
  async function readAgentFile(agentPath) {
184948
184951
  const parsed = await readJsonFile(agentPath);
184949
184952
  const result = AgentConfigSchema.safeParse(parsed);
@@ -184975,7 +184978,8 @@ async function writeAgents(agentsDir, remoteAgents) {
184975
184978
  const newNames = new Set(remoteAgents.map((a) => a.name));
184976
184979
  const toDelete = existingAgents.filter((a) => !newNames.has(a.name));
184977
184980
  for (const agent of toDelete) {
184978
- const files = await globby(`${agent.name}.${CONFIG_FILE_EXTENSION_GLOB}`, {
184981
+ const slug = toFileSlug(agent.name);
184982
+ const files = await globby(`${slug}.${CONFIG_FILE_EXTENSION_GLOB}`, {
184979
184983
  cwd: agentsDir,
184980
184984
  absolute: true
184981
184985
  });
@@ -184984,7 +184988,8 @@ async function writeAgents(agentsDir, remoteAgents) {
184984
184988
  }
184985
184989
  }
184986
184990
  for (const agent of remoteAgents) {
184987
- const filePath = join3(agentsDir, `${agent.name}.${CONFIG_FILE_EXTENSION}`);
184991
+ const slug = toFileSlug(agent.name);
184992
+ const filePath = join3(agentsDir, `${slug}.${CONFIG_FILE_EXTENSION}`);
184988
184993
  await writeJsonFile(filePath, agent);
184989
184994
  }
184990
184995
  const written = remoteAgents.map((a) => a.name);
@@ -194298,9 +194303,55 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
194298
194303
  var open_default = open;
194299
194304
 
194300
194305
  // src/cli/commands/connectors/oauth-prompt.ts
194306
+ var POLL_INTERVAL_MS = 2000;
194307
+ var POLL_TIMEOUT_MS = 2 * 60 * 1000;
194301
194308
  function filterPendingOAuth(results) {
194302
194309
  return results.filter((r2) => r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId);
194303
194310
  }
194311
+ async function runOAuthFlowWithSkip(connector2) {
194312
+ await open_default(connector2.redirectUrl);
194313
+ let finalStatus = "PENDING";
194314
+ let skipped = false;
194315
+ const s = Y2();
194316
+ const originalExit = process.exit;
194317
+ process.exit = () => {
194318
+ skipped = true;
194319
+ s.stop(`${connector2.type} skipped`);
194320
+ };
194321
+ s.start(`Waiting for ${connector2.type} authorization... (Esc to skip)`);
194322
+ try {
194323
+ await pWaitFor(async () => {
194324
+ if (skipped) {
194325
+ finalStatus = "SKIPPED";
194326
+ return true;
194327
+ }
194328
+ const response = await getOAuthStatus(connector2.type, connector2.connectionId);
194329
+ finalStatus = response.status;
194330
+ return response.status !== "PENDING";
194331
+ }, {
194332
+ interval: POLL_INTERVAL_MS,
194333
+ timeout: POLL_TIMEOUT_MS
194334
+ });
194335
+ } catch (err) {
194336
+ if (err instanceof TimeoutError2) {
194337
+ finalStatus = "PENDING";
194338
+ } else {
194339
+ throw err;
194340
+ }
194341
+ } finally {
194342
+ process.exit = originalExit;
194343
+ if (!skipped) {
194344
+ if (finalStatus === "ACTIVE") {
194345
+ s.stop(`${connector2.type} authorization complete`);
194346
+ } else if (finalStatus === "FAILED") {
194347
+ s.stop(`${connector2.type} authorization failed`);
194348
+ } else {
194349
+ s.stop(`${connector2.type} authorization timed out`);
194350
+ }
194351
+ }
194352
+ }
194353
+ return finalStatus;
194354
+ }
194304
194355
  async function promptOAuthFlows(pending, options) {
194305
194356
  const outcomes = new Map;
194306
194357
  if (pending.length === 0) {
@@ -194320,30 +194371,15 @@ async function promptOAuthFlows(pending, options) {
194320
194371
  return outcomes;
194321
194372
  }
194322
194373
  for (const connector2 of pending) {
194323
- M2.info(`
194374
+ try {
194375
+ M2.info(`
194324
194376
  Opening browser for ${connector2.type}...`);
194325
- await open_default(connector2.redirectUrl);
194326
- let finalStatus = "PENDING";
194327
- await runTask(`Waiting for ${connector2.type} authorization...`, async () => {
194328
- await pWaitFor(async () => {
194329
- const response = await getOAuthStatus(connector2.type, connector2.connectionId);
194330
- finalStatus = response.status;
194331
- return response.status !== "PENDING";
194332
- }, {
194333
- interval: 2000,
194334
- timeout: 2 * 60 * 1000
194335
- });
194336
- }, {
194337
- successMessage: `${connector2.type} authorization complete`,
194338
- errorMessage: `${connector2.type} authorization failed`
194339
- }).catch((err) => {
194340
- if (err instanceof TimeoutError2) {
194341
- finalStatus = "PENDING";
194342
- } else {
194343
- throw err;
194344
- }
194345
- });
194346
- outcomes.set(connector2.type, finalStatus);
194377
+ const status = await runOAuthFlowWithSkip(connector2);
194378
+ outcomes.set(connector2.type, status);
194379
+ } catch (err) {
194380
+ M2.error(`Failed to authorize ${connector2.type}: ${err instanceof Error ? err.message : String(err)}`);
194381
+ outcomes.set(connector2.type, "FAILED");
194382
+ }
194347
194383
  }
194348
194384
  return outcomes;
194349
194385
  }
@@ -194353,6 +194389,7 @@ function printSummary(results, oauthOutcomes) {
194353
194389
  const synced = [];
194354
194390
  const added = [];
194355
194391
  const removed = [];
194392
+ const skipped = [];
194356
194393
  const failed = [];
194357
194394
  for (const r2 of results) {
194358
194395
  const oauthStatus = oauthOutcomes.get(r2.type);
@@ -194365,6 +194402,8 @@ function printSummary(results, oauthOutcomes) {
194365
194402
  } else if (r2.action === "needs_oauth") {
194366
194403
  if (oauthStatus === "ACTIVE") {
194367
194404
  added.push(r2.type);
194405
+ } else if (oauthStatus === "SKIPPED") {
194406
+ skipped.push(r2.type);
194368
194407
  } else if (oauthStatus === "PENDING") {
194369
194408
  failed.push({ type: r2.type, error: "authorization timed out" });
194370
194409
  } else if (oauthStatus === "FAILED") {
@@ -194384,6 +194423,9 @@ function printSummary(results, oauthOutcomes) {
194384
194423
  if (removed.length > 0) {
194385
194424
  M2.info(theme.styles.dim(`Removed: ${removed.join(", ")}`));
194386
194425
  }
194426
+ if (skipped.length > 0) {
194427
+ M2.warn(`Skipped: ${skipped.join(", ")}`);
194428
+ }
194387
194429
  for (const r2 of failed) {
194388
194430
  M2.error(`Failed: ${r2.type}${r2.error ? ` - ${r2.error}` : ""}`);
194389
194431
  }
@@ -194404,8 +194446,9 @@ async function pushConnectorsAction() {
194404
194446
  const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
194405
194447
  skipPrompt: !!process.env.CI
194406
194448
  });
194407
- if (needsOAuth.length > 0 && oauthOutcomes.size === 0) {
194408
- outroMessage = process.env.CI ? "Skipped OAuth in CI. Run 'base44 connectors push' locally or open the links above to authorize." : "Authorization skipped. Run 'base44 connectors push' or open the links above to authorize.";
194449
+ const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
194450
+ if (needsOAuth.length > 0 && !allAuthorized) {
194451
+ outroMessage = process.env.CI ? "Skipped OAuth in CI. Run 'base44 connectors push' locally or open the links above to authorize." : "Some connectors still require authorization. Run 'base44 connectors push' or open the links above to authorize.";
194409
194452
  }
194410
194453
  printSummary(results, oauthOutcomes);
194411
194454
  return { outroMessage };
@@ -194739,8 +194782,9 @@ ${summaryLines.join(`
194739
194782
  const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
194740
194783
  skipPrompt: options.yes || !!process.env.CI
194741
194784
  });
194742
- if (oauthOutcomes.size === 0) {
194743
- M2.info("To authorize, run 'base44 connectors push' or open the links above in your browser.");
194785
+ const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
194786
+ if (!allAuthorized) {
194787
+ M2.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
194744
194788
  }
194745
194789
  }
194746
194790
  M2.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
@@ -199641,4 +199685,4 @@ export {
199641
199685
  CLIExitError
199642
199686
  };
199643
199687
 
199644
- //# debugId=3AF0A883AF7DD29464756E2164756E21
199688
+ //# debugId=2EB2E2FCC8EF3F8464756E2164756E21