@base44-preview/cli 0.1.6-pr.555.928bd24 → 0.1.6-pr.575.77cce10
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
|
@@ -12998,10 +12998,10 @@ var require_ejs = __commonJS((exports) => {
|
|
|
12998
12998
|
exports.localsName = _DEFAULT_LOCALS_NAME;
|
|
12999
12999
|
exports.promiseImpl = new Function("return this;")().Promise;
|
|
13000
13000
|
exports.resolveInclude = function(name2, filename, isDir) {
|
|
13001
|
-
var
|
|
13001
|
+
var dirname9 = path11.dirname;
|
|
13002
13002
|
var extname = path11.extname;
|
|
13003
13003
|
var resolve3 = path11.resolve;
|
|
13004
|
-
var includePath = resolve3(isDir ? filename :
|
|
13004
|
+
var includePath = resolve3(isDir ? filename : dirname9(filename), name2);
|
|
13005
13005
|
var ext = extname(name2);
|
|
13006
13006
|
if (!ext) {
|
|
13007
13007
|
includePath += ".ejs";
|
|
@@ -13379,10 +13379,10 @@ var require_ejs = __commonJS((exports) => {
|
|
|
13379
13379
|
};
|
|
13380
13380
|
if (opts.filename && typeof Object.defineProperty === "function") {
|
|
13381
13381
|
var filename = opts.filename;
|
|
13382
|
-
var
|
|
13382
|
+
var basename4 = path11.basename(filename, path11.extname(filename));
|
|
13383
13383
|
try {
|
|
13384
13384
|
Object.defineProperty(returnedFn, "name", {
|
|
13385
|
-
value:
|
|
13385
|
+
value: basename4,
|
|
13386
13386
|
writable: false,
|
|
13387
13387
|
enumerable: false,
|
|
13388
13388
|
configurable: true
|
|
@@ -122736,12 +122736,12 @@ function getLanguageByFileName(languages2, file2) {
|
|
|
122736
122736
|
if (!file2) {
|
|
122737
122737
|
return;
|
|
122738
122738
|
}
|
|
122739
|
-
const
|
|
122739
|
+
const basename6 = getFileBasename(file2).toLowerCase();
|
|
122740
122740
|
return languages2.find(({
|
|
122741
122741
|
filenames
|
|
122742
|
-
}) => filenames?.some((name2) => name2.toLowerCase() ===
|
|
122742
|
+
}) => filenames?.some((name2) => name2.toLowerCase() === basename6)) ?? languages2.find(({
|
|
122743
122743
|
extensions
|
|
122744
|
-
}) => extensions?.some((extension) =>
|
|
122744
|
+
}) => extensions?.some((extension) => basename6.endsWith(extension)));
|
|
122745
122745
|
}
|
|
122746
122746
|
function getLanguageByLanguageName(languages2, languageName) {
|
|
122747
122747
|
if (!languageName) {
|
|
@@ -127963,8 +127963,8 @@ var init_prettier = __esm(() => {
|
|
|
127963
127963
|
}
|
|
127964
127964
|
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
127965
127965
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
127966
|
-
const
|
|
127967
|
-
return endsWithSlashGlobStar(pattern) || isStaticPattern(
|
|
127966
|
+
const basename6 = path152.basename(pattern);
|
|
127967
|
+
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename6);
|
|
127968
127968
|
}
|
|
127969
127969
|
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
127970
127970
|
function expandPatternsWithBraceExpansion(patterns) {
|
|
@@ -142972,7 +142972,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142972
142972
|
exports.fromFileSystemPath = fromFileSystemPath;
|
|
142973
142973
|
exports.toFileSystemPath = toFileSystemPath;
|
|
142974
142974
|
exports.safePointerToPath = safePointerToPath;
|
|
142975
|
-
exports.relative =
|
|
142975
|
+
exports.relative = relative4;
|
|
142976
142976
|
var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
|
|
142977
142977
|
var path_1 = __importStar(__require("path"));
|
|
142978
142978
|
var forwardSlashPattern = /\//g;
|
|
@@ -143122,7 +143122,7 @@ var require_url = __commonJS((exports) => {
|
|
|
143122
143122
|
return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
|
|
143123
143123
|
});
|
|
143124
143124
|
}
|
|
143125
|
-
function
|
|
143125
|
+
function relative4(from, to5) {
|
|
143126
143126
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143127
143127
|
return resolve13(from, to5);
|
|
143128
143128
|
}
|
|
@@ -146451,7 +146451,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
146451
146451
|
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
146452
146452
|
* MIT Licensed
|
|
146453
146453
|
*/
|
|
146454
|
-
var
|
|
146454
|
+
var relative4 = __require("path").relative;
|
|
146455
146455
|
module.exports = depd;
|
|
146456
146456
|
var basePath = process.cwd();
|
|
146457
146457
|
function containsNamespace(str, namespace) {
|
|
@@ -146647,7 +146647,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
146647
146647
|
return formatted;
|
|
146648
146648
|
}
|
|
146649
146649
|
function formatLocation(callSite) {
|
|
146650
|
-
return
|
|
146650
|
+
return relative4(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
146651
146651
|
}
|
|
146652
146652
|
function getStack() {
|
|
146653
146653
|
var limit = Error.stackTraceLimit;
|
|
@@ -164109,10 +164109,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164109
164109
|
var debug = require_src4()("express:view");
|
|
164110
164110
|
var path18 = __require("node:path");
|
|
164111
164111
|
var fs28 = __require("node:fs");
|
|
164112
|
-
var
|
|
164113
|
-
var
|
|
164112
|
+
var dirname20 = path18.dirname;
|
|
164113
|
+
var basename6 = path18.basename;
|
|
164114
164114
|
var extname2 = path18.extname;
|
|
164115
|
-
var
|
|
164115
|
+
var join27 = path18.join;
|
|
164116
164116
|
var resolve13 = path18.resolve;
|
|
164117
164117
|
module.exports = View;
|
|
164118
164118
|
function View(name2, options8) {
|
|
@@ -164148,8 +164148,8 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164148
164148
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
164149
164149
|
var root2 = roots[i5];
|
|
164150
164150
|
var loc = resolve13(root2, name2);
|
|
164151
|
-
var dir =
|
|
164152
|
-
var file2 =
|
|
164151
|
+
var dir = dirname20(loc);
|
|
164152
|
+
var file2 = basename6(loc);
|
|
164153
164153
|
path19 = this.resolve(dir, file2);
|
|
164154
164154
|
}
|
|
164155
164155
|
return path19;
|
|
@@ -164174,12 +164174,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164174
164174
|
};
|
|
164175
164175
|
View.prototype.resolve = function resolve14(dir, file2) {
|
|
164176
164176
|
var ext = this.ext;
|
|
164177
|
-
var path19 =
|
|
164177
|
+
var path19 = join27(dir, file2);
|
|
164178
164178
|
var stat2 = tryStat(path19);
|
|
164179
164179
|
if (stat2 && stat2.isFile()) {
|
|
164180
164180
|
return path19;
|
|
164181
164181
|
}
|
|
164182
|
-
path19 =
|
|
164182
|
+
path19 = join27(dir, basename6(file2, ext), "index" + ext);
|
|
164183
164183
|
stat2 = tryStat(path19);
|
|
164184
164184
|
if (stat2 && stat2.isFile()) {
|
|
164185
164185
|
return path19;
|
|
@@ -167500,7 +167500,7 @@ var require_content_disposition = __commonJS((exports, module) => {
|
|
|
167500
167500
|
*/
|
|
167501
167501
|
module.exports = contentDisposition;
|
|
167502
167502
|
module.exports.parse = parse11;
|
|
167503
|
-
var
|
|
167503
|
+
var basename6 = __require("path").basename;
|
|
167504
167504
|
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
|
|
167505
167505
|
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
|
|
167506
167506
|
var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g;
|
|
@@ -167535,9 +167535,9 @@ var require_content_disposition = __commonJS((exports, module) => {
|
|
|
167535
167535
|
if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
|
|
167536
167536
|
throw new TypeError("fallback must be ISO-8859-1 string");
|
|
167537
167537
|
}
|
|
167538
|
-
var name2 =
|
|
167538
|
+
var name2 = basename6(filename);
|
|
167539
167539
|
var isQuotedString = TEXT_REGEXP.test(name2);
|
|
167540
|
-
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name2) :
|
|
167540
|
+
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name2) : basename6(fallback);
|
|
167541
167541
|
var hasFallback = typeof fallbackName === "string" && fallbackName !== name2;
|
|
167542
167542
|
if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name2)) {
|
|
167543
167543
|
params["filename*"] = name2;
|
|
@@ -167874,7 +167874,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167874
167874
|
var Stream2 = __require("stream");
|
|
167875
167875
|
var util2 = __require("util");
|
|
167876
167876
|
var extname2 = path18.extname;
|
|
167877
|
-
var
|
|
167877
|
+
var join27 = path18.join;
|
|
167878
167878
|
var normalize2 = path18.normalize;
|
|
167879
167879
|
var resolve13 = path18.resolve;
|
|
167880
167880
|
var sep = path18.sep;
|
|
@@ -168046,7 +168046,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168046
168046
|
return res;
|
|
168047
168047
|
}
|
|
168048
168048
|
parts = path19.split(sep);
|
|
168049
|
-
path19 = normalize2(
|
|
168049
|
+
path19 = normalize2(join27(root2, path19));
|
|
168050
168050
|
} else {
|
|
168051
168051
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
168052
168052
|
debug('malicious path "%s"', path19);
|
|
@@ -168186,7 +168186,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168186
168186
|
return self2.onStatError(err);
|
|
168187
168187
|
return self2.error(404);
|
|
168188
168188
|
}
|
|
168189
|
-
var p4 =
|
|
168189
|
+
var p4 = join27(path19, self2._index[i5]);
|
|
168190
168190
|
debug('stat "%s"', p4);
|
|
168191
168191
|
fs28.stat(p4, function(err2, stat2) {
|
|
168192
168192
|
if (err2)
|
|
@@ -169795,8 +169795,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
169795
169795
|
}
|
|
169796
169796
|
return parsed;
|
|
169797
169797
|
}
|
|
169798
|
-
function resolveUrl(
|
|
169799
|
-
return useNativeURL ? new URL2(
|
|
169798
|
+
function resolveUrl(relative4, base) {
|
|
169799
|
+
return useNativeURL ? new URL2(relative4, base) : parseUrl(url3.resolve(base, relative4));
|
|
169800
169800
|
}
|
|
169801
169801
|
function validateUrl(input) {
|
|
169802
169802
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -171434,8 +171434,8 @@ var require_tmp = __commonJS((exports, module) => {
|
|
|
171434
171434
|
const name2 = options8.name;
|
|
171435
171435
|
if (path18.isAbsolute(name2))
|
|
171436
171436
|
throw new Error(`name option must not contain an absolute path, found "${name2}".`);
|
|
171437
|
-
const
|
|
171438
|
-
if (
|
|
171437
|
+
const basename6 = path18.basename(name2);
|
|
171438
|
+
if (basename6 === ".." || basename6 === "." || basename6 !== name2)
|
|
171439
171439
|
throw new Error(`name option must not contain a path, found "${name2}".`);
|
|
171440
171440
|
}
|
|
171441
171441
|
if (!_isUndefined(options8.template) && !options8.template.match(TEMPLATE_PATTERN)) {
|
|
@@ -213566,7 +213566,7 @@ var require_utils12 = __commonJS((exports, module) => {
|
|
|
213566
213566
|
if (decode4)
|
|
213567
213567
|
return decode4(data, hint);
|
|
213568
213568
|
}
|
|
213569
|
-
function
|
|
213569
|
+
function basename6(path18) {
|
|
213570
213570
|
if (typeof path18 !== "string")
|
|
213571
213571
|
return "";
|
|
213572
213572
|
for (let i5 = path18.length - 1;i5 >= 0; --i5) {
|
|
@@ -214870,7 +214870,7 @@ var require_utils12 = __commonJS((exports, module) => {
|
|
|
214870
214870
|
-1
|
|
214871
214871
|
];
|
|
214872
214872
|
module.exports = {
|
|
214873
|
-
basename:
|
|
214873
|
+
basename: basename6,
|
|
214874
214874
|
convertToUTF8,
|
|
214875
214875
|
getDecoder,
|
|
214876
214876
|
parseContentType,
|
|
@@ -215278,7 +215278,7 @@ var require_multipart = __commonJS((exports, module) => {
|
|
|
215278
215278
|
var { Readable: Readable6, Writable: Writable4 } = __require("stream");
|
|
215279
215279
|
var StreamSearch = require_sbmh();
|
|
215280
215280
|
var {
|
|
215281
|
-
basename:
|
|
215281
|
+
basename: basename6,
|
|
215282
215282
|
convertToUTF8,
|
|
215283
215283
|
getDecoder,
|
|
215284
215284
|
parseContentType,
|
|
@@ -215540,7 +215540,7 @@ var require_multipart = __commonJS((exports, module) => {
|
|
|
215540
215540
|
else if (disp.params.filename)
|
|
215541
215541
|
filename = disp.params.filename;
|
|
215542
215542
|
if (filename !== undefined && !preservePath)
|
|
215543
|
-
filename =
|
|
215543
|
+
filename = basename6(filename);
|
|
215544
215544
|
}
|
|
215545
215545
|
if (header2["content-type"]) {
|
|
215546
215546
|
const conType = parseContentType(header2["content-type"][0]);
|
|
@@ -217632,7 +217632,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
217632
217632
|
}
|
|
217633
217633
|
}, {
|
|
217634
217634
|
key: "join",
|
|
217635
|
-
value: function
|
|
217635
|
+
value: function join29(s5) {
|
|
217636
217636
|
if (this.length === 0)
|
|
217637
217637
|
return "";
|
|
217638
217638
|
var p4 = this.head;
|
|
@@ -237049,7 +237049,7 @@ function normalizeBase44Env() {
|
|
|
237049
237049
|
loadProjectEnvFiles();
|
|
237050
237050
|
|
|
237051
237051
|
// src/cli/index.ts
|
|
237052
|
-
import { dirname as
|
|
237052
|
+
import { dirname as dirname25, join as join33 } from "node:path";
|
|
237053
237053
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
237054
237054
|
|
|
237055
237055
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -238256,15 +238256,8 @@ var {
|
|
|
238256
238256
|
Help
|
|
238257
238257
|
} = import__.default;
|
|
238258
238258
|
|
|
238259
|
-
// src/cli/
|
|
238260
|
-
|
|
238261
|
-
code;
|
|
238262
|
-
constructor(code) {
|
|
238263
|
-
super(`CLI exited with code ${code}`);
|
|
238264
|
-
this.code = code;
|
|
238265
|
-
this.name = "CLIExitError";
|
|
238266
|
-
}
|
|
238267
|
-
}
|
|
238259
|
+
// src/cli/commands/agent-skills/pull.ts
|
|
238260
|
+
import { dirname as dirname10, join as join15 } from "node:path";
|
|
238268
238261
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
238269
238262
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
238270
238263
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
@@ -239078,8 +239071,8 @@ var ProjectConfigSchema = exports_external.object({
|
|
|
239078
239071
|
site: SiteConfigSchema.optional(),
|
|
239079
239072
|
entitiesDir: exports_external.string().optional().default("entities"),
|
|
239080
239073
|
functionsDir: exports_external.string().optional().default("functions"),
|
|
239081
|
-
actorsDir: exports_external.string().optional().default("actors"),
|
|
239082
239074
|
agentsDir: exports_external.string().optional().default("agents"),
|
|
239075
|
+
agentSkillsDir: exports_external.string().optional().default("agent-skills"),
|
|
239083
239076
|
connectorsDir: exports_external.string().optional().default("connectors"),
|
|
239084
239077
|
authDir: exports_external.string().optional().default("auth"),
|
|
239085
239078
|
plugin: PluginMetadataSchema.optional(),
|
|
@@ -244989,7 +244982,7 @@ async function getSiteUrl() {
|
|
|
244989
244982
|
return result.data.url;
|
|
244990
244983
|
}
|
|
244991
244984
|
// src/core/project/config.ts
|
|
244992
|
-
import { dirname as
|
|
244985
|
+
import { dirname as dirname8, join as join11 } from "node:path";
|
|
244993
244986
|
|
|
244994
244987
|
// src/core/project/plugins.ts
|
|
244995
244988
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -245027,165 +245020,6 @@ function markPluginEntities(entities, pluginNamespace) {
|
|
|
245027
245020
|
}));
|
|
245028
245021
|
}
|
|
245029
245022
|
|
|
245030
|
-
// src/core/resources/types.ts
|
|
245031
|
-
var ResourceSourceSchema = exports_external.discriminatedUnion("type", [
|
|
245032
|
-
exports_external.object({
|
|
245033
|
-
type: exports_external.literal("project")
|
|
245034
|
-
}),
|
|
245035
|
-
exports_external.object({
|
|
245036
|
-
type: exports_external.literal("plugin"),
|
|
245037
|
-
namespace: exports_external.string().min(1, "Plugin namespace cannot be empty")
|
|
245038
|
-
})
|
|
245039
|
-
]);
|
|
245040
|
-
|
|
245041
|
-
// src/core/resources/actor/schema.ts
|
|
245042
|
-
var ActorConfigSchema = exports_external.object({
|
|
245043
|
-
name: exports_external.string().min(1),
|
|
245044
|
-
entry: exports_external.string().min(1)
|
|
245045
|
-
});
|
|
245046
|
-
var ActorSchemaFileSchema = exports_external.object({
|
|
245047
|
-
types: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
245048
|
-
toClient: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
245049
|
-
toServer: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
|
|
245050
|
-
});
|
|
245051
|
-
var DeployActorResponseSchema = exports_external.object({
|
|
245052
|
-
status: exports_external.enum(["deployed", "unchanged"]),
|
|
245053
|
-
handler_name: exports_external.string().optional()
|
|
245054
|
-
});
|
|
245055
|
-
var ActorSchema = ActorConfigSchema.extend({
|
|
245056
|
-
entryPath: exports_external.string().min(1),
|
|
245057
|
-
filePaths: exports_external.array(exports_external.string()).min(1),
|
|
245058
|
-
source: ResourceSourceSchema,
|
|
245059
|
-
messageSchema: exports_external.unknown().optional()
|
|
245060
|
-
});
|
|
245061
|
-
|
|
245062
|
-
// src/core/resources/actor/api.ts
|
|
245063
|
-
async function deploySingleActor(name2, payload) {
|
|
245064
|
-
const appClient = getAppClient();
|
|
245065
|
-
let response;
|
|
245066
|
-
try {
|
|
245067
|
-
response = await appClient.put(`actors/${encodeURIComponent(name2)}`, {
|
|
245068
|
-
json: payload,
|
|
245069
|
-
timeout: false
|
|
245070
|
-
});
|
|
245071
|
-
} catch (error48) {
|
|
245072
|
-
throw await ApiError.fromHttpError(error48, `deploying actor "${name2}"`);
|
|
245073
|
-
}
|
|
245074
|
-
const result = DeployActorResponseSchema.safeParse(await response.json());
|
|
245075
|
-
if (!result.success) {
|
|
245076
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
245077
|
-
}
|
|
245078
|
-
return result.data;
|
|
245079
|
-
}
|
|
245080
|
-
// src/core/resources/actor/config.ts
|
|
245081
|
-
import { basename as basename3, dirname as dirname6, join as join5, relative } from "node:path";
|
|
245082
|
-
async function readActor(entryFile, actorsDir) {
|
|
245083
|
-
const actorDir = dirname6(entryFile);
|
|
245084
|
-
const filePaths = await globby("**/*.ts", {
|
|
245085
|
-
cwd: actorDir,
|
|
245086
|
-
absolute: true
|
|
245087
|
-
});
|
|
245088
|
-
const name2 = relative(actorsDir, actorDir).split(/[/\\]/).join("/");
|
|
245089
|
-
if (!name2) {
|
|
245090
|
-
throw new InvalidInputError("entry.ts found directly in the actors directory — it must be inside a named subfolder", {
|
|
245091
|
-
hints: [
|
|
245092
|
-
{
|
|
245093
|
-
message: `Move ${entryFile} into a subfolder (e.g. actors/MyActor/entry.ts)`
|
|
245094
|
-
}
|
|
245095
|
-
]
|
|
245096
|
-
});
|
|
245097
|
-
}
|
|
245098
|
-
const entry = basename3(entryFile);
|
|
245099
|
-
const schemaPath = join5(actorDir, "schema.jsonc");
|
|
245100
|
-
let messageSchema;
|
|
245101
|
-
if (await pathExists(schemaPath)) {
|
|
245102
|
-
const parsed = await readJsonFile(schemaPath);
|
|
245103
|
-
const result = ActorSchemaFileSchema.safeParse(parsed);
|
|
245104
|
-
if (result.success) {
|
|
245105
|
-
messageSchema = {
|
|
245106
|
-
types: result.data.types,
|
|
245107
|
-
toClient: result.data.toClient,
|
|
245108
|
-
toServer: result.data.toServer
|
|
245109
|
-
};
|
|
245110
|
-
}
|
|
245111
|
-
}
|
|
245112
|
-
return {
|
|
245113
|
-
name: name2,
|
|
245114
|
-
entry,
|
|
245115
|
-
entryPath: entryFile,
|
|
245116
|
-
filePaths,
|
|
245117
|
-
source: { type: "project" },
|
|
245118
|
-
messageSchema
|
|
245119
|
-
};
|
|
245120
|
-
}
|
|
245121
|
-
async function readAllActors(actorsDir) {
|
|
245122
|
-
if (!await pathExists(actorsDir)) {
|
|
245123
|
-
return [];
|
|
245124
|
-
}
|
|
245125
|
-
const entryFiles = await globby(ENTRY_FILE_GLOB, {
|
|
245126
|
-
cwd: actorsDir,
|
|
245127
|
-
absolute: true,
|
|
245128
|
-
ignore: ENTRY_IGNORE_DOT_PATHS
|
|
245129
|
-
});
|
|
245130
|
-
const actors = await Promise.all(entryFiles.map((entryFile) => readActor(entryFile, actorsDir)));
|
|
245131
|
-
const names = new Set;
|
|
245132
|
-
for (const actor of actors) {
|
|
245133
|
-
if (names.has(actor.name)) {
|
|
245134
|
-
throw new InvalidInputError(`Duplicate actor name "${actor.name}" in ${actorsDir}`);
|
|
245135
|
-
}
|
|
245136
|
-
names.add(actor.name);
|
|
245137
|
-
}
|
|
245138
|
-
return actors;
|
|
245139
|
-
}
|
|
245140
|
-
// src/core/resources/actor/deploy.ts
|
|
245141
|
-
import { dirname as dirname7, relative as relative2 } from "node:path";
|
|
245142
|
-
async function loadActorCode(actor) {
|
|
245143
|
-
const actorDir = dirname7(actor.entryPath);
|
|
245144
|
-
const resolvedFiles = await Promise.all(actor.filePaths.map(async (filePath) => {
|
|
245145
|
-
const content = await readTextFile(filePath);
|
|
245146
|
-
const path11 = relative2(actorDir, filePath).split(/[/\\]/).join("/");
|
|
245147
|
-
return { path: path11, content };
|
|
245148
|
-
}));
|
|
245149
|
-
return { name: actor.name, entry: actor.entry, files: resolvedFiles };
|
|
245150
|
-
}
|
|
245151
|
-
async function deployOne(actor) {
|
|
245152
|
-
const start = Date.now();
|
|
245153
|
-
try {
|
|
245154
|
-
const loaded = await loadActorCode(actor);
|
|
245155
|
-
const response = await deploySingleActor(loaded.name, {
|
|
245156
|
-
entry: loaded.entry,
|
|
245157
|
-
files: loaded.files
|
|
245158
|
-
});
|
|
245159
|
-
return {
|
|
245160
|
-
name: loaded.name,
|
|
245161
|
-
status: response.status,
|
|
245162
|
-
durationMs: Date.now() - start
|
|
245163
|
-
};
|
|
245164
|
-
} catch (error48) {
|
|
245165
|
-
return {
|
|
245166
|
-
name: actor.name,
|
|
245167
|
-
status: "error",
|
|
245168
|
-
error: error48 instanceof Error ? error48.message : String(error48)
|
|
245169
|
-
};
|
|
245170
|
-
}
|
|
245171
|
-
}
|
|
245172
|
-
async function deployActorsSequentially(actors, options) {
|
|
245173
|
-
if (actors.length === 0)
|
|
245174
|
-
return [];
|
|
245175
|
-
const results = [];
|
|
245176
|
-
for (const actor of actors) {
|
|
245177
|
-
options?.onStart?.([actor.name]);
|
|
245178
|
-
const result = await deployOne(actor);
|
|
245179
|
-
results.push(result);
|
|
245180
|
-
options?.onResult?.(result);
|
|
245181
|
-
}
|
|
245182
|
-
return results;
|
|
245183
|
-
}
|
|
245184
|
-
// src/core/resources/actor/resource.ts
|
|
245185
|
-
var actorResource = {
|
|
245186
|
-
readAll: readAllActors,
|
|
245187
|
-
push: (actors) => deployActorsSequentially(actors)
|
|
245188
|
-
};
|
|
245189
245023
|
// src/core/resources/agent/schema.ts
|
|
245190
245024
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
245191
245025
|
var EntityToolConfigSchema = exports_external.object({
|
|
@@ -245211,6 +245045,7 @@ var AgentConfigSchema = exports_external.looseObject({
|
|
|
245211
245045
|
description: exports_external.string().trim().min(1, "Description is required"),
|
|
245212
245046
|
instructions: exports_external.string().trim().min(1, "Instructions are required"),
|
|
245213
245047
|
tool_configs: exports_external.array(ToolConfigSchema).optional().default([]),
|
|
245048
|
+
selected_skill_names: exports_external.array(exports_external.string()).optional().default([]),
|
|
245214
245049
|
memory_config: MemoryConfigSchema.optional(),
|
|
245215
245050
|
whatsapp_greeting: exports_external.string().nullable().optional()
|
|
245216
245051
|
});
|
|
@@ -245263,7 +245098,7 @@ async function fetchAgents() {
|
|
|
245263
245098
|
return result.data;
|
|
245264
245099
|
}
|
|
245265
245100
|
// src/core/resources/agent/config.ts
|
|
245266
|
-
import { join as
|
|
245101
|
+
import { join as join5, normalize } from "node:path";
|
|
245267
245102
|
import { isDeepStrictEqual } from "node:util";
|
|
245268
245103
|
async function readAgentFile(agentPath) {
|
|
245269
245104
|
const raw2 = await readJsonFile(agentPath);
|
|
@@ -245308,12 +245143,12 @@ async function readAllAgents(agentsDir) {
|
|
|
245308
245143
|
return [...nameToEntry.values()].map((e2) => e2.data);
|
|
245309
245144
|
}
|
|
245310
245145
|
function findAvailablePath(agentsDir, name2, claimedPaths) {
|
|
245311
|
-
const base =
|
|
245146
|
+
const base = join5(agentsDir, `${name2}.${CONFIG_FILE_EXTENSION}`);
|
|
245312
245147
|
if (!claimedPaths.has(base)) {
|
|
245313
245148
|
return base;
|
|
245314
245149
|
}
|
|
245315
245150
|
for (let i = 1;; i++) {
|
|
245316
|
-
const candidate =
|
|
245151
|
+
const candidate = join5(agentsDir, `${name2}_${i}.${CONFIG_FILE_EXTENSION}`);
|
|
245317
245152
|
if (!claimedPaths.has(candidate)) {
|
|
245318
245153
|
return candidate;
|
|
245319
245154
|
}
|
|
@@ -245354,6 +245189,145 @@ var agentResource = {
|
|
|
245354
245189
|
readAll: readAllAgents,
|
|
245355
245190
|
push: pushAgents
|
|
245356
245191
|
};
|
|
245192
|
+
// src/core/resources/agent-skill/schema.ts
|
|
245193
|
+
var SKILL_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
245194
|
+
var AgentSkillSchema = exports_external.object({
|
|
245195
|
+
name: exports_external.string().trim().min(1).max(64).regex(SKILL_NAME_REGEX, "Skill name must be lowercase-hyphenated (a-z, 0-9, -)"),
|
|
245196
|
+
description: exports_external.string().trim().min(1, "Description is required").max(1024),
|
|
245197
|
+
body: exports_external.string().trim().min(1, "Body is required").max(15000)
|
|
245198
|
+
});
|
|
245199
|
+
var AgentSkillApiResponseSchema = exports_external.object({
|
|
245200
|
+
name: exports_external.string(),
|
|
245201
|
+
description: exports_external.string(),
|
|
245202
|
+
body: exports_external.string()
|
|
245203
|
+
});
|
|
245204
|
+
var ListAgentSkillsResponseSchema = exports_external.object({
|
|
245205
|
+
items: exports_external.array(AgentSkillApiResponseSchema),
|
|
245206
|
+
total: exports_external.number()
|
|
245207
|
+
});
|
|
245208
|
+
var SyncAgentSkillsResultSchema = exports_external.object({
|
|
245209
|
+
created: exports_external.array(exports_external.string()),
|
|
245210
|
+
updated: exports_external.array(exports_external.string()),
|
|
245211
|
+
deleted: exports_external.array(exports_external.string())
|
|
245212
|
+
});
|
|
245213
|
+
|
|
245214
|
+
// src/core/resources/agent-skill/api.ts
|
|
245215
|
+
async function fetchAgentSkills() {
|
|
245216
|
+
const appClient = getAppClient();
|
|
245217
|
+
let response;
|
|
245218
|
+
try {
|
|
245219
|
+
response = await appClient.get("agent-skills");
|
|
245220
|
+
} catch (error48) {
|
|
245221
|
+
throw await ApiError.fromHttpError(error48, "fetching agent skills");
|
|
245222
|
+
}
|
|
245223
|
+
const result = ListAgentSkillsResponseSchema.safeParse(await response.json());
|
|
245224
|
+
if (!result.success) {
|
|
245225
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
245226
|
+
}
|
|
245227
|
+
return result.data;
|
|
245228
|
+
}
|
|
245229
|
+
async function pushAgentSkills(skills) {
|
|
245230
|
+
if (skills.length === 0) {
|
|
245231
|
+
return { created: [], updated: [], deleted: [] };
|
|
245232
|
+
}
|
|
245233
|
+
const appClient = getAppClient();
|
|
245234
|
+
const remote = await fetchAgentSkills();
|
|
245235
|
+
const remoteByName = new Map(remote.items.map((s) => [s.name, s]));
|
|
245236
|
+
const localNames = new Set(skills.map((s) => s.name));
|
|
245237
|
+
const created = [];
|
|
245238
|
+
const updated = [];
|
|
245239
|
+
const deleted = [];
|
|
245240
|
+
try {
|
|
245241
|
+
for (const skill of skills) {
|
|
245242
|
+
const prev = remoteByName.get(skill.name);
|
|
245243
|
+
if (!prev) {
|
|
245244
|
+
await appClient.post("agent-skills", { json: skill });
|
|
245245
|
+
created.push(skill.name);
|
|
245246
|
+
} else if (prev.description !== skill.description || prev.body !== skill.body) {
|
|
245247
|
+
await appClient.put(`agent-skills/${skill.name}`, {
|
|
245248
|
+
json: { description: skill.description, body: skill.body }
|
|
245249
|
+
});
|
|
245250
|
+
updated.push(skill.name);
|
|
245251
|
+
}
|
|
245252
|
+
}
|
|
245253
|
+
for (const remoteSkill of remote.items) {
|
|
245254
|
+
if (!localNames.has(remoteSkill.name)) {
|
|
245255
|
+
await appClient.delete(`agent-skills/${remoteSkill.name}`);
|
|
245256
|
+
deleted.push(remoteSkill.name);
|
|
245257
|
+
}
|
|
245258
|
+
}
|
|
245259
|
+
} catch (error48) {
|
|
245260
|
+
throw await ApiError.fromHttpError(error48, "syncing agent skills");
|
|
245261
|
+
}
|
|
245262
|
+
return { created, updated, deleted };
|
|
245263
|
+
}
|
|
245264
|
+
// src/core/resources/agent-skill/config.ts
|
|
245265
|
+
import { join as join6 } from "node:path";
|
|
245266
|
+
function parseSkillFile(raw2) {
|
|
245267
|
+
const match = raw2.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
245268
|
+
if (!match) {
|
|
245269
|
+
return { description: "", body: raw2.trim() };
|
|
245270
|
+
}
|
|
245271
|
+
const [, frontmatter, body] = match;
|
|
245272
|
+
let description = "";
|
|
245273
|
+
for (const line of frontmatter.split(/\r?\n/)) {
|
|
245274
|
+
const kv = line.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
|
|
245275
|
+
if (kv && kv[1] === "description") {
|
|
245276
|
+
description = kv[2].trim().replace(/^["']|["']$/g, "");
|
|
245277
|
+
}
|
|
245278
|
+
}
|
|
245279
|
+
return { description, body: body.trim() };
|
|
245280
|
+
}
|
|
245281
|
+
function serializeSkillFile(skill) {
|
|
245282
|
+
return `---
|
|
245283
|
+
description: ${skill.description}
|
|
245284
|
+
---
|
|
245285
|
+
|
|
245286
|
+
${skill.body}
|
|
245287
|
+
`;
|
|
245288
|
+
}
|
|
245289
|
+
async function readAllAgentSkills(dir) {
|
|
245290
|
+
if (!await pathExists(dir)) {
|
|
245291
|
+
return [];
|
|
245292
|
+
}
|
|
245293
|
+
const files = await globby("*.md", { cwd: dir, absolute: true });
|
|
245294
|
+
return await Promise.all(files.map(async (filePath) => {
|
|
245295
|
+
const name2 = filePath.split(/[/\\]/).pop()?.replace(/\.md$/, "") ?? "";
|
|
245296
|
+
const { description, body } = parseSkillFile(await readTextFile(filePath));
|
|
245297
|
+
const result = AgentSkillSchema.safeParse({ name: name2, description, body });
|
|
245298
|
+
if (!result.success) {
|
|
245299
|
+
throw new SchemaValidationError("Invalid skill file", result.error, filePath);
|
|
245300
|
+
}
|
|
245301
|
+
return result.data;
|
|
245302
|
+
}));
|
|
245303
|
+
}
|
|
245304
|
+
async function writeAgentSkills(dir, remote) {
|
|
245305
|
+
const existing = await readAllAgentSkills(dir);
|
|
245306
|
+
const remoteNames = new Set(remote.map((s) => s.name));
|
|
245307
|
+
const deleted = [];
|
|
245308
|
+
for (const skill of existing) {
|
|
245309
|
+
if (!remoteNames.has(skill.name)) {
|
|
245310
|
+
await deleteFile(join6(dir, `${skill.name}.md`));
|
|
245311
|
+
deleted.push(skill.name);
|
|
245312
|
+
}
|
|
245313
|
+
}
|
|
245314
|
+
const existingByName = new Map(existing.map((s) => [s.name, s]));
|
|
245315
|
+
const written = [];
|
|
245316
|
+
for (const skill of remote) {
|
|
245317
|
+
const prev = existingByName.get(skill.name);
|
|
245318
|
+
if (prev && prev.description === skill.description && prev.body === skill.body) {
|
|
245319
|
+
continue;
|
|
245320
|
+
}
|
|
245321
|
+
await writeFile(join6(dir, `${skill.name}.md`), serializeSkillFile(skill));
|
|
245322
|
+
written.push(skill.name);
|
|
245323
|
+
}
|
|
245324
|
+
return { written, deleted };
|
|
245325
|
+
}
|
|
245326
|
+
// src/core/resources/agent-skill/resource.ts
|
|
245327
|
+
var agentSkillResource = {
|
|
245328
|
+
readAll: readAllAgentSkills,
|
|
245329
|
+
push: pushAgentSkills
|
|
245330
|
+
};
|
|
245357
245331
|
// src/core/resources/auth-config/schema.ts
|
|
245358
245332
|
var GoogleOAuthMode = exports_external.enum(["default", "custom"]);
|
|
245359
245333
|
var AuthConfigSchema = exports_external.object({
|
|
@@ -246354,6 +246328,17 @@ var connectorResource = {
|
|
|
246354
246328
|
readAll: readAllConnectors,
|
|
246355
246329
|
push: pushConnectors
|
|
246356
246330
|
};
|
|
246331
|
+
// src/core/resources/types.ts
|
|
246332
|
+
var ResourceSourceSchema = exports_external.discriminatedUnion("type", [
|
|
246333
|
+
exports_external.object({
|
|
246334
|
+
type: exports_external.literal("project")
|
|
246335
|
+
}),
|
|
246336
|
+
exports_external.object({
|
|
246337
|
+
type: exports_external.literal("plugin"),
|
|
246338
|
+
namespace: exports_external.string().min(1, "Plugin namespace cannot be empty")
|
|
246339
|
+
})
|
|
246340
|
+
]);
|
|
246341
|
+
|
|
246357
246342
|
// src/core/resources/entity/schema.ts
|
|
246358
246343
|
var FieldConditionSchema = exports_external.union([
|
|
246359
246344
|
exports_external.string(),
|
|
@@ -246790,7 +246775,7 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
246790
246775
|
return result.data;
|
|
246791
246776
|
}
|
|
246792
246777
|
// src/core/resources/function/config.ts
|
|
246793
|
-
import { basename as
|
|
246778
|
+
import { basename as basename3, dirname as dirname6, join as join9, relative, resolve as resolve2 } from "node:path";
|
|
246794
246779
|
async function readSharedFiles(functionsDir) {
|
|
246795
246780
|
const sharedDir = resolve2(functionsDir, "..", "shared");
|
|
246796
246781
|
if (!await pathExists(sharedDir)) {
|
|
@@ -246808,7 +246793,7 @@ async function readFunctionConfig(configPath) {
|
|
|
246808
246793
|
}
|
|
246809
246794
|
async function readFunction(configPath, sharedFiles) {
|
|
246810
246795
|
const config8 = await readFunctionConfig(configPath);
|
|
246811
|
-
const functionDir =
|
|
246796
|
+
const functionDir = dirname6(configPath);
|
|
246812
246797
|
const entryPath = join9(functionDir, config8.entry);
|
|
246813
246798
|
if (!await pathExists(entryPath)) {
|
|
246814
246799
|
throw new InvalidInputError(`Function entry file not found: ${entryPath} (referenced in ${configPath})`, {
|
|
@@ -246841,18 +246826,18 @@ async function readAllFunctions(functionsDir) {
|
|
|
246841
246826
|
absolute: true,
|
|
246842
246827
|
ignore: ENTRY_IGNORE_DOT_PATHS
|
|
246843
246828
|
});
|
|
246844
|
-
const configFilesDirs = new Set(configFiles.map((f) =>
|
|
246845
|
-
const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(
|
|
246829
|
+
const configFilesDirs = new Set(configFiles.map((f) => dirname6(f)));
|
|
246830
|
+
const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname6(entryFile)));
|
|
246846
246831
|
const sharedFiles = await readSharedFiles(functionsDir);
|
|
246847
246832
|
const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath, sharedFiles)));
|
|
246848
246833
|
const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
|
|
246849
|
-
const functionDir =
|
|
246834
|
+
const functionDir = dirname6(entryFile);
|
|
246850
246835
|
const filePaths = await globby(BACKEND_FILE_GLOB, {
|
|
246851
246836
|
cwd: functionDir,
|
|
246852
246837
|
absolute: true
|
|
246853
246838
|
});
|
|
246854
246839
|
const allFilePaths = [...new Set([...filePaths, ...sharedFiles])];
|
|
246855
|
-
const name2 =
|
|
246840
|
+
const name2 = relative(functionsDir, functionDir).split(/[/\\]/).join("/");
|
|
246856
246841
|
if (!name2) {
|
|
246857
246842
|
throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
|
|
246858
246843
|
hints: [
|
|
@@ -246862,7 +246847,7 @@ async function readAllFunctions(functionsDir) {
|
|
|
246862
246847
|
]
|
|
246863
246848
|
});
|
|
246864
246849
|
}
|
|
246865
|
-
const entry =
|
|
246850
|
+
const entry = basename3(entryFile);
|
|
246866
246851
|
const functionData = {
|
|
246867
246852
|
name: name2,
|
|
246868
246853
|
entry,
|
|
@@ -246889,17 +246874,17 @@ async function readAllFunctions(functionsDir) {
|
|
|
246889
246874
|
return functions;
|
|
246890
246875
|
}
|
|
246891
246876
|
// src/core/resources/function/deploy.ts
|
|
246892
|
-
import { dirname as
|
|
246877
|
+
import { dirname as dirname7, relative as relative2 } from "node:path";
|
|
246893
246878
|
async function loadFunctionCode(fn) {
|
|
246894
|
-
const functionDir =
|
|
246879
|
+
const functionDir = dirname7(fn.entryPath);
|
|
246895
246880
|
const resolvedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
|
|
246896
246881
|
const content = await readTextFile(filePath);
|
|
246897
|
-
const path11 =
|
|
246882
|
+
const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
|
|
246898
246883
|
return { path: path11, content };
|
|
246899
246884
|
}));
|
|
246900
246885
|
return { ...fn, files: resolvedFiles };
|
|
246901
246886
|
}
|
|
246902
|
-
async function
|
|
246887
|
+
async function deployOne(fn) {
|
|
246903
246888
|
const start = Date.now();
|
|
246904
246889
|
try {
|
|
246905
246890
|
const functionWithCode = await loadFunctionCode(fn);
|
|
@@ -246927,7 +246912,7 @@ async function deployFunctionsSequentially(functions, options) {
|
|
|
246927
246912
|
const results = [];
|
|
246928
246913
|
for (const fn of functions) {
|
|
246929
246914
|
options?.onStart?.([fn.name]);
|
|
246930
|
-
const result = await
|
|
246915
|
+
const result = await deployOne(fn);
|
|
246931
246916
|
results.push(result);
|
|
246932
246917
|
options?.onResult?.(result);
|
|
246933
246918
|
}
|
|
@@ -247041,8 +247026,8 @@ class ProjectConfigReader {
|
|
|
247041
247026
|
project: { ...project, root, configPath },
|
|
247042
247027
|
entities,
|
|
247043
247028
|
functions,
|
|
247044
|
-
actors: localResources.actors,
|
|
247045
247029
|
agents: localResources.agents,
|
|
247030
|
+
agentSkills: localResources.agentSkills,
|
|
247046
247031
|
connectors: localResources.connectors,
|
|
247047
247032
|
authConfig: localResources.authConfig
|
|
247048
247033
|
};
|
|
@@ -247069,23 +247054,16 @@ class ProjectConfigReader {
|
|
|
247069
247054
|
return result.data;
|
|
247070
247055
|
}
|
|
247071
247056
|
async readProjectResources(configPath, project) {
|
|
247072
|
-
const configDir =
|
|
247073
|
-
const [entities, functions,
|
|
247057
|
+
const configDir = dirname8(configPath);
|
|
247058
|
+
const [entities, functions, agents, agentSkills, connectors, authConfig] = await Promise.all([
|
|
247074
247059
|
entityResource.readAll(join11(configDir, project.entitiesDir)),
|
|
247075
247060
|
functionResource.readAll(join11(configDir, project.functionsDir)),
|
|
247076
|
-
actorResource.readAll(join11(configDir, project.actorsDir)),
|
|
247077
247061
|
agentResource.readAll(join11(configDir, project.agentsDir)),
|
|
247062
|
+
agentSkillResource.readAll(join11(configDir, project.agentSkillsDir)),
|
|
247078
247063
|
connectorResource.readAll(join11(configDir, project.connectorsDir)),
|
|
247079
247064
|
authConfigResource.readAll(join11(configDir, project.authDir))
|
|
247080
247065
|
]);
|
|
247081
|
-
return {
|
|
247082
|
-
entities,
|
|
247083
|
-
functions,
|
|
247084
|
-
actors,
|
|
247085
|
-
agents,
|
|
247086
|
-
connectors,
|
|
247087
|
-
authConfig
|
|
247088
|
-
};
|
|
247066
|
+
return { entities, functions, agents, agentSkills, connectors, authConfig };
|
|
247089
247067
|
}
|
|
247090
247068
|
assertPluginProjectDoesNotLoadPlugins(project, configPath) {
|
|
247091
247069
|
if (project.plugin && project.plugins.length > 0) {
|
|
@@ -247106,7 +247084,7 @@ class ProjectConfigReader {
|
|
|
247106
247084
|
this.pluginSourceByNamespace.set(namespace, source);
|
|
247107
247085
|
}
|
|
247108
247086
|
async readPluginConfig(plugin, hostConfigPath) {
|
|
247109
|
-
const pluginRoot = resolvePluginRoot(plugin.source,
|
|
247087
|
+
const pluginRoot = resolvePluginRoot(plugin.source, dirname8(hostConfigPath));
|
|
247110
247088
|
const { configPath } = await this.findConfigOrThrow(pluginRoot);
|
|
247111
247089
|
const project = await this.readConfigFile(configPath);
|
|
247112
247090
|
const namespace = requirePluginNamespace(project, plugin.source, configPath);
|
|
@@ -247118,8 +247096,8 @@ class ProjectConfigReader {
|
|
|
247118
247096
|
return {
|
|
247119
247097
|
entities: markPluginEntities(resources.entities, namespace),
|
|
247120
247098
|
functions: namespacePluginFunctions(resources.functions, namespace),
|
|
247121
|
-
actors: [],
|
|
247122
247099
|
agents: [],
|
|
247100
|
+
agentSkills: [],
|
|
247123
247101
|
connectors: [],
|
|
247124
247102
|
authConfig: []
|
|
247125
247103
|
};
|
|
@@ -247156,8 +247134,8 @@ class ProjectConfigReader {
|
|
|
247156
247134
|
return {
|
|
247157
247135
|
entities,
|
|
247158
247136
|
functions,
|
|
247159
|
-
actors: [],
|
|
247160
247137
|
agents: [],
|
|
247138
|
+
agentSkills: [],
|
|
247161
247139
|
connectors: [],
|
|
247162
247140
|
authConfig: []
|
|
247163
247141
|
};
|
|
@@ -247186,7 +247164,7 @@ async function readProjectConfig(projectRoot) {
|
|
|
247186
247164
|
// src/core/project/template.ts
|
|
247187
247165
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
247188
247166
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
247189
|
-
import { dirname as
|
|
247167
|
+
import { dirname as dirname9, join as join13 } from "node:path";
|
|
247190
247168
|
|
|
247191
247169
|
// src/core/assets.ts
|
|
247192
247170
|
import { cpSync, existsSync } from "node:fs";
|
|
@@ -247346,7 +247324,7 @@ async function renderTemplate(template, destPath, data, options = {}) {
|
|
|
247346
247324
|
if (file2.endsWith(".ejs")) {
|
|
247347
247325
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
247348
247326
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
247349
|
-
const destFile = attributes.outputFileName ? join13(
|
|
247327
|
+
const destFile = attributes.outputFileName ? join13(dirname9(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
247350
247328
|
const destFilePath = join13(destPath, destFile);
|
|
247351
247329
|
if (skipExisting && await pathExists(destFilePath)) {
|
|
247352
247330
|
skipped.push(destFile);
|
|
@@ -247492,28 +247470,28 @@ function hasResourcesToDeploy(projectData) {
|
|
|
247492
247470
|
project,
|
|
247493
247471
|
entities,
|
|
247494
247472
|
functions,
|
|
247495
|
-
actors,
|
|
247496
247473
|
agents,
|
|
247474
|
+
agentSkills,
|
|
247497
247475
|
connectors,
|
|
247498
247476
|
authConfig
|
|
247499
247477
|
} = projectData;
|
|
247500
247478
|
const hasSite = Boolean(project.site?.outputDirectory);
|
|
247501
247479
|
const hasEntities = entities.length > 0;
|
|
247502
247480
|
const hasFunctions = functions.length > 0;
|
|
247503
|
-
const hasActors = actors.length > 0;
|
|
247504
247481
|
const hasAgents = agents.length > 0;
|
|
247482
|
+
const hasAgentSkills = agentSkills.length > 0;
|
|
247505
247483
|
const hasConnectors = connectors.length > 0;
|
|
247506
247484
|
const hasAuthConfig = authConfig.length > 0;
|
|
247507
247485
|
const hasVisibility = Boolean(project.visibility);
|
|
247508
|
-
return hasEntities || hasFunctions ||
|
|
247486
|
+
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
247509
247487
|
}
|
|
247510
247488
|
async function deployAll(projectData, options) {
|
|
247511
247489
|
const {
|
|
247512
247490
|
project,
|
|
247513
247491
|
entities,
|
|
247514
247492
|
functions,
|
|
247515
|
-
actors,
|
|
247516
247493
|
agents,
|
|
247494
|
+
agentSkills,
|
|
247517
247495
|
connectors,
|
|
247518
247496
|
authConfig
|
|
247519
247497
|
} = projectData;
|
|
@@ -247526,7 +247504,7 @@ async function deployAll(projectData, options) {
|
|
|
247526
247504
|
onStart: options?.onFunctionStart,
|
|
247527
247505
|
onResult: options?.onFunctionResult
|
|
247528
247506
|
});
|
|
247529
|
-
await
|
|
247507
|
+
await agentSkillResource.push(agentSkills);
|
|
247530
247508
|
await agentResource.push(agents);
|
|
247531
247509
|
await authConfigResource.push(authConfig);
|
|
247532
247510
|
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
@@ -254575,6 +254553,16 @@ function toJsonStdout(result) {
|
|
|
254575
254553
|
return `${JSON.stringify(result, null, 2)}
|
|
254576
254554
|
`;
|
|
254577
254555
|
}
|
|
254556
|
+
// src/cli/errors.ts
|
|
254557
|
+
class CLIExitError extends Error {
|
|
254558
|
+
code;
|
|
254559
|
+
constructor(code2) {
|
|
254560
|
+
super(`CLI exited with code ${code2}`);
|
|
254561
|
+
this.code = code2;
|
|
254562
|
+
this.name = "CLIExitError";
|
|
254563
|
+
}
|
|
254564
|
+
}
|
|
254565
|
+
|
|
254578
254566
|
// src/cli/utils/prompts.ts
|
|
254579
254567
|
var onPromptCancel = () => {
|
|
254580
254568
|
Ne("Operation cancelled.");
|
|
@@ -254814,136 +254802,75 @@ async function moveAppToWorkspace(appId, targetWorkspaceId, options = {}) {
|
|
|
254814
254802
|
}
|
|
254815
254803
|
return result.data;
|
|
254816
254804
|
}
|
|
254817
|
-
// src/cli/commands/
|
|
254818
|
-
function
|
|
254819
|
-
|
|
254820
|
-
|
|
254821
|
-
|
|
254822
|
-
|
|
254823
|
-
|
|
254824
|
-
const
|
|
254825
|
-
|
|
254826
|
-
|
|
254827
|
-
}
|
|
254828
|
-
return allActors.filter((a2) => names.includes(a2.name));
|
|
254829
|
-
}
|
|
254830
|
-
function formatDeployResult(result, log) {
|
|
254831
|
-
const label = result.name.padEnd(25);
|
|
254832
|
-
if (result.status === "deployed") {
|
|
254833
|
-
const timing = result.durationMs ? theme.styles.dim(` (${(result.durationMs / 1000).toFixed(1)}s)`) : "";
|
|
254834
|
-
log.success(`${label} deployed${timing}`);
|
|
254835
|
-
} else if (result.status === "unchanged") {
|
|
254836
|
-
log.success(`${label} unchanged`);
|
|
254837
|
-
} else {
|
|
254838
|
-
log.error(`${label} error: ${result.error}`);
|
|
254839
|
-
}
|
|
254840
|
-
}
|
|
254841
|
-
function buildDeploySummary(results) {
|
|
254842
|
-
const deployed = results.filter((r) => r.status === "deployed").length;
|
|
254843
|
-
const unchanged = results.filter((r) => r.status === "unchanged").length;
|
|
254844
|
-
const failed = results.filter((r) => r.status === "error").length;
|
|
254845
|
-
const parts = [];
|
|
254846
|
-
if (deployed > 0)
|
|
254847
|
-
parts.push(`${deployed} deployed`);
|
|
254848
|
-
if (unchanged > 0)
|
|
254849
|
-
parts.push(`${unchanged} unchanged`);
|
|
254850
|
-
if (failed > 0)
|
|
254851
|
-
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
254852
|
-
return parts.join(", ") || "No actors deployed";
|
|
254853
|
-
}
|
|
254854
|
-
async function deployActorAction({ log }, names) {
|
|
254855
|
-
const { actors } = await readProjectConfig();
|
|
254856
|
-
const toDeploy = resolveActorsToDeploy(names, actors);
|
|
254857
|
-
if (toDeploy.length === 0) {
|
|
254858
|
-
return {
|
|
254859
|
-
outroMessage: "No actors found. Create actors in the 'actors' directory."
|
|
254860
|
-
};
|
|
254861
|
-
}
|
|
254862
|
-
log.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "actor" : "actors"} to deploy`);
|
|
254863
|
-
let completed = 0;
|
|
254864
|
-
const total = toDeploy.length;
|
|
254865
|
-
const results = await deployActorsSequentially(toDeploy, {
|
|
254866
|
-
onStart: (startNames) => {
|
|
254867
|
-
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} actors`;
|
|
254868
|
-
log.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
254869
|
-
},
|
|
254870
|
-
onResult: (result) => {
|
|
254871
|
-
completed++;
|
|
254872
|
-
formatDeployResult(result, log);
|
|
254873
|
-
}
|
|
254805
|
+
// src/cli/commands/agent-skills/pull.ts
|
|
254806
|
+
async function pullAction({
|
|
254807
|
+
log,
|
|
254808
|
+
runTask: runTask2
|
|
254809
|
+
}) {
|
|
254810
|
+
const { project: project2 } = await readProjectConfig();
|
|
254811
|
+
const dir = join15(dirname10(project2.configPath), project2.agentSkillsDir);
|
|
254812
|
+
const remote = await runTask2("Fetching agent skills from Base44", () => fetchAgentSkills(), {
|
|
254813
|
+
successMessage: "Agent skills fetched successfully",
|
|
254814
|
+
errorMessage: "Failed to fetch agent skills"
|
|
254874
254815
|
});
|
|
254875
|
-
const
|
|
254876
|
-
|
|
254877
|
-
|
|
254878
|
-
throw new CLIExitError(1);
|
|
254879
|
-
}
|
|
254880
|
-
return { outroMessage: buildDeploySummary(results) };
|
|
254881
|
-
}
|
|
254882
|
-
function getDeployCommand() {
|
|
254883
|
-
return new Base44Command("deploy").description("Deploy actors to Base44").argument("[names...]", "Actor names to deploy (deploys all if omitted)").action(async (ctx, rawNames) => {
|
|
254884
|
-
const names = parseNames(rawNames);
|
|
254885
|
-
return deployActorAction(ctx, names);
|
|
254816
|
+
const { written, deleted } = await runTask2("Syncing skill files", () => writeAgentSkills(dir, remote.items), {
|
|
254817
|
+
successMessage: "Skill files synced successfully",
|
|
254818
|
+
errorMessage: "Failed to sync skill files"
|
|
254886
254819
|
});
|
|
254820
|
+
if (written.length > 0)
|
|
254821
|
+
log.success(`Written: ${written.join(", ")}`);
|
|
254822
|
+
if (deleted.length > 0)
|
|
254823
|
+
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
254824
|
+
if (written.length === 0 && deleted.length === 0)
|
|
254825
|
+
log.info("All skills are already up to date");
|
|
254826
|
+
return { outroMessage: `Pulled ${remote.total} agent skills to ${dir}` };
|
|
254887
254827
|
}
|
|
254888
|
-
|
|
254889
|
-
|
|
254890
|
-
import { dirname as dirname12, join as join15 } from "node:path";
|
|
254891
|
-
function buildActorScaffold(actorName) {
|
|
254892
|
-
return `import { Actor } from "base44:runtime/actors";
|
|
254893
|
-
import type { Conn } from "@base44/sdk";
|
|
254894
|
-
|
|
254895
|
-
interface State {
|
|
254896
|
-
// shared state broadcast to all clients
|
|
254897
|
-
}
|
|
254898
|
-
|
|
254899
|
-
interface Message {
|
|
254900
|
-
// messages sent from clients
|
|
254828
|
+
function getAgentSkillsPullCommand() {
|
|
254829
|
+
return new Base44Command("pull").description("Pull agent skills from Base44 to local files (replaces all local agent skills)").action(pullAction);
|
|
254901
254830
|
}
|
|
254902
254831
|
|
|
254903
|
-
|
|
254904
|
-
|
|
254905
|
-
|
|
254906
|
-
}
|
|
254907
|
-
|
|
254908
|
-
|
|
254909
|
-
|
|
254910
|
-
|
|
254911
|
-
|
|
254912
|
-
}
|
|
254913
|
-
|
|
254914
|
-
}
|
|
254915
|
-
async function newActorAction(_ctx, actorName) {
|
|
254916
|
-
const { project: project2 } = await readProjectConfig();
|
|
254917
|
-
const actorsDir = join15(dirname12(project2.configPath), project2.actorsDir);
|
|
254918
|
-
const actorDir = join15(actorsDir, actorName);
|
|
254919
|
-
if (await pathExists(actorDir)) {
|
|
254920
|
-
throw new InvalidInputError(`Actor "${actorName}" already exists at ${actorDir}`);
|
|
254832
|
+
// src/cli/commands/agent-skills/push.ts
|
|
254833
|
+
async function pushAction({ isNonInteractive, log, runTask: runTask2 }, options) {
|
|
254834
|
+
const { agentSkills } = await readProjectConfig();
|
|
254835
|
+
log.info(agentSkills.length === 0 ? "No local agent skills found - this will delete all remote skills" : `Found ${agentSkills.length} agent skills to push`);
|
|
254836
|
+
const proceed = await confirmPush({
|
|
254837
|
+
isNonInteractive,
|
|
254838
|
+
yes: options.yes,
|
|
254839
|
+
log,
|
|
254840
|
+
warning: "This will replace all remote agent skills with your local skills and delete any not present locally."
|
|
254841
|
+
});
|
|
254842
|
+
if (!proceed) {
|
|
254843
|
+
return { outroMessage: "Push cancelled" };
|
|
254921
254844
|
}
|
|
254922
|
-
const
|
|
254923
|
-
|
|
254924
|
-
|
|
254925
|
-
outroMessage: `Created actor "${actorName}" at ${entryPath}`
|
|
254926
|
-
};
|
|
254927
|
-
}
|
|
254928
|
-
function getNewCommand() {
|
|
254929
|
-
return new Base44Command("new").description("Create a new actor scaffold").argument("<ActorName>", "Name of the actor class").action(async (ctx, actorName) => {
|
|
254930
|
-
return newActorAction(ctx, actorName);
|
|
254845
|
+
const result = await runTask2("Pushing agent skills to Base44", () => pushAgentSkills(agentSkills), {
|
|
254846
|
+
successMessage: "Agent skills pushed successfully",
|
|
254847
|
+
errorMessage: "Failed to push agent skills"
|
|
254931
254848
|
});
|
|
254849
|
+
if (result.created.length > 0)
|
|
254850
|
+
log.success(`Created: ${result.created.join(", ")}`);
|
|
254851
|
+
if (result.updated.length > 0)
|
|
254852
|
+
log.success(`Updated: ${result.updated.join(", ")}`);
|
|
254853
|
+
if (result.deleted.length > 0)
|
|
254854
|
+
log.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
254855
|
+
return { outroMessage: "Agent skills pushed to Base44" };
|
|
254856
|
+
}
|
|
254857
|
+
function getAgentSkillsPushCommand() {
|
|
254858
|
+
return new Base44Command("push").description("Push local agent skills to Base44 (replaces all remote agent skills)").option("-y, --yes", "Skip confirmation prompt").action(pushAction);
|
|
254932
254859
|
}
|
|
254933
254860
|
|
|
254934
|
-
// src/cli/commands/
|
|
254935
|
-
function
|
|
254936
|
-
return new Command("
|
|
254861
|
+
// src/cli/commands/agent-skills/index.ts
|
|
254862
|
+
function getAgentSkillsCommand() {
|
|
254863
|
+
return new Command("agent-skills").description("Manage project agent skills").addCommand(getAgentSkillsPushCommand()).addCommand(getAgentSkillsPullCommand());
|
|
254937
254864
|
}
|
|
254938
254865
|
|
|
254939
254866
|
// src/cli/commands/agents/pull.ts
|
|
254940
|
-
import { dirname as
|
|
254867
|
+
import { dirname as dirname11, join as join16 } from "node:path";
|
|
254941
254868
|
async function pullAgentsAction({
|
|
254942
254869
|
log,
|
|
254943
254870
|
runTask: runTask2
|
|
254944
254871
|
}) {
|
|
254945
254872
|
const { project: project2 } = await readProjectConfig();
|
|
254946
|
-
const configDir =
|
|
254873
|
+
const configDir = dirname11(project2.configPath);
|
|
254947
254874
|
const agentsDir = join16(configDir, project2.agentsDir);
|
|
254948
254875
|
const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
|
|
254949
254876
|
return await fetchAgents();
|
|
@@ -255014,11 +254941,11 @@ function getAgentsCommand() {
|
|
|
255014
254941
|
}
|
|
255015
254942
|
|
|
255016
254943
|
// src/cli/commands/auth/password-login.ts
|
|
255017
|
-
import { dirname as
|
|
254944
|
+
import { dirname as dirname12, join as join17 } from "node:path";
|
|
255018
254945
|
async function passwordLoginAction({ log, runTask: runTask2 }, action) {
|
|
255019
254946
|
const shouldEnable = action === "enable";
|
|
255020
254947
|
const { project: project2 } = await readProjectConfig();
|
|
255021
|
-
const configDir =
|
|
254948
|
+
const configDir = dirname12(project2.configPath);
|
|
255022
254949
|
const authDir = join17(configDir, project2.authDir);
|
|
255023
254950
|
const updated = await runTask2("Updating local auth config", async () => {
|
|
255024
254951
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
@@ -255039,13 +254966,13 @@ function getPasswordLoginCommand() {
|
|
|
255039
254966
|
}
|
|
255040
254967
|
|
|
255041
254968
|
// src/cli/commands/auth/pull.ts
|
|
255042
|
-
import { dirname as
|
|
254969
|
+
import { dirname as dirname13, join as join18 } from "node:path";
|
|
255043
254970
|
async function pullAuthAction({
|
|
255044
254971
|
log,
|
|
255045
254972
|
runTask: runTask2
|
|
255046
254973
|
}) {
|
|
255047
254974
|
const { project: project2 } = await readProjectConfig();
|
|
255048
|
-
const configDir =
|
|
254975
|
+
const configDir = dirname13(project2.configPath);
|
|
255049
254976
|
const authDir = join18(configDir, project2.authDir);
|
|
255050
254977
|
const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
|
|
255051
254978
|
return await pullAuthConfig();
|
|
@@ -255110,7 +255037,7 @@ function getAuthPushCommand() {
|
|
|
255110
255037
|
}
|
|
255111
255038
|
|
|
255112
255039
|
// src/cli/commands/auth/social-login.ts
|
|
255113
|
-
import { dirname as
|
|
255040
|
+
import { dirname as dirname14, join as join19, resolve as resolve4 } from "node:path";
|
|
255114
255041
|
var PROVIDER_LABELS = {
|
|
255115
255042
|
google: "Google",
|
|
255116
255043
|
microsoft: "Microsoft",
|
|
@@ -255180,7 +255107,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
255180
255107
|
}
|
|
255181
255108
|
}
|
|
255182
255109
|
const { project: project2 } = await readProjectConfig();
|
|
255183
|
-
const configDir =
|
|
255110
|
+
const configDir = dirname14(project2.configPath);
|
|
255184
255111
|
const authDir = join19(configDir, project2.authDir);
|
|
255185
255112
|
const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
255186
255113
|
if (clientSecret) {
|
|
@@ -255206,7 +255133,7 @@ function getSocialLoginCommand() {
|
|
|
255206
255133
|
}
|
|
255207
255134
|
|
|
255208
255135
|
// src/cli/commands/auth/sso.ts
|
|
255209
|
-
import { dirname as
|
|
255136
|
+
import { dirname as dirname15, join as join20, resolve as resolve5 } from "node:path";
|
|
255210
255137
|
var SSOConfigFileSchema = exports_external.object({
|
|
255211
255138
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
255212
255139
|
clientId: exports_external.string(),
|
|
@@ -255369,7 +255296,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
255369
255296
|
throw error48;
|
|
255370
255297
|
}
|
|
255371
255298
|
const { project: project2 } = await readProjectConfig();
|
|
255372
|
-
const configDir =
|
|
255299
|
+
const configDir = dirname15(project2.configPath);
|
|
255373
255300
|
const authDir = join20(configDir, project2.authDir);
|
|
255374
255301
|
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
255375
255302
|
await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
@@ -255385,7 +255312,7 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
|
|
|
255385
255312
|
throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
|
|
255386
255313
|
}
|
|
255387
255314
|
const { project: project2 } = await readProjectConfig();
|
|
255388
|
-
const configDir =
|
|
255315
|
+
const configDir = dirname15(project2.configPath);
|
|
255389
255316
|
const authDir = join20(configDir, project2.authDir);
|
|
255390
255317
|
const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
255391
255318
|
await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
@@ -256243,13 +256170,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
256243
256170
|
}
|
|
256244
256171
|
|
|
256245
256172
|
// src/cli/commands/connectors/pull.ts
|
|
256246
|
-
import { dirname as
|
|
256173
|
+
import { dirname as dirname16, join as join21, resolve as resolve6 } from "node:path";
|
|
256247
256174
|
async function resolveConnectorsDir(options) {
|
|
256248
256175
|
if (!getAppContext().projectRoot) {
|
|
256249
256176
|
return resolve6(options.dir ?? "connectors");
|
|
256250
256177
|
}
|
|
256251
256178
|
const { project: project2 } = await readProjectConfig();
|
|
256252
|
-
return join21(
|
|
256179
|
+
return join21(dirname16(project2.configPath), project2.connectorsDir);
|
|
256253
256180
|
}
|
|
256254
256181
|
async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
|
|
256255
256182
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -256504,18 +256431,18 @@ async function deleteFunctionsAction({ runTask: runTask2 }, names) {
|
|
|
256504
256431
|
parts.push(`${errors5} error${errors5 !== 1 ? "s" : ""}`);
|
|
256505
256432
|
return { outroMessage: parts.join(", ") };
|
|
256506
256433
|
}
|
|
256507
|
-
function
|
|
256434
|
+
function parseNames(args) {
|
|
256508
256435
|
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
256509
256436
|
}
|
|
256510
256437
|
function validateNames(command2) {
|
|
256511
|
-
const names =
|
|
256438
|
+
const names = parseNames(command2.args);
|
|
256512
256439
|
if (names.length === 0) {
|
|
256513
256440
|
command2.error("At least one function name is required");
|
|
256514
256441
|
}
|
|
256515
256442
|
}
|
|
256516
256443
|
function getDeleteCommand() {
|
|
256517
256444
|
return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (ctx, rawNames) => {
|
|
256518
|
-
const names =
|
|
256445
|
+
const names = parseNames(rawNames);
|
|
256519
256446
|
return deleteFunctionsAction(ctx, names);
|
|
256520
256447
|
});
|
|
256521
256448
|
}
|
|
@@ -256524,7 +256451,7 @@ function getDeleteCommand() {
|
|
|
256524
256451
|
function formatDuration(ms) {
|
|
256525
256452
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
256526
256453
|
}
|
|
256527
|
-
function
|
|
256454
|
+
function formatDeployResult(result, log) {
|
|
256528
256455
|
const label = result.name.padEnd(25);
|
|
256529
256456
|
if (result.status === "deployed") {
|
|
256530
256457
|
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
@@ -256537,7 +256464,7 @@ function formatDeployResult2(result, log) {
|
|
|
256537
256464
|
}
|
|
256538
256465
|
|
|
256539
256466
|
// src/cli/commands/functions/parseNames.ts
|
|
256540
|
-
function
|
|
256467
|
+
function parseNames2(args) {
|
|
256541
256468
|
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
256542
256469
|
}
|
|
256543
256470
|
|
|
@@ -256564,7 +256491,7 @@ function formatPruneSummary(pruneResults, log) {
|
|
|
256564
256491
|
log.info(`${pruned} deleted`);
|
|
256565
256492
|
}
|
|
256566
256493
|
}
|
|
256567
|
-
function
|
|
256494
|
+
function buildDeploySummary(results) {
|
|
256568
256495
|
const deployed = results.filter((r) => r.status === "deployed").length;
|
|
256569
256496
|
const unchanged = results.filter((r) => r.status === "unchanged").length;
|
|
256570
256497
|
const failed = results.filter((r) => r.status === "error").length;
|
|
@@ -256598,12 +256525,12 @@ async function deployFunctionsAction({ log }, names, options) {
|
|
|
256598
256525
|
},
|
|
256599
256526
|
onResult: (result) => {
|
|
256600
256527
|
completed++;
|
|
256601
|
-
|
|
256528
|
+
formatDeployResult(result, log);
|
|
256602
256529
|
}
|
|
256603
256530
|
});
|
|
256604
256531
|
const hasFailures = results.some((r) => r.status === "error");
|
|
256605
256532
|
if (hasFailures) {
|
|
256606
|
-
log.message(
|
|
256533
|
+
log.message(buildDeploySummary(results));
|
|
256607
256534
|
throw new CLIExitError(1);
|
|
256608
256535
|
}
|
|
256609
256536
|
if (options.force) {
|
|
@@ -256625,11 +256552,11 @@ async function deployFunctionsAction({ log }, names, options) {
|
|
|
256625
256552
|
});
|
|
256626
256553
|
formatPruneSummary(pruneResults, log);
|
|
256627
256554
|
}
|
|
256628
|
-
return { outroMessage:
|
|
256555
|
+
return { outroMessage: buildDeploySummary(results) };
|
|
256629
256556
|
}
|
|
256630
|
-
function
|
|
256557
|
+
function getDeployCommand() {
|
|
256631
256558
|
return new Base44Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (ctx, rawNames, options) => {
|
|
256632
|
-
const names =
|
|
256559
|
+
const names = parseNames2(rawNames);
|
|
256633
256560
|
return deployFunctionsAction(ctx, names, options);
|
|
256634
256561
|
});
|
|
256635
256562
|
}
|
|
@@ -256657,10 +256584,10 @@ function getListCommand() {
|
|
|
256657
256584
|
}
|
|
256658
256585
|
|
|
256659
256586
|
// src/cli/commands/functions/pull.ts
|
|
256660
|
-
import { dirname as
|
|
256587
|
+
import { dirname as dirname17, join as join22 } from "node:path";
|
|
256661
256588
|
async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
|
|
256662
256589
|
const { project: project2, functions } = await readProjectConfig();
|
|
256663
|
-
const configDir =
|
|
256590
|
+
const configDir = dirname17(project2.configPath);
|
|
256664
256591
|
const functionsDir = join22(configDir, project2.functionsDir);
|
|
256665
256592
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
256666
256593
|
const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
|
|
@@ -256716,11 +256643,11 @@ function getPullCommand() {
|
|
|
256716
256643
|
|
|
256717
256644
|
// src/cli/commands/functions/index.ts
|
|
256718
256645
|
function getFunctionsCommand() {
|
|
256719
|
-
return new Command("functions").description("Manage backend functions").addCommand(
|
|
256646
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand()).addCommand(getDeleteCommand()).addCommand(getListCommand()).addCommand(getPullCommand());
|
|
256720
256647
|
}
|
|
256721
256648
|
|
|
256722
256649
|
// src/cli/commands/project/create.ts
|
|
256723
|
-
import { basename as
|
|
256650
|
+
import { basename as basename4, resolve as resolve8 } from "node:path";
|
|
256724
256651
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
256725
256652
|
|
|
256726
256653
|
// src/cli/commands/project/scaffold-shared.ts
|
|
@@ -256741,7 +256668,7 @@ async function completeProjectSetup({
|
|
|
256741
256668
|
projectId,
|
|
256742
256669
|
name: name2,
|
|
256743
256670
|
resolvedPath,
|
|
256744
|
-
deploy:
|
|
256671
|
+
deploy: deploy5,
|
|
256745
256672
|
skills,
|
|
256746
256673
|
isInteractive
|
|
256747
256674
|
}, { runTask: runTask2 }) {
|
|
@@ -256755,7 +256682,7 @@ async function completeProjectSetup({
|
|
|
256755
256682
|
});
|
|
256756
256683
|
shouldPushEntities = !Ct(result) && result;
|
|
256757
256684
|
} else {
|
|
256758
|
-
shouldPushEntities = !!
|
|
256685
|
+
shouldPushEntities = !!deploy5;
|
|
256759
256686
|
}
|
|
256760
256687
|
if (shouldPushEntities) {
|
|
256761
256688
|
await runTask2(`Pushing ${entities.length} data models to Base44...`, async () => {
|
|
@@ -256775,7 +256702,7 @@ async function completeProjectSetup({
|
|
|
256775
256702
|
});
|
|
256776
256703
|
shouldDeploy = !Ct(result) && result;
|
|
256777
256704
|
} else {
|
|
256778
|
-
shouldDeploy = !!
|
|
256705
|
+
shouldDeploy = !!deploy5;
|
|
256779
256706
|
}
|
|
256780
256707
|
if (shouldDeploy && installCommand && buildCommand && outputDirectory) {
|
|
256781
256708
|
const { appUrl } = await runTask2("Installing dependencies...", async (updateMessage) => {
|
|
@@ -256881,8 +256808,8 @@ async function createInteractive(options, ctx) {
|
|
|
256881
256808
|
name: () => {
|
|
256882
256809
|
return options.name ? Promise.resolve(options.name) : Ze({
|
|
256883
256810
|
message: "What is the name of your project?",
|
|
256884
|
-
placeholder:
|
|
256885
|
-
initialValue:
|
|
256811
|
+
placeholder: basename4(process.cwd()),
|
|
256812
|
+
initialValue: basename4(process.cwd()),
|
|
256886
256813
|
validate: (value) => {
|
|
256887
256814
|
if (!value || value.trim().length === 0) {
|
|
256888
256815
|
return "Every project deserves a name";
|
|
@@ -256929,7 +256856,7 @@ async function executeCreate({
|
|
|
256929
256856
|
name: rawName,
|
|
256930
256857
|
description,
|
|
256931
256858
|
projectPath,
|
|
256932
|
-
deploy:
|
|
256859
|
+
deploy: deploy5,
|
|
256933
256860
|
skills,
|
|
256934
256861
|
workspaceId: flagWorkspaceId,
|
|
256935
256862
|
isInteractive
|
|
@@ -256951,7 +256878,7 @@ async function executeCreate({
|
|
|
256951
256878
|
errorMessage: "Failed to create project"
|
|
256952
256879
|
});
|
|
256953
256880
|
setAppContext({ id: projectId, projectRoot: resolvedPath });
|
|
256954
|
-
const summary = await completeProjectSetup({ projectId, name: name2, resolvedPath, deploy:
|
|
256881
|
+
const summary = await completeProjectSetup({ projectId, name: name2, resolvedPath, deploy: deploy5, skills, isInteractive }, ctx);
|
|
256955
256882
|
printProjectSummary(summary, log);
|
|
256956
256883
|
return { outroMessage: "Your project is set up and ready to use" };
|
|
256957
256884
|
}
|
|
@@ -256997,15 +256924,7 @@ async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
|
256997
256924
|
outroMessage: "No resources found to deploy"
|
|
256998
256925
|
};
|
|
256999
256926
|
}
|
|
257000
|
-
const {
|
|
257001
|
-
project: project2,
|
|
257002
|
-
entities,
|
|
257003
|
-
functions,
|
|
257004
|
-
actors,
|
|
257005
|
-
agents,
|
|
257006
|
-
connectors,
|
|
257007
|
-
authConfig
|
|
257008
|
-
} = projectData;
|
|
256927
|
+
const { project: project2, entities, functions, agents, connectors, authConfig } = projectData;
|
|
257009
256928
|
const summaryLines = [];
|
|
257010
256929
|
if (entities.length > 0) {
|
|
257011
256930
|
summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
|
|
@@ -257013,9 +256932,6 @@ async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
|
257013
256932
|
if (functions.length > 0) {
|
|
257014
256933
|
summaryLines.push(` - ${functions.length} ${functions.length === 1 ? "function" : "functions"}`);
|
|
257015
256934
|
}
|
|
257016
|
-
if (actors.length > 0) {
|
|
257017
|
-
summaryLines.push(` - ${actors.length} ${actors.length === 1 ? "actor" : "actors"}`);
|
|
257018
|
-
}
|
|
257019
256935
|
if (agents.length > 0) {
|
|
257020
256936
|
summaryLines.push(` - ${agents.length} ${agents.length === 1 ? "agent" : "agents"}`);
|
|
257021
256937
|
}
|
|
@@ -257058,7 +256974,7 @@ ${summaryLines.join(`
|
|
|
257058
256974
|
},
|
|
257059
256975
|
onFunctionResult: (r) => {
|
|
257060
256976
|
functionCompleted++;
|
|
257061
|
-
|
|
256977
|
+
formatDeployResult(r, log);
|
|
257062
256978
|
}
|
|
257063
256979
|
});
|
|
257064
256980
|
const connectorResults = result.connectorResults ?? [];
|
|
@@ -257073,7 +256989,7 @@ ${summaryLines.join(`
|
|
|
257073
256989
|
}
|
|
257074
256990
|
return { outroMessage: "App deployed successfully" };
|
|
257075
256991
|
}
|
|
257076
|
-
function
|
|
256992
|
+
function getDeployCommand2() {
|
|
257077
256993
|
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(deployAction);
|
|
257078
256994
|
}
|
|
257079
256995
|
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
@@ -257466,7 +257382,7 @@ function getLogsCommand() {
|
|
|
257466
257382
|
}
|
|
257467
257383
|
|
|
257468
257384
|
// src/cli/commands/project/scaffold.ts
|
|
257469
|
-
import { basename as
|
|
257385
|
+
import { basename as basename5, resolve as resolve9 } from "node:path";
|
|
257470
257386
|
function resolveAppId(options) {
|
|
257471
257387
|
const appId = options.appId;
|
|
257472
257388
|
if (!appId) {
|
|
@@ -257483,7 +257399,7 @@ async function scaffoldAction(ctx, name2, options, command2) {
|
|
|
257483
257399
|
const { log, runTask: runTask2 } = ctx;
|
|
257484
257400
|
const appId = resolveAppId(command2.optsWithGlobals());
|
|
257485
257401
|
const resolvedPath = resolve9("./");
|
|
257486
|
-
const projectName = (name2 ??
|
|
257402
|
+
const projectName = (name2 ?? basename5(resolvedPath)).trim();
|
|
257487
257403
|
const template2 = await getTemplateById("backend-only");
|
|
257488
257404
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
257489
257405
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
@@ -257997,7 +257913,6 @@ function getSiteCommand() {
|
|
|
257997
257913
|
// src/core/types/generator.ts
|
|
257998
257914
|
var import_common_tags = __toESM(require_lib2(), 1);
|
|
257999
257915
|
var import_json_schema_to_typescript = __toESM(require_src3(), 1);
|
|
258000
|
-
import { join as join26 } from "node:path";
|
|
258001
257916
|
var HEADER2 = import_common_tags.stripIndent`
|
|
258002
257917
|
// Auto-generated by Base44 CLI - DO NOT EDIT
|
|
258003
257918
|
// Regenerate with: base44 types generate
|
|
@@ -258006,43 +257921,24 @@ var EMPTY_TEMPLATE = import_common_tags.stripIndent`
|
|
|
258006
257921
|
// Auto-generated by Base44 CLI - DO NOT EDIT
|
|
258007
257922
|
// Regenerate with: base44 types
|
|
258008
257923
|
//
|
|
258009
|
-
// No entities, functions, agents,
|
|
258010
|
-
// Add resources to base44/entities/, base44/functions/, base44/agents/,
|
|
257924
|
+
// No entities, functions, agents, or connectors found in project.
|
|
257925
|
+
// Add resources to base44/entities/, base44/functions/, base44/agents/, or base44/connectors/
|
|
258011
257926
|
// and run \`base44 types generate\` again.
|
|
258012
257927
|
|
|
258013
257928
|
declare module '@base44/sdk' {
|
|
258014
257929
|
// No types to augment - add resources and regenerate
|
|
258015
257930
|
}
|
|
258016
257931
|
`;
|
|
258017
|
-
var SDK_PACKAGE_NAMES = ["@base44/sdk", "@base44-preview/sdk"];
|
|
258018
|
-
async function detectSdkPackageName(projectRoot) {
|
|
258019
|
-
try {
|
|
258020
|
-
const pkg = await readJsonFile(join26(projectRoot, "package.json"));
|
|
258021
|
-
const deps = {
|
|
258022
|
-
...pkg.dependencies,
|
|
258023
|
-
...pkg.devDependencies
|
|
258024
|
-
};
|
|
258025
|
-
for (const name2 of SDK_PACKAGE_NAMES) {
|
|
258026
|
-
if (name2 in deps)
|
|
258027
|
-
return name2;
|
|
258028
|
-
}
|
|
258029
|
-
} catch {}
|
|
258030
|
-
return "@base44/sdk";
|
|
258031
|
-
}
|
|
258032
257932
|
async function generateTypesFile(input) {
|
|
258033
257933
|
const content = await generateContent(input);
|
|
258034
257934
|
await writeFile(getTypesOutputPath(input.projectRoot), content);
|
|
258035
257935
|
}
|
|
258036
257936
|
async function generateContent(input) {
|
|
258037
|
-
const { entities, functions, agents, connectors
|
|
258038
|
-
|
|
258039
|
-
if (!entities.length && !functions.length && !agents.length && !connectors.length && !actors.length) {
|
|
257937
|
+
const { entities, functions, agents, connectors } = input;
|
|
257938
|
+
if (!entities.length && !functions.length && !agents.length && !connectors.length) {
|
|
258040
257939
|
return EMPTY_TEMPLATE;
|
|
258041
257940
|
}
|
|
258042
|
-
const
|
|
258043
|
-
Promise.all(entities.map((e8) => compileEntity(e8))),
|
|
258044
|
-
Promise.all(actors.map((a5) => compileActor(a5)))
|
|
258045
|
-
]);
|
|
257941
|
+
const entityInterfaces = await Promise.all(entities.map((e8) => compileEntity(e8)));
|
|
258046
257942
|
const registryEntries = [
|
|
258047
257943
|
[
|
|
258048
257944
|
"EntityTypeRegistry",
|
|
@@ -258050,40 +257946,21 @@ async function generateContent(input) {
|
|
|
258050
257946
|
],
|
|
258051
257947
|
["FunctionNameRegistry", functions.map((f7) => `"${f7.name}": true;`)],
|
|
258052
257948
|
["AgentNameRegistry", agents.map((a5) => `"${a5.name}": true;`)],
|
|
258053
|
-
["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)]
|
|
258054
|
-
["ActorNameRegistry", actors.map((a5) => `"${a5.name}": true;`)],
|
|
258055
|
-
[
|
|
258056
|
-
"ActorRegistry",
|
|
258057
|
-
actors.filter((a5) => a5.messageSchema).map((a5) => {
|
|
258058
|
-
const idx = actors.indexOf(a5);
|
|
258059
|
-
return `"${a5.name}": ${actorResults[idx].entry};`;
|
|
258060
|
-
})
|
|
258061
|
-
]
|
|
257949
|
+
["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)]
|
|
258062
257950
|
];
|
|
258063
257951
|
const registries2 = registryEntries.filter(([, entries]) => entries.length > 0).map(([name2, entries]) => registry2(name2, entries));
|
|
258064
|
-
const actorInterfaces = actorResults.map((r5) => r5.decls).filter(Boolean);
|
|
258065
|
-
const actorRuntimeModule = actors.length ? import_common_tags.source`
|
|
258066
|
-
declare module 'base44:runtime/actors' {
|
|
258067
|
-
export { Actor } from '${sdkPackage}';
|
|
258068
|
-
}
|
|
258069
|
-
` : "";
|
|
258070
257952
|
return [
|
|
258071
257953
|
HEADER2,
|
|
258072
|
-
"export {};",
|
|
258073
257954
|
entityInterfaces.join(`
|
|
258074
257955
|
|
|
258075
|
-
`),
|
|
258076
|
-
actorInterfaces.join(`
|
|
258077
|
-
|
|
258078
257956
|
`),
|
|
258079
257957
|
import_common_tags.source`
|
|
258080
|
-
declare module '
|
|
257958
|
+
declare module '@base44/sdk' {
|
|
258081
257959
|
${registries2.join(`
|
|
258082
257960
|
|
|
258083
257961
|
`)}
|
|
258084
257962
|
}
|
|
258085
|
-
|
|
258086
|
-
actorRuntimeModule
|
|
257963
|
+
`
|
|
258087
257964
|
].filter(Boolean).join(`
|
|
258088
257965
|
|
|
258089
257966
|
`);
|
|
@@ -258106,81 +257983,6 @@ async function compileEntity(entity2) {
|
|
|
258106
257983
|
throw new TypeGenerationError(`Failed to generate types for entity "${name2}"`, name2, error48);
|
|
258107
257984
|
}
|
|
258108
257985
|
}
|
|
258109
|
-
async function compileActor(actor) {
|
|
258110
|
-
const { messageSchema } = actor;
|
|
258111
|
-
if (!messageSchema) {
|
|
258112
|
-
return { decls: "", entry: "{ toClient: unknown; toServer: unknown }" };
|
|
258113
|
-
}
|
|
258114
|
-
const prefix = toPascalCase(actor.name);
|
|
258115
|
-
const types = messageSchema.types ?? {};
|
|
258116
|
-
const toClient = messageSchema.toClient ?? {};
|
|
258117
|
-
const toServer = messageSchema.toServer ?? {};
|
|
258118
|
-
const typeName = (key2) => `${prefix}${toPascalCase(key2)}`;
|
|
258119
|
-
const msgName = (dir, key2) => `${prefix}${dir}${toPascalCase(key2)}`;
|
|
258120
|
-
const defs = {};
|
|
258121
|
-
const add = (name2, schema12) => {
|
|
258122
|
-
if (name2 in defs) {
|
|
258123
|
-
throw new TypeGenerationError(`Duplicate generated type "${name2}" in actor "${actor.name}" — a shared type and a message resolve to the same name.`, actor.name);
|
|
258124
|
-
}
|
|
258125
|
-
defs[name2] = { ...schema12, title: name2 };
|
|
258126
|
-
};
|
|
258127
|
-
for (const [key2, schema12] of Object.entries(types)) {
|
|
258128
|
-
add(typeName(key2), rewriteTypeRefs(schema12, typeName));
|
|
258129
|
-
}
|
|
258130
|
-
const compileMessages = (msgs, dir) => Object.entries(msgs).map(([key2, schema12]) => {
|
|
258131
|
-
const name2 = msgName(dir, key2);
|
|
258132
|
-
const rewritten = rewriteTypeRefs(schema12, typeName);
|
|
258133
|
-
add(name2, {
|
|
258134
|
-
type: "object",
|
|
258135
|
-
...rewritten,
|
|
258136
|
-
properties: { type: { const: key2 }, ...rewritten.properties ?? {} },
|
|
258137
|
-
required: [
|
|
258138
|
-
"type",
|
|
258139
|
-
...rewritten.required ?? []
|
|
258140
|
-
],
|
|
258141
|
-
additionalProperties: false
|
|
258142
|
-
});
|
|
258143
|
-
return name2;
|
|
258144
|
-
});
|
|
258145
|
-
const toClientNames = compileMessages(toClient, "ToClient");
|
|
258146
|
-
const toServerNames = compileMessages(toServer, "ToServer");
|
|
258147
|
-
const allNames = [...toClientNames, ...toServerNames];
|
|
258148
|
-
const rootName = `${prefix}Message`;
|
|
258149
|
-
const rootSchema = {
|
|
258150
|
-
title: rootName,
|
|
258151
|
-
$defs: defs,
|
|
258152
|
-
oneOf: allNames.map((n5) => ({ $ref: `#/$defs/${n5}` }))
|
|
258153
|
-
};
|
|
258154
|
-
let decls = "";
|
|
258155
|
-
try {
|
|
258156
|
-
decls = (await import_json_schema_to_typescript.compile(rootSchema, rootName, {
|
|
258157
|
-
bannerComment: "",
|
|
258158
|
-
additionalProperties: false,
|
|
258159
|
-
strictIndexSignatures: true
|
|
258160
|
-
})).trim();
|
|
258161
|
-
} catch (error48) {
|
|
258162
|
-
throw new TypeGenerationError(`Failed to generate types for actor "${actor.name}"`, actor.name, error48);
|
|
258163
|
-
}
|
|
258164
|
-
const union2 = (names) => names.length ? names.join(" | ") : "never";
|
|
258165
|
-
return {
|
|
258166
|
-
decls,
|
|
258167
|
-
entry: `{ toClient: ${union2(toClientNames)}; toServer: ${union2(toServerNames)} }`
|
|
258168
|
-
};
|
|
258169
|
-
}
|
|
258170
|
-
function rewriteTypeRefs(node, defName) {
|
|
258171
|
-
if (Array.isArray(node)) {
|
|
258172
|
-
return node.map((n5) => rewriteTypeRefs(n5, defName));
|
|
258173
|
-
}
|
|
258174
|
-
if (node && typeof node === "object") {
|
|
258175
|
-
const out = {};
|
|
258176
|
-
for (const [key2, value] of Object.entries(node)) {
|
|
258177
|
-
const match = key2 === "$ref" && typeof value === "string" ? value.match(/^#\/types\/(.+)$/) : null;
|
|
258178
|
-
out[key2] = match ? `#/$defs/${defName(match[1])}` : rewriteTypeRefs(value, defName);
|
|
258179
|
-
}
|
|
258180
|
-
return out;
|
|
258181
|
-
}
|
|
258182
|
-
return node;
|
|
258183
|
-
}
|
|
258184
257986
|
function registry2(name2, entries) {
|
|
258185
257987
|
return import_common_tags.source`
|
|
258186
257988
|
interface ${name2} {
|
|
@@ -258193,10 +257995,10 @@ function toPascalCase(name2) {
|
|
|
258193
257995
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
258194
257996
|
}
|
|
258195
257997
|
// src/core/types/update-project.ts
|
|
258196
|
-
import { join as
|
|
257998
|
+
import { join as join26 } from "node:path";
|
|
258197
257999
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
258198
258000
|
async function updateProjectConfig(projectRoot) {
|
|
258199
|
-
const tsconfigPath =
|
|
258001
|
+
const tsconfigPath = join26(projectRoot, "tsconfig.json");
|
|
258200
258002
|
if (!await pathExists(tsconfigPath)) {
|
|
258201
258003
|
return false;
|
|
258202
258004
|
}
|
|
@@ -258220,15 +258022,14 @@ var TYPES_FILE_PATH = "base44/.types/types.d.ts";
|
|
|
258220
258022
|
async function generateTypesAction({
|
|
258221
258023
|
runTask: runTask2
|
|
258222
258024
|
}) {
|
|
258223
|
-
const { entities, functions, agents, connectors,
|
|
258025
|
+
const { entities, functions, agents, connectors, project: project2 } = await readProjectConfig();
|
|
258224
258026
|
await runTask2("Generating types", async () => {
|
|
258225
258027
|
await generateTypesFile({
|
|
258226
258028
|
projectRoot: project2.root,
|
|
258227
258029
|
entities,
|
|
258228
258030
|
functions,
|
|
258229
258031
|
agents,
|
|
258230
|
-
connectors
|
|
258231
|
-
actors
|
|
258032
|
+
connectors
|
|
258232
258033
|
});
|
|
258233
258034
|
});
|
|
258234
258035
|
const tsconfigUpdated = await updateProjectConfig(project2.root);
|
|
@@ -258395,7 +258196,7 @@ function getWorkspaceCommand() {
|
|
|
258395
258196
|
// src/cli/dev/dev-server/main.ts
|
|
258396
258197
|
var import_cors = __toESM(require_lib4(), 1);
|
|
258397
258198
|
var import_express6 = __toESM(require_express(), 1);
|
|
258398
|
-
import { dirname as
|
|
258199
|
+
import { dirname as dirname23, join as join31 } from "node:path";
|
|
258399
258200
|
|
|
258400
258201
|
// ../../node_modules/get-port/index.js
|
|
258401
258202
|
import net from "node:net";
|
|
@@ -258567,7 +258368,7 @@ function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
|
258567
258368
|
|
|
258568
258369
|
// src/cli/dev/dev-server/function-manager.ts
|
|
258569
258370
|
import { spawn as spawn2 } from "node:child_process";
|
|
258570
|
-
import { dirname as
|
|
258371
|
+
import { dirname as dirname20, join as join27 } from "node:path";
|
|
258571
258372
|
import { pathToFileURL } from "node:url";
|
|
258572
258373
|
|
|
258573
258374
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -258672,7 +258473,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
258672
258473
|
}
|
|
258673
258474
|
spawnFunction(func, port) {
|
|
258674
258475
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
258675
|
-
const importMapPath =
|
|
258476
|
+
const importMapPath = join27(dirname20(this.wrapperPath), "import-map.json");
|
|
258676
258477
|
const process23 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
258677
258478
|
env: {
|
|
258678
258479
|
...globalThis.process.env,
|
|
@@ -258746,7 +258547,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
258746
258547
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
258747
258548
|
import { isBuiltin } from "node:module";
|
|
258748
258549
|
import { homedir as homedir3 } from "node:os";
|
|
258749
|
-
import { join as
|
|
258550
|
+
import { join as join28 } from "node:path";
|
|
258750
258551
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
258751
258552
|
var depsPromise;
|
|
258752
258553
|
function loadDeps() {
|
|
@@ -258867,9 +258668,9 @@ export default {
|
|
|
258867
258668
|
};
|
|
258868
258669
|
`;
|
|
258869
258670
|
function ensureBundlerConfig() {
|
|
258870
|
-
const dir =
|
|
258671
|
+
const dir = join28(homedir3(), ".base44", "function-bundler");
|
|
258871
258672
|
mkdirSync2(dir, { recursive: true });
|
|
258872
|
-
const configPath =
|
|
258673
|
+
const configPath = join28(dir, "deno.json");
|
|
258873
258674
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
258874
258675
|
`);
|
|
258875
258676
|
return configPath;
|
|
@@ -260423,7 +260224,7 @@ class ServeRunner {
|
|
|
260423
260224
|
|
|
260424
260225
|
// src/cli/dev/dev-server/watcher.ts
|
|
260425
260226
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
260426
|
-
import { relative as
|
|
260227
|
+
import { relative as relative6 } from "node:path";
|
|
260427
260228
|
|
|
260428
260229
|
// ../../node_modules/chokidar/index.js
|
|
260429
260230
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
@@ -260593,10 +260394,10 @@ class ReaddirpStream extends Readable6 {
|
|
|
260593
260394
|
}
|
|
260594
260395
|
async _formatEntry(dirent, path19) {
|
|
260595
260396
|
let entry;
|
|
260596
|
-
const
|
|
260397
|
+
const basename6 = this._isDirent ? dirent.name : dirent;
|
|
260597
260398
|
try {
|
|
260598
|
-
const fullPath = presolve(pjoin(path19,
|
|
260599
|
-
entry = { path: prelative(this._root, fullPath), fullPath, basename:
|
|
260399
|
+
const fullPath = presolve(pjoin(path19, basename6));
|
|
260400
|
+
entry = { path: prelative(this._root, fullPath), fullPath, basename: basename6 };
|
|
260600
260401
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
260601
260402
|
} catch (err) {
|
|
260602
260403
|
this._onError(err);
|
|
@@ -261123,9 +260924,9 @@ class NodeFsHandler {
|
|
|
261123
260924
|
_watchWithNodeFs(path19, listener) {
|
|
261124
260925
|
const opts = this.fsw.options;
|
|
261125
260926
|
const directory = sp2.dirname(path19);
|
|
261126
|
-
const
|
|
260927
|
+
const basename7 = sp2.basename(path19);
|
|
261127
260928
|
const parent = this.fsw._getWatchedDir(directory);
|
|
261128
|
-
parent.add(
|
|
260929
|
+
parent.add(basename7);
|
|
261129
260930
|
const absolutePath = sp2.resolve(path19);
|
|
261130
260931
|
const options8 = {
|
|
261131
260932
|
persistent: opts.persistent
|
|
@@ -261135,7 +260936,7 @@ class NodeFsHandler {
|
|
|
261135
260936
|
let closer;
|
|
261136
260937
|
if (opts.usePolling) {
|
|
261137
260938
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
261138
|
-
options8.interval = enableBin && isBinaryPath(
|
|
260939
|
+
options8.interval = enableBin && isBinaryPath(basename7) ? opts.binaryInterval : opts.interval;
|
|
261139
260940
|
closer = setFsWatchFileListener(path19, absolutePath, options8, {
|
|
261140
260941
|
listener,
|
|
261141
260942
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -261153,11 +260954,11 @@ class NodeFsHandler {
|
|
|
261153
260954
|
if (this.fsw.closed) {
|
|
261154
260955
|
return;
|
|
261155
260956
|
}
|
|
261156
|
-
const
|
|
261157
|
-
const
|
|
261158
|
-
const parent = this.fsw._getWatchedDir(
|
|
260957
|
+
const dirname22 = sp2.dirname(file2);
|
|
260958
|
+
const basename7 = sp2.basename(file2);
|
|
260959
|
+
const parent = this.fsw._getWatchedDir(dirname22);
|
|
261159
260960
|
let prevStats = stats;
|
|
261160
|
-
if (parent.has(
|
|
260961
|
+
if (parent.has(basename7))
|
|
261161
260962
|
return;
|
|
261162
260963
|
const listener = async (path19, newStats) => {
|
|
261163
260964
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
@@ -261182,9 +260983,9 @@ class NodeFsHandler {
|
|
|
261182
260983
|
prevStats = newStats2;
|
|
261183
260984
|
}
|
|
261184
260985
|
} catch (error48) {
|
|
261185
|
-
this.fsw._remove(
|
|
260986
|
+
this.fsw._remove(dirname22, basename7);
|
|
261186
260987
|
}
|
|
261187
|
-
} else if (parent.has(
|
|
260988
|
+
} else if (parent.has(basename7)) {
|
|
261188
260989
|
const at13 = newStats.atimeMs;
|
|
261189
260990
|
const mt12 = newStats.mtimeMs;
|
|
261190
260991
|
if (!at13 || at13 <= mt12 || mt12 !== prevStats.mtimeMs) {
|
|
@@ -261405,11 +261206,11 @@ function createPattern(matcher) {
|
|
|
261405
261206
|
if (matcher.path === string4)
|
|
261406
261207
|
return true;
|
|
261407
261208
|
if (matcher.recursive) {
|
|
261408
|
-
const
|
|
261409
|
-
if (!
|
|
261209
|
+
const relative6 = sp3.relative(matcher.path, string4);
|
|
261210
|
+
if (!relative6) {
|
|
261410
261211
|
return false;
|
|
261411
261212
|
}
|
|
261412
|
-
return !
|
|
261213
|
+
return !relative6.startsWith("..") && !sp3.isAbsolute(relative6);
|
|
261413
261214
|
}
|
|
261414
261215
|
return false;
|
|
261415
261216
|
};
|
|
@@ -262108,7 +261909,7 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
262108
261909
|
ignoreInitial: true
|
|
262109
261910
|
});
|
|
262110
261911
|
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
262111
|
-
this.emit("change", name2,
|
|
261912
|
+
this.emit("change", name2, relative6(targetPath, path19));
|
|
262112
261913
|
}, WATCH_DEBOUNCE_MS));
|
|
262113
261914
|
watcher.on("error", (err) => {
|
|
262114
261915
|
this.logger.error(`Watch handler failed for ${targetPath}`, err);
|
|
@@ -262215,8 +262016,8 @@ async function createDevServer(options8) {
|
|
|
262215
262016
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
262216
262017
|
};
|
|
262217
262018
|
const base44ConfigWatcher = new WatchBase44({
|
|
262218
|
-
functions:
|
|
262219
|
-
entities:
|
|
262019
|
+
functions: join31(dirname23(project2.configPath), project2.functionsDir),
|
|
262020
|
+
entities: join31(dirname23(project2.configPath), project2.entitiesDir)
|
|
262220
262021
|
}, devLogger);
|
|
262221
262022
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
262222
262023
|
try {
|
|
@@ -262586,16 +262387,16 @@ function createProgram(context) {
|
|
|
262586
262387
|
program2.addCommand(getCreateCommand());
|
|
262587
262388
|
program2.addCommand(getScaffoldCommand());
|
|
262588
262389
|
program2.addCommand(getDashboardCommand());
|
|
262589
|
-
program2.addCommand(
|
|
262390
|
+
program2.addCommand(getDeployCommand2());
|
|
262590
262391
|
program2.addCommand(getVisibilityCommand());
|
|
262591
262392
|
program2.addCommand(getLinkCommand());
|
|
262592
262393
|
program2.addCommand(getEjectCommand());
|
|
262593
262394
|
program2.addCommand(getWorkspaceCommand());
|
|
262594
262395
|
program2.addCommand(getEntitiesPushCommand());
|
|
262595
262396
|
program2.addCommand(getAgentsCommand());
|
|
262397
|
+
program2.addCommand(getAgentSkillsCommand());
|
|
262596
262398
|
program2.addCommand(getConnectorsCommand());
|
|
262597
262399
|
program2.addCommand(getFunctionsCommand());
|
|
262598
|
-
program2.addCommand(getActorCommand());
|
|
262599
262400
|
program2.addCommand(getSecretsCommand());
|
|
262600
262401
|
program2.addCommand(getSandboxCommand());
|
|
262601
262402
|
program2.addCommand(getAuthCommand());
|
|
@@ -262612,7 +262413,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
262612
262413
|
import { release, type } from "node:os";
|
|
262613
262414
|
|
|
262614
262415
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
262615
|
-
import { dirname as
|
|
262416
|
+
import { dirname as dirname24, posix, sep } from "path";
|
|
262616
262417
|
function createModulerModifier() {
|
|
262617
262418
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
262618
262419
|
return async (frames) => {
|
|
@@ -262621,7 +262422,7 @@ function createModulerModifier() {
|
|
|
262621
262422
|
return frames;
|
|
262622
262423
|
};
|
|
262623
262424
|
}
|
|
262624
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
262425
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname24(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
262625
262426
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
262626
262427
|
return (filename) => {
|
|
262627
262428
|
if (!filename)
|
|
@@ -266810,9 +266611,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
266810
266611
|
});
|
|
266811
266612
|
}
|
|
266812
266613
|
// src/cli/index.ts
|
|
266813
|
-
var __dirname4 =
|
|
266614
|
+
var __dirname4 = dirname25(fileURLToPath6(import.meta.url));
|
|
266814
266615
|
async function runCLI(options8) {
|
|
266815
|
-
ensureNpmAssets(
|
|
266616
|
+
ensureNpmAssets(join33(__dirname4, "../assets"));
|
|
266816
266617
|
const errorReporter = new ErrorReporter;
|
|
266817
266618
|
errorReporter.registerProcessErrorHandlers();
|
|
266818
266619
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -266851,4 +266652,4 @@ export {
|
|
|
266851
266652
|
CLIExitError
|
|
266852
266653
|
};
|
|
266853
266654
|
|
|
266854
|
-
//# debugId=
|
|
266655
|
+
//# debugId=F83E5816D8B23B6064756E2164756E21
|