@base44-preview/cli 0.0.31-pr.214.25a02b0 → 0.0.31-pr.214.681d4a1
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 +66 -25
- package/dist/cli/index.js.map +5 -5
- 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);
|
|
@@ -194369,6 +194374,52 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
|
194369
194374
|
var open_default = open;
|
|
194370
194375
|
|
|
194371
194376
|
// src/cli/commands/connectors/push.ts
|
|
194377
|
+
var POLL_INTERVAL_MS = 2000;
|
|
194378
|
+
var POLL_TIMEOUT_MS = 2 * 60 * 1000;
|
|
194379
|
+
async function runOAuthFlowWithSkip(params) {
|
|
194380
|
+
await open_default(params.redirectUrl);
|
|
194381
|
+
let finalStatus = "PENDING";
|
|
194382
|
+
let skipped = false;
|
|
194383
|
+
const s = Y2();
|
|
194384
|
+
const originalExit = process.exit;
|
|
194385
|
+
process.exit = () => {
|
|
194386
|
+
skipped = true;
|
|
194387
|
+
s.stop(`${params.type} skipped`);
|
|
194388
|
+
};
|
|
194389
|
+
s.start(`Waiting for ${params.type} authorization... (Esc to skip)`);
|
|
194390
|
+
try {
|
|
194391
|
+
await pWaitFor(async () => {
|
|
194392
|
+
if (skipped) {
|
|
194393
|
+
finalStatus = "SKIPPED";
|
|
194394
|
+
return true;
|
|
194395
|
+
}
|
|
194396
|
+
const response = await getOAuthStatus(params.type, params.connectionId);
|
|
194397
|
+
finalStatus = response.status;
|
|
194398
|
+
return response.status !== "PENDING";
|
|
194399
|
+
}, {
|
|
194400
|
+
interval: POLL_INTERVAL_MS,
|
|
194401
|
+
timeout: POLL_TIMEOUT_MS
|
|
194402
|
+
});
|
|
194403
|
+
} catch (err) {
|
|
194404
|
+
if (err instanceof TimeoutError2) {
|
|
194405
|
+
finalStatus = "PENDING";
|
|
194406
|
+
} else {
|
|
194407
|
+
throw err;
|
|
194408
|
+
}
|
|
194409
|
+
} finally {
|
|
194410
|
+
process.exit = originalExit;
|
|
194411
|
+
if (!skipped) {
|
|
194412
|
+
if (finalStatus === "ACTIVE") {
|
|
194413
|
+
s.stop(`${params.type} authorization complete`);
|
|
194414
|
+
} else if (finalStatus === "FAILED") {
|
|
194415
|
+
s.stop(`${params.type} authorization failed`);
|
|
194416
|
+
} else {
|
|
194417
|
+
s.stop(`${params.type} authorization timed out`);
|
|
194418
|
+
}
|
|
194419
|
+
}
|
|
194420
|
+
}
|
|
194421
|
+
return { type: params.type, status: finalStatus };
|
|
194422
|
+
}
|
|
194372
194423
|
function isPendingOAuth(r2) {
|
|
194373
194424
|
return r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId;
|
|
194374
194425
|
}
|
|
@@ -194376,6 +194427,7 @@ function printSummary(results, oauthOutcomes) {
|
|
|
194376
194427
|
const synced = [];
|
|
194377
194428
|
const added = [];
|
|
194378
194429
|
const removed = [];
|
|
194430
|
+
const skipped = [];
|
|
194379
194431
|
const failed = [];
|
|
194380
194432
|
for (const r2 of results) {
|
|
194381
194433
|
const oauthStatus = oauthOutcomes.get(r2.type);
|
|
@@ -194388,6 +194440,8 @@ function printSummary(results, oauthOutcomes) {
|
|
|
194388
194440
|
} else if (r2.action === "needs_oauth") {
|
|
194389
194441
|
if (oauthStatus === "ACTIVE") {
|
|
194390
194442
|
added.push(r2.type);
|
|
194443
|
+
} else if (oauthStatus === "SKIPPED") {
|
|
194444
|
+
skipped.push(r2.type);
|
|
194391
194445
|
} else if (oauthStatus === "PENDING") {
|
|
194392
194446
|
failed.push({ type: r2.type, error: "authorization timed out" });
|
|
194393
194447
|
} else if (oauthStatus === "FAILED") {
|
|
@@ -194408,6 +194462,9 @@ function printSummary(results, oauthOutcomes) {
|
|
|
194408
194462
|
if (removed.length > 0) {
|
|
194409
194463
|
M2.info(theme.styles.dim(`Removed: ${removed.join(", ")}`));
|
|
194410
194464
|
}
|
|
194465
|
+
if (skipped.length > 0) {
|
|
194466
|
+
M2.warn(`Skipped: ${skipped.join(", ")}`);
|
|
194467
|
+
}
|
|
194411
194468
|
for (const r2 of failed) {
|
|
194412
194469
|
M2.error(`Failed: ${r2.type}${r2.error ? ` - ${r2.error}` : ""}`);
|
|
194413
194470
|
}
|
|
@@ -194448,28 +194505,12 @@ async function pushConnectorsAction() {
|
|
|
194448
194505
|
try {
|
|
194449
194506
|
M2.info(`
|
|
194450
194507
|
Opening browser for '${connector2.type}'...`);
|
|
194451
|
-
await
|
|
194452
|
-
|
|
194453
|
-
|
|
194454
|
-
|
|
194455
|
-
const response = await getOAuthStatus(connector2.type, connector2.connectionId);
|
|
194456
|
-
finalStatus = response.status;
|
|
194457
|
-
return response.status !== "PENDING";
|
|
194458
|
-
}, {
|
|
194459
|
-
interval: 2000,
|
|
194460
|
-
timeout: 2 * 60 * 1000
|
|
194461
|
-
});
|
|
194462
|
-
}, {
|
|
194463
|
-
successMessage: `'${connector2.type}' authorization complete`,
|
|
194464
|
-
errorMessage: `'${connector2.type}' authorization failed`
|
|
194465
|
-
}).catch((err) => {
|
|
194466
|
-
if (err instanceof TimeoutError2) {
|
|
194467
|
-
finalStatus = "PENDING";
|
|
194468
|
-
} else {
|
|
194469
|
-
throw err;
|
|
194470
|
-
}
|
|
194508
|
+
const oauthResult = await runOAuthFlowWithSkip({
|
|
194509
|
+
type: connector2.type,
|
|
194510
|
+
redirectUrl: connector2.redirectUrl,
|
|
194511
|
+
connectionId: connector2.connectionId
|
|
194471
194512
|
});
|
|
194472
|
-
oauthOutcomes.set(connector2.type,
|
|
194513
|
+
oauthOutcomes.set(connector2.type, oauthResult.status);
|
|
194473
194514
|
} catch (err) {
|
|
194474
194515
|
M2.error(`Failed to authorize '${connector2.type}': ${err instanceof Error ? err.message : String(err)}`);
|
|
194475
194516
|
oauthOutcomes.set(connector2.type, "FAILED");
|
|
@@ -199699,4 +199740,4 @@ export {
|
|
|
199699
199740
|
CLIExitError
|
|
199700
199741
|
};
|
|
199701
199742
|
|
|
199702
|
-
//# debugId=
|
|
199743
|
+
//# debugId=C6B64E5818FEF02264756E2164756E21
|