@base44-preview/cli 0.0.49-pr.452.a028d51 → 0.0.49-pr.453.20f6e7b

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
@@ -16067,7 +16067,7 @@ var require_lodash = __commonJS((exports, module) => {
16067
16067
  }
16068
16068
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
16069
16069
  });
16070
- function join13(array2, separator) {
16070
+ function join12(array2, separator) {
16071
16071
  return array2 == null ? "" : nativeJoin.call(array2, separator);
16072
16072
  }
16073
16073
  function last(array2) {
@@ -17999,7 +17999,7 @@ __p += '`;
17999
17999
  lodash.isUndefined = isUndefined;
18000
18000
  lodash.isWeakMap = isWeakMap;
18001
18001
  lodash.isWeakSet = isWeakSet;
18002
- lodash.join = join13;
18002
+ lodash.join = join12;
18003
18003
  lodash.kebabCase = kebabCase;
18004
18004
  lodash.last = last;
18005
18005
  lodash.lastIndexOf = lastIndexOf;
@@ -27503,7 +27503,7 @@ function cleanDoc(doc2) {
27503
27503
  return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
27504
27504
  }
27505
27505
  function replaceEndOfLine(doc2, replacement = literalline) {
27506
- return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join19(replacement, currentDoc.split(`
27506
+ return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join18(replacement, currentDoc.split(`
27507
27507
  `)) : currentDoc);
27508
27508
  }
27509
27509
  function canBreakFn(doc2) {
@@ -27583,7 +27583,7 @@ function indentIfBreak(contents, options) {
27583
27583
  negate: options.negate
27584
27584
  };
27585
27585
  }
27586
- function join19(separator, docs) {
27586
+ function join18(separator, docs) {
27587
27587
  assertDoc(separator);
27588
27588
  assertDocArray(docs);
27589
27589
  const parts = [];
@@ -28294,7 +28294,7 @@ var init_doc = __esm(() => {
28294
28294
  MODE_FLAT = Symbol("MODE_FLAT");
28295
28295
  DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
28296
28296
  builders = {
28297
- join: join19,
28297
+ join: join18,
28298
28298
  line,
28299
28299
  softline,
28300
28300
  hardline,
@@ -133208,7 +133208,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
133208
133208
  return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
133209
133209
  }
133210
133210
  function replaceEndOfLine2(doc2, replacement = literalline2) {
133211
- return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join21(replacement, currentDoc.split(`
133211
+ return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join20(replacement, currentDoc.split(`
133212
133212
  `)) : currentDoc);
133213
133213
  }
133214
133214
  function canBreakFn2(doc2) {
@@ -133294,7 +133294,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
133294
133294
  negate: options8.negate
133295
133295
  };
133296
133296
  }
133297
- function join21(separator, docs) {
133297
+ function join20(separator, docs) {
133298
133298
  assertDoc2(separator);
133299
133299
  assertDocArray2(docs);
133300
133300
  const parts = [];
@@ -133959,7 +133959,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
133959
133959
  }
133960
133960
  }
133961
133961
  var builders2 = {
133962
- join: join21,
133962
+ join: join20,
133963
133963
  line: line3,
133964
133964
  softline: softline2,
133965
133965
  hardline: hardline4,
@@ -160402,7 +160402,7 @@ var require_view = __commonJS((exports, module) => {
160402
160402
  var dirname14 = path18.dirname;
160403
160403
  var basename4 = path18.basename;
160404
160404
  var extname2 = path18.extname;
160405
- var join22 = path18.join;
160405
+ var join21 = path18.join;
160406
160406
  var resolve6 = path18.resolve;
160407
160407
  module.exports = View;
160408
160408
  function View(name2, options8) {
@@ -160464,12 +160464,12 @@ var require_view = __commonJS((exports, module) => {
160464
160464
  };
160465
160465
  View.prototype.resolve = function resolve7(dir, file2) {
160466
160466
  var ext = this.ext;
160467
- var path19 = join22(dir, file2);
160467
+ var path19 = join21(dir, file2);
160468
160468
  var stat2 = tryStat(path19);
160469
160469
  if (stat2 && stat2.isFile()) {
160470
160470
  return path19;
160471
160471
  }
160472
- path19 = join22(dir, basename4(file2, ext), "index" + ext);
160472
+ path19 = join21(dir, basename4(file2, ext), "index" + ext);
160473
160473
  stat2 = tryStat(path19);
160474
160474
  if (stat2 && stat2.isFile()) {
160475
160475
  return path19;
@@ -164164,7 +164164,7 @@ var require_send = __commonJS((exports, module) => {
164164
164164
  var Stream2 = __require("stream");
164165
164165
  var util2 = __require("util");
164166
164166
  var extname2 = path18.extname;
164167
- var join22 = path18.join;
164167
+ var join21 = path18.join;
164168
164168
  var normalize = path18.normalize;
164169
164169
  var resolve6 = path18.resolve;
164170
164170
  var sep = path18.sep;
@@ -164336,7 +164336,7 @@ var require_send = __commonJS((exports, module) => {
164336
164336
  return res;
164337
164337
  }
164338
164338
  parts = path19.split(sep);
164339
- path19 = normalize(join22(root2, path19));
164339
+ path19 = normalize(join21(root2, path19));
164340
164340
  } else {
164341
164341
  if (UP_PATH_REGEXP.test(path19)) {
164342
164342
  debug('malicious path "%s"', path19);
@@ -164476,7 +164476,7 @@ var require_send = __commonJS((exports, module) => {
164476
164476
  return self2.onStatError(err);
164477
164477
  return self2.error(404);
164478
164478
  }
164479
- var p4 = join22(path19, self2._index[i5]);
164479
+ var p4 = join21(path19, self2._index[i5]);
164480
164480
  debug('stat "%s"', p4);
164481
164481
  fs28.stat(p4, function(err2, stat2) {
164482
164482
  if (err2)
@@ -214616,7 +214616,7 @@ var require_buffer_list = __commonJS((exports, module) => {
214616
214616
  }
214617
214617
  }, {
214618
214618
  key: "join",
214619
- value: function join22(s5) {
214619
+ value: function join21(s5) {
214620
214620
  if (this.length === 0)
214621
214621
  return "";
214622
214622
  var p4 = this.head;
@@ -218270,7 +218270,7 @@ var require_dist5 = __commonJS((exports, module) => {
218270
218270
  });
218271
218271
 
218272
218272
  // src/cli/index.ts
218273
- import { dirname as dirname18, join as join25 } from "node:path";
218273
+ import { dirname as dirname18, join as join24 } from "node:path";
218274
218274
  import { fileURLToPath as fileURLToPath6 } from "node:url";
218275
218275
 
218276
218276
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -219422,7 +219422,7 @@ var {
219422
219422
  } = import__.default;
219423
219423
 
219424
219424
  // src/cli/commands/agents/pull.ts
219425
- import { dirname as dirname7, join as join13 } from "node:path";
219425
+ import { dirname as dirname7, join as join12 } from "node:path";
219426
219426
  // ../../node_modules/chalk/source/vendor/ansi-styles/index.js
219427
219427
  var ANSI_BACKGROUND_OFFSET = 10;
219428
219428
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -220132,6 +220132,825 @@ class TimeoutError extends Error {
220132
220132
  }
220133
220133
  }
220134
220134
 
220135
+ // ../../node_modules/ky/distribution/errors/HTTPError.js
220136
+ class HTTPError extends Error {
220137
+ response;
220138
+ request;
220139
+ options;
220140
+ constructor(response, request, options) {
220141
+ const code = response.status || response.status === 0 ? response.status : "";
220142
+ const title = response.statusText ?? "";
220143
+ const status = `${code} ${title}`.trim();
220144
+ const reason = status ? `status code ${status}` : "an unknown error";
220145
+ super(`Request failed with ${reason}: ${request.method} ${request.url}`);
220146
+ this.name = "HTTPError";
220147
+ this.response = response;
220148
+ this.request = request;
220149
+ this.options = options;
220150
+ }
220151
+ }
220152
+
220153
+ // ../../node_modules/ky/distribution/errors/NonError.js
220154
+ class NonError extends Error {
220155
+ name = "NonError";
220156
+ value;
220157
+ constructor(value) {
220158
+ let message = "Non-error value was thrown";
220159
+ try {
220160
+ if (typeof value === "string") {
220161
+ message = value;
220162
+ } else if (value && typeof value === "object" && "message" in value && typeof value.message === "string") {
220163
+ message = value.message;
220164
+ }
220165
+ } catch {}
220166
+ super(message);
220167
+ this.value = value;
220168
+ }
220169
+ }
220170
+
220171
+ // ../../node_modules/ky/distribution/errors/ForceRetryError.js
220172
+ class ForceRetryError extends Error {
220173
+ name = "ForceRetryError";
220174
+ customDelay;
220175
+ code;
220176
+ customRequest;
220177
+ constructor(options) {
220178
+ const cause = options?.cause ? options.cause instanceof Error ? options.cause : new NonError(options.cause) : undefined;
220179
+ super(options?.code ? `Forced retry: ${options.code}` : "Forced retry", cause ? { cause } : undefined);
220180
+ this.customDelay = options?.delay;
220181
+ this.code = options?.code;
220182
+ this.customRequest = options?.request;
220183
+ }
220184
+ }
220185
+
220186
+ // ../../node_modules/ky/distribution/core/constants.js
220187
+ var supportsRequestStreams = (() => {
220188
+ let duplexAccessed = false;
220189
+ let hasContentType = false;
220190
+ const supportsReadableStream = typeof globalThis.ReadableStream === "function";
220191
+ const supportsRequest = typeof globalThis.Request === "function";
220192
+ if (supportsReadableStream && supportsRequest) {
220193
+ try {
220194
+ hasContentType = new globalThis.Request("https://empty.invalid", {
220195
+ body: new globalThis.ReadableStream,
220196
+ method: "POST",
220197
+ get duplex() {
220198
+ duplexAccessed = true;
220199
+ return "half";
220200
+ }
220201
+ }).headers.has("Content-Type");
220202
+ } catch (error) {
220203
+ if (error instanceof Error && error.message === "unsupported BodyInit type") {
220204
+ return false;
220205
+ }
220206
+ throw error;
220207
+ }
220208
+ }
220209
+ return duplexAccessed && !hasContentType;
220210
+ })();
220211
+ var supportsAbortController = typeof globalThis.AbortController === "function";
220212
+ var supportsAbortSignal = typeof globalThis.AbortSignal === "function" && typeof globalThis.AbortSignal.any === "function";
220213
+ var supportsResponseStreams = typeof globalThis.ReadableStream === "function";
220214
+ var supportsFormData = typeof globalThis.FormData === "function";
220215
+ var requestMethods = ["get", "post", "put", "patch", "head", "delete"];
220216
+ var validate = () => {
220217
+ return;
220218
+ };
220219
+ validate();
220220
+ var responseTypes = {
220221
+ json: "application/json",
220222
+ text: "text/*",
220223
+ formData: "multipart/form-data",
220224
+ arrayBuffer: "*/*",
220225
+ blob: "*/*",
220226
+ bytes: "*/*"
220227
+ };
220228
+ var maxSafeTimeout = 2147483647;
220229
+ var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
220230
+ var stop = Symbol("stop");
220231
+
220232
+ class RetryMarker {
220233
+ options;
220234
+ constructor(options) {
220235
+ this.options = options;
220236
+ }
220237
+ }
220238
+ var retry = (options) => new RetryMarker(options);
220239
+ var kyOptionKeys = {
220240
+ json: true,
220241
+ parseJson: true,
220242
+ stringifyJson: true,
220243
+ searchParams: true,
220244
+ prefixUrl: true,
220245
+ retry: true,
220246
+ timeout: true,
220247
+ hooks: true,
220248
+ throwHttpErrors: true,
220249
+ onDownloadProgress: true,
220250
+ onUploadProgress: true,
220251
+ fetch: true,
220252
+ context: true
220253
+ };
220254
+ var vendorSpecificOptions = {
220255
+ next: true
220256
+ };
220257
+ var requestOptionsRegistry = {
220258
+ method: true,
220259
+ headers: true,
220260
+ body: true,
220261
+ mode: true,
220262
+ credentials: true,
220263
+ cache: true,
220264
+ redirect: true,
220265
+ referrer: true,
220266
+ referrerPolicy: true,
220267
+ integrity: true,
220268
+ keepalive: true,
220269
+ signal: true,
220270
+ window: true,
220271
+ duplex: true
220272
+ };
220273
+
220274
+ // ../../node_modules/ky/distribution/utils/body.js
220275
+ var getBodySize = (body) => {
220276
+ if (!body) {
220277
+ return 0;
220278
+ }
220279
+ if (body instanceof FormData) {
220280
+ let size = 0;
220281
+ for (const [key, value] of body) {
220282
+ size += usualFormBoundarySize;
220283
+ size += new TextEncoder().encode(`Content-Disposition: form-data; name="${key}"`).length;
220284
+ size += typeof value === "string" ? new TextEncoder().encode(value).length : value.size;
220285
+ }
220286
+ return size;
220287
+ }
220288
+ if (body instanceof Blob) {
220289
+ return body.size;
220290
+ }
220291
+ if (body instanceof ArrayBuffer) {
220292
+ return body.byteLength;
220293
+ }
220294
+ if (typeof body === "string") {
220295
+ return new TextEncoder().encode(body).length;
220296
+ }
220297
+ if (body instanceof URLSearchParams) {
220298
+ return new TextEncoder().encode(body.toString()).length;
220299
+ }
220300
+ if ("byteLength" in body) {
220301
+ return body.byteLength;
220302
+ }
220303
+ if (typeof body === "object" && body !== null) {
220304
+ try {
220305
+ const jsonString = JSON.stringify(body);
220306
+ return new TextEncoder().encode(jsonString).length;
220307
+ } catch {
220308
+ return 0;
220309
+ }
220310
+ }
220311
+ return 0;
220312
+ };
220313
+ var withProgress = (stream, totalBytes, onProgress) => {
220314
+ let previousChunk;
220315
+ let transferredBytes = 0;
220316
+ return stream.pipeThrough(new TransformStream({
220317
+ transform(currentChunk, controller) {
220318
+ controller.enqueue(currentChunk);
220319
+ if (previousChunk) {
220320
+ transferredBytes += previousChunk.byteLength;
220321
+ let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
220322
+ if (percent >= 1) {
220323
+ percent = 1 - Number.EPSILON;
220324
+ }
220325
+ onProgress?.({ percent, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
220326
+ }
220327
+ previousChunk = currentChunk;
220328
+ },
220329
+ flush() {
220330
+ if (previousChunk) {
220331
+ transferredBytes += previousChunk.byteLength;
220332
+ onProgress?.({ percent: 1, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
220333
+ }
220334
+ }
220335
+ }));
220336
+ };
220337
+ var streamResponse = (response, onDownloadProgress) => {
220338
+ if (!response.body) {
220339
+ return response;
220340
+ }
220341
+ if (response.status === 204) {
220342
+ return new Response(null, {
220343
+ status: response.status,
220344
+ statusText: response.statusText,
220345
+ headers: response.headers
220346
+ });
220347
+ }
220348
+ const totalBytes = Math.max(0, Number(response.headers.get("content-length")) || 0);
220349
+ return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
220350
+ status: response.status,
220351
+ statusText: response.statusText,
220352
+ headers: response.headers
220353
+ });
220354
+ };
220355
+ var streamRequest = (request, onUploadProgress, originalBody) => {
220356
+ if (!request.body) {
220357
+ return request;
220358
+ }
220359
+ const totalBytes = getBodySize(originalBody ?? request.body);
220360
+ return new Request(request, {
220361
+ duplex: "half",
220362
+ body: withProgress(request.body, totalBytes, onUploadProgress)
220363
+ });
220364
+ };
220365
+
220366
+ // ../../node_modules/ky/distribution/utils/is.js
220367
+ var isObject = (value) => value !== null && typeof value === "object";
220368
+
220369
+ // ../../node_modules/ky/distribution/utils/merge.js
220370
+ var validateAndMerge = (...sources) => {
220371
+ for (const source of sources) {
220372
+ if ((!isObject(source) || Array.isArray(source)) && source !== undefined) {
220373
+ throw new TypeError("The `options` argument must be an object");
220374
+ }
220375
+ }
220376
+ return deepMerge({}, ...sources);
220377
+ };
220378
+ var mergeHeaders = (source1 = {}, source2 = {}) => {
220379
+ const result = new globalThis.Headers(source1);
220380
+ const isHeadersInstance = source2 instanceof globalThis.Headers;
220381
+ const source = new globalThis.Headers(source2);
220382
+ for (const [key, value] of source.entries()) {
220383
+ if (isHeadersInstance && value === "undefined" || value === undefined) {
220384
+ result.delete(key);
220385
+ } else {
220386
+ result.set(key, value);
220387
+ }
220388
+ }
220389
+ return result;
220390
+ };
220391
+ function newHookValue(original, incoming, property) {
220392
+ return Object.hasOwn(incoming, property) && incoming[property] === undefined ? [] : deepMerge(original[property] ?? [], incoming[property] ?? []);
220393
+ }
220394
+ var mergeHooks = (original = {}, incoming = {}) => ({
220395
+ beforeRequest: newHookValue(original, incoming, "beforeRequest"),
220396
+ beforeRetry: newHookValue(original, incoming, "beforeRetry"),
220397
+ afterResponse: newHookValue(original, incoming, "afterResponse"),
220398
+ beforeError: newHookValue(original, incoming, "beforeError")
220399
+ });
220400
+ var appendSearchParameters = (target, source) => {
220401
+ const result = new URLSearchParams;
220402
+ for (const input of [target, source]) {
220403
+ if (input === undefined) {
220404
+ continue;
220405
+ }
220406
+ if (input instanceof URLSearchParams) {
220407
+ for (const [key, value] of input.entries()) {
220408
+ result.append(key, value);
220409
+ }
220410
+ } else if (Array.isArray(input)) {
220411
+ for (const pair of input) {
220412
+ if (!Array.isArray(pair) || pair.length !== 2) {
220413
+ throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
220414
+ }
220415
+ result.append(String(pair[0]), String(pair[1]));
220416
+ }
220417
+ } else if (isObject(input)) {
220418
+ for (const [key, value] of Object.entries(input)) {
220419
+ if (value !== undefined) {
220420
+ result.append(key, String(value));
220421
+ }
220422
+ }
220423
+ } else {
220424
+ const parameters = new URLSearchParams(input);
220425
+ for (const [key, value] of parameters.entries()) {
220426
+ result.append(key, value);
220427
+ }
220428
+ }
220429
+ }
220430
+ return result;
220431
+ };
220432
+ var deepMerge = (...sources) => {
220433
+ let returnValue = {};
220434
+ let headers = {};
220435
+ let hooks = {};
220436
+ let searchParameters;
220437
+ const signals = [];
220438
+ for (const source of sources) {
220439
+ if (Array.isArray(source)) {
220440
+ if (!Array.isArray(returnValue)) {
220441
+ returnValue = [];
220442
+ }
220443
+ returnValue = [...returnValue, ...source];
220444
+ } else if (isObject(source)) {
220445
+ for (let [key, value] of Object.entries(source)) {
220446
+ if (key === "signal" && value instanceof globalThis.AbortSignal) {
220447
+ signals.push(value);
220448
+ continue;
220449
+ }
220450
+ if (key === "context") {
220451
+ if (value !== undefined && value !== null && (!isObject(value) || Array.isArray(value))) {
220452
+ throw new TypeError("The `context` option must be an object");
220453
+ }
220454
+ returnValue = {
220455
+ ...returnValue,
220456
+ context: value === undefined || value === null ? {} : { ...returnValue.context, ...value }
220457
+ };
220458
+ continue;
220459
+ }
220460
+ if (key === "searchParams") {
220461
+ if (value === undefined || value === null) {
220462
+ searchParameters = undefined;
220463
+ } else {
220464
+ searchParameters = searchParameters === undefined ? value : appendSearchParameters(searchParameters, value);
220465
+ }
220466
+ continue;
220467
+ }
220468
+ if (isObject(value) && key in returnValue) {
220469
+ value = deepMerge(returnValue[key], value);
220470
+ }
220471
+ returnValue = { ...returnValue, [key]: value };
220472
+ }
220473
+ if (isObject(source.hooks)) {
220474
+ hooks = mergeHooks(hooks, source.hooks);
220475
+ returnValue.hooks = hooks;
220476
+ }
220477
+ if (isObject(source.headers)) {
220478
+ headers = mergeHeaders(headers, source.headers);
220479
+ returnValue.headers = headers;
220480
+ }
220481
+ }
220482
+ }
220483
+ if (searchParameters !== undefined) {
220484
+ returnValue.searchParams = searchParameters;
220485
+ }
220486
+ if (signals.length > 0) {
220487
+ if (signals.length === 1) {
220488
+ returnValue.signal = signals[0];
220489
+ } else if (supportsAbortSignal) {
220490
+ returnValue.signal = AbortSignal.any(signals);
220491
+ } else {
220492
+ returnValue.signal = signals.at(-1);
220493
+ }
220494
+ }
220495
+ return returnValue;
220496
+ };
220497
+
220498
+ // ../../node_modules/ky/distribution/utils/normalize.js
220499
+ var normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
220500
+ var retryMethods = ["get", "put", "head", "delete", "options", "trace"];
220501
+ var retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
220502
+ var retryAfterStatusCodes = [413, 429, 503];
220503
+ var defaultRetryOptions = {
220504
+ limit: 2,
220505
+ methods: retryMethods,
220506
+ statusCodes: retryStatusCodes,
220507
+ afterStatusCodes: retryAfterStatusCodes,
220508
+ maxRetryAfter: Number.POSITIVE_INFINITY,
220509
+ backoffLimit: Number.POSITIVE_INFINITY,
220510
+ delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1000,
220511
+ jitter: undefined,
220512
+ retryOnTimeout: false
220513
+ };
220514
+ var normalizeRetryOptions = (retry2 = {}) => {
220515
+ if (typeof retry2 === "number") {
220516
+ return {
220517
+ ...defaultRetryOptions,
220518
+ limit: retry2
220519
+ };
220520
+ }
220521
+ if (retry2.methods && !Array.isArray(retry2.methods)) {
220522
+ throw new Error("retry.methods must be an array");
220523
+ }
220524
+ retry2.methods &&= retry2.methods.map((method) => method.toLowerCase());
220525
+ if (retry2.statusCodes && !Array.isArray(retry2.statusCodes)) {
220526
+ throw new Error("retry.statusCodes must be an array");
220527
+ }
220528
+ const normalizedRetry = Object.fromEntries(Object.entries(retry2).filter(([, value]) => value !== undefined));
220529
+ return {
220530
+ ...defaultRetryOptions,
220531
+ ...normalizedRetry
220532
+ };
220533
+ };
220534
+
220535
+ // ../../node_modules/ky/distribution/errors/TimeoutError.js
220536
+ class TimeoutError2 extends Error {
220537
+ request;
220538
+ constructor(request) {
220539
+ super(`Request timed out: ${request.method} ${request.url}`);
220540
+ this.name = "TimeoutError";
220541
+ this.request = request;
220542
+ }
220543
+ }
220544
+
220545
+ // ../../node_modules/ky/distribution/utils/timeout.js
220546
+ async function timeout(request, init, abortController, options) {
220547
+ return new Promise((resolve, reject) => {
220548
+ const timeoutId = setTimeout(() => {
220549
+ if (abortController) {
220550
+ abortController.abort();
220551
+ }
220552
+ reject(new TimeoutError2(request));
220553
+ }, options.timeout);
220554
+ options.fetch(request, init).then(resolve).catch(reject).then(() => {
220555
+ clearTimeout(timeoutId);
220556
+ });
220557
+ });
220558
+ }
220559
+
220560
+ // ../../node_modules/ky/distribution/utils/delay.js
220561
+ async function delay(ms, { signal }) {
220562
+ return new Promise((resolve, reject) => {
220563
+ if (signal) {
220564
+ signal.throwIfAborted();
220565
+ signal.addEventListener("abort", abortHandler, { once: true });
220566
+ }
220567
+ function abortHandler() {
220568
+ clearTimeout(timeoutId);
220569
+ reject(signal.reason);
220570
+ }
220571
+ const timeoutId = setTimeout(() => {
220572
+ signal?.removeEventListener("abort", abortHandler);
220573
+ resolve();
220574
+ }, ms);
220575
+ });
220576
+ }
220577
+
220578
+ // ../../node_modules/ky/distribution/utils/options.js
220579
+ var findUnknownOptions = (request, options) => {
220580
+ const unknownOptions = {};
220581
+ for (const key in options) {
220582
+ if (!Object.hasOwn(options, key)) {
220583
+ continue;
220584
+ }
220585
+ if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || (key in vendorSpecificOptions))) {
220586
+ unknownOptions[key] = options[key];
220587
+ }
220588
+ }
220589
+ return unknownOptions;
220590
+ };
220591
+ var hasSearchParameters = (search) => {
220592
+ if (search === undefined) {
220593
+ return false;
220594
+ }
220595
+ if (Array.isArray(search)) {
220596
+ return search.length > 0;
220597
+ }
220598
+ if (search instanceof URLSearchParams) {
220599
+ return search.size > 0;
220600
+ }
220601
+ if (typeof search === "object") {
220602
+ return Object.keys(search).length > 0;
220603
+ }
220604
+ if (typeof search === "string") {
220605
+ return search.trim().length > 0;
220606
+ }
220607
+ return Boolean(search);
220608
+ };
220609
+
220610
+ // ../../node_modules/ky/distribution/utils/type-guards.js
220611
+ function isHTTPError(error) {
220612
+ return error instanceof HTTPError || error?.name === HTTPError.name;
220613
+ }
220614
+ function isTimeoutError(error) {
220615
+ return error instanceof TimeoutError2 || error?.name === TimeoutError2.name;
220616
+ }
220617
+
220618
+ // ../../node_modules/ky/distribution/core/Ky.js
220619
+ class Ky {
220620
+ static create(input, options) {
220621
+ const ky = new Ky(input, options);
220622
+ const function_ = async () => {
220623
+ if (typeof ky.#options.timeout === "number" && ky.#options.timeout > maxSafeTimeout) {
220624
+ throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
220625
+ }
220626
+ await Promise.resolve();
220627
+ let response = await ky.#fetch();
220628
+ for (const hook of ky.#options.hooks.afterResponse) {
220629
+ const clonedResponse = ky.#decorateResponse(response.clone());
220630
+ let modifiedResponse;
220631
+ try {
220632
+ modifiedResponse = await hook(ky.request, ky.#getNormalizedOptions(), clonedResponse, { retryCount: ky.#retryCount });
220633
+ } catch (error) {
220634
+ ky.#cancelResponseBody(clonedResponse);
220635
+ ky.#cancelResponseBody(response);
220636
+ throw error;
220637
+ }
220638
+ if (modifiedResponse instanceof RetryMarker) {
220639
+ ky.#cancelResponseBody(clonedResponse);
220640
+ ky.#cancelResponseBody(response);
220641
+ throw new ForceRetryError(modifiedResponse.options);
220642
+ }
220643
+ const nextResponse = modifiedResponse instanceof globalThis.Response ? modifiedResponse : response;
220644
+ if (clonedResponse !== nextResponse) {
220645
+ ky.#cancelResponseBody(clonedResponse);
220646
+ }
220647
+ if (response !== nextResponse) {
220648
+ ky.#cancelResponseBody(response);
220649
+ }
220650
+ response = nextResponse;
220651
+ }
220652
+ ky.#decorateResponse(response);
220653
+ if (!response.ok && (typeof ky.#options.throwHttpErrors === "function" ? ky.#options.throwHttpErrors(response.status) : ky.#options.throwHttpErrors)) {
220654
+ let error = new HTTPError(response, ky.request, ky.#getNormalizedOptions());
220655
+ for (const hook of ky.#options.hooks.beforeError) {
220656
+ error = await hook(error, { retryCount: ky.#retryCount });
220657
+ }
220658
+ throw error;
220659
+ }
220660
+ if (ky.#options.onDownloadProgress) {
220661
+ if (typeof ky.#options.onDownloadProgress !== "function") {
220662
+ throw new TypeError("The `onDownloadProgress` option must be a function");
220663
+ }
220664
+ if (!supportsResponseStreams) {
220665
+ throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
220666
+ }
220667
+ const progressResponse = response.clone();
220668
+ ky.#cancelResponseBody(response);
220669
+ return streamResponse(progressResponse, ky.#options.onDownloadProgress);
220670
+ }
220671
+ return response;
220672
+ };
220673
+ const result = ky.#retry(function_).finally(() => {
220674
+ const originalRequest = ky.#originalRequest;
220675
+ ky.#cancelBody(originalRequest?.body ?? undefined);
220676
+ ky.#cancelBody(ky.request.body ?? undefined);
220677
+ });
220678
+ for (const [type, mimeType] of Object.entries(responseTypes)) {
220679
+ if (type === "bytes" && typeof globalThis.Response?.prototype?.bytes !== "function") {
220680
+ continue;
220681
+ }
220682
+ result[type] = async () => {
220683
+ ky.request.headers.set("accept", ky.request.headers.get("accept") || mimeType);
220684
+ const response = await result;
220685
+ if (type === "json") {
220686
+ if (response.status === 204) {
220687
+ return "";
220688
+ }
220689
+ const text = await response.text();
220690
+ if (text === "") {
220691
+ return "";
220692
+ }
220693
+ if (options.parseJson) {
220694
+ return options.parseJson(text);
220695
+ }
220696
+ return JSON.parse(text);
220697
+ }
220698
+ return response[type]();
220699
+ };
220700
+ }
220701
+ return result;
220702
+ }
220703
+ static #normalizeSearchParams(searchParams) {
220704
+ if (searchParams && typeof searchParams === "object" && !Array.isArray(searchParams) && !(searchParams instanceof URLSearchParams)) {
220705
+ return Object.fromEntries(Object.entries(searchParams).filter(([, value]) => value !== undefined));
220706
+ }
220707
+ return searchParams;
220708
+ }
220709
+ request;
220710
+ #abortController;
220711
+ #retryCount = 0;
220712
+ #input;
220713
+ #options;
220714
+ #originalRequest;
220715
+ #userProvidedAbortSignal;
220716
+ #cachedNormalizedOptions;
220717
+ constructor(input, options = {}) {
220718
+ this.#input = input;
220719
+ this.#options = {
220720
+ ...options,
220721
+ headers: mergeHeaders(this.#input.headers, options.headers),
220722
+ hooks: mergeHooks({
220723
+ beforeRequest: [],
220724
+ beforeRetry: [],
220725
+ beforeError: [],
220726
+ afterResponse: []
220727
+ }, options.hooks),
220728
+ method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
220729
+ prefixUrl: String(options.prefixUrl || ""),
220730
+ retry: normalizeRetryOptions(options.retry),
220731
+ throwHttpErrors: options.throwHttpErrors ?? true,
220732
+ timeout: options.timeout ?? 1e4,
220733
+ fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
220734
+ context: options.context ?? {}
220735
+ };
220736
+ if (typeof this.#input !== "string" && !(this.#input instanceof URL || this.#input instanceof globalThis.Request)) {
220737
+ throw new TypeError("`input` must be a string, URL, or Request");
220738
+ }
220739
+ if (this.#options.prefixUrl && typeof this.#input === "string") {
220740
+ if (this.#input.startsWith("/")) {
220741
+ throw new Error("`input` must not begin with a slash when using `prefixUrl`");
220742
+ }
220743
+ if (!this.#options.prefixUrl.endsWith("/")) {
220744
+ this.#options.prefixUrl += "/";
220745
+ }
220746
+ this.#input = this.#options.prefixUrl + this.#input;
220747
+ }
220748
+ if (supportsAbortController && supportsAbortSignal) {
220749
+ this.#userProvidedAbortSignal = this.#options.signal ?? this.#input.signal;
220750
+ this.#abortController = new globalThis.AbortController;
220751
+ this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
220752
+ }
220753
+ if (supportsRequestStreams) {
220754
+ this.#options.duplex = "half";
220755
+ }
220756
+ if (this.#options.json !== undefined) {
220757
+ this.#options.body = this.#options.stringifyJson?.(this.#options.json) ?? JSON.stringify(this.#options.json);
220758
+ this.#options.headers.set("content-type", this.#options.headers.get("content-type") ?? "application/json");
220759
+ }
220760
+ const userProvidedContentType = options.headers && new globalThis.Headers(options.headers).has("content-type");
220761
+ if (this.#input instanceof globalThis.Request && (supportsFormData && this.#options.body instanceof globalThis.FormData || this.#options.body instanceof URLSearchParams) && !userProvidedContentType) {
220762
+ this.#options.headers.delete("content-type");
220763
+ }
220764
+ this.request = new globalThis.Request(this.#input, this.#options);
220765
+ if (hasSearchParameters(this.#options.searchParams)) {
220766
+ const textSearchParams = typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString();
220767
+ const searchParams = "?" + textSearchParams;
220768
+ const url = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
220769
+ this.request = new globalThis.Request(url, this.#options);
220770
+ }
220771
+ if (this.#options.onUploadProgress) {
220772
+ if (typeof this.#options.onUploadProgress !== "function") {
220773
+ throw new TypeError("The `onUploadProgress` option must be a function");
220774
+ }
220775
+ if (!supportsRequestStreams) {
220776
+ throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
220777
+ }
220778
+ this.request = this.#wrapRequestWithUploadProgress(this.request, this.#options.body ?? undefined);
220779
+ }
220780
+ }
220781
+ #calculateDelay() {
220782
+ const retryDelay = this.#options.retry.delay(this.#retryCount);
220783
+ let jitteredDelay = retryDelay;
220784
+ if (this.#options.retry.jitter === true) {
220785
+ jitteredDelay = Math.random() * retryDelay;
220786
+ } else if (typeof this.#options.retry.jitter === "function") {
220787
+ jitteredDelay = this.#options.retry.jitter(retryDelay);
220788
+ if (!Number.isFinite(jitteredDelay) || jitteredDelay < 0) {
220789
+ jitteredDelay = retryDelay;
220790
+ }
220791
+ }
220792
+ const backoffLimit = this.#options.retry.backoffLimit ?? Number.POSITIVE_INFINITY;
220793
+ return Math.min(backoffLimit, jitteredDelay);
220794
+ }
220795
+ async#calculateRetryDelay(error) {
220796
+ this.#retryCount++;
220797
+ if (this.#retryCount > this.#options.retry.limit) {
220798
+ throw error;
220799
+ }
220800
+ const errorObject = error instanceof Error ? error : new NonError(error);
220801
+ if (errorObject instanceof ForceRetryError) {
220802
+ return errorObject.customDelay ?? this.#calculateDelay();
220803
+ }
220804
+ if (!this.#options.retry.methods.includes(this.request.method.toLowerCase())) {
220805
+ throw error;
220806
+ }
220807
+ if (this.#options.retry.shouldRetry !== undefined) {
220808
+ const result = await this.#options.retry.shouldRetry({ error: errorObject, retryCount: this.#retryCount });
220809
+ if (result === false) {
220810
+ throw error;
220811
+ }
220812
+ if (result === true) {
220813
+ return this.#calculateDelay();
220814
+ }
220815
+ }
220816
+ if (isTimeoutError(error) && !this.#options.retry.retryOnTimeout) {
220817
+ throw error;
220818
+ }
220819
+ if (isHTTPError(error)) {
220820
+ if (!this.#options.retry.statusCodes.includes(error.response.status)) {
220821
+ throw error;
220822
+ }
220823
+ const retryAfter = error.response.headers.get("Retry-After") ?? error.response.headers.get("RateLimit-Reset") ?? error.response.headers.get("X-RateLimit-Retry-After") ?? error.response.headers.get("X-RateLimit-Reset") ?? error.response.headers.get("X-Rate-Limit-Reset");
220824
+ if (retryAfter && this.#options.retry.afterStatusCodes.includes(error.response.status)) {
220825
+ let after = Number(retryAfter) * 1000;
220826
+ if (Number.isNaN(after)) {
220827
+ after = Date.parse(retryAfter) - Date.now();
220828
+ } else if (after >= Date.parse("2024-01-01")) {
220829
+ after -= Date.now();
220830
+ }
220831
+ const max = this.#options.retry.maxRetryAfter ?? after;
220832
+ return after < max ? after : max;
220833
+ }
220834
+ if (error.response.status === 413) {
220835
+ throw error;
220836
+ }
220837
+ }
220838
+ return this.#calculateDelay();
220839
+ }
220840
+ #decorateResponse(response) {
220841
+ if (this.#options.parseJson) {
220842
+ response.json = async () => this.#options.parseJson(await response.text());
220843
+ }
220844
+ return response;
220845
+ }
220846
+ #cancelBody(body) {
220847
+ if (!body) {
220848
+ return;
220849
+ }
220850
+ body.cancel().catch(() => {
220851
+ return;
220852
+ });
220853
+ }
220854
+ #cancelResponseBody(response) {
220855
+ this.#cancelBody(response.body ?? undefined);
220856
+ }
220857
+ async#retry(function_) {
220858
+ try {
220859
+ return await function_();
220860
+ } catch (error) {
220861
+ const ms = Math.min(await this.#calculateRetryDelay(error), maxSafeTimeout);
220862
+ if (this.#retryCount < 1) {
220863
+ throw error;
220864
+ }
220865
+ await delay(ms, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
220866
+ if (error instanceof ForceRetryError && error.customRequest) {
220867
+ const managedRequest = this.#options.signal ? new globalThis.Request(error.customRequest, { signal: this.#options.signal }) : new globalThis.Request(error.customRequest);
220868
+ this.#assignRequest(managedRequest);
220869
+ }
220870
+ for (const hook of this.#options.hooks.beforeRetry) {
220871
+ const hookResult = await hook({
220872
+ request: this.request,
220873
+ options: this.#getNormalizedOptions(),
220874
+ error,
220875
+ retryCount: this.#retryCount
220876
+ });
220877
+ if (hookResult instanceof globalThis.Request) {
220878
+ this.#assignRequest(hookResult);
220879
+ break;
220880
+ }
220881
+ if (hookResult instanceof globalThis.Response) {
220882
+ return hookResult;
220883
+ }
220884
+ if (hookResult === stop) {
220885
+ return;
220886
+ }
220887
+ }
220888
+ return this.#retry(function_);
220889
+ }
220890
+ }
220891
+ async#fetch() {
220892
+ if (this.#abortController?.signal.aborted) {
220893
+ this.#abortController = new globalThis.AbortController;
220894
+ this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
220895
+ this.request = new globalThis.Request(this.request, { signal: this.#options.signal });
220896
+ }
220897
+ for (const hook of this.#options.hooks.beforeRequest) {
220898
+ const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
220899
+ if (result instanceof Response) {
220900
+ return result;
220901
+ }
220902
+ if (result instanceof globalThis.Request) {
220903
+ this.#assignRequest(result);
220904
+ break;
220905
+ }
220906
+ }
220907
+ const nonRequestOptions = findUnknownOptions(this.request, this.#options);
220908
+ this.#originalRequest = this.request;
220909
+ this.request = this.#originalRequest.clone();
220910
+ if (this.#options.timeout === false) {
220911
+ return this.#options.fetch(this.#originalRequest, nonRequestOptions);
220912
+ }
220913
+ return timeout(this.#originalRequest, nonRequestOptions, this.#abortController, this.#options);
220914
+ }
220915
+ #getNormalizedOptions() {
220916
+ if (!this.#cachedNormalizedOptions) {
220917
+ const { hooks, ...normalizedOptions } = this.#options;
220918
+ this.#cachedNormalizedOptions = Object.freeze(normalizedOptions);
220919
+ }
220920
+ return this.#cachedNormalizedOptions;
220921
+ }
220922
+ #assignRequest(request) {
220923
+ this.#cachedNormalizedOptions = undefined;
220924
+ this.request = this.#wrapRequestWithUploadProgress(request);
220925
+ }
220926
+ #wrapRequestWithUploadProgress(request, originalBody) {
220927
+ if (!this.#options.onUploadProgress || !request.body) {
220928
+ return request;
220929
+ }
220930
+ return streamRequest(request, this.#options.onUploadProgress, originalBody ?? this.#options.body ?? undefined);
220931
+ }
220932
+ }
220933
+ // ../../node_modules/ky/distribution/index.js
220934
+ /*! MIT License © Sindre Sorhus */
220935
+ var createInstance = (defaults) => {
220936
+ const ky = (input, options) => Ky.create(input, validateAndMerge(defaults, options));
220937
+ for (const method of requestMethods) {
220938
+ ky[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
220939
+ }
220940
+ ky.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
220941
+ ky.extend = (newDefaults) => {
220942
+ if (typeof newDefaults === "function") {
220943
+ newDefaults = newDefaults(defaults ?? {});
220944
+ }
220945
+ return createInstance(validateAndMerge(defaults, newDefaults));
220946
+ };
220947
+ ky.stop = stop;
220948
+ ky.retry = retry;
220949
+ return ky;
220950
+ };
220951
+ var ky = createInstance();
220952
+ var distribution_default = ky;
220953
+
220135
220954
  // ../../node_modules/zod/v4/classic/external.js
220136
220955
  var exports_external = {};
220137
220956
  __export(exports_external, {
@@ -220759,7 +221578,7 @@ __export(exports_util, {
220759
221578
  joinValues: () => joinValues,
220760
221579
  issue: () => issue,
220761
221580
  isPlainObject: () => isPlainObject,
220762
- isObject: () => isObject,
221581
+ isObject: () => isObject2,
220763
221582
  hexToUint8Array: () => hexToUint8Array,
220764
221583
  getSizableOrigin: () => getSizableOrigin,
220765
221584
  getParsedType: () => getParsedType,
@@ -220928,7 +221747,7 @@ function slugify(input) {
220928
221747
  return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
220929
221748
  }
220930
221749
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
220931
- function isObject(data) {
221750
+ function isObject2(data) {
220932
221751
  return typeof data === "object" && data !== null && !Array.isArray(data);
220933
221752
  }
220934
221753
  var allowsEval = cached(() => {
@@ -220944,7 +221763,7 @@ var allowsEval = cached(() => {
220944
221763
  }
220945
221764
  });
220946
221765
  function isPlainObject(o) {
220947
- if (isObject(o) === false)
221766
+ if (isObject2(o) === false)
220948
221767
  return false;
220949
221768
  const ctor = o.constructor;
220950
221769
  if (ctor === undefined)
@@ -220952,7 +221771,7 @@ function isPlainObject(o) {
220952
221771
  if (typeof ctor !== "function")
220953
221772
  return true;
220954
221773
  const prot = ctor.prototype;
220955
- if (isObject(prot) === false)
221774
+ if (isObject2(prot) === false)
220956
221775
  return false;
220957
221776
  if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
220958
221777
  return false;
@@ -223105,13 +223924,13 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
223105
223924
  }
223106
223925
  return propValues;
223107
223926
  });
223108
- const isObject2 = isObject;
223927
+ const isObject3 = isObject2;
223109
223928
  const catchall = def.catchall;
223110
223929
  let value;
223111
223930
  inst._zod.parse = (payload, ctx) => {
223112
223931
  value ?? (value = _normalized.value);
223113
223932
  const input = payload.value;
223114
- if (!isObject2(input)) {
223933
+ if (!isObject3(input)) {
223115
223934
  payload.issues.push({
223116
223935
  expected: "object",
223117
223936
  code: "invalid_type",
@@ -223209,7 +224028,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
223209
224028
  return (payload, ctx) => fn(shape, payload, ctx);
223210
224029
  };
223211
224030
  let fastpass;
223212
- const isObject2 = isObject;
224031
+ const isObject3 = isObject2;
223213
224032
  const jit = !globalConfig.jitless;
223214
224033
  const allowsEval2 = allowsEval;
223215
224034
  const fastEnabled = jit && allowsEval2.value;
@@ -223218,7 +224037,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
223218
224037
  inst._zod.parse = (payload, ctx) => {
223219
224038
  value ?? (value = _normalized.value);
223220
224039
  const input = payload.value;
223221
- if (!isObject2(input)) {
224040
+ if (!isObject3(input)) {
223222
224041
  payload.issues.push({
223223
224042
  expected: "object",
223224
224043
  code: "invalid_type",
@@ -223396,7 +224215,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
223396
224215
  });
223397
224216
  inst._zod.parse = (payload, ctx) => {
223398
224217
  const input = payload.value;
223399
- if (!isObject(input)) {
224218
+ if (!isObject2(input)) {
223400
224219
  payload.issues.push({
223401
224220
  code: "invalid_type",
223402
224221
  expected: "object",
@@ -233664,870 +234483,362 @@ function date4(params) {
233664
234483
 
233665
234484
  // ../../node_modules/zod/v4/classic/external.js
233666
234485
  config(en_default());
233667
- // src/core/auth/schema.ts
233668
- var AuthDataSchema = exports_external.object({
233669
- accessToken: exports_external.string().min(1, "Token cannot be empty"),
233670
- refreshToken: exports_external.string().min(1, "Refresh token cannot be empty"),
233671
- expiresAt: exports_external.number().int().positive("Expires at must be a positive integer"),
233672
- email: exports_external.email(),
233673
- name: exports_external.string().min(1, "Name cannot be empty")
233674
- });
233675
- var DeviceCodeResponseSchema = exports_external.object({
233676
- device_code: exports_external.string().min(1, "Device code cannot be empty"),
233677
- user_code: exports_external.string().min(1, "User code cannot be empty"),
233678
- verification_uri: exports_external.url("Invalid verification URL"),
233679
- expires_in: exports_external.number().int().positive("Expires in must be a positive integer"),
233680
- interval: exports_external.number().int().positive("Interval in must be a positive integer")
233681
- }).transform((data) => ({
233682
- deviceCode: data.device_code,
233683
- userCode: data.user_code,
233684
- verificationUri: data.verification_uri,
233685
- expiresIn: data.expires_in,
233686
- interval: data.interval
233687
- }));
233688
- var TokenResponseSchema = exports_external.object({
233689
- access_token: exports_external.string().min(1, "Token cannot be empty"),
233690
- token_type: exports_external.string().min(1, "Token type cannot be empty"),
233691
- expires_in: exports_external.number().int().positive("Expires in must be a positive integer"),
233692
- refresh_token: exports_external.string().min(1, "Refresh token cannot be empty"),
233693
- scope: exports_external.string().optional()
233694
- }).transform((data) => ({
233695
- accessToken: data.access_token,
233696
- tokenType: data.token_type,
233697
- expiresIn: data.expires_in,
233698
- refreshToken: data.refresh_token,
233699
- scope: data.scope
233700
- }));
233701
- var OAuthErrorSchema = exports_external.object({
233702
- error: exports_external.string(),
233703
- error_description: exports_external.string().optional()
233704
- });
233705
- var UserInfoSchema = exports_external.object({
233706
- email: exports_external.email(),
233707
- name: exports_external.string()
234486
+ // src/core/clients/schemas.ts
234487
+ var ApiErrorResponseSchema = exports_external.looseObject({
234488
+ message: exports_external.unknown().optional(),
234489
+ detail: exports_external.unknown().optional(),
234490
+ extra_data: exports_external.looseObject({
234491
+ reason: exports_external.string().optional().catch(undefined),
234492
+ errors: exports_external.array(exports_external.looseObject({ name: exports_external.string(), message: exports_external.string() })).optional().catch(undefined)
234493
+ }).optional().nullable().catch(undefined)
233708
234494
  });
233709
234495
 
233710
- // src/core/clients/base44-client.ts
233711
- import { randomUUID as randomUUID2 } from "node:crypto";
233712
-
233713
- // ../../node_modules/ky/distribution/errors/HTTPError.js
233714
- class HTTPError extends Error {
233715
- response;
233716
- request;
233717
- options;
233718
- constructor(response, request, options) {
233719
- const code = response.status || response.status === 0 ? response.status : "";
233720
- const title = response.statusText ?? "";
233721
- const status = `${code} ${title}`.trim();
233722
- const reason = status ? `status code ${status}` : "an unknown error";
233723
- super(`Request failed with ${reason}: ${request.method} ${request.url}`);
233724
- this.name = "HTTPError";
233725
- this.response = response;
233726
- this.request = request;
233727
- this.options = options;
234496
+ // src/core/errors.ts
234497
+ function formatApiError(errorBody, parsed) {
234498
+ const data = parsed ?? ApiErrorResponseSchema.safeParse(errorBody).data;
234499
+ if (data) {
234500
+ const content = data.message ?? data.detail;
234501
+ if (typeof content === "string")
234502
+ return content;
234503
+ if (content !== undefined)
234504
+ return JSON.stringify(content, null, 2);
233728
234505
  }
234506
+ if (typeof errorBody === "string")
234507
+ return errorBody;
234508
+ return JSON.stringify(errorBody, null, 2);
234509
+ }
234510
+ function parseErrorDetails(extraData) {
234511
+ const errors3 = extraData?.errors;
234512
+ if (!errors3 || errors3.length === 0)
234513
+ return;
234514
+ return errors3.map((e2) => `${e2.name}: ${e2.message}`);
233729
234515
  }
233730
234516
 
233731
- // ../../node_modules/ky/distribution/errors/NonError.js
233732
- class NonError extends Error {
233733
- name = "NonError";
233734
- value;
233735
- constructor(value) {
233736
- let message = "Non-error value was thrown";
233737
- try {
233738
- if (typeof value === "string") {
233739
- message = value;
233740
- } else if (value && typeof value === "object" && "message" in value && typeof value.message === "string") {
233741
- message = value.message;
233742
- }
233743
- } catch {}
234517
+ class CLIError extends Error {
234518
+ hints;
234519
+ details;
234520
+ cause;
234521
+ constructor(message, options) {
233744
234522
  super(message);
233745
- this.value = value;
234523
+ this.name = this.constructor.name;
234524
+ this.hints = options?.hints ?? [];
234525
+ this.details = options?.details ?? [];
234526
+ this.cause = options?.cause;
234527
+ Error.captureStackTrace(this, this.constructor);
233746
234528
  }
233747
234529
  }
233748
234530
 
233749
- // ../../node_modules/ky/distribution/errors/ForceRetryError.js
233750
- class ForceRetryError extends Error {
233751
- name = "ForceRetryError";
233752
- customDelay;
233753
- code;
233754
- customRequest;
233755
- constructor(options) {
233756
- const cause = options?.cause ? options.cause instanceof Error ? options.cause : new NonError(options.cause) : undefined;
233757
- super(options?.code ? `Forced retry: ${options.code}` : "Forced retry", cause ? { cause } : undefined);
233758
- this.customDelay = options?.delay;
233759
- this.code = options?.code;
233760
- this.customRequest = options?.request;
233761
- }
234531
+ class UserError extends CLIError {
233762
234532
  }
233763
234533
 
233764
- // ../../node_modules/ky/distribution/core/constants.js
233765
- var supportsRequestStreams = (() => {
233766
- let duplexAccessed = false;
233767
- let hasContentType = false;
233768
- const supportsReadableStream = typeof globalThis.ReadableStream === "function";
233769
- const supportsRequest = typeof globalThis.Request === "function";
233770
- if (supportsReadableStream && supportsRequest) {
233771
- try {
233772
- hasContentType = new globalThis.Request("https://empty.invalid", {
233773
- body: new globalThis.ReadableStream,
233774
- method: "POST",
233775
- get duplex() {
233776
- duplexAccessed = true;
233777
- return "half";
234534
+ class SystemError extends CLIError {
234535
+ }
234536
+ class AuthExpiredError extends UserError {
234537
+ code = "AUTH_EXPIRED";
234538
+ constructor(message = "Authentication has expired", options) {
234539
+ super(message, {
234540
+ hints: options?.hints ?? [
234541
+ {
234542
+ message: "Run 'base44 login' to re-authenticate",
234543
+ command: "base44 login"
233778
234544
  }
233779
- }).headers.has("Content-Type");
233780
- } catch (error48) {
233781
- if (error48 instanceof Error && error48.message === "unsupported BodyInit type") {
233782
- return false;
233783
- }
233784
- throw error48;
233785
- }
233786
- }
233787
- return duplexAccessed && !hasContentType;
233788
- })();
233789
- var supportsAbortController = typeof globalThis.AbortController === "function";
233790
- var supportsAbortSignal = typeof globalThis.AbortSignal === "function" && typeof globalThis.AbortSignal.any === "function";
233791
- var supportsResponseStreams = typeof globalThis.ReadableStream === "function";
233792
- var supportsFormData = typeof globalThis.FormData === "function";
233793
- var requestMethods = ["get", "post", "put", "patch", "head", "delete"];
233794
- var validate = () => {
233795
- return;
233796
- };
233797
- validate();
233798
- var responseTypes = {
233799
- json: "application/json",
233800
- text: "text/*",
233801
- formData: "multipart/form-data",
233802
- arrayBuffer: "*/*",
233803
- blob: "*/*",
233804
- bytes: "*/*"
233805
- };
233806
- var maxSafeTimeout = 2147483647;
233807
- var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
233808
- var stop = Symbol("stop");
233809
-
233810
- class RetryMarker {
233811
- options;
233812
- constructor(options) {
233813
- this.options = options;
234545
+ ],
234546
+ cause: options?.cause
234547
+ });
233814
234548
  }
233815
234549
  }
233816
- var retry = (options) => new RetryMarker(options);
233817
- var kyOptionKeys = {
233818
- json: true,
233819
- parseJson: true,
233820
- stringifyJson: true,
233821
- searchParams: true,
233822
- prefixUrl: true,
233823
- retry: true,
233824
- timeout: true,
233825
- hooks: true,
233826
- throwHttpErrors: true,
233827
- onDownloadProgress: true,
233828
- onUploadProgress: true,
233829
- fetch: true,
233830
- context: true
233831
- };
233832
- var vendorSpecificOptions = {
233833
- next: true
233834
- };
233835
- var requestOptionsRegistry = {
233836
- method: true,
233837
- headers: true,
233838
- body: true,
233839
- mode: true,
233840
- credentials: true,
233841
- cache: true,
233842
- redirect: true,
233843
- referrer: true,
233844
- referrerPolicy: true,
233845
- integrity: true,
233846
- keepalive: true,
233847
- signal: true,
233848
- window: true,
233849
- duplex: true
233850
- };
233851
234550
 
233852
- // ../../node_modules/ky/distribution/utils/body.js
233853
- var getBodySize = (body) => {
233854
- if (!body) {
233855
- return 0;
233856
- }
233857
- if (body instanceof FormData) {
233858
- let size = 0;
233859
- for (const [key, value] of body) {
233860
- size += usualFormBoundarySize;
233861
- size += new TextEncoder().encode(`Content-Disposition: form-data; name="${key}"`).length;
233862
- size += typeof value === "string" ? new TextEncoder().encode(value).length : value.size;
233863
- }
233864
- return size;
233865
- }
233866
- if (body instanceof Blob) {
233867
- return body.size;
233868
- }
233869
- if (body instanceof ArrayBuffer) {
233870
- return body.byteLength;
233871
- }
233872
- if (typeof body === "string") {
233873
- return new TextEncoder().encode(body).length;
233874
- }
233875
- if (body instanceof URLSearchParams) {
233876
- return new TextEncoder().encode(body.toString()).length;
233877
- }
233878
- if ("byteLength" in body) {
233879
- return body.byteLength;
233880
- }
233881
- if (typeof body === "object" && body !== null) {
233882
- try {
233883
- const jsonString = JSON.stringify(body);
233884
- return new TextEncoder().encode(jsonString).length;
233885
- } catch {
233886
- return 0;
233887
- }
233888
- }
233889
- return 0;
233890
- };
233891
- var withProgress = (stream, totalBytes, onProgress) => {
233892
- let previousChunk;
233893
- let transferredBytes = 0;
233894
- return stream.pipeThrough(new TransformStream({
233895
- transform(currentChunk, controller) {
233896
- controller.enqueue(currentChunk);
233897
- if (previousChunk) {
233898
- transferredBytes += previousChunk.byteLength;
233899
- let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
233900
- if (percent >= 1) {
233901
- percent = 1 - Number.EPSILON;
234551
+ class ConfigNotFoundError extends UserError {
234552
+ code = "CONFIG_NOT_FOUND";
234553
+ constructor(message = "No Base44 project found in this directory", options) {
234554
+ super(message, {
234555
+ hints: options?.hints ?? [
234556
+ {
234557
+ message: "Run 'base44 create' to create a new project",
234558
+ command: "base44 create"
234559
+ },
234560
+ {
234561
+ message: "Or run 'base44 link' to link an existing project",
234562
+ command: "base44 link"
233902
234563
  }
233903
- onProgress?.({ percent, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
233904
- }
233905
- previousChunk = currentChunk;
233906
- },
233907
- flush() {
233908
- if (previousChunk) {
233909
- transferredBytes += previousChunk.byteLength;
233910
- onProgress?.({ percent: 1, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
233911
- }
233912
- }
233913
- }));
233914
- };
233915
- var streamResponse = (response, onDownloadProgress) => {
233916
- if (!response.body) {
233917
- return response;
233918
- }
233919
- if (response.status === 204) {
233920
- return new Response(null, {
233921
- status: response.status,
233922
- statusText: response.statusText,
233923
- headers: response.headers
234564
+ ],
234565
+ cause: options?.cause
233924
234566
  });
233925
234567
  }
233926
- const totalBytes = Math.max(0, Number(response.headers.get("content-length")) || 0);
233927
- return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
233928
- status: response.status,
233929
- statusText: response.statusText,
233930
- headers: response.headers
233931
- });
233932
- };
233933
- var streamRequest = (request, onUploadProgress, originalBody) => {
233934
- if (!request.body) {
233935
- return request;
233936
- }
233937
- const totalBytes = getBodySize(originalBody ?? request.body);
233938
- return new Request(request, {
233939
- duplex: "half",
233940
- body: withProgress(request.body, totalBytes, onUploadProgress)
233941
- });
233942
- };
233943
-
233944
- // ../../node_modules/ky/distribution/utils/is.js
233945
- var isObject2 = (value) => value !== null && typeof value === "object";
233946
-
233947
- // ../../node_modules/ky/distribution/utils/merge.js
233948
- var validateAndMerge = (...sources) => {
233949
- for (const source of sources) {
233950
- if ((!isObject2(source) || Array.isArray(source)) && source !== undefined) {
233951
- throw new TypeError("The `options` argument must be an object");
233952
- }
233953
- }
233954
- return deepMerge({}, ...sources);
233955
- };
233956
- var mergeHeaders = (source1 = {}, source2 = {}) => {
233957
- const result = new globalThis.Headers(source1);
233958
- const isHeadersInstance = source2 instanceof globalThis.Headers;
233959
- const source = new globalThis.Headers(source2);
233960
- for (const [key, value] of source.entries()) {
233961
- if (isHeadersInstance && value === "undefined" || value === undefined) {
233962
- result.delete(key);
233963
- } else {
233964
- result.set(key, value);
233965
- }
233966
- }
233967
- return result;
233968
- };
233969
- function newHookValue(original, incoming, property) {
233970
- return Object.hasOwn(incoming, property) && incoming[property] === undefined ? [] : deepMerge(original[property] ?? [], incoming[property] ?? []);
233971
234568
  }
233972
- var mergeHooks = (original = {}, incoming = {}) => ({
233973
- beforeRequest: newHookValue(original, incoming, "beforeRequest"),
233974
- beforeRetry: newHookValue(original, incoming, "beforeRetry"),
233975
- afterResponse: newHookValue(original, incoming, "afterResponse"),
233976
- beforeError: newHookValue(original, incoming, "beforeError")
233977
- });
233978
- var appendSearchParameters = (target, source) => {
233979
- const result = new URLSearchParams;
233980
- for (const input of [target, source]) {
233981
- if (input === undefined) {
233982
- continue;
233983
- }
233984
- if (input instanceof URLSearchParams) {
233985
- for (const [key, value] of input.entries()) {
233986
- result.append(key, value);
233987
- }
233988
- } else if (Array.isArray(input)) {
233989
- for (const pair of input) {
233990
- if (!Array.isArray(pair) || pair.length !== 2) {
233991
- throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
233992
- }
233993
- result.append(String(pair[0]), String(pair[1]));
233994
- }
233995
- } else if (isObject2(input)) {
233996
- for (const [key, value] of Object.entries(input)) {
233997
- if (value !== undefined) {
233998
- result.append(key, String(value));
233999
- }
234000
- }
234001
- } else {
234002
- const parameters = new URLSearchParams(input);
234003
- for (const [key, value] of parameters.entries()) {
234004
- result.append(key, value);
234005
- }
234006
- }
234007
- }
234008
- return result;
234009
- };
234010
- var deepMerge = (...sources) => {
234011
- let returnValue = {};
234012
- let headers = {};
234013
- let hooks = {};
234014
- let searchParameters;
234015
- const signals = [];
234016
- for (const source of sources) {
234017
- if (Array.isArray(source)) {
234018
- if (!Array.isArray(returnValue)) {
234019
- returnValue = [];
234020
- }
234021
- returnValue = [...returnValue, ...source];
234022
- } else if (isObject2(source)) {
234023
- for (let [key, value] of Object.entries(source)) {
234024
- if (key === "signal" && value instanceof globalThis.AbortSignal) {
234025
- signals.push(value);
234026
- continue;
234027
- }
234028
- if (key === "context") {
234029
- if (value !== undefined && value !== null && (!isObject2(value) || Array.isArray(value))) {
234030
- throw new TypeError("The `context` option must be an object");
234031
- }
234032
- returnValue = {
234033
- ...returnValue,
234034
- context: value === undefined || value === null ? {} : { ...returnValue.context, ...value }
234035
- };
234036
- continue;
234037
- }
234038
- if (key === "searchParams") {
234039
- if (value === undefined || value === null) {
234040
- searchParameters = undefined;
234041
- } else {
234042
- searchParameters = searchParameters === undefined ? value : appendSearchParameters(searchParameters, value);
234043
- }
234044
- continue;
234045
- }
234046
- if (isObject2(value) && key in returnValue) {
234047
- value = deepMerge(returnValue[key], value);
234048
- }
234049
- returnValue = { ...returnValue, [key]: value };
234050
- }
234051
- if (isObject2(source.hooks)) {
234052
- hooks = mergeHooks(hooks, source.hooks);
234053
- returnValue.hooks = hooks;
234054
- }
234055
- if (isObject2(source.headers)) {
234056
- headers = mergeHeaders(headers, source.headers);
234057
- returnValue.headers = headers;
234058
- }
234059
- }
234060
- }
234061
- if (searchParameters !== undefined) {
234062
- returnValue.searchParams = searchParameters;
234063
- }
234064
- if (signals.length > 0) {
234065
- if (signals.length === 1) {
234066
- returnValue.signal = signals[0];
234067
- } else if (supportsAbortSignal) {
234068
- returnValue.signal = AbortSignal.any(signals);
234069
- } else {
234070
- returnValue.signal = signals.at(-1);
234071
- }
234072
- }
234073
- return returnValue;
234074
- };
234075
234569
 
234076
- // ../../node_modules/ky/distribution/utils/normalize.js
234077
- var normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
234078
- var retryMethods = ["get", "put", "head", "delete", "options", "trace"];
234079
- var retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
234080
- var retryAfterStatusCodes = [413, 429, 503];
234081
- var defaultRetryOptions = {
234082
- limit: 2,
234083
- methods: retryMethods,
234084
- statusCodes: retryStatusCodes,
234085
- afterStatusCodes: retryAfterStatusCodes,
234086
- maxRetryAfter: Number.POSITIVE_INFINITY,
234087
- backoffLimit: Number.POSITIVE_INFINITY,
234088
- delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1000,
234089
- jitter: undefined,
234090
- retryOnTimeout: false
234091
- };
234092
- var normalizeRetryOptions = (retry2 = {}) => {
234093
- if (typeof retry2 === "number") {
234094
- return {
234095
- ...defaultRetryOptions,
234096
- limit: retry2
234097
- };
234098
- }
234099
- if (retry2.methods && !Array.isArray(retry2.methods)) {
234100
- throw new Error("retry.methods must be an array");
234101
- }
234102
- retry2.methods &&= retry2.methods.map((method) => method.toLowerCase());
234103
- if (retry2.statusCodes && !Array.isArray(retry2.statusCodes)) {
234104
- throw new Error("retry.statusCodes must be an array");
234570
+ class ConfigInvalidError extends UserError {
234571
+ code = "CONFIG_INVALID";
234572
+ constructor(message, configFilePath, options) {
234573
+ const defaultHint = configFilePath ? `Check the file at ${configFilePath} for syntax errors` : "Check the file for syntax errors";
234574
+ super(message, {
234575
+ hints: options?.hints ?? [{ message: defaultHint }],
234576
+ cause: options?.cause
234577
+ });
234105
234578
  }
234106
- const normalizedRetry = Object.fromEntries(Object.entries(retry2).filter(([, value]) => value !== undefined));
234107
- return {
234108
- ...defaultRetryOptions,
234109
- ...normalizedRetry
234110
- };
234111
- };
234579
+ }
234112
234580
 
234113
- // ../../node_modules/ky/distribution/errors/TimeoutError.js
234114
- class TimeoutError2 extends Error {
234115
- request;
234116
- constructor(request) {
234117
- super(`Request timed out: ${request.method} ${request.url}`);
234118
- this.name = "TimeoutError";
234119
- this.request = request;
234581
+ class ConfigExistsError extends UserError {
234582
+ code = "CONFIG_EXISTS";
234583
+ constructor(message, options) {
234584
+ super(message, {
234585
+ hints: options?.hints ?? [
234586
+ {
234587
+ message: "Choose a different location or remove the existing project"
234588
+ }
234589
+ ],
234590
+ cause: options?.cause
234591
+ });
234120
234592
  }
234121
234593
  }
234122
234594
 
234123
- // ../../node_modules/ky/distribution/utils/timeout.js
234124
- async function timeout(request, init, abortController, options) {
234125
- return new Promise((resolve, reject) => {
234126
- const timeoutId = setTimeout(() => {
234127
- if (abortController) {
234128
- abortController.abort();
234129
- }
234130
- reject(new TimeoutError2(request));
234131
- }, options.timeout);
234132
- options.fetch(request, init).then(resolve).catch(reject).then(() => {
234133
- clearTimeout(timeoutId);
234134
- });
234135
- });
234595
+ class SchemaValidationError extends UserError {
234596
+ code = "SCHEMA_INVALID";
234597
+ filePath;
234598
+ constructor(context, zodError, filePath) {
234599
+ const message = filePath ? `${context} in ${filePath}:
234600
+ ${exports_external.prettifyError(zodError)}` : `${context}:
234601
+ ${exports_external.prettifyError(zodError)}`;
234602
+ const hints = filePath ? [{ message: `Fix the schema/data structure errors in ${filePath}` }] : [{ message: "Fix the schema/data structure errors above" }];
234603
+ super(message, { hints });
234604
+ this.filePath = filePath;
234605
+ }
234136
234606
  }
234137
234607
 
234138
- // ../../node_modules/ky/distribution/utils/delay.js
234139
- async function delay(ms, { signal }) {
234140
- return new Promise((resolve, reject) => {
234141
- if (signal) {
234142
- signal.throwIfAborted();
234143
- signal.addEventListener("abort", abortHandler, { once: true });
234144
- }
234145
- function abortHandler() {
234146
- clearTimeout(timeoutId);
234147
- reject(signal.reason);
234148
- }
234149
- const timeoutId = setTimeout(() => {
234150
- signal?.removeEventListener("abort", abortHandler);
234151
- resolve();
234152
- }, ms);
234153
- });
234608
+ class InvalidInputError extends UserError {
234609
+ code = "INVALID_INPUT";
234154
234610
  }
234155
234611
 
234156
- // ../../node_modules/ky/distribution/utils/options.js
234157
- var findUnknownOptions = (request, options) => {
234158
- const unknownOptions = {};
234159
- for (const key in options) {
234160
- if (!Object.hasOwn(options, key)) {
234161
- continue;
234162
- }
234163
- if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || (key in vendorSpecificOptions))) {
234164
- unknownOptions[key] = options[key];
234165
- }
234166
- }
234167
- return unknownOptions;
234168
- };
234169
- var hasSearchParameters = (search) => {
234170
- if (search === undefined) {
234171
- return false;
234172
- }
234173
- if (Array.isArray(search)) {
234174
- return search.length > 0;
234175
- }
234176
- if (search instanceof URLSearchParams) {
234177
- return search.size > 0;
234178
- }
234179
- if (typeof search === "object") {
234180
- return Object.keys(search).length > 0;
234181
- }
234182
- if (typeof search === "string") {
234183
- return search.trim().length > 0;
234612
+ class DependencyNotFoundError extends UserError {
234613
+ code = "DEPENDENCY_NOT_FOUND";
234614
+ constructor(message, options) {
234615
+ super(message, {
234616
+ hints: options?.hints ?? [
234617
+ { message: "Install the required dependency and try again" }
234618
+ ],
234619
+ cause: options?.cause
234620
+ });
234184
234621
  }
234185
- return Boolean(search);
234186
- };
234187
-
234188
- // ../../node_modules/ky/distribution/utils/type-guards.js
234189
- function isHTTPError(error48) {
234190
- return error48 instanceof HTTPError || error48?.name === HTTPError.name;
234191
- }
234192
- function isTimeoutError(error48) {
234193
- return error48 instanceof TimeoutError2 || error48?.name === TimeoutError2.name;
234194
234622
  }
234195
234623
 
234196
- // ../../node_modules/ky/distribution/core/Ky.js
234197
- class Ky {
234198
- static create(input, options) {
234199
- const ky = new Ky(input, options);
234200
- const function_ = async () => {
234201
- if (typeof ky.#options.timeout === "number" && ky.#options.timeout > maxSafeTimeout) {
234202
- throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
234203
- }
234204
- await Promise.resolve();
234205
- let response = await ky.#fetch();
234206
- for (const hook of ky.#options.hooks.afterResponse) {
234207
- const clonedResponse = ky.#decorateResponse(response.clone());
234208
- let modifiedResponse;
234209
- try {
234210
- modifiedResponse = await hook(ky.request, ky.#getNormalizedOptions(), clonedResponse, { retryCount: ky.#retryCount });
234211
- } catch (error48) {
234212
- ky.#cancelResponseBody(clonedResponse);
234213
- ky.#cancelResponseBody(response);
234214
- throw error48;
234215
- }
234216
- if (modifiedResponse instanceof RetryMarker) {
234217
- ky.#cancelResponseBody(clonedResponse);
234218
- ky.#cancelResponseBody(response);
234219
- throw new ForceRetryError(modifiedResponse.options);
234220
- }
234221
- const nextResponse = modifiedResponse instanceof globalThis.Response ? modifiedResponse : response;
234222
- if (clonedResponse !== nextResponse) {
234223
- ky.#cancelResponseBody(clonedResponse);
234224
- }
234225
- if (response !== nextResponse) {
234226
- ky.#cancelResponseBody(response);
234227
- }
234228
- response = nextResponse;
234229
- }
234230
- ky.#decorateResponse(response);
234231
- if (!response.ok && (typeof ky.#options.throwHttpErrors === "function" ? ky.#options.throwHttpErrors(response.status) : ky.#options.throwHttpErrors)) {
234232
- let error48 = new HTTPError(response, ky.request, ky.#getNormalizedOptions());
234233
- for (const hook of ky.#options.hooks.beforeError) {
234234
- error48 = await hook(error48, { retryCount: ky.#retryCount });
234235
- }
234236
- throw error48;
234237
- }
234238
- if (ky.#options.onDownloadProgress) {
234239
- if (typeof ky.#options.onDownloadProgress !== "function") {
234240
- throw new TypeError("The `onDownloadProgress` option must be a function");
234241
- }
234242
- if (!supportsResponseStreams) {
234243
- throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
234624
+ class ApiError extends SystemError {
234625
+ code = "API_ERROR";
234626
+ statusCode;
234627
+ requestUrl;
234628
+ requestMethod;
234629
+ requestBody;
234630
+ responseBody;
234631
+ requestId;
234632
+ constructor(message, options) {
234633
+ const hints = options?.hints ?? ApiError.getDefaultHints(options?.statusCode);
234634
+ super(message, { hints, details: options?.details, cause: options?.cause });
234635
+ this.statusCode = options?.statusCode;
234636
+ this.requestUrl = options?.requestUrl;
234637
+ this.requestMethod = options?.requestMethod;
234638
+ this.requestBody = options?.requestBody;
234639
+ this.responseBody = options?.responseBody;
234640
+ this.requestId = options?.requestId;
234641
+ }
234642
+ static async fromHttpError(error48, context) {
234643
+ if (error48 instanceof HTTPError) {
234644
+ let message;
234645
+ let responseBody;
234646
+ let hints;
234647
+ let details;
234648
+ try {
234649
+ responseBody = await error48.response.clone().json();
234650
+ const parsed = ApiErrorResponseSchema.safeParse(responseBody);
234651
+ const parsedData = parsed.success ? parsed.data : undefined;
234652
+ message = formatApiError(responseBody, parsedData);
234653
+ if (parsedData) {
234654
+ hints = ApiError.getReasonHints(parsedData);
234655
+ details = parseErrorDetails(parsedData.extra_data);
234244
234656
  }
234245
- const progressResponse = response.clone();
234246
- ky.#cancelResponseBody(response);
234247
- return streamResponse(progressResponse, ky.#options.onDownloadProgress);
234248
- }
234249
- return response;
234250
- };
234251
- const result = ky.#retry(function_).finally(() => {
234252
- const originalRequest = ky.#originalRequest;
234253
- ky.#cancelBody(originalRequest?.body ?? undefined);
234254
- ky.#cancelBody(ky.request.body ?? undefined);
234255
- });
234256
- for (const [type, mimeType] of Object.entries(responseTypes)) {
234257
- if (type === "bytes" && typeof globalThis.Response?.prototype?.bytes !== "function") {
234258
- continue;
234657
+ } catch {
234658
+ message = error48.message;
234259
234659
  }
234260
- result[type] = async () => {
234261
- ky.request.headers.set("accept", ky.request.headers.get("accept") || mimeType);
234262
- const response = await result;
234263
- if (type === "json") {
234264
- if (response.status === 204) {
234265
- return "";
234266
- }
234267
- const text = await response.text();
234268
- if (text === "") {
234269
- return "";
234270
- }
234271
- if (options.parseJson) {
234272
- return options.parseJson(text);
234273
- }
234274
- return JSON.parse(text);
234275
- }
234276
- return response[type]();
234277
- };
234660
+ const statusCode = ApiError.normalizeStatusCode(error48.response.status, responseBody);
234661
+ const requestBody = error48.options.context?.__requestBody;
234662
+ const requestId = error48.response.headers.get("X-Request-ID") ?? undefined;
234663
+ return new ApiError(`Error ${context}: ${message}`, {
234664
+ statusCode,
234665
+ requestUrl: error48.request.url,
234666
+ requestMethod: error48.request.method,
234667
+ requestBody,
234668
+ responseBody,
234669
+ requestId,
234670
+ hints,
234671
+ details,
234672
+ cause: error48
234673
+ });
234278
234674
  }
234279
- return result;
234280
- }
234281
- static #normalizeSearchParams(searchParams) {
234282
- if (searchParams && typeof searchParams === "object" && !Array.isArray(searchParams) && !(searchParams instanceof URLSearchParams)) {
234283
- return Object.fromEntries(Object.entries(searchParams).filter(([, value]) => value !== undefined));
234675
+ if (error48 instanceof Error) {
234676
+ return new ApiError(`Error ${context}: ${error48.message}`, {
234677
+ cause: error48
234678
+ });
234284
234679
  }
234285
- return searchParams;
234680
+ return new ApiError(`Error ${context}: ${String(error48)}`);
234286
234681
  }
234287
- request;
234288
- #abortController;
234289
- #retryCount = 0;
234290
- #input;
234291
- #options;
234292
- #originalRequest;
234293
- #userProvidedAbortSignal;
234294
- #cachedNormalizedOptions;
234295
- constructor(input, options = {}) {
234296
- this.#input = input;
234297
- this.#options = {
234298
- ...options,
234299
- headers: mergeHeaders(this.#input.headers, options.headers),
234300
- hooks: mergeHooks({
234301
- beforeRequest: [],
234302
- beforeRetry: [],
234303
- beforeError: [],
234304
- afterResponse: []
234305
- }, options.hooks),
234306
- method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
234307
- prefixUrl: String(options.prefixUrl || ""),
234308
- retry: normalizeRetryOptions(options.retry),
234309
- throwHttpErrors: options.throwHttpErrors ?? true,
234310
- timeout: options.timeout ?? 1e4,
234311
- fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
234312
- context: options.context ?? {}
234313
- };
234314
- if (typeof this.#input !== "string" && !(this.#input instanceof URL || this.#input instanceof globalThis.Request)) {
234315
- throw new TypeError("`input` must be a string, URL, or Request");
234316
- }
234317
- if (this.#options.prefixUrl && typeof this.#input === "string") {
234318
- if (this.#input.startsWith("/")) {
234319
- throw new Error("`input` must not begin with a slash when using `prefixUrl`");
234320
- }
234321
- if (!this.#options.prefixUrl.endsWith("/")) {
234322
- this.#options.prefixUrl += "/";
234323
- }
234324
- this.#input = this.#options.prefixUrl + this.#input;
234325
- }
234326
- if (supportsAbortController && supportsAbortSignal) {
234327
- this.#userProvidedAbortSignal = this.#options.signal ?? this.#input.signal;
234328
- this.#abortController = new globalThis.AbortController;
234329
- this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
234330
- }
234331
- if (supportsRequestStreams) {
234332
- this.#options.duplex = "half";
234682
+ static getDefaultHints(statusCode) {
234683
+ if (statusCode === 400) {
234684
+ return [
234685
+ {
234686
+ message: "The server rejected the request. Check the error message above for details."
234687
+ }
234688
+ ];
234333
234689
  }
234334
- if (this.#options.json !== undefined) {
234335
- this.#options.body = this.#options.stringifyJson?.(this.#options.json) ?? JSON.stringify(this.#options.json);
234336
- this.#options.headers.set("content-type", this.#options.headers.get("content-type") ?? "application/json");
234690
+ if (statusCode === 401) {
234691
+ return [{ message: "Try logging in again", command: "base44 login" }];
234337
234692
  }
234338
- const userProvidedContentType = options.headers && new globalThis.Headers(options.headers).has("content-type");
234339
- if (this.#input instanceof globalThis.Request && (supportsFormData && this.#options.body instanceof globalThis.FormData || this.#options.body instanceof URLSearchParams) && !userProvidedContentType) {
234340
- this.#options.headers.delete("content-type");
234693
+ if (statusCode === 403) {
234694
+ return [{ message: "You don't have permission to perform this action" }];
234341
234695
  }
234342
- this.request = new globalThis.Request(this.#input, this.#options);
234343
- if (hasSearchParameters(this.#options.searchParams)) {
234344
- const textSearchParams = typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString();
234345
- const searchParams = "?" + textSearchParams;
234346
- const url2 = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
234347
- this.request = new globalThis.Request(url2, this.#options);
234696
+ if (statusCode === 404) {
234697
+ return [{ message: "The requested resource was not found" }];
234348
234698
  }
234349
- if (this.#options.onUploadProgress) {
234350
- if (typeof this.#options.onUploadProgress !== "function") {
234351
- throw new TypeError("The `onUploadProgress` option must be a function");
234352
- }
234353
- if (!supportsRequestStreams) {
234354
- throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
234355
- }
234356
- this.request = this.#wrapRequestWithUploadProgress(this.request, this.#options.body ?? undefined);
234699
+ if (statusCode === 422) {
234700
+ return [
234701
+ {
234702
+ message: "The request was rejected due to a validation error. Check the error message above for details."
234703
+ }
234704
+ ];
234357
234705
  }
234358
- }
234359
- #calculateDelay() {
234360
- const retryDelay = this.#options.retry.delay(this.#retryCount);
234361
- let jitteredDelay = retryDelay;
234362
- if (this.#options.retry.jitter === true) {
234363
- jitteredDelay = Math.random() * retryDelay;
234364
- } else if (typeof this.#options.retry.jitter === "function") {
234365
- jitteredDelay = this.#options.retry.jitter(retryDelay);
234366
- if (!Number.isFinite(jitteredDelay) || jitteredDelay < 0) {
234367
- jitteredDelay = retryDelay;
234368
- }
234706
+ if (statusCode === 428) {
234707
+ return [
234708
+ {
234709
+ message: "The server rejected the request due to a precondition failure. Check the error message above for details"
234710
+ }
234711
+ ];
234369
234712
  }
234370
- const backoffLimit = this.#options.retry.backoffLimit ?? Number.POSITIVE_INFINITY;
234371
- return Math.min(backoffLimit, jitteredDelay);
234713
+ return [{ message: "Check your network connection and try again" }];
234372
234714
  }
234373
- async#calculateRetryDelay(error48) {
234374
- this.#retryCount++;
234375
- if (this.#retryCount > this.#options.retry.limit) {
234376
- throw error48;
234377
- }
234378
- const errorObject = error48 instanceof Error ? error48 : new NonError(error48);
234379
- if (errorObject instanceof ForceRetryError) {
234380
- return errorObject.customDelay ?? this.#calculateDelay();
234381
- }
234382
- if (!this.#options.retry.methods.includes(this.request.method.toLowerCase())) {
234383
- throw error48;
234384
- }
234385
- if (this.#options.retry.shouldRetry !== undefined) {
234386
- const result = await this.#options.retry.shouldRetry({ error: errorObject, retryCount: this.#retryCount });
234387
- if (result === false) {
234388
- throw error48;
234389
- }
234390
- if (result === true) {
234391
- return this.#calculateDelay();
234392
- }
234393
- }
234394
- if (isTimeoutError(error48) && !this.#options.retry.retryOnTimeout) {
234395
- throw error48;
234396
- }
234397
- if (isHTTPError(error48)) {
234398
- if (!this.#options.retry.statusCodes.includes(error48.response.status)) {
234399
- throw error48;
234400
- }
234401
- const retryAfter = error48.response.headers.get("Retry-After") ?? error48.response.headers.get("RateLimit-Reset") ?? error48.response.headers.get("X-RateLimit-Retry-After") ?? error48.response.headers.get("X-RateLimit-Reset") ?? error48.response.headers.get("X-Rate-Limit-Reset");
234402
- if (retryAfter && this.#options.retry.afterStatusCodes.includes(error48.response.status)) {
234403
- let after = Number(retryAfter) * 1000;
234404
- if (Number.isNaN(after)) {
234405
- after = Date.parse(retryAfter) - Date.now();
234406
- } else if (after >= Date.parse("2024-01-01")) {
234407
- after -= Date.now();
234715
+ static getReasonHints(parsedResponse) {
234716
+ const REASON_HINTS = {
234717
+ requires_backend_platform_app: [
234718
+ {
234719
+ message: "This feature requires an app created with the Base44 CLI. Remove `base44/.app.jsonc` and run 'base44 link' to connect your project to a CLI-created app."
234720
+ },
234721
+ {
234722
+ message: "Read more at https://docs.base44.com/developers/backend/overview/introduction"
234408
234723
  }
234409
- const max = this.#options.retry.maxRetryAfter ?? after;
234410
- return after < max ? after : max;
234411
- }
234412
- if (error48.response.status === 413) {
234413
- throw error48;
234414
- }
234415
- }
234416
- return this.#calculateDelay();
234724
+ ]
234725
+ };
234726
+ const reason = parsedResponse.extra_data?.reason;
234727
+ if (typeof reason !== "string")
234728
+ return;
234729
+ return REASON_HINTS[reason];
234417
234730
  }
234418
- #decorateResponse(response) {
234419
- if (this.#options.parseJson) {
234420
- response.json = async () => this.#options.parseJson(await response.text());
234731
+ static normalizeStatusCode(statusCode, responseBody) {
234732
+ if (responseBody?.error_type === "KeyError") {
234733
+ return 404;
234421
234734
  }
234422
- return response;
234735
+ return statusCode;
234423
234736
  }
234424
- #cancelBody(body) {
234425
- if (!body) {
234426
- return;
234427
- }
234428
- body.cancel().catch(() => {
234429
- return;
234737
+ }
234738
+
234739
+ class FileNotFoundError extends SystemError {
234740
+ code = "FILE_NOT_FOUND";
234741
+ constructor(message, options) {
234742
+ super(message, {
234743
+ hints: options?.hints ?? [
234744
+ { message: "Check the file path and try again" }
234745
+ ],
234746
+ cause: options?.cause
234430
234747
  });
234431
234748
  }
234432
- #cancelResponseBody(response) {
234433
- this.#cancelBody(response.body ?? undefined);
234749
+ }
234750
+
234751
+ class FileReadError extends SystemError {
234752
+ code = "FILE_READ_ERROR";
234753
+ constructor(message, options) {
234754
+ super(message, {
234755
+ hints: options?.hints ?? [
234756
+ { message: "Check file permissions and try again" }
234757
+ ],
234758
+ cause: options?.cause
234759
+ });
234434
234760
  }
234435
- async#retry(function_) {
234436
- try {
234437
- return await function_();
234438
- } catch (error48) {
234439
- const ms = Math.min(await this.#calculateRetryDelay(error48), maxSafeTimeout);
234440
- if (this.#retryCount < 1) {
234441
- throw error48;
234442
- }
234443
- await delay(ms, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
234444
- if (error48 instanceof ForceRetryError && error48.customRequest) {
234445
- const managedRequest = this.#options.signal ? new globalThis.Request(error48.customRequest, { signal: this.#options.signal }) : new globalThis.Request(error48.customRequest);
234446
- this.#assignRequest(managedRequest);
234447
- }
234448
- for (const hook of this.#options.hooks.beforeRetry) {
234449
- const hookResult = await hook({
234450
- request: this.request,
234451
- options: this.#getNormalizedOptions(),
234452
- error: error48,
234453
- retryCount: this.#retryCount
234454
- });
234455
- if (hookResult instanceof globalThis.Request) {
234456
- this.#assignRequest(hookResult);
234457
- break;
234458
- }
234459
- if (hookResult instanceof globalThis.Response) {
234460
- return hookResult;
234461
- }
234462
- if (hookResult === stop) {
234463
- return;
234761
+ }
234762
+
234763
+ class InternalError extends SystemError {
234764
+ code = "INTERNAL_ERROR";
234765
+ constructor(message, options) {
234766
+ super(message, {
234767
+ hints: options?.hints ?? [
234768
+ {
234769
+ message: "This is an unexpected error. Please report it if it persists."
234464
234770
  }
234465
- }
234466
- return this.#retry(function_);
234467
- }
234468
- }
234469
- async#fetch() {
234470
- if (this.#abortController?.signal.aborted) {
234471
- this.#abortController = new globalThis.AbortController;
234472
- this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
234473
- this.request = new globalThis.Request(this.request, { signal: this.#options.signal });
234474
- }
234475
- for (const hook of this.#options.hooks.beforeRequest) {
234476
- const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
234477
- if (result instanceof Response) {
234478
- return result;
234479
- }
234480
- if (result instanceof globalThis.Request) {
234481
- this.#assignRequest(result);
234482
- break;
234483
- }
234484
- }
234485
- const nonRequestOptions = findUnknownOptions(this.request, this.#options);
234486
- this.#originalRequest = this.request;
234487
- this.request = this.#originalRequest.clone();
234488
- if (this.#options.timeout === false) {
234489
- return this.#options.fetch(this.#originalRequest, nonRequestOptions);
234490
- }
234491
- return timeout(this.#originalRequest, nonRequestOptions, this.#abortController, this.#options);
234492
- }
234493
- #getNormalizedOptions() {
234494
- if (!this.#cachedNormalizedOptions) {
234495
- const { hooks, ...normalizedOptions } = this.#options;
234496
- this.#cachedNormalizedOptions = Object.freeze(normalizedOptions);
234497
- }
234498
- return this.#cachedNormalizedOptions;
234499
- }
234500
- #assignRequest(request) {
234501
- this.#cachedNormalizedOptions = undefined;
234502
- this.request = this.#wrapRequestWithUploadProgress(request);
234503
- }
234504
- #wrapRequestWithUploadProgress(request, originalBody) {
234505
- if (!this.#options.onUploadProgress || !request.body) {
234506
- return request;
234507
- }
234508
- return streamRequest(request, this.#options.onUploadProgress, originalBody ?? this.#options.body ?? undefined);
234771
+ ],
234772
+ cause: options?.cause
234773
+ });
234509
234774
  }
234510
234775
  }
234511
- // ../../node_modules/ky/distribution/index.js
234512
- /*! MIT License © Sindre Sorhus */
234513
- var createInstance = (defaults) => {
234514
- const ky = (input, options) => Ky.create(input, validateAndMerge(defaults, options));
234515
- for (const method of requestMethods) {
234516
- ky[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
234776
+
234777
+ class TypeGenerationError extends SystemError {
234778
+ code = "TYPE_GENERATION_ERROR";
234779
+ constructor(message, entityName, cause) {
234780
+ super(message, {
234781
+ hints: [
234782
+ {
234783
+ message: entityName ? `Check the schema for entity "${entityName}"` : "Check your entity schemas for errors"
234784
+ }
234785
+ ],
234786
+ cause: cause instanceof Error ? cause : undefined
234787
+ });
234517
234788
  }
234518
- ky.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
234519
- ky.extend = (newDefaults) => {
234520
- if (typeof newDefaults === "function") {
234521
- newDefaults = newDefaults(defaults ?? {});
234522
- }
234523
- return createInstance(validateAndMerge(defaults, newDefaults));
234524
- };
234525
- ky.stop = stop;
234526
- ky.retry = retry;
234527
- return ky;
234528
- };
234529
- var ky = createInstance();
234530
- var distribution_default = ky;
234789
+ }
234790
+ function isCLIError(error48) {
234791
+ return error48 instanceof CLIError;
234792
+ }
234793
+ function isUserError(error48) {
234794
+ return error48 instanceof UserError;
234795
+ }
234796
+
234797
+ // src/core/auth/schema.ts
234798
+ var AuthDataSchema = exports_external.object({
234799
+ accessToken: exports_external.string().min(1, "Token cannot be empty"),
234800
+ refreshToken: exports_external.string().min(1, "Refresh token cannot be empty"),
234801
+ expiresAt: exports_external.number().int().positive("Expires at must be a positive integer"),
234802
+ email: exports_external.email(),
234803
+ name: exports_external.string().min(1, "Name cannot be empty")
234804
+ });
234805
+ var DeviceCodeResponseSchema = exports_external.object({
234806
+ device_code: exports_external.string().min(1, "Device code cannot be empty"),
234807
+ user_code: exports_external.string().min(1, "User code cannot be empty"),
234808
+ verification_uri: exports_external.url("Invalid verification URL"),
234809
+ expires_in: exports_external.number().int().positive("Expires in must be a positive integer"),
234810
+ interval: exports_external.number().int().positive("Interval in must be a positive integer")
234811
+ }).transform((data) => ({
234812
+ deviceCode: data.device_code,
234813
+ userCode: data.user_code,
234814
+ verificationUri: data.verification_uri,
234815
+ expiresIn: data.expires_in,
234816
+ interval: data.interval
234817
+ }));
234818
+ var TokenResponseSchema = exports_external.object({
234819
+ access_token: exports_external.string().min(1, "Token cannot be empty"),
234820
+ token_type: exports_external.string().min(1, "Token type cannot be empty"),
234821
+ expires_in: exports_external.number().int().positive("Expires in must be a positive integer"),
234822
+ refresh_token: exports_external.string().min(1, "Refresh token cannot be empty"),
234823
+ scope: exports_external.string().optional()
234824
+ }).transform((data) => ({
234825
+ accessToken: data.access_token,
234826
+ tokenType: data.token_type,
234827
+ expiresIn: data.expires_in,
234828
+ refreshToken: data.refresh_token,
234829
+ scope: data.scope
234830
+ }));
234831
+ var OAuthErrorSchema = exports_external.object({
234832
+ error: exports_external.string(),
234833
+ error_description: exports_external.string().optional()
234834
+ });
234835
+ var UserInfoSchema = exports_external.object({
234836
+ email: exports_external.email(),
234837
+ name: exports_external.string()
234838
+ });
234839
+
234840
+ // src/core/clients/base44-client.ts
234841
+ import { randomUUID as randomUUID2 } from "node:crypto";
234531
234842
 
234532
234843
  // src/core/config.ts
234533
234844
  import { homedir } from "node:os";
@@ -234633,302 +234944,6 @@ function getTestOverrides() {
234633
234944
  }
234634
234945
  }
234635
234946
 
234636
- // src/core/clients/schemas.ts
234637
- var ApiErrorResponseSchema = exports_external.looseObject({
234638
- message: exports_external.unknown().optional(),
234639
- detail: exports_external.unknown().optional(),
234640
- extra_data: exports_external.looseObject({
234641
- reason: exports_external.string().optional().catch(undefined),
234642
- errors: exports_external.array(exports_external.looseObject({ name: exports_external.string(), message: exports_external.string() })).optional().catch(undefined)
234643
- }).optional().nullable().catch(undefined)
234644
- });
234645
-
234646
- // src/core/errors.ts
234647
- function formatApiError(errorBody, parsed) {
234648
- const data = parsed ?? ApiErrorResponseSchema.safeParse(errorBody).data;
234649
- if (data) {
234650
- const content = data.message ?? data.detail;
234651
- if (typeof content === "string")
234652
- return content;
234653
- if (content !== undefined)
234654
- return JSON.stringify(content, null, 2);
234655
- }
234656
- if (typeof errorBody === "string")
234657
- return errorBody;
234658
- return JSON.stringify(errorBody, null, 2);
234659
- }
234660
- function parseErrorDetails(extraData) {
234661
- const errors3 = extraData?.errors;
234662
- if (!errors3 || errors3.length === 0)
234663
- return;
234664
- return errors3.map((e2) => `${e2.name}: ${e2.message}`);
234665
- }
234666
-
234667
- class CLIError extends Error {
234668
- hints;
234669
- details;
234670
- cause;
234671
- constructor(message, options) {
234672
- super(message);
234673
- this.name = this.constructor.name;
234674
- this.hints = options?.hints ?? [];
234675
- this.details = options?.details ?? [];
234676
- this.cause = options?.cause;
234677
- Error.captureStackTrace(this, this.constructor);
234678
- }
234679
- }
234680
-
234681
- class UserError extends CLIError {
234682
- }
234683
-
234684
- class SystemError extends CLIError {
234685
- }
234686
- class ConfigNotFoundError extends UserError {
234687
- code = "CONFIG_NOT_FOUND";
234688
- constructor(message = "No Base44 project found in this directory", options) {
234689
- super(message, {
234690
- hints: options?.hints ?? [
234691
- {
234692
- message: "Run 'base44 create' to create a new project",
234693
- command: "base44 create"
234694
- },
234695
- {
234696
- message: "Or run 'base44 link' to link an existing project",
234697
- command: "base44 link"
234698
- }
234699
- ],
234700
- cause: options?.cause
234701
- });
234702
- }
234703
- }
234704
-
234705
- class ConfigInvalidError extends UserError {
234706
- code = "CONFIG_INVALID";
234707
- constructor(message, configFilePath, options) {
234708
- const defaultHint = configFilePath ? `Check the file at ${configFilePath} for syntax errors` : "Check the file for syntax errors";
234709
- super(message, {
234710
- hints: options?.hints ?? [{ message: defaultHint }],
234711
- cause: options?.cause
234712
- });
234713
- }
234714
- }
234715
-
234716
- class ConfigExistsError extends UserError {
234717
- code = "CONFIG_EXISTS";
234718
- constructor(message, options) {
234719
- super(message, {
234720
- hints: options?.hints ?? [
234721
- {
234722
- message: "Choose a different location or remove the existing project"
234723
- }
234724
- ],
234725
- cause: options?.cause
234726
- });
234727
- }
234728
- }
234729
-
234730
- class SchemaValidationError extends UserError {
234731
- code = "SCHEMA_INVALID";
234732
- filePath;
234733
- constructor(context, zodError, filePath) {
234734
- const message = filePath ? `${context} in ${filePath}:
234735
- ${exports_external.prettifyError(zodError)}` : `${context}:
234736
- ${exports_external.prettifyError(zodError)}`;
234737
- const hints = filePath ? [{ message: `Fix the schema/data structure errors in ${filePath}` }] : [{ message: "Fix the schema/data structure errors above" }];
234738
- super(message, { hints });
234739
- this.filePath = filePath;
234740
- }
234741
- }
234742
-
234743
- class InvalidInputError extends UserError {
234744
- code = "INVALID_INPUT";
234745
- }
234746
-
234747
- class DependencyNotFoundError extends UserError {
234748
- code = "DEPENDENCY_NOT_FOUND";
234749
- constructor(message, options) {
234750
- super(message, {
234751
- hints: options?.hints ?? [
234752
- { message: "Install the required dependency and try again" }
234753
- ],
234754
- cause: options?.cause
234755
- });
234756
- }
234757
- }
234758
-
234759
- class ApiError extends SystemError {
234760
- code = "API_ERROR";
234761
- statusCode;
234762
- requestUrl;
234763
- requestMethod;
234764
- requestBody;
234765
- responseBody;
234766
- requestId;
234767
- constructor(message, options) {
234768
- const hints = options?.hints ?? ApiError.getDefaultHints(options?.statusCode);
234769
- super(message, { hints, details: options?.details, cause: options?.cause });
234770
- this.statusCode = options?.statusCode;
234771
- this.requestUrl = options?.requestUrl;
234772
- this.requestMethod = options?.requestMethod;
234773
- this.requestBody = options?.requestBody;
234774
- this.responseBody = options?.responseBody;
234775
- this.requestId = options?.requestId;
234776
- }
234777
- static async fromHttpError(error48, context) {
234778
- if (error48 instanceof HTTPError) {
234779
- let message;
234780
- let responseBody;
234781
- let hints;
234782
- let details;
234783
- try {
234784
- responseBody = await error48.response.clone().json();
234785
- const parsed = ApiErrorResponseSchema.safeParse(responseBody);
234786
- const parsedData = parsed.success ? parsed.data : undefined;
234787
- message = formatApiError(responseBody, parsedData);
234788
- if (parsedData) {
234789
- hints = ApiError.getReasonHints(parsedData);
234790
- details = parseErrorDetails(parsedData.extra_data);
234791
- }
234792
- } catch {
234793
- message = error48.message;
234794
- }
234795
- const statusCode = ApiError.normalizeStatusCode(error48.response.status, responseBody);
234796
- const requestBody = error48.options.context?.__requestBody;
234797
- const requestId = error48.response.headers.get("X-Request-ID") ?? undefined;
234798
- return new ApiError(`Error ${context}: ${message}`, {
234799
- statusCode,
234800
- requestUrl: error48.request.url,
234801
- requestMethod: error48.request.method,
234802
- requestBody,
234803
- responseBody,
234804
- requestId,
234805
- hints,
234806
- details,
234807
- cause: error48
234808
- });
234809
- }
234810
- if (error48 instanceof Error) {
234811
- return new ApiError(`Error ${context}: ${error48.message}`, {
234812
- cause: error48
234813
- });
234814
- }
234815
- return new ApiError(`Error ${context}: ${String(error48)}`);
234816
- }
234817
- static getDefaultHints(statusCode) {
234818
- if (statusCode === 400) {
234819
- return [
234820
- {
234821
- message: "The server rejected the request. Check the error message above for details."
234822
- }
234823
- ];
234824
- }
234825
- if (statusCode === 401) {
234826
- return [{ message: "Try logging in again", command: "base44 login" }];
234827
- }
234828
- if (statusCode === 403) {
234829
- return [{ message: "You don't have permission to perform this action" }];
234830
- }
234831
- if (statusCode === 404) {
234832
- return [{ message: "The requested resource was not found" }];
234833
- }
234834
- if (statusCode === 422) {
234835
- return [
234836
- {
234837
- message: "The request was rejected due to a validation error. Check the error message above for details."
234838
- }
234839
- ];
234840
- }
234841
- if (statusCode === 428) {
234842
- return [
234843
- {
234844
- message: "The server rejected the request due to a precondition failure. Check the error message above for details"
234845
- }
234846
- ];
234847
- }
234848
- return [{ message: "Check your network connection and try again" }];
234849
- }
234850
- static getReasonHints(parsedResponse) {
234851
- const REASON_HINTS = {
234852
- requires_backend_platform_app: [
234853
- {
234854
- message: "This feature requires an app created with the Base44 CLI. Remove `base44/.app.jsonc` and run 'base44 link' to connect your project to a CLI-created app."
234855
- },
234856
- {
234857
- message: "Read more at https://docs.base44.com/developers/backend/overview/introduction"
234858
- }
234859
- ]
234860
- };
234861
- const reason = parsedResponse.extra_data?.reason;
234862
- if (typeof reason !== "string")
234863
- return;
234864
- return REASON_HINTS[reason];
234865
- }
234866
- static normalizeStatusCode(statusCode, responseBody) {
234867
- if (responseBody?.error_type === "KeyError") {
234868
- return 404;
234869
- }
234870
- return statusCode;
234871
- }
234872
- }
234873
-
234874
- class FileNotFoundError extends SystemError {
234875
- code = "FILE_NOT_FOUND";
234876
- constructor(message, options) {
234877
- super(message, {
234878
- hints: options?.hints ?? [
234879
- { message: "Check the file path and try again" }
234880
- ],
234881
- cause: options?.cause
234882
- });
234883
- }
234884
- }
234885
-
234886
- class FileReadError extends SystemError {
234887
- code = "FILE_READ_ERROR";
234888
- constructor(message, options) {
234889
- super(message, {
234890
- hints: options?.hints ?? [
234891
- { message: "Check file permissions and try again" }
234892
- ],
234893
- cause: options?.cause
234894
- });
234895
- }
234896
- }
234897
-
234898
- class InternalError extends SystemError {
234899
- code = "INTERNAL_ERROR";
234900
- constructor(message, options) {
234901
- super(message, {
234902
- hints: options?.hints ?? [
234903
- {
234904
- message: "This is an unexpected error. Please report it if it persists."
234905
- }
234906
- ],
234907
- cause: options?.cause
234908
- });
234909
- }
234910
- }
234911
-
234912
- class TypeGenerationError extends SystemError {
234913
- code = "TYPE_GENERATION_ERROR";
234914
- constructor(message, entityName, cause) {
234915
- super(message, {
234916
- hints: [
234917
- {
234918
- message: entityName ? `Check the schema for entity "${entityName}"` : "Check your entity schemas for errors"
234919
- }
234920
- ],
234921
- cause: cause instanceof Error ? cause : undefined
234922
- });
234923
- }
234924
- }
234925
- function isCLIError(error48) {
234926
- return error48 instanceof CLIError;
234927
- }
234928
- function isUserError(error48) {
234929
- return error48 instanceof UserError;
234930
- }
234931
-
234932
234947
  // src/core/utils/fs.ts
234933
234948
  var import_json5 = __toESM(require_lib(), 1);
234934
234949
  import {
@@ -243629,12 +243644,12 @@ async function waitForAuthentication(deviceCode, expiresIn, interval) {
243629
243644
  });
243630
243645
  } catch (error48) {
243631
243646
  if (error48 instanceof Error && error48.message.includes("timed out")) {
243632
- throw new Error("Authentication timed out. Please try again.");
243647
+ throw new AuthExpiredError("Authentication timed out. Please try again.");
243633
243648
  }
243634
243649
  throw error48;
243635
243650
  }
243636
243651
  if (tokenResponse === undefined) {
243637
- throw new Error("Failed to retrieve authentication token.");
243652
+ throw new InternalError("Failed to retrieve authentication token.");
243638
243653
  }
243639
243654
  return tokenResponse;
243640
243655
  }
@@ -243677,9 +243692,6 @@ async function ensureAppConfig(ctx) {
243677
243692
  ctx.errorReporter.setContext({ appId: appConfig.id });
243678
243693
  }
243679
243694
 
243680
- // src/cli/utils/skill-version-check.ts
243681
- import { join as join12 } from "node:path";
243682
-
243683
243695
  // ../../node_modules/is-plain-obj/index.js
243684
243696
  function isPlainObject2(value) {
243685
243697
  if (typeof value !== "object" || value === null) {
@@ -250176,87 +250188,6 @@ var {
250176
250188
  getCancelSignal: getCancelSignal2
250177
250189
  } = getIpcExport();
250178
250190
 
250179
- // src/cli/utils/skill-version-check.ts
250180
- var import_front_matter2 = __toESM(require_front_matter(), 1);
250181
- var SourcePackageSchema = exports_external.object({
250182
- name: exports_external.string(),
250183
- version: exports_external.string()
250184
- });
250185
- var SkillFrontmatterSchema = exports_external.object({
250186
- metadata: exports_external.object({
250187
- sourcePackage: SourcePackageSchema
250188
- })
250189
- });
250190
- var InstalledSkillSchema = exports_external.object({
250191
- name: exports_external.string(),
250192
- path: exports_external.string()
250193
- });
250194
- var InstalledSkillsSchema = exports_external.array(InstalledSkillSchema);
250195
- async function listInstalledSkills(cwd) {
250196
- const { stdout } = await execa("npx", ["-y", "skills", "list", "--json"], {
250197
- cwd,
250198
- timeout: 3000,
250199
- env: { ...process.env, CI: "1" }
250200
- });
250201
- const jsonStart = stdout.indexOf("[");
250202
- if (jsonStart === -1)
250203
- return [];
250204
- const parsed = JSON.parse(stdout.slice(jsonStart));
250205
- return InstalledSkillsSchema.parse(parsed);
250206
- }
250207
- async function readSkillFrontmatter(skillPath) {
250208
- try {
250209
- const content = await readTextFile(join12(skillPath, "SKILL.md"));
250210
- const { attributes } = import_front_matter2.default(content);
250211
- const result = SkillFrontmatterSchema.safeParse(attributes);
250212
- return result.success ? result.data : null;
250213
- } catch {
250214
- return null;
250215
- }
250216
- }
250217
- async function checkSkillVersions(projectRoot) {
250218
- const skills = await listInstalledSkills(projectRoot);
250219
- const results = await Promise.all(skills.map(async (skill) => {
250220
- const fm = await readSkillFrontmatter(skill.path);
250221
- if (!fm)
250222
- return null;
250223
- if (fm.metadata.sourcePackage.name !== package_default.name)
250224
- return null;
250225
- if (fm.metadata.sourcePackage.version === package_default.version)
250226
- return null;
250227
- return {
250228
- skillName: skill.name,
250229
- installedVersion: fm.metadata.sourcePackage.version,
250230
- currentVersion: package_default.version
250231
- };
250232
- }));
250233
- return results.filter((r) => r !== null);
250234
- }
250235
- function startSkillVersionCheck(projectRoot) {
250236
- return checkSkillVersions(projectRoot).catch(() => null);
250237
- }
250238
- function formatSkillWarning(staleSkills) {
250239
- const { shinyOrange } = theme.colors;
250240
- const { bold: bold2 } = theme.styles;
250241
- const lines = staleSkills.map((s) => shinyOrange(`Skill "${s.skillName}" was built for v${s.installedVersion}, current CLI is v${bold2(s.currentVersion)}`));
250242
- lines.push(shinyOrange("Run: base44 agent-skills update"));
250243
- return lines.join(`
250244
- `);
250245
- }
250246
- function formatPlainSkillWarning(staleSkills) {
250247
- const lines = staleSkills.map((s) => `Skill "${s.skillName}" was built for v${s.installedVersion}, current CLI is v${s.currentVersion}.`);
250248
- lines.push("Run: base44 agent-skills update");
250249
- return lines.join(" ");
250250
- }
250251
- async function printSkillVersionWarning(promise2) {
250252
- try {
250253
- const staleSkills = await promise2;
250254
- if (staleSkills && staleSkills.length > 0) {
250255
- Ve(formatSkillWarning(staleSkills));
250256
- }
250257
- } catch {}
250258
- }
250259
-
250260
250191
  // src/cli/utils/version-check.ts
250261
250192
  async function checkForUpgrade() {
250262
250193
  const testLatestVersion = getTestOverrides()?.latestVersion;
@@ -250343,9 +250274,8 @@ async function showCommandStart(fullBanner) {
250343
250274
  We(theme.colors.base44OrangeBackground(" Base 44 "));
250344
250275
  }
250345
250276
  }
250346
- async function showCommandEnd(result, options) {
250347
- await printUpgradeNotification(options.upgradeCheck, options.distribution);
250348
- await printSkillVersionWarning(options.skillCheck);
250277
+ async function showCommandEnd(result, upgradeCheckPromise, distribution) {
250278
+ await printUpgradeNotification(upgradeCheckPromise, distribution);
250349
250279
  Le(result.outroMessage || "");
250350
250280
  if (result.stdout) {
250351
250281
  process.stdout.write(result.stdout);
@@ -250418,22 +250348,16 @@ class Base44Command extends Command {
250418
250348
  await showCommandStart(this._commandOptions.fullBanner);
250419
250349
  }
250420
250350
  const upgradeCheckPromise = startUpgradeCheck();
250421
- let skillCheckPromise = Promise.resolve(null);
250422
250351
  try {
250423
250352
  if (this._commandOptions.requireAuth) {
250424
250353
  await ensureAuth(this.context);
250425
250354
  }
250426
250355
  if (this._commandOptions.requireAppConfig) {
250427
250356
  await ensureAppConfig(this.context);
250428
- skillCheckPromise = startSkillVersionCheck(getAppConfig().projectRoot);
250429
250357
  }
250430
250358
  const result = await fn(this.context, ...args) ?? {};
250431
250359
  if (!quiet) {
250432
- await showCommandEnd(result, {
250433
- upgradeCheck: upgradeCheckPromise,
250434
- skillCheck: skillCheckPromise,
250435
- distribution: this.context.distribution
250436
- });
250360
+ await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
250437
250361
  } else {
250438
250362
  if (result.outroMessage) {
250439
250363
  process.stdout.write(`${result.outroMessage}
@@ -250445,11 +250369,6 @@ class Base44Command extends Command {
250445
250369
  const upgradeInfo = await upgradeCheckPromise;
250446
250370
  if (upgradeInfo) {
250447
250371
  process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
250448
- `);
250449
- }
250450
- const staleSkills = await skillCheckPromise;
250451
- if (staleSkills && staleSkills.length > 0) {
250452
- process.stderr.write(`${formatPlainSkillWarning(staleSkills)}
250453
250372
  `);
250454
250373
  }
250455
250374
  }
@@ -250649,7 +250568,7 @@ async function pullAgentsAction({
250649
250568
  }) {
250650
250569
  const { project: project2 } = await readProjectConfig();
250651
250570
  const configDir = dirname7(project2.configPath);
250652
- const agentsDir = join13(configDir, project2.agentsDir);
250571
+ const agentsDir = join12(configDir, project2.agentsDir);
250653
250572
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
250654
250573
  return await fetchAgents();
250655
250574
  }, {
@@ -250712,7 +250631,7 @@ function getAgentsCommand() {
250712
250631
  }
250713
250632
 
250714
250633
  // src/cli/commands/auth/password-login.ts
250715
- import { dirname as dirname8, join as join14 } from "node:path";
250634
+ import { dirname as dirname8, join as join13 } from "node:path";
250716
250635
  function validateAction(action) {
250717
250636
  if (action !== "enable" && action !== "disable") {
250718
250637
  throw new InvalidInputError(`Invalid action "${action}". Must be "enable" or "disable".`, {
@@ -250734,7 +250653,7 @@ async function passwordLoginAction({ log }, action) {
250734
250653
  const shouldEnable = action === "enable";
250735
250654
  const { project: project2 } = await readProjectConfig();
250736
250655
  const configDir = dirname8(project2.configPath);
250737
- const authDir = join14(configDir, project2.authDir);
250656
+ const authDir = join13(configDir, project2.authDir);
250738
250657
  const updated = await runTask("Updating local auth config", async () => {
250739
250658
  const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
250740
250659
  const merged = { ...current, enableUsernamePassword: shouldEnable };
@@ -250754,11 +250673,11 @@ function getPasswordLoginCommand() {
250754
250673
  }
250755
250674
 
250756
250675
  // src/cli/commands/auth/pull.ts
250757
- import { dirname as dirname9, join as join15 } from "node:path";
250676
+ import { dirname as dirname9, join as join14 } from "node:path";
250758
250677
  async function pullAuthAction({ log }) {
250759
250678
  const { project: project2 } = await readProjectConfig();
250760
250679
  const configDir = dirname9(project2.configPath);
250761
- const authDir = join15(configDir, project2.authDir);
250680
+ const authDir = join14(configDir, project2.authDir);
250762
250681
  const remoteConfig = await runTask("Fetching auth config from Base44", async () => {
250763
250682
  return await pullAuthConfig();
250764
250683
  }, {
@@ -250884,13 +250803,13 @@ function getConnectorsListAvailableCommand() {
250884
250803
  }
250885
250804
 
250886
250805
  // src/cli/commands/connectors/pull.ts
250887
- import { dirname as dirname10, join as join16 } from "node:path";
250806
+ import { dirname as dirname10, join as join15 } from "node:path";
250888
250807
  async function pullConnectorsAction({
250889
250808
  log
250890
250809
  }) {
250891
250810
  const { project: project2 } = await readProjectConfig();
250892
250811
  const configDir = dirname10(project2.configPath);
250893
- const connectorsDir = join16(configDir, project2.connectorsDir);
250812
+ const connectorsDir = join15(configDir, project2.connectorsDir);
250894
250813
  const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
250895
250814
  return await pullAllConnectors();
250896
250815
  }, {
@@ -251942,11 +251861,11 @@ function getListCommand() {
251942
251861
  }
251943
251862
 
251944
251863
  // src/cli/commands/functions/pull.ts
251945
- import { dirname as dirname11, join as join17 } from "node:path";
251864
+ import { dirname as dirname11, join as join16 } from "node:path";
251946
251865
  async function pullFunctionsAction({ log }, name2) {
251947
251866
  const { project: project2 } = await readProjectConfig();
251948
251867
  const configDir = dirname11(project2.configPath);
251949
- const functionsDir = join17(configDir, project2.functionsDir);
251868
+ const functionsDir = join16(configDir, project2.functionsDir);
251950
251869
  const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
251951
251870
  const { functions } = await listDeployedFunctions();
251952
251871
  return functions;
@@ -251989,39 +251908,8 @@ function getFunctionsCommand() {
251989
251908
  }
251990
251909
 
251991
251910
  // src/cli/commands/project/create.ts
251992
- import { basename as basename3, join as join18, resolve as resolve2 } from "node:path";
251911
+ import { basename as basename3, join as join17, resolve as resolve2 } from "node:path";
251993
251912
  var import_kebabCase = __toESM(require_kebabCase(), 1);
251994
-
251995
- // src/cli/commands/skills/update.ts
251996
- var SKILLS_REPO = "base44/skills";
251997
- async function installAllSkills(cwd) {
251998
- await execa("npx", ["-y", "skills", "add", SKILLS_REPO, "--all", "-y"], {
251999
- cwd
252000
- });
252001
- }
252002
- async function updateAction(_ctx) {
252003
- const projectRoot = await findProjectRoot();
252004
- if (!projectRoot) {
252005
- return {
252006
- outroMessage: "Not in a Base44 project. Run this command from a project directory."
252007
- };
252008
- }
252009
- await runTask("Updating agent skills...", async () => {
252010
- await installAllSkills(projectRoot.root);
252011
- }, {
252012
- successMessage: theme.colors.base44Orange("Agent skills updated successfully"),
252013
- errorMessage: "Failed to update agent skills"
252014
- });
252015
- return { outroMessage: "Agent skills are up to date" };
252016
- }
252017
- function getSkillsUpdateCommand() {
252018
- return new Base44Command("update", {
252019
- requireAuth: false,
252020
- requireAppConfig: false
252021
- }).description("Update locally installed agent skills to the latest version").action(updateAction);
252022
- }
252023
-
252024
- // src/cli/commands/project/create.ts
252025
251913
  var DEFAULT_TEMPLATE_ID = "backend-only";
252026
251914
  async function getTemplateById(templateId) {
252027
251915
  const templates = await listTemplates();
@@ -252157,7 +252045,7 @@ async function executeCreate({
252157
252045
  updateMessage("Building project...");
252158
252046
  await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
252159
252047
  updateMessage("Deploying site...");
252160
- return await deploySite(join18(resolvedPath, outputDirectory));
252048
+ return await deploySite(join17(resolvedPath, outputDirectory));
252161
252049
  }, {
252162
252050
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
252163
252051
  errorMessage: "Failed to deploy site"
@@ -252169,10 +252057,13 @@ async function executeCreate({
252169
252057
  if (shouldAddSkills) {
252170
252058
  try {
252171
252059
  await runTask("Installing AI agent skills...", async () => {
252172
- await installAllSkills(resolvedPath);
252060
+ await execa("npx", ["-y", "skills", "add", "base44/skills", "-y"], {
252061
+ cwd: resolvedPath,
252062
+ shell: true
252063
+ });
252173
252064
  }, {
252174
252065
  successMessage: theme.colors.base44Orange("AI agent skills added successfully"),
252175
- errorMessage: "Failed to add agent skills - you can add them later with: base44 agent-skills update"
252066
+ errorMessage: "Failed to add AI agent skills - you can add them later with: npx skills add base44/skills"
252176
252067
  });
252177
252068
  } catch {}
252178
252069
  }
@@ -252732,11 +252623,6 @@ function getSiteCommand() {
252732
252623
  return new Command("site").description("Manage app site (frontend app)").addCommand(getSiteDeployCommand()).addCommand(getSiteOpenCommand());
252733
252624
  }
252734
252625
 
252735
- // src/cli/commands/skills/index.ts
252736
- function getAgentSkillsCommand() {
252737
- return new Command("agent-skills").description("Manage locally installed agent skills").addCommand(getSkillsUpdateCommand());
252738
- }
252739
-
252740
252626
  // src/core/types/generator.ts
252741
252627
  var import_common_tags = __toESM(require_lib2(), 1);
252742
252628
  var import_json_schema_to_typescript = __toESM(require_src3(), 1);
@@ -252823,10 +252709,10 @@ function toPascalCase(name2) {
252823
252709
  return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
252824
252710
  }
252825
252711
  // src/core/types/update-project.ts
252826
- import { join as join21 } from "node:path";
252712
+ import { join as join20 } from "node:path";
252827
252713
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
252828
252714
  async function updateProjectConfig(projectRoot) {
252829
- const tsconfigPath = join21(projectRoot, "tsconfig.json");
252715
+ const tsconfigPath = join20(projectRoot, "tsconfig.json");
252830
252716
  if (!await pathExists(tsconfigPath)) {
252831
252717
  return false;
252832
252718
  }
@@ -252869,7 +252755,7 @@ function getTypesCommand() {
252869
252755
  // src/cli/dev/dev-server/main.ts
252870
252756
  var import_cors = __toESM(require_lib4(), 1);
252871
252757
  var import_express5 = __toESM(require_express(), 1);
252872
- import { dirname as dirname16, join as join24 } from "node:path";
252758
+ import { dirname as dirname16, join as join23 } from "node:path";
252873
252759
 
252874
252760
  // ../../node_modules/get-port/index.js
252875
252761
  import net from "node:net";
@@ -255732,8 +255618,8 @@ async function createDevServer(options8) {
255732
255618
  broadcastEntityEvent(io6, appId, entityName, event);
255733
255619
  };
255734
255620
  const base44ConfigWatcher = new WatchBase44({
255735
- functions: join24(dirname16(project2.configPath), project2.functionsDir),
255736
- entities: join24(dirname16(project2.configPath), project2.entitiesDir)
255621
+ functions: join23(dirname16(project2.configPath), project2.functionsDir),
255622
+ entities: join23(dirname16(project2.configPath), project2.entitiesDir)
255737
255623
  }, devLogger);
255738
255624
  base44ConfigWatcher.on("change", async (name2) => {
255739
255625
  try {
@@ -256007,7 +255893,6 @@ function createProgram(context) {
256007
255893
  program2.addCommand(getConnectorsCommand());
256008
255894
  program2.addCommand(getFunctionsCommand());
256009
255895
  program2.addCommand(getSecretsCommand());
256010
- program2.addCommand(getAgentSkillsCommand());
256011
255896
  program2.addCommand(getAuthCommand());
256012
255897
  program2.addCommand(getSiteCommand());
256013
255898
  program2.addCommand(getTypesCommand());
@@ -260222,7 +260107,7 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
260222
260107
  // src/cli/index.ts
260223
260108
  var __dirname4 = dirname18(fileURLToPath6(import.meta.url));
260224
260109
  async function runCLI(options8) {
260225
- ensureNpmAssets(join25(__dirname4, "../assets"));
260110
+ ensureNpmAssets(join24(__dirname4, "../assets"));
260226
260111
  const errorReporter = new ErrorReporter;
260227
260112
  errorReporter.registerProcessErrorHandlers();
260228
260113
  const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
@@ -260257,4 +260142,4 @@ export {
260257
260142
  CLIExitError
260258
260143
  };
260259
260144
 
260260
- //# debugId=C4931A4AAC344DAA64756E2164756E21
260145
+ //# debugId=2F95C59D7C57E46064756E2164756E21