@base44-preview/cli 0.0.25-pr.151.924f8b5 → 0.0.25-pr.151.94c529c
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/index.js +41 -135
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5747,77 +5747,6 @@ function handleIntersectionResults(result, left, right) {
|
|
|
5747
5747
|
result.value = merged.data;
|
|
5748
5748
|
return result;
|
|
5749
5749
|
}
|
|
5750
|
-
const $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
5751
|
-
$ZodType.init(inst, def);
|
|
5752
|
-
const items = def.items;
|
|
5753
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5754
|
-
const input = payload.value;
|
|
5755
|
-
if (!Array.isArray(input)) {
|
|
5756
|
-
payload.issues.push({
|
|
5757
|
-
input,
|
|
5758
|
-
inst,
|
|
5759
|
-
expected: "tuple",
|
|
5760
|
-
code: "invalid_type"
|
|
5761
|
-
});
|
|
5762
|
-
return payload;
|
|
5763
|
-
}
|
|
5764
|
-
payload.value = [];
|
|
5765
|
-
const proms = [];
|
|
5766
|
-
const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
5767
|
-
const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
|
|
5768
|
-
if (!def.rest) {
|
|
5769
|
-
const tooBig = input.length > items.length;
|
|
5770
|
-
const tooSmall = input.length < optStart - 1;
|
|
5771
|
-
if (tooBig || tooSmall) {
|
|
5772
|
-
payload.issues.push({
|
|
5773
|
-
...tooBig ? {
|
|
5774
|
-
code: "too_big",
|
|
5775
|
-
maximum: items.length,
|
|
5776
|
-
inclusive: true
|
|
5777
|
-
} : {
|
|
5778
|
-
code: "too_small",
|
|
5779
|
-
minimum: items.length
|
|
5780
|
-
},
|
|
5781
|
-
input,
|
|
5782
|
-
inst,
|
|
5783
|
-
origin: "array"
|
|
5784
|
-
});
|
|
5785
|
-
return payload;
|
|
5786
|
-
}
|
|
5787
|
-
}
|
|
5788
|
-
let i$1 = -1;
|
|
5789
|
-
for (const item of items) {
|
|
5790
|
-
i$1++;
|
|
5791
|
-
if (i$1 >= input.length) {
|
|
5792
|
-
if (i$1 >= optStart) continue;
|
|
5793
|
-
}
|
|
5794
|
-
const result = item._zod.run({
|
|
5795
|
-
value: input[i$1],
|
|
5796
|
-
issues: []
|
|
5797
|
-
}, ctx);
|
|
5798
|
-
if (result instanceof Promise) proms.push(result.then((result$1) => handleTupleResult(result$1, payload, i$1)));
|
|
5799
|
-
else handleTupleResult(result, payload, i$1);
|
|
5800
|
-
}
|
|
5801
|
-
if (def.rest) {
|
|
5802
|
-
const rest = input.slice(items.length);
|
|
5803
|
-
for (const el of rest) {
|
|
5804
|
-
i$1++;
|
|
5805
|
-
const result = def.rest._zod.run({
|
|
5806
|
-
value: el,
|
|
5807
|
-
issues: []
|
|
5808
|
-
}, ctx);
|
|
5809
|
-
if (result instanceof Promise) proms.push(result.then((result$1) => handleTupleResult(result$1, payload, i$1)));
|
|
5810
|
-
else handleTupleResult(result, payload, i$1);
|
|
5811
|
-
}
|
|
5812
|
-
}
|
|
5813
|
-
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
5814
|
-
return payload;
|
|
5815
|
-
};
|
|
5816
|
-
});
|
|
5817
|
-
function handleTupleResult(result, final, index) {
|
|
5818
|
-
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
5819
|
-
final.value[index] = result.value;
|
|
5820
|
-
}
|
|
5821
5750
|
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
5822
5751
|
$ZodType.init(inst, def);
|
|
5823
5752
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -7200,44 +7129,6 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
7200
7129
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
7201
7130
|
json.allOf = [...isSimpleIntersection(a$1) ? a$1.allOf : [a$1], ...isSimpleIntersection(b$2) ? b$2.allOf : [b$2]];
|
|
7202
7131
|
};
|
|
7203
|
-
const tupleProcessor = (schema, ctx, _json, params) => {
|
|
7204
|
-
const json = _json;
|
|
7205
|
-
const def = schema._zod.def;
|
|
7206
|
-
json.type = "array";
|
|
7207
|
-
const prefixPath$1 = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
7208
|
-
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
7209
|
-
const prefixItems = def.items.map((x$2, i$1) => process$2(x$2, ctx, {
|
|
7210
|
-
...params,
|
|
7211
|
-
path: [
|
|
7212
|
-
...params.path,
|
|
7213
|
-
prefixPath$1,
|
|
7214
|
-
i$1
|
|
7215
|
-
]
|
|
7216
|
-
}));
|
|
7217
|
-
const rest = def.rest ? process$2(def.rest, ctx, {
|
|
7218
|
-
...params,
|
|
7219
|
-
path: [
|
|
7220
|
-
...params.path,
|
|
7221
|
-
restPath,
|
|
7222
|
-
...ctx.target === "openapi-3.0" ? [def.items.length] : []
|
|
7223
|
-
]
|
|
7224
|
-
}) : null;
|
|
7225
|
-
if (ctx.target === "draft-2020-12") {
|
|
7226
|
-
json.prefixItems = prefixItems;
|
|
7227
|
-
if (rest) json.items = rest;
|
|
7228
|
-
} else if (ctx.target === "openapi-3.0") {
|
|
7229
|
-
json.items = { anyOf: prefixItems };
|
|
7230
|
-
if (rest) json.items.anyOf.push(rest);
|
|
7231
|
-
json.minItems = prefixItems.length;
|
|
7232
|
-
if (!rest) json.maxItems = prefixItems.length;
|
|
7233
|
-
} else {
|
|
7234
|
-
json.items = prefixItems;
|
|
7235
|
-
if (rest) json.additionalItems = rest;
|
|
7236
|
-
}
|
|
7237
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
7238
|
-
if (typeof minimum === "number") json.minItems = minimum;
|
|
7239
|
-
if (typeof maximum === "number") json.maxItems = maximum;
|
|
7240
|
-
};
|
|
7241
7132
|
const recordProcessor = (schema, ctx, _json, params) => {
|
|
7242
7133
|
const json = _json;
|
|
7243
7134
|
const def = schema._zod.def;
|
|
@@ -7789,25 +7680,6 @@ function intersection(left, right) {
|
|
|
7789
7680
|
right
|
|
7790
7681
|
});
|
|
7791
7682
|
}
|
|
7792
|
-
const ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
7793
|
-
$ZodTuple.init(inst, def);
|
|
7794
|
-
ZodType.init(inst, def);
|
|
7795
|
-
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
7796
|
-
inst.rest = (rest) => inst.clone({
|
|
7797
|
-
...inst._zod.def,
|
|
7798
|
-
rest
|
|
7799
|
-
});
|
|
7800
|
-
});
|
|
7801
|
-
function tuple(items, _paramsOrRest, _params) {
|
|
7802
|
-
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
7803
|
-
const params = hasRest ? _params : _paramsOrRest;
|
|
7804
|
-
return new ZodTuple({
|
|
7805
|
-
type: "tuple",
|
|
7806
|
-
items,
|
|
7807
|
-
rest: hasRest ? _paramsOrRest : null,
|
|
7808
|
-
...normalizeParams(params)
|
|
7809
|
-
});
|
|
7810
|
-
}
|
|
7811
7683
|
const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
7812
7684
|
$ZodRecord.init(inst, def);
|
|
7813
7685
|
ZodType.init(inst, def);
|
|
@@ -16863,7 +16735,9 @@ const SyncEntitiesResponseSchema = object({
|
|
|
16863
16735
|
//#region src/core/resources/entity/config.ts
|
|
16864
16736
|
async function readEntityFile(entityPath) {
|
|
16865
16737
|
const parsed = await readJsonFile(entityPath);
|
|
16866
|
-
|
|
16738
|
+
const result = EntitySchema.safeParse(parsed);
|
|
16739
|
+
if (!result.success) throw new Error(`Invalid entity in ${entityPath}: ${result.error.message}`);
|
|
16740
|
+
return result.data;
|
|
16867
16741
|
}
|
|
16868
16742
|
async function readAllEntities(entitiesDir) {
|
|
16869
16743
|
if (!await pathExists(entitiesDir)) return [];
|
|
@@ -16911,14 +16785,23 @@ const entityResource = {
|
|
|
16911
16785
|
|
|
16912
16786
|
//#endregion
|
|
16913
16787
|
//#region src/core/resources/function/schema.ts
|
|
16788
|
+
const FunctionNameSchema = string().trim().min(1, "Function name cannot be empty").regex(/^[^.]+$/, "Function name cannot contain dots");
|
|
16789
|
+
const FunctionFileSchema = object({
|
|
16790
|
+
path: string().min(1),
|
|
16791
|
+
content: string()
|
|
16792
|
+
});
|
|
16914
16793
|
const FunctionConfigSchema = object({
|
|
16915
|
-
name:
|
|
16916
|
-
entry: string().min(1, "Entry point cannot be empty")
|
|
16917
|
-
triggers: tuple([]).optional()
|
|
16794
|
+
name: FunctionNameSchema,
|
|
16795
|
+
entry: string().min(1, "Entry point cannot be empty")
|
|
16918
16796
|
});
|
|
16919
16797
|
const FunctionSchema = FunctionConfigSchema.extend({
|
|
16920
16798
|
entryPath: string().min(1, "Entry path cannot be empty"),
|
|
16921
|
-
files: array(string()).min(1, "
|
|
16799
|
+
files: array(string()).min(1, "Function must have at least one file")
|
|
16800
|
+
});
|
|
16801
|
+
const FunctionDeploySchema = object({
|
|
16802
|
+
name: FunctionNameSchema,
|
|
16803
|
+
entry: string().min(1),
|
|
16804
|
+
files: array(FunctionFileSchema).min(1, "Function must have at least one file")
|
|
16922
16805
|
});
|
|
16923
16806
|
const DeployFunctionsResponseSchema = object({
|
|
16924
16807
|
deployed: array(string()),
|
|
@@ -17022,7 +16905,28 @@ const functionResource = {
|
|
|
17022
16905
|
|
|
17023
16906
|
//#endregion
|
|
17024
16907
|
//#region src/core/resources/agent/schema.ts
|
|
17025
|
-
const
|
|
16908
|
+
const EntityOperationSchema = _enum([
|
|
16909
|
+
"create",
|
|
16910
|
+
"update",
|
|
16911
|
+
"delete",
|
|
16912
|
+
"read"
|
|
16913
|
+
]);
|
|
16914
|
+
const EntityToolConfigSchema = object({
|
|
16915
|
+
entity_name: string().min(1),
|
|
16916
|
+
allowed_operations: array(EntityOperationSchema)
|
|
16917
|
+
});
|
|
16918
|
+
const BackendFunctionToolConfigSchema = object({
|
|
16919
|
+
function_name: string().min(1),
|
|
16920
|
+
description: string().default("agent backend function")
|
|
16921
|
+
});
|
|
16922
|
+
const ToolConfigSchema = union([EntityToolConfigSchema, BackendFunctionToolConfigSchema]);
|
|
16923
|
+
const AgentConfigSchema = looseObject({
|
|
16924
|
+
name: string().regex(/^[a-z0-9_]+$/, "Agent name must be lowercase alphanumeric with underscores").min(1).max(100),
|
|
16925
|
+
description: string().trim().min(1, "Description is required"),
|
|
16926
|
+
instructions: string().trim().min(1, "Instructions are required"),
|
|
16927
|
+
tool_configs: array(ToolConfigSchema).optional().default([]),
|
|
16928
|
+
whatsapp_greeting: string().nullable().optional()
|
|
16929
|
+
});
|
|
17026
16930
|
const SyncAgentsResponseSchema = object({
|
|
17027
16931
|
created: array(string()),
|
|
17028
16932
|
updated: array(string()),
|
|
@@ -17038,7 +16942,9 @@ const ListAgentsResponseSchema = object({
|
|
|
17038
16942
|
//#region src/core/resources/agent/config.ts
|
|
17039
16943
|
async function readAgentFile(agentPath) {
|
|
17040
16944
|
const parsed = await readJsonFile(agentPath);
|
|
17041
|
-
|
|
16945
|
+
const result = AgentConfigSchema.safeParse(parsed);
|
|
16946
|
+
if (!result.success) throw new Error(`Invalid agent config in ${agentPath}: ${result.error.message}`);
|
|
16947
|
+
return result.data;
|
|
17042
16948
|
}
|
|
17043
16949
|
async function readAllAgents(agentsDir) {
|
|
17044
16950
|
if (!await pathExists(agentsDir)) return [];
|