lua-cli 3.37.0 → 3.38.0

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.
@@ -10,6 +10,39 @@ import { z as z2 } from "zod";
10
10
  import { z as z3 } from "zod";
11
11
  var __defProp2 = Object.defineProperty;
12
12
  var __name2 = /* @__PURE__ */ __name((target, value3) => __defProp2(target, "name", { value: value3, configurable: true }), "__name");
13
+ var PLUMBING_THREAD_CHANNELS = [
14
+ "trigger",
15
+ "template-install",
16
+ "template-uninstall"
17
+ ];
18
+ var CHANNEL_CONVERSATION_CHANNELS = [
19
+ "whatsapp",
20
+ "slack",
21
+ "teams",
22
+ "front",
23
+ "email",
24
+ "messagebird",
25
+ "sms",
26
+ "mms",
27
+ "rcs",
28
+ "instagram",
29
+ "facebook",
30
+ "imessage"
31
+ ];
32
+ var HIDDEN_THREAD_CHANNELS = [
33
+ ...PLUMBING_THREAD_CHANNELS,
34
+ ...CHANNEL_CONVERSATION_CHANNELS
35
+ ];
36
+ function isChannelConversationChannel(channel) {
37
+ return !!channel && CHANNEL_CONVERSATION_CHANNELS.includes(channel);
38
+ }
39
+ __name(isChannelConversationChannel, "isChannelConversationChannel");
40
+ __name2(isChannelConversationChannel, "isChannelConversationChannel");
41
+ function isChannelConversationThread(threadId, channel) {
42
+ return !!threadId && isChannelConversationChannel(channel);
43
+ }
44
+ __name(isChannelConversationThread, "isChannelConversationThread");
45
+ __name2(isChannelConversationThread, "isChannelConversationThread");
13
46
  function isPersonaTextObject(value3) {
14
47
  if (value3 === null || typeof value3 !== "object" || Array.isArray(value3)) return false;
15
48
  const obj = value3;
@@ -1174,6 +1207,188 @@ function buildPersonalSpaceStartingPersona(agentName) {
1174
1207
  }
1175
1208
  __name(buildPersonalSpaceStartingPersona, "buildPersonalSpaceStartingPersona");
1176
1209
  __name2(buildPersonalSpaceStartingPersona, "buildPersonalSpaceStartingPersona");
1210
+ var AGENT_LOG_SOURCES = [
1211
+ "skill",
1212
+ "job",
1213
+ "webhook",
1214
+ "trigger",
1215
+ "preprocessor",
1216
+ "postprocessor",
1217
+ "user_message",
1218
+ "agent_response",
1219
+ "agent_error",
1220
+ "runtime",
1221
+ "mcp",
1222
+ "rag",
1223
+ "device",
1224
+ "device-trigger",
1225
+ "model-resolver",
1226
+ "workflow-step",
1227
+ "workflow-script",
1228
+ "workflow"
1229
+ ];
1230
+ var LOG_DRAIN_SOURCES = [
1231
+ ...AGENT_LOG_SOURCES,
1232
+ "execution",
1233
+ // ── phase 2 ──
1234
+ "delivery",
1235
+ "trigger-execution",
1236
+ "job-execution",
1237
+ "workflow-run",
1238
+ "workflow-audit"
1239
+ ];
1240
+ var LOG_DRAIN_MAX_PER_ORG = 5;
1241
+ var LOG_DRAIN_MAX_PER_ORG_ENTERPRISE = 10;
1242
+ function maxDrainsForTier(tier) {
1243
+ return tier === "enterprise" ? LOG_DRAIN_MAX_PER_ORG_ENTERPRISE : LOG_DRAIN_MAX_PER_ORG;
1244
+ }
1245
+ __name(maxDrainsForTier, "maxDrainsForTier");
1246
+ __name2(maxDrainsForTier, "maxDrainsForTier");
1247
+ var LOG_DRAIN_ENDPOINT_TEMPLATES = {
1248
+ datadog: "https://http-intake.logs.{site}/api/v2/logs"
1249
+ };
1250
+ function resolvePresetEndpoint(type, site) {
1251
+ const template3 = LOG_DRAIN_ENDPOINT_TEMPLATES[type];
1252
+ if (!template3 || !site) return void 0;
1253
+ return template3.replace("{site}", site);
1254
+ }
1255
+ __name(resolvePresetEndpoint, "resolvePresetEndpoint");
1256
+ __name2(resolvePresetEndpoint, "resolvePresetEndpoint");
1257
+ var LOG_DRAIN_QUOTAS = {
1258
+ team: {
1259
+ eventsPerDay: 1e6,
1260
+ bytesPerDay: 1 * 1024 ** 3
1261
+ },
1262
+ business: {
1263
+ eventsPerDay: 1e7,
1264
+ bytesPerDay: 10 * 1024 ** 3
1265
+ },
1266
+ enterprise: {
1267
+ eventsPerDay: Number.MAX_SAFE_INTEGER,
1268
+ bytesPerDay: Number.MAX_SAFE_INTEGER
1269
+ }
1270
+ };
1271
+ var LOG_DRAIN_QUOTA_WARN_RATIO = 0.8;
1272
+ var LOG_DRAIN_QUOTA_DROP_DEBUG_RATIO = 1;
1273
+ var LOG_DRAIN_QUOTA_DROP_INFO_RATIO = 1.25;
1274
+ var LOG_DRAIN_QUOTA_PAUSE_RATIO = 1.5;
1275
+ function nextLogDrainQuotaResetAt(now) {
1276
+ return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + 1)).toISOString();
1277
+ }
1278
+ __name(nextLogDrainQuotaResetAt, "nextLogDrainQuotaResetAt");
1279
+ __name2(nextLogDrainQuotaResetAt, "nextLogDrainQuotaResetAt");
1280
+ function logDrainQuotaWindowExpired(usage, now) {
1281
+ const resetsAt = Date.parse(usage?.resetsAt ?? "");
1282
+ if (!Number.isFinite(resetsAt)) return true;
1283
+ return now.getTime() >= resetsAt;
1284
+ }
1285
+ __name(logDrainQuotaWindowExpired, "logDrainQuotaWindowExpired");
1286
+ __name2(logDrainQuotaWindowExpired, "logDrainQuotaWindowExpired");
1287
+ function logDrainQuotaRatio(usage, now) {
1288
+ if (!usage) return 0;
1289
+ if (now && logDrainQuotaWindowExpired(usage, now)) return 0;
1290
+ const dimension = /* @__PURE__ */ __name2((used, limit) => {
1291
+ if (!Number.isFinite(limit) || limit <= 0) return 0;
1292
+ if (!Number.isFinite(used) || used <= 0) return 0;
1293
+ return used / limit;
1294
+ }, "dimension");
1295
+ return Math.max(dimension(usage.usedEvents, usage.eventsPerDay), dimension(usage.usedBytes, usage.bytesPerDay));
1296
+ }
1297
+ __name(logDrainQuotaRatio, "logDrainQuotaRatio");
1298
+ __name2(logDrainQuotaRatio, "logDrainQuotaRatio");
1299
+ function logDrainQuotaDegradationForRatio(ratio) {
1300
+ if (!Number.isFinite(ratio)) return "none";
1301
+ if (ratio >= LOG_DRAIN_QUOTA_PAUSE_RATIO) return "paused";
1302
+ if (ratio >= LOG_DRAIN_QUOTA_DROP_INFO_RATIO) return "info_dropped";
1303
+ if (ratio >= LOG_DRAIN_QUOTA_DROP_DEBUG_RATIO) return "debug_dropped";
1304
+ return "none";
1305
+ }
1306
+ __name(logDrainQuotaDegradationForRatio, "logDrainQuotaDegradationForRatio");
1307
+ __name2(logDrainQuotaDegradationForRatio, "logDrainQuotaDegradationForRatio");
1308
+ function logDrainQuotaDegradation(usage, now) {
1309
+ return logDrainQuotaDegradationForRatio(logDrainQuotaRatio(usage, now));
1310
+ }
1311
+ __name(logDrainQuotaDegradation, "logDrainQuotaDegradation");
1312
+ __name2(logDrainQuotaDegradation, "logDrainQuotaDegradation");
1313
+ function logDrainQuotaWarned(usage, now) {
1314
+ return logDrainQuotaRatio(usage, now) >= LOG_DRAIN_QUOTA_WARN_RATIO;
1315
+ }
1316
+ __name(logDrainQuotaWarned, "logDrainQuotaWarned");
1317
+ __name2(logDrainQuotaWarned, "logDrainQuotaWarned");
1318
+ function logDrainQuotaDroppedSeverities(degradation) {
1319
+ switch (degradation) {
1320
+ case "debug_dropped":
1321
+ return [
1322
+ 5
1323
+ ];
1324
+ case "info_dropped":
1325
+ return [
1326
+ 5,
1327
+ 9
1328
+ ];
1329
+ default:
1330
+ return [];
1331
+ }
1332
+ }
1333
+ __name(logDrainQuotaDroppedSeverities, "logDrainQuotaDroppedSeverities");
1334
+ __name2(logDrainQuotaDroppedSeverities, "logDrainQuotaDroppedSeverities");
1335
+ var LOG_CURSOR_MAX_LENGTH = 512;
1336
+ var LOG_CURSOR_MAX_ID_LENGTH = 128;
1337
+ var LOG_RELATIVE_TIME_PATTERN = /^(\d{1,9})([smhd])$/;
1338
+ var LOG_ISO_TIME_PATTERN = /^\d{4}-\d{2}-\d{2}([Tt ]\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?([Zz]|[+-]\d{2}:?\d{2})?)?$/;
1339
+ var RELATIVE_UNIT_MS = {
1340
+ s: 1e3,
1341
+ m: 6e4,
1342
+ h: 36e5,
1343
+ d: 864e5
1344
+ };
1345
+ function encodeLogCursor(c) {
1346
+ return Buffer.from(JSON.stringify({
1347
+ t: c.t,
1348
+ id: c.id
1349
+ }), "utf8").toString("base64url");
1350
+ }
1351
+ __name(encodeLogCursor, "encodeLogCursor");
1352
+ __name2(encodeLogCursor, "encodeLogCursor");
1353
+ function decodeLogCursor(raw) {
1354
+ if (typeof raw !== "string") return null;
1355
+ const trimmed = raw.trim();
1356
+ if (!trimmed || trimmed.length > LOG_CURSOR_MAX_LENGTH) return null;
1357
+ let parsed;
1358
+ try {
1359
+ parsed = JSON.parse(Buffer.from(trimmed, "base64url").toString("utf8"));
1360
+ } catch {
1361
+ return null;
1362
+ }
1363
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
1364
+ const { t, id } = parsed;
1365
+ if (typeof t !== "number" || !Number.isSafeInteger(t) || t < 0) return null;
1366
+ if (typeof id !== "string" || !id || id.length > LOG_CURSOR_MAX_ID_LENGTH) return null;
1367
+ return {
1368
+ t,
1369
+ id
1370
+ };
1371
+ }
1372
+ __name(decodeLogCursor, "decodeLogCursor");
1373
+ __name2(decodeLogCursor, "decodeLogCursor");
1374
+ function parseLogTimeBound(raw, now = /* @__PURE__ */ new Date()) {
1375
+ if (typeof raw !== "string") return null;
1376
+ const value3 = raw.trim();
1377
+ if (!value3) return null;
1378
+ const relative = LOG_RELATIVE_TIME_PATTERN.exec(value3);
1379
+ if (relative) {
1380
+ const amount = Number(relative[1]);
1381
+ const unitMs = RELATIVE_UNIT_MS[relative[2]];
1382
+ if (!Number.isFinite(amount) || unitMs === void 0) return null;
1383
+ const at2 = now.getTime() - amount * unitMs;
1384
+ return Number.isFinite(at2) ? new Date(at2) : null;
1385
+ }
1386
+ if (!LOG_ISO_TIME_PATTERN.test(value3)) return null;
1387
+ const at = Date.parse(value3);
1388
+ return Number.isNaN(at) ? null : new Date(at);
1389
+ }
1390
+ __name(parseLogTimeBound, "parseLogTimeBound");
1391
+ __name2(parseLogTimeBound, "parseLogTimeBound");
1177
1392
  var CORE_DRAINING_CODE = "CORE_DRAINING";
1178
1393
  var CORE_DRAINING_DEFAULT_RETRY_MS = 1e3;
1179
1394
  var CORE_DRAINING_MAX_RETRY_MS = 5e3;