@base44-preview/cli 0.0.31-pr.211.25a2296 → 0.0.31-pr.211.808fac0
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 +75 -33
- package/dist/cli/index.js.map +7 -7
- package/package.json +1 -1
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().
|
|
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
|
|
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
|
|
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,15 +194303,60 @@ 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) {
|
|
194307
194358
|
return outcomes;
|
|
194308
194359
|
}
|
|
194309
|
-
M2.info("");
|
|
194310
194360
|
M2.warn(`${pending.length} connector(s) require authorization in your browser:`);
|
|
194311
194361
|
for (const connector2 of pending) {
|
|
194312
194362
|
M2.info(` ${connector2.type}: ${theme.styles.dim(connector2.redirectUrl)}`);
|
|
@@ -194321,30 +194371,15 @@ async function promptOAuthFlows(pending, options) {
|
|
|
194321
194371
|
return outcomes;
|
|
194322
194372
|
}
|
|
194323
194373
|
for (const connector2 of pending) {
|
|
194324
|
-
|
|
194374
|
+
try {
|
|
194375
|
+
M2.info(`
|
|
194325
194376
|
Opening browser for ${connector2.type}...`);
|
|
194326
|
-
|
|
194327
|
-
|
|
194328
|
-
|
|
194329
|
-
|
|
194330
|
-
|
|
194331
|
-
|
|
194332
|
-
return response.status !== "PENDING";
|
|
194333
|
-
}, {
|
|
194334
|
-
interval: 2000,
|
|
194335
|
-
timeout: 2 * 60 * 1000
|
|
194336
|
-
});
|
|
194337
|
-
}, {
|
|
194338
|
-
successMessage: `${connector2.type} authorization complete`,
|
|
194339
|
-
errorMessage: `${connector2.type} authorization failed`
|
|
194340
|
-
}).catch((err) => {
|
|
194341
|
-
if (err instanceof TimeoutError2) {
|
|
194342
|
-
finalStatus = "PENDING";
|
|
194343
|
-
} else {
|
|
194344
|
-
throw err;
|
|
194345
|
-
}
|
|
194346
|
-
});
|
|
194347
|
-
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
|
+
}
|
|
194348
194383
|
}
|
|
194349
194384
|
return outcomes;
|
|
194350
194385
|
}
|
|
@@ -194354,6 +194389,7 @@ function printSummary(results, oauthOutcomes) {
|
|
|
194354
194389
|
const synced = [];
|
|
194355
194390
|
const added = [];
|
|
194356
194391
|
const removed = [];
|
|
194392
|
+
const skipped = [];
|
|
194357
194393
|
const failed = [];
|
|
194358
194394
|
for (const r2 of results) {
|
|
194359
194395
|
const oauthStatus = oauthOutcomes.get(r2.type);
|
|
@@ -194366,6 +194402,8 @@ function printSummary(results, oauthOutcomes) {
|
|
|
194366
194402
|
} else if (r2.action === "needs_oauth") {
|
|
194367
194403
|
if (oauthStatus === "ACTIVE") {
|
|
194368
194404
|
added.push(r2.type);
|
|
194405
|
+
} else if (oauthStatus === "SKIPPED") {
|
|
194406
|
+
skipped.push(r2.type);
|
|
194369
194407
|
} else if (oauthStatus === "PENDING") {
|
|
194370
194408
|
failed.push({ type: r2.type, error: "authorization timed out" });
|
|
194371
194409
|
} else if (oauthStatus === "FAILED") {
|
|
@@ -194375,7 +194413,6 @@ function printSummary(results, oauthOutcomes) {
|
|
|
194375
194413
|
}
|
|
194376
194414
|
}
|
|
194377
194415
|
}
|
|
194378
|
-
M2.info("");
|
|
194379
194416
|
M2.info(theme.styles.bold("Summary:"));
|
|
194380
194417
|
if (synced.length > 0) {
|
|
194381
194418
|
M2.success(`Synced: ${synced.join(", ")}`);
|
|
@@ -194386,6 +194423,9 @@ function printSummary(results, oauthOutcomes) {
|
|
|
194386
194423
|
if (removed.length > 0) {
|
|
194387
194424
|
M2.info(theme.styles.dim(`Removed: ${removed.join(", ")}`));
|
|
194388
194425
|
}
|
|
194426
|
+
if (skipped.length > 0) {
|
|
194427
|
+
M2.warn(`Skipped: ${skipped.join(", ")}`);
|
|
194428
|
+
}
|
|
194389
194429
|
for (const r2 of failed) {
|
|
194390
194430
|
M2.error(`Failed: ${r2.type}${r2.error ? ` - ${r2.error}` : ""}`);
|
|
194391
194431
|
}
|
|
@@ -194406,8 +194446,9 @@ async function pushConnectorsAction() {
|
|
|
194406
194446
|
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
194407
194447
|
skipPrompt: !!process.env.CI
|
|
194408
194448
|
});
|
|
194409
|
-
|
|
194410
|
-
|
|
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.";
|
|
194411
194452
|
}
|
|
194412
194453
|
printSummary(results, oauthOutcomes);
|
|
194413
194454
|
return { outroMessage };
|
|
@@ -194741,8 +194782,9 @@ ${summaryLines.join(`
|
|
|
194741
194782
|
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
194742
194783
|
skipPrompt: options.yes || !!process.env.CI
|
|
194743
194784
|
});
|
|
194744
|
-
|
|
194745
|
-
|
|
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.");
|
|
194746
194788
|
}
|
|
194747
194789
|
}
|
|
194748
194790
|
M2.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
@@ -199643,4 +199685,4 @@ export {
|
|
|
199643
199685
|
CLIExitError
|
|
199644
199686
|
};
|
|
199645
199687
|
|
|
199646
|
-
//# debugId=
|
|
199688
|
+
//# debugId=2EB2E2FCC8EF3F8464756E2164756E21
|