@swmansion/argent 0.16.2-next.9 → 0.17.1-next.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.
- package/dist/cli-cmds.mjs +1710 -1594
- package/dist/installer.mjs +67 -63
- package/dist/mcp-server.mjs +306 -188
- package/dist/tool-server.cjs +430 -131
- package/package.json +1 -1
- package/skills/argent-create-flow/SKILL.md +3 -1
- package/skills/argent-device-interact/SKILL.md +1 -1
- package/skills/argent-screen-recording/SKILL.md +6 -2
package/dist/cli-cmds.mjs
CHANGED
|
@@ -1100,783 +1100,1388 @@ function createToolsClient(options = {}) {
|
|
|
1100
1100
|
}
|
|
1101
1101
|
|
|
1102
1102
|
// ../argent-tools-client/src/artifacts.ts
|
|
1103
|
-
import { mkdir as mkdir4, readFile as readFile4, rm as rm3, stat as stat2, writeFile as writeFile4 } from "node:fs/promises";
|
|
1103
|
+
import { copyFile, mkdir as mkdir4, readFile as readFile4, realpath, rm as rm3, stat as stat2, writeFile as writeFile4 } from "node:fs/promises";
|
|
1104
|
+
import { constants as fsConstants } from "node:fs";
|
|
1104
1105
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
1105
|
-
import { basename as basename3, join as
|
|
1106
|
+
import { basename as basename3, dirname as dirname5, extname, isAbsolute as isAbsolute3, join as join8, normalize, sep as sep2 } from "node:path";
|
|
1106
1107
|
import { createHash as createHash3 } from "node:crypto";
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1108
|
+
|
|
1109
|
+
// ../configuration-core/src/flags.ts
|
|
1110
|
+
import * as fs2 from "node:fs";
|
|
1111
|
+
import * as path4 from "node:path";
|
|
1112
|
+
import { homedir as homedir3 } from "node:os";
|
|
1113
|
+
var FLAG_REGISTRY = [
|
|
1114
|
+
{
|
|
1115
|
+
name: "disable-auto-screenshot",
|
|
1116
|
+
description: "Disable the automatic screenshot captured after interaction tools."
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
name: "argent-lens",
|
|
1120
|
+
description: "Argent Lens \u2014 the propose_variant / await_user_selection tools and the Electron preview window for staging UI design variants and letting a human pick among them. Off by default while the feature is in development."
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
name: "artifacts-list-endpoint",
|
|
1124
|
+
description: "Expose GET /artifacts for remote artifact inventory consumers."
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
name: "tool-server-event-log",
|
|
1128
|
+
description: "Write structured tool-server lifecycle events to a JSONL file."
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
name: "video-watermark",
|
|
1132
|
+
description: "Overlay the argent corner watermark on recorded screen videos. On by default; turn it off with `argent disable video-watermark`.",
|
|
1133
|
+
defaultEnabled: true
|
|
1116
1134
|
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
return segment.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
1135
|
+
];
|
|
1136
|
+
function getFlagDefinition(name, registry = FLAG_REGISTRY) {
|
|
1137
|
+
return registry.find((def) => def.name === name);
|
|
1121
1138
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1139
|
+
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
1140
|
+
function findProjectRoot(startDir) {
|
|
1141
|
+
let current = path4.resolve(startDir);
|
|
1142
|
+
while (true) {
|
|
1143
|
+
for (const marker of PROJECT_MARKERS) {
|
|
1144
|
+
if (fs2.existsSync(path4.join(current, marker))) return current;
|
|
1145
|
+
}
|
|
1146
|
+
const parent = path4.dirname(current);
|
|
1147
|
+
if (parent === current) return null;
|
|
1148
|
+
current = parent;
|
|
1149
|
+
}
|
|
1127
1150
|
}
|
|
1128
|
-
function
|
|
1129
|
-
return
|
|
1151
|
+
function resolveProjectRoot(startDir) {
|
|
1152
|
+
return findProjectRoot(startDir) ?? path4.resolve(startDir);
|
|
1130
1153
|
}
|
|
1131
|
-
function
|
|
1132
|
-
const
|
|
1133
|
-
if (
|
|
1134
|
-
|
|
1154
|
+
function getFlagsPath(scope, options = {}) {
|
|
1155
|
+
const home = options.homeDir ?? homedir3();
|
|
1156
|
+
if (scope === "global") {
|
|
1157
|
+
return path4.join(home, ".argent", "flags.json");
|
|
1158
|
+
}
|
|
1159
|
+
const cwd = options.cwd ?? process.cwd();
|
|
1160
|
+
return path4.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
1135
1161
|
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1162
|
+
function readFlagsFile(filePath) {
|
|
1163
|
+
let raw;
|
|
1138
1164
|
try {
|
|
1139
|
-
|
|
1140
|
-
if (handle.archive) {
|
|
1141
|
-
return st.isDirectory() ? handle.hostPath : null;
|
|
1142
|
-
}
|
|
1143
|
-
if (!st.isFile()) return null;
|
|
1144
|
-
if (st.size !== handle.size) return null;
|
|
1145
|
-
if (handle.mtimeMs != null && Math.round(st.mtimeMs) !== Math.round(handle.mtimeMs)) {
|
|
1146
|
-
return null;
|
|
1147
|
-
}
|
|
1148
|
-
return handle.hostPath;
|
|
1165
|
+
raw = fs2.readFileSync(filePath, "utf8");
|
|
1149
1166
|
} catch {
|
|
1150
|
-
return
|
|
1167
|
+
return {};
|
|
1151
1168
|
}
|
|
1152
|
-
|
|
1153
|
-
async function downloadAndExtractArchive(handle, data, dir) {
|
|
1154
|
-
const tarball2 = join5(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
1169
|
+
let parsed;
|
|
1155
1170
|
try {
|
|
1156
|
-
|
|
1157
|
-
return await safeExtractTarGz(tarball2, dir, handle.filename);
|
|
1171
|
+
parsed = JSON.parse(raw);
|
|
1158
1172
|
} catch {
|
|
1159
|
-
return
|
|
1160
|
-
} finally {
|
|
1161
|
-
await rm3(tarball2, { force: true }).catch(() => {
|
|
1162
|
-
});
|
|
1173
|
+
return {};
|
|
1163
1174
|
}
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
const
|
|
1168
|
-
const
|
|
1169
|
-
|
|
1170
|
-
let dirReady = false;
|
|
1171
|
-
async function ensureDir() {
|
|
1172
|
-
if (!dirReady) {
|
|
1173
|
-
await mkdir4(dir, { recursive: true });
|
|
1174
|
-
dirReady = true;
|
|
1175
|
-
}
|
|
1175
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
1176
|
+
const flags2 = parsed.flags;
|
|
1177
|
+
if (!flags2 || typeof flags2 !== "object" || Array.isArray(flags2)) return {};
|
|
1178
|
+
const out = {};
|
|
1179
|
+
for (const [k, v] of Object.entries(flags2)) {
|
|
1180
|
+
if (typeof v === "boolean") out[k] = v;
|
|
1176
1181
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
try {
|
|
1187
|
-
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
1188
|
-
headers: authHeaders3
|
|
1189
|
-
});
|
|
1190
|
-
if (!res.ok) return null;
|
|
1191
|
-
const data = Buffer.from(await res.arrayBuffer());
|
|
1192
|
-
await ensureDir();
|
|
1193
|
-
if (value.archive === "tar.gz") {
|
|
1194
|
-
return await downloadAndExtractArchive(value, data, dir);
|
|
1195
|
-
}
|
|
1196
|
-
if (value.size > 0 && data.length !== value.size) return null;
|
|
1197
|
-
const downloadedPath = join5(dir, sanitizeSegment(value.filename));
|
|
1198
|
-
await writeFile4(downloadedPath, data);
|
|
1199
|
-
if (value.mimeType.startsWith("image/")) {
|
|
1200
|
-
images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
|
|
1201
|
-
}
|
|
1202
|
-
return downloadedPath;
|
|
1203
|
-
} catch {
|
|
1204
|
-
return null;
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
if (Array.isArray(value)) {
|
|
1208
|
-
return Promise.all(value.map(walk));
|
|
1209
|
-
}
|
|
1210
|
-
if (value && typeof value === "object") {
|
|
1211
|
-
const out = {};
|
|
1212
|
-
for (const [k, v] of Object.entries(value)) {
|
|
1213
|
-
out[k] = await walk(v);
|
|
1182
|
+
return out;
|
|
1183
|
+
}
|
|
1184
|
+
function writeFlagsFile(filePath, flags2) {
|
|
1185
|
+
if (Object.keys(flags2).length === 0) {
|
|
1186
|
+
if (fs2.existsSync(filePath)) fs2.rmSync(filePath, { force: true });
|
|
1187
|
+
const parent = path4.dirname(filePath);
|
|
1188
|
+
try {
|
|
1189
|
+
if (fs2.existsSync(parent) && fs2.readdirSync(parent).length === 0) {
|
|
1190
|
+
fs2.rmdirSync(parent);
|
|
1214
1191
|
}
|
|
1215
|
-
|
|
1192
|
+
} catch {
|
|
1216
1193
|
}
|
|
1217
|
-
return
|
|
1194
|
+
return;
|
|
1218
1195
|
}
|
|
1219
|
-
|
|
1220
|
-
|
|
1196
|
+
fs2.mkdirSync(path4.dirname(filePath), { recursive: true });
|
|
1197
|
+
const tmp = `${filePath}.${process.pid}.tmp`;
|
|
1198
|
+
fs2.writeFileSync(tmp, JSON.stringify({ flags: flags2 }, null, 2) + "\n");
|
|
1199
|
+
fs2.renameSync(tmp, filePath);
|
|
1221
1200
|
}
|
|
1222
|
-
function
|
|
1223
|
-
|
|
1224
|
-
const rec = args;
|
|
1225
|
-
if (typeof rec.udid === "string") return rec.udid;
|
|
1226
|
-
if (typeof rec.device_id === "string") return rec.device_id;
|
|
1227
|
-
return void 0;
|
|
1201
|
+
function readFlags(scope, options = {}) {
|
|
1202
|
+
return readFlagsFile(getFlagsPath(scope, options));
|
|
1228
1203
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
return async (frames) => {
|
|
1235
|
-
for (const frame of frames) frame.module = getModuleFromFileName(frame.filename);
|
|
1236
|
-
return frames;
|
|
1237
|
-
};
|
|
1204
|
+
function setFlag(name, value, scope, options = {}) {
|
|
1205
|
+
const filePath = getFlagsPath(scope, options);
|
|
1206
|
+
const current = readFlagsFile(filePath);
|
|
1207
|
+
current[name] = value;
|
|
1208
|
+
writeFlagsFile(filePath, current);
|
|
1238
1209
|
}
|
|
1239
|
-
function
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
const decodedFile = decodeURIComponent(file);
|
|
1247
|
-
if (!dir) dir = ".";
|
|
1248
|
-
const n2 = dir.lastIndexOf("/node_modules");
|
|
1249
|
-
if (n2 > -1) return `${dir.slice(n2 + 14).replace(/\//g, ".")}:${decodedFile}`;
|
|
1250
|
-
if (dir.startsWith(normalizedBase)) {
|
|
1251
|
-
const moduleName = dir.slice(normalizedBase.length + 1).replace(/\//g, ".");
|
|
1252
|
-
return moduleName ? `${moduleName}:${decodedFile}` : decodedFile;
|
|
1253
|
-
}
|
|
1254
|
-
return decodedFile;
|
|
1255
|
-
};
|
|
1210
|
+
function unsetFlag(name, scope, options = {}) {
|
|
1211
|
+
const filePath = getFlagsPath(scope, options);
|
|
1212
|
+
const current = readFlagsFile(filePath);
|
|
1213
|
+
if (!Object.hasOwn(current, name)) return false;
|
|
1214
|
+
delete current[name];
|
|
1215
|
+
writeFlagsFile(filePath, current);
|
|
1216
|
+
return true;
|
|
1256
1217
|
}
|
|
1257
|
-
function
|
|
1258
|
-
|
|
1218
|
+
function isFlagEnabled(name, options = {}) {
|
|
1219
|
+
const projectFlags = readFlags("project", options);
|
|
1220
|
+
if (Object.hasOwn(projectFlags, name)) return projectFlags[name];
|
|
1221
|
+
const globalFlags = readFlags("global", options);
|
|
1222
|
+
if (Object.hasOwn(globalFlags, name)) return globalFlags[name];
|
|
1223
|
+
return options.default ?? false;
|
|
1259
1224
|
}
|
|
1260
1225
|
|
|
1261
|
-
//
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1226
|
+
// ../configuration-core/src/paths.ts
|
|
1227
|
+
import * as os from "node:os";
|
|
1228
|
+
import * as path5 from "node:path";
|
|
1229
|
+
function nonEmpty(value) {
|
|
1230
|
+
if (value == void 0) return null;
|
|
1231
|
+
const trimmed = value.trim();
|
|
1232
|
+
return trimmed === "" ? null : value;
|
|
1233
|
+
}
|
|
1234
|
+
function argentHomeDir() {
|
|
1235
|
+
const home = process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
1236
|
+
return path5.join(home, ".argent");
|
|
1237
|
+
}
|
|
1238
|
+
function configDir(scope = "global", options = {}) {
|
|
1239
|
+
if (scope === "global") {
|
|
1240
|
+
return options.homeDir ? path5.join(options.homeDir, ".argent") : argentHomeDir();
|
|
1271
1241
|
}
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1242
|
+
const cwd = options.cwd ?? process.cwd();
|
|
1243
|
+
return path5.join(resolveProjectRoot(cwd), ".argent");
|
|
1244
|
+
}
|
|
1245
|
+
function configFilePath(scope = "global", options = {}) {
|
|
1246
|
+
return path5.join(configDir(scope, options), "config.json");
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
// ../configuration-core/src/config.ts
|
|
1250
|
+
import * as crypto from "node:crypto";
|
|
1251
|
+
import * as fs3 from "node:fs";
|
|
1252
|
+
import * as path6 from "node:path";
|
|
1253
|
+
function readConfigObject(scope = "global", options = {}) {
|
|
1254
|
+
try {
|
|
1255
|
+
const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
|
|
1256
|
+
const json = JSON.parse(raw);
|
|
1257
|
+
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
1258
|
+
return json;
|
|
1259
|
+
}
|
|
1260
|
+
} catch {
|
|
1288
1261
|
}
|
|
1289
|
-
};
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
description: void 0
|
|
1262
|
+
return {};
|
|
1263
|
+
}
|
|
1264
|
+
var FORBIDDEN_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
1265
|
+
function splitKey(dottedKey) {
|
|
1266
|
+
const parts = dottedKey.split(".");
|
|
1267
|
+
if (parts.length === 0 || parts.some((p) => p === "")) {
|
|
1268
|
+
throw new Error(`Invalid config key "${dottedKey}": empty path segment`);
|
|
1269
|
+
}
|
|
1270
|
+
for (const p of parts) {
|
|
1271
|
+
if (FORBIDDEN_SEGMENTS.has(p)) {
|
|
1272
|
+
throw new Error(`Invalid config key "${dottedKey}": forbidden segment "${p}"`);
|
|
1301
1273
|
}
|
|
1302
|
-
}
|
|
1274
|
+
}
|
|
1275
|
+
return parts;
|
|
1303
1276
|
}
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1277
|
+
function isPlainObject(value) {
|
|
1278
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
1279
|
+
}
|
|
1280
|
+
function getAtPath(obj, dottedKey) {
|
|
1281
|
+
const parts = splitKey(dottedKey);
|
|
1282
|
+
let cur = obj;
|
|
1283
|
+
for (const part of parts) {
|
|
1284
|
+
if (!isPlainObject(cur)) return void 0;
|
|
1285
|
+
cur = cur[part];
|
|
1286
|
+
}
|
|
1287
|
+
return cur;
|
|
1288
|
+
}
|
|
1289
|
+
function setAtPath(obj, dottedKey, value) {
|
|
1290
|
+
const parts = splitKey(dottedKey);
|
|
1291
|
+
let cur = obj;
|
|
1292
|
+
for (let i2 = 0; i2 < parts.length - 1; i2++) {
|
|
1293
|
+
const part = parts[i2];
|
|
1294
|
+
const next = cur[part];
|
|
1295
|
+
if (!isPlainObject(next)) {
|
|
1296
|
+
cur[part] = {};
|
|
1297
|
+
}
|
|
1298
|
+
cur = cur[part];
|
|
1299
|
+
}
|
|
1300
|
+
cur[parts[parts.length - 1]] = value;
|
|
1301
|
+
}
|
|
1302
|
+
function deleteAtPath(obj, dottedKey) {
|
|
1303
|
+
const parts = splitKey(dottedKey);
|
|
1304
|
+
let cur = obj;
|
|
1305
|
+
for (let i2 = 0; i2 < parts.length - 1; i2++) {
|
|
1306
|
+
const next = cur[parts[i2]];
|
|
1307
|
+
if (!isPlainObject(next)) return false;
|
|
1308
|
+
cur = next;
|
|
1309
|
+
}
|
|
1310
|
+
const leaf = parts[parts.length - 1];
|
|
1311
|
+
if (!Object.hasOwn(cur, leaf)) return false;
|
|
1312
|
+
delete cur[leaf];
|
|
1313
|
+
return true;
|
|
1314
|
+
}
|
|
1315
|
+
var LOCK_STALE_MS2 = 1e4;
|
|
1316
|
+
var LOCK_MAX_WAIT_MS = 2e3;
|
|
1317
|
+
var LOCK_RETRY_MS = 25;
|
|
1318
|
+
function sleepSync(ms) {
|
|
1319
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
1320
|
+
}
|
|
1321
|
+
function acquireConfigLock(finalPath) {
|
|
1322
|
+
const lockPath = finalPath + ".lock";
|
|
1323
|
+
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
1324
|
+
for (; ; ) {
|
|
1325
|
+
try {
|
|
1326
|
+
const fd = fs3.openSync(lockPath, "wx", 384);
|
|
1327
|
+
try {
|
|
1328
|
+
fs3.writeSync(fd, `${process.pid}
|
|
1329
|
+
`);
|
|
1330
|
+
} catch {
|
|
1331
|
+
}
|
|
1332
|
+
return { fd, lockPath };
|
|
1333
|
+
} catch (err) {
|
|
1334
|
+
if (err.code !== "EEXIST") return null;
|
|
1335
|
+
try {
|
|
1336
|
+
if (Date.now() - fs3.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
|
|
1337
|
+
fs3.unlinkSync(lockPath);
|
|
1338
|
+
continue;
|
|
1339
|
+
}
|
|
1340
|
+
} catch {
|
|
1341
|
+
}
|
|
1342
|
+
if (Date.now() >= deadline) return null;
|
|
1343
|
+
sleepSync(LOCK_RETRY_MS);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
function releaseConfigLock(lock) {
|
|
1324
1348
|
try {
|
|
1325
|
-
|
|
1349
|
+
fs3.closeSync(lock.fd);
|
|
1326
1350
|
} catch {
|
|
1327
|
-
return response;
|
|
1328
1351
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
var types_PostHogPersistedProperty = /* @__PURE__ */ (function(PostHogPersistedProperty) {
|
|
1333
|
-
PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
|
|
1334
|
-
PostHogPersistedProperty["DistinctId"] = "distinct_id";
|
|
1335
|
-
PostHogPersistedProperty["Props"] = "props";
|
|
1336
|
-
PostHogPersistedProperty["EnablePersonProcessing"] = "enable_person_processing";
|
|
1337
|
-
PostHogPersistedProperty["PersonMode"] = "person_mode";
|
|
1338
|
-
PostHogPersistedProperty["FeatureFlagDetails"] = "feature_flag_details";
|
|
1339
|
-
PostHogPersistedProperty["FeatureFlags"] = "feature_flags";
|
|
1340
|
-
PostHogPersistedProperty["FeatureFlagPayloads"] = "feature_flag_payloads";
|
|
1341
|
-
PostHogPersistedProperty["BootstrapFeatureFlagDetails"] = "bootstrap_feature_flag_details";
|
|
1342
|
-
PostHogPersistedProperty["BootstrapFeatureFlags"] = "bootstrap_feature_flags";
|
|
1343
|
-
PostHogPersistedProperty["BootstrapFeatureFlagPayloads"] = "bootstrap_feature_flag_payloads";
|
|
1344
|
-
PostHogPersistedProperty["OverrideFeatureFlags"] = "override_feature_flags";
|
|
1345
|
-
PostHogPersistedProperty["Queue"] = "queue";
|
|
1346
|
-
PostHogPersistedProperty["LogsQueue"] = "logs_queue";
|
|
1347
|
-
PostHogPersistedProperty["OptedOut"] = "opted_out";
|
|
1348
|
-
PostHogPersistedProperty["SessionId"] = "session_id";
|
|
1349
|
-
PostHogPersistedProperty["SessionStartTimestamp"] = "session_start_timestamp";
|
|
1350
|
-
PostHogPersistedProperty["SessionLastTimestamp"] = "session_timestamp";
|
|
1351
|
-
PostHogPersistedProperty["PersonProperties"] = "person_properties";
|
|
1352
|
-
PostHogPersistedProperty["GroupProperties"] = "group_properties";
|
|
1353
|
-
PostHogPersistedProperty["InstalledAppBuild"] = "installed_app_build";
|
|
1354
|
-
PostHogPersistedProperty["InstalledAppVersion"] = "installed_app_version";
|
|
1355
|
-
PostHogPersistedProperty["SessionReplay"] = "session_replay";
|
|
1356
|
-
PostHogPersistedProperty["SessionReplayEventTriggerActivatedSession"] = "session_replay_event_trigger_activated_session";
|
|
1357
|
-
PostHogPersistedProperty["SurveyLastSeenDate"] = "survey_last_seen_date";
|
|
1358
|
-
PostHogPersistedProperty["SurveysSeen"] = "surveys_seen";
|
|
1359
|
-
PostHogPersistedProperty["Surveys"] = "surveys";
|
|
1360
|
-
PostHogPersistedProperty["RemoteConfig"] = "remote_config";
|
|
1361
|
-
PostHogPersistedProperty["FlagsEndpointWasHit"] = "flags_endpoint_was_hit";
|
|
1362
|
-
PostHogPersistedProperty["DeviceId"] = "device_id";
|
|
1363
|
-
return PostHogPersistedProperty;
|
|
1364
|
-
})({});
|
|
1365
|
-
|
|
1366
|
-
// ../../node_modules/@posthog/core/dist/gzip.mjs
|
|
1367
|
-
function isGzipSupported() {
|
|
1368
|
-
return "CompressionStream" in globalThis && "TextEncoder" in globalThis && "Response" in globalThis && "function" == typeof Response.prototype.blob;
|
|
1369
|
-
}
|
|
1370
|
-
var NATIVE_GZIP_VALIDATION_ERROR = "NativeGzipValidationError";
|
|
1371
|
-
var GZIP_MAGIC_FIRST_BYTE = 31;
|
|
1372
|
-
var GZIP_MAGIC_SECOND_BYTE = 139;
|
|
1373
|
-
var GZIP_DEFLATE_METHOD = 8;
|
|
1374
|
-
var hasGzipMagic = (bytes) => bytes.length >= 2 && bytes[0] === GZIP_MAGIC_FIRST_BYTE && bytes[1] === GZIP_MAGIC_SECOND_BYTE;
|
|
1375
|
-
var crc32Table;
|
|
1376
|
-
var getCrc32Table = () => {
|
|
1377
|
-
if (crc32Table) return crc32Table;
|
|
1378
|
-
crc32Table = [];
|
|
1379
|
-
for (let i2 = 0; i2 < 256; i2++) {
|
|
1380
|
-
let crc = i2;
|
|
1381
|
-
for (let j = 0; j < 8; j++) crc = 1 & crc ? 3988292384 ^ crc >>> 1 : crc >>> 1;
|
|
1382
|
-
crc32Table[i2] = crc >>> 0;
|
|
1352
|
+
try {
|
|
1353
|
+
fs3.unlinkSync(lock.lockPath);
|
|
1354
|
+
} catch {
|
|
1383
1355
|
}
|
|
1384
|
-
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
return (4294967295 ^ crc) >>> 0;
|
|
1391
|
-
};
|
|
1392
|
-
var throwNativeGzipValidationError = (reason) => {
|
|
1393
|
-
const error = new Error(`Native gzip produced invalid output: ${reason}`);
|
|
1394
|
-
error.name = NATIVE_GZIP_VALIDATION_ERROR;
|
|
1395
|
-
throw error;
|
|
1396
|
-
};
|
|
1397
|
-
var validateNativeGzip = async (compressed, inputBytes) => {
|
|
1398
|
-
if (compressed.size < 18) throwNativeGzipValidationError("too-short");
|
|
1399
|
-
const header = new Uint8Array(await compressed.slice(0, 10).arrayBuffer());
|
|
1400
|
-
if (!hasGzipMagic(header) || header[2] !== GZIP_DEFLATE_METHOD) throwNativeGzipValidationError("invalid-header");
|
|
1401
|
-
const trailer = new DataView(await compressed.slice(compressed.size - 8).arrayBuffer());
|
|
1402
|
-
if (trailer.getUint32(0, true) !== crc32(inputBytes)) throwNativeGzipValidationError("invalid-crc");
|
|
1403
|
-
const inputSize = inputBytes.length >>> 0;
|
|
1404
|
-
if (trailer.getUint32(4, true) !== inputSize) throwNativeGzipValidationError("invalid-size");
|
|
1405
|
-
};
|
|
1406
|
-
async function gzipCompress(input, isDebug = true, options) {
|
|
1356
|
+
}
|
|
1357
|
+
function updateConfig(mutate, scope = "global", options = {}) {
|
|
1358
|
+
const dir = configDir(scope, options);
|
|
1359
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
1360
|
+
const finalPath = configFilePath(scope, options);
|
|
1361
|
+
const lock = acquireConfigLock(finalPath);
|
|
1407
1362
|
try {
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1410
|
-
const
|
|
1411
|
-
const
|
|
1363
|
+
const next = readConfigObject(scope, options);
|
|
1364
|
+
mutate(next);
|
|
1365
|
+
const tmpPath = path6.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
1366
|
+
const fd = fs3.openSync(tmpPath, "wx", 384);
|
|
1367
|
+
try {
|
|
1368
|
+
fs3.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
1369
|
+
fs3.fsyncSync(fd);
|
|
1370
|
+
} finally {
|
|
1371
|
+
fs3.closeSync(fd);
|
|
1372
|
+
}
|
|
1373
|
+
try {
|
|
1374
|
+
fs3.renameSync(tmpPath, finalPath);
|
|
1375
|
+
} catch (err) {
|
|
1412
1376
|
try {
|
|
1413
|
-
|
|
1377
|
+
fs3.unlinkSync(tmpPath);
|
|
1414
1378
|
} catch {
|
|
1415
1379
|
}
|
|
1416
1380
|
throw err;
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
responsePromise,
|
|
1421
|
-
writePromise
|
|
1422
|
-
]);
|
|
1423
|
-
await validateNativeGzip(compressed, inputBytes);
|
|
1424
|
-
return compressed;
|
|
1425
|
-
} catch (error) {
|
|
1426
|
-
if (options?.rethrow) throw error;
|
|
1427
|
-
if (isDebug) console.error("Failed to gzip compress data", error);
|
|
1428
|
-
return null;
|
|
1381
|
+
}
|
|
1382
|
+
} finally {
|
|
1383
|
+
if (lock) releaseConfigLock(lock);
|
|
1429
1384
|
}
|
|
1430
1385
|
}
|
|
1431
1386
|
|
|
1432
|
-
//
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
"
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
"
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
"bingpreview",
|
|
1444
|
-
"chrome-lighthouse",
|
|
1445
|
-
"dataforseobot",
|
|
1446
|
-
"deepscan",
|
|
1447
|
-
"duckduckbot",
|
|
1448
|
-
"facebookexternal",
|
|
1449
|
-
"facebookcatalog",
|
|
1450
|
-
"http://yandex.com/bots",
|
|
1451
|
-
"hubspot",
|
|
1452
|
-
"ia_archiver",
|
|
1453
|
-
"leikibot",
|
|
1454
|
-
"linkedinbot",
|
|
1455
|
-
"meta-externalagent",
|
|
1456
|
-
"mj12bot",
|
|
1457
|
-
"msnbot",
|
|
1458
|
-
"nessus",
|
|
1459
|
-
"petalbot",
|
|
1460
|
-
"pinterest",
|
|
1461
|
-
"prerender",
|
|
1462
|
-
"rogerbot",
|
|
1463
|
-
"screaming frog",
|
|
1464
|
-
"sebot-wa",
|
|
1465
|
-
"sitebulb",
|
|
1466
|
-
"slackbot",
|
|
1467
|
-
"slurp",
|
|
1468
|
-
"trendictionbot",
|
|
1469
|
-
"turnitin",
|
|
1470
|
-
"twitterbot",
|
|
1471
|
-
"vercel-screenshot",
|
|
1472
|
-
"vercelbot",
|
|
1473
|
-
"yahoo! slurp",
|
|
1474
|
-
"yandexbot",
|
|
1475
|
-
"zoombot",
|
|
1476
|
-
"bot.htm",
|
|
1477
|
-
"bot.php",
|
|
1478
|
-
"(bot;",
|
|
1479
|
-
"bot/",
|
|
1480
|
-
"crawler",
|
|
1481
|
-
"ahrefsbot",
|
|
1482
|
-
"ahrefssiteaudit",
|
|
1483
|
-
"semrushbot",
|
|
1484
|
-
"siteauditbot",
|
|
1485
|
-
"splitsignalbot",
|
|
1486
|
-
"gptbot",
|
|
1487
|
-
"oai-searchbot",
|
|
1488
|
-
"chatgpt-user",
|
|
1489
|
-
"perplexitybot",
|
|
1490
|
-
"better uptime bot",
|
|
1491
|
-
"sentryuptimebot",
|
|
1492
|
-
"uptimerobot",
|
|
1493
|
-
"headlesschrome",
|
|
1494
|
-
"cypress",
|
|
1495
|
-
"google-hoteladsverifier",
|
|
1496
|
-
"adsbot-google",
|
|
1497
|
-
"apis-google",
|
|
1498
|
-
"duplexweb-google",
|
|
1499
|
-
"feedfetcher-google",
|
|
1500
|
-
"google favicon",
|
|
1501
|
-
"google web preview",
|
|
1502
|
-
"google-read-aloud",
|
|
1503
|
-
"googlebot",
|
|
1504
|
-
"googleother",
|
|
1505
|
-
"google-cloudvertexbot",
|
|
1506
|
-
"googleweblight",
|
|
1507
|
-
"mediapartners-google",
|
|
1508
|
-
"storebot-google",
|
|
1509
|
-
"google-inspectiontool",
|
|
1510
|
-
"bytespider"
|
|
1511
|
-
];
|
|
1512
|
-
var isBlockedUA = function(ua, customBlockedUserAgents = []) {
|
|
1513
|
-
if (!ua) return false;
|
|
1514
|
-
const uaLower = ua.toLowerCase();
|
|
1515
|
-
return DEFAULT_BLOCKED_UA_STRS.concat(customBlockedUserAgents).some((blockedUA) => {
|
|
1516
|
-
const blockedUaLower = blockedUA.toLowerCase();
|
|
1517
|
-
return -1 !== uaLower.indexOf(blockedUaLower);
|
|
1518
|
-
});
|
|
1519
|
-
};
|
|
1520
|
-
|
|
1521
|
-
// ../../node_modules/@posthog/core/dist/utils/type-utils.mjs
|
|
1522
|
-
var nativeIsArray = Array.isArray;
|
|
1523
|
-
var ObjProto = Object.prototype;
|
|
1524
|
-
var type_utils_hasOwnProperty = ObjProto.hasOwnProperty;
|
|
1525
|
-
var type_utils_toString = ObjProto.toString;
|
|
1526
|
-
var isArray = nativeIsArray || function(obj) {
|
|
1527
|
-
return "[object Array]" === type_utils_toString.call(obj);
|
|
1528
|
-
};
|
|
1529
|
-
var isObject = (x) => x === Object(x) && !isArray(x);
|
|
1530
|
-
var isUndefined = (x) => void 0 === x;
|
|
1531
|
-
var isString = (x) => "[object String]" == type_utils_toString.call(x);
|
|
1532
|
-
var isEmptyString = (x) => isString(x) && 0 === x.trim().length;
|
|
1533
|
-
var isNumber = (x) => "[object Number]" == type_utils_toString.call(x) && x === x;
|
|
1534
|
-
var isPlainError = (x) => x instanceof Error;
|
|
1535
|
-
function isPrimitive(value) {
|
|
1536
|
-
return null === value || "object" != typeof value;
|
|
1537
|
-
}
|
|
1538
|
-
function isBuiltin(candidate, className) {
|
|
1539
|
-
return Object.prototype.toString.call(candidate) === `[object ${className}]`;
|
|
1387
|
+
// ../configuration-core/src/merge.ts
|
|
1388
|
+
function mergeRestrictive(local, global2) {
|
|
1389
|
+
if (local === void 0) return global2;
|
|
1390
|
+
if (global2 === void 0) return local;
|
|
1391
|
+
if (typeof local === "boolean" && typeof global2 === "boolean") {
|
|
1392
|
+
return local && global2;
|
|
1393
|
+
}
|
|
1394
|
+
if (typeof local === "number" && typeof global2 === "number") {
|
|
1395
|
+
return Math.min(local, global2);
|
|
1396
|
+
}
|
|
1397
|
+
return local;
|
|
1540
1398
|
}
|
|
1541
|
-
function
|
|
1542
|
-
return
|
|
1399
|
+
function toArray(value) {
|
|
1400
|
+
return Array.isArray(value) ? value : null;
|
|
1543
1401
|
}
|
|
1544
|
-
function
|
|
1545
|
-
|
|
1402
|
+
function mergeUnion(local, global2) {
|
|
1403
|
+
const l2 = toArray(local);
|
|
1404
|
+
const g = toArray(global2);
|
|
1405
|
+
if (l2 === null && g === null) return local ?? global2;
|
|
1406
|
+
const merged = [...g ?? [], ...l2 ?? []];
|
|
1407
|
+
return Array.from(new Set(merged));
|
|
1546
1408
|
}
|
|
1547
|
-
function
|
|
1548
|
-
|
|
1409
|
+
function mergeIntersection(local, global2) {
|
|
1410
|
+
const l2 = toArray(local);
|
|
1411
|
+
const g = toArray(global2);
|
|
1412
|
+
if (l2 === null && g === null) return local ?? global2;
|
|
1413
|
+
if (l2 === null) return global2;
|
|
1414
|
+
if (g === null) return local;
|
|
1415
|
+
const globalSet = new Set(g);
|
|
1416
|
+
return l2.filter((item) => globalSet.has(item));
|
|
1549
1417
|
}
|
|
1550
|
-
function
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1418
|
+
function applyMergePolicy(policy, local, global2) {
|
|
1419
|
+
if (typeof policy === "function") return policy({ local, global: global2 });
|
|
1420
|
+
switch (policy) {
|
|
1421
|
+
case "prioritize-local":
|
|
1422
|
+
return local ?? global2;
|
|
1423
|
+
case "prioritize-global":
|
|
1424
|
+
return global2 ?? local;
|
|
1425
|
+
case "prioritize-restrictive":
|
|
1426
|
+
return mergeRestrictive(local, global2);
|
|
1427
|
+
case "union":
|
|
1428
|
+
return mergeUnion(local, global2);
|
|
1429
|
+
case "intersection":
|
|
1430
|
+
return mergeIntersection(local, global2);
|
|
1431
|
+
default: {
|
|
1432
|
+
const _exhaustive = policy;
|
|
1433
|
+
return _exhaustive;
|
|
1434
|
+
}
|
|
1555
1435
|
}
|
|
1556
1436
|
}
|
|
1557
1437
|
|
|
1558
|
-
//
|
|
1559
|
-
function
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1438
|
+
// ../configuration-core/src/config-schema.ts
|
|
1439
|
+
function asBoolean(raw) {
|
|
1440
|
+
return typeof raw === "boolean" ? raw : void 0;
|
|
1441
|
+
}
|
|
1442
|
+
function asString(raw) {
|
|
1443
|
+
if (typeof raw !== "string") return void 0;
|
|
1444
|
+
const trimmed = raw.trim();
|
|
1445
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
1446
|
+
}
|
|
1447
|
+
var CONFIG_SCHEMA = [
|
|
1448
|
+
{
|
|
1449
|
+
key: "telemetry.enabled",
|
|
1450
|
+
description: "Whether anonymous opt-out telemetry is enabled (on by default; environment opt-outs like DO_NOT_TRACK are not reflected here \u2014 `argent telemetry status` shows effective consent).",
|
|
1451
|
+
scopes: ["global"],
|
|
1452
|
+
parse: asBoolean,
|
|
1453
|
+
// A committed project file must never re-enable telemetry a user disabled
|
|
1454
|
+
// globally, so the more-restrictive (opt-out) value always wins.
|
|
1455
|
+
merge: "prioritize-restrictive",
|
|
1456
|
+
// Telemetry is opt-out: with nothing stored, consent.ts treats it as
|
|
1457
|
+
// enabled, and the config surface must report the same instead of "(unset)".
|
|
1458
|
+
default: true,
|
|
1459
|
+
// Read-only under `argent config`: opt-in/out goes through the dedicated
|
|
1460
|
+
// command so the live client is drained/reset, not just the file rewritten.
|
|
1461
|
+
manageCommand: "argent telemetry"
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
key: "lens.agent",
|
|
1465
|
+
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
1466
|
+
scopes: ["project", "global"],
|
|
1467
|
+
parse: asString,
|
|
1468
|
+
// A repo can pin the agent its screenshots should use; falls back to the
|
|
1469
|
+
// user's global remembered choice.
|
|
1470
|
+
merge: "prioritize-local",
|
|
1471
|
+
example: "claude"
|
|
1571
1472
|
}
|
|
1572
|
-
|
|
1573
|
-
|
|
1473
|
+
];
|
|
1474
|
+
function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
1475
|
+
return registry.find((def) => def.key === key);
|
|
1574
1476
|
}
|
|
1575
1477
|
|
|
1576
|
-
//
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1478
|
+
// ../configuration-core/src/config-access.ts
|
|
1479
|
+
function readScopeValue(def, scope, options) {
|
|
1480
|
+
if (!def.scopes.includes(scope)) return void 0;
|
|
1481
|
+
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
1482
|
+
return raw === void 0 ? void 0 : def.parse(raw);
|
|
1483
|
+
}
|
|
1484
|
+
function getConfigValue(def, options = {}) {
|
|
1485
|
+
const local = readScopeValue(def, "project", options);
|
|
1486
|
+
const global2 = readScopeValue(def, "global", options);
|
|
1487
|
+
const merged = applyMergePolicy(def.merge, local, global2);
|
|
1488
|
+
return merged ?? def.default;
|
|
1489
|
+
}
|
|
1490
|
+
function getConfigValueAtScope(key, scope, options = {}, registry = CONFIG_SCHEMA) {
|
|
1491
|
+
const def = requireDefinition(key, registry);
|
|
1492
|
+
return readScopeValue(def, scope, options);
|
|
1493
|
+
}
|
|
1494
|
+
function getConfigValueByKey(key, options = {}, registry = CONFIG_SCHEMA) {
|
|
1495
|
+
const def = requireDefinition(key, registry);
|
|
1496
|
+
return getConfigValue(def, options);
|
|
1497
|
+
}
|
|
1498
|
+
function requireDefinition(key, registry = CONFIG_SCHEMA) {
|
|
1499
|
+
const def = getConfigDefinition(key, registry);
|
|
1500
|
+
if (!def) {
|
|
1501
|
+
throw new UnknownConfigKeyError(key);
|
|
1585
1502
|
}
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
}
|
|
1503
|
+
return def;
|
|
1504
|
+
}
|
|
1505
|
+
var UnknownConfigKeyError = class extends Error {
|
|
1506
|
+
constructor(key) {
|
|
1507
|
+
super(`Unknown configuration key "${key}".`);
|
|
1508
|
+
this.key = key;
|
|
1509
|
+
this.name = "UnknownConfigKeyError";
|
|
1594
1510
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
};
|
|
1605
|
-
this._buckets[keyStr] = bucket;
|
|
1606
|
-
}
|
|
1607
|
-
if (0 === bucket.tokens) return true;
|
|
1608
|
-
bucket.tokens--;
|
|
1609
|
-
if (0 === bucket.tokens) this._onBucketRateLimited?.(key);
|
|
1610
|
-
return 0 === bucket.tokens;
|
|
1511
|
+
key;
|
|
1512
|
+
};
|
|
1513
|
+
var ConfigScopeError = class extends Error {
|
|
1514
|
+
constructor(key, scope, allowed) {
|
|
1515
|
+
super(`Config key "${key}" cannot be set at ${scope} scope (allowed: ${allowed.join(", ")}).`);
|
|
1516
|
+
this.key = key;
|
|
1517
|
+
this.scope = scope;
|
|
1518
|
+
this.allowed = allowed;
|
|
1519
|
+
this.name = "ConfigScopeError";
|
|
1611
1520
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1521
|
+
key;
|
|
1522
|
+
scope;
|
|
1523
|
+
allowed;
|
|
1524
|
+
};
|
|
1525
|
+
var ConfigValidationError = class extends Error {
|
|
1526
|
+
constructor(key) {
|
|
1527
|
+
super(`Invalid value for config key "${key}".`);
|
|
1528
|
+
this.key = key;
|
|
1529
|
+
this.name = "ConfigValidationError";
|
|
1614
1530
|
}
|
|
1531
|
+
key;
|
|
1615
1532
|
};
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
this.
|
|
1533
|
+
var ConfigManagedElsewhereError = class extends Error {
|
|
1534
|
+
constructor(key, command) {
|
|
1535
|
+
super(`Config key "${key}" is managed by \`${command}\`.`);
|
|
1536
|
+
this.key = key;
|
|
1537
|
+
this.command = command;
|
|
1538
|
+
this.name = "ConfigManagedElsewhereError";
|
|
1622
1539
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1540
|
+
key;
|
|
1541
|
+
command;
|
|
1542
|
+
};
|
|
1543
|
+
function setConfigValue(key, rawValue, scope = "global", options = {}, registry = CONFIG_SCHEMA) {
|
|
1544
|
+
const def = requireDefinition(key, registry);
|
|
1545
|
+
if (def.manageCommand) throw new ConfigManagedElsewhereError(key, def.manageCommand);
|
|
1546
|
+
if (!def.scopes.includes(scope)) throw new ConfigScopeError(key, scope, def.scopes);
|
|
1547
|
+
const parsed = def.parse(rawValue);
|
|
1548
|
+
if (parsed === void 0) throw new ConfigValidationError(key);
|
|
1549
|
+
updateConfig((config2) => setAtPath(config2, key, parsed), scope, options);
|
|
1550
|
+
return parsed;
|
|
1551
|
+
}
|
|
1552
|
+
function unsetConfigValue(key, scope = "global", options = {}, registry = CONFIG_SCHEMA) {
|
|
1553
|
+
const def = requireDefinition(key, registry);
|
|
1554
|
+
if (def.manageCommand) throw new ConfigManagedElsewhereError(key, def.manageCommand);
|
|
1555
|
+
if (!def.scopes.includes(scope)) throw new ConfigScopeError(key, scope, def.scopes);
|
|
1556
|
+
if (getAtPath(readConfigObject(scope, options), key) === void 0) return false;
|
|
1557
|
+
let removed = false;
|
|
1558
|
+
updateConfig(
|
|
1559
|
+
(config2) => {
|
|
1560
|
+
removed = deleteAtPath(config2, key);
|
|
1561
|
+
},
|
|
1562
|
+
scope,
|
|
1563
|
+
options
|
|
1564
|
+
);
|
|
1565
|
+
return removed;
|
|
1566
|
+
}
|
|
1567
|
+
function listConfig(options = {}, registry = CONFIG_SCHEMA) {
|
|
1568
|
+
return registry.map((def) => ({
|
|
1569
|
+
key: def.key,
|
|
1570
|
+
description: def.description,
|
|
1571
|
+
scopes: def.scopes,
|
|
1572
|
+
...def.manageCommand ? { manageCommand: def.manageCommand } : {},
|
|
1573
|
+
effective: getConfigValue(def, options),
|
|
1574
|
+
project: readScopeValue(def, "project", options),
|
|
1575
|
+
global: readScopeValue(def, "global", options)
|
|
1576
|
+
}));
|
|
1577
|
+
}
|
|
1578
|
+
function coerceCliValue(raw) {
|
|
1579
|
+
try {
|
|
1580
|
+
return JSON.parse(raw);
|
|
1581
|
+
} catch {
|
|
1582
|
+
return raw;
|
|
1626
1583
|
}
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1584
|
+
}
|
|
1585
|
+
var LENS_AGENT_KEY = "lens.agent";
|
|
1586
|
+
function getRememberedAgent(options = {}) {
|
|
1587
|
+
const value = getConfigValueByKey(LENS_AGENT_KEY, options);
|
|
1588
|
+
return typeof value === "string" && value.trim() ? value : null;
|
|
1589
|
+
}
|
|
1590
|
+
function setRememberedAgent(agentId, options = {}) {
|
|
1591
|
+
setConfigValue(LENS_AGENT_KEY, agentId, "global", options);
|
|
1592
|
+
}
|
|
1593
|
+
function clearRememberedAgent(options = {}) {
|
|
1594
|
+
unsetConfigValue(LENS_AGENT_KEY, "global", options);
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
// ../argent-tools-client/src/artifacts.ts
|
|
1598
|
+
var ARTIFACT_MARKER = "__argentArtifact";
|
|
1599
|
+
function isArtifactHandle(value) {
|
|
1600
|
+
return !!value && typeof value === "object" && value[ARTIFACT_MARKER] === true && typeof value.id === "string" && typeof value.filename === "string";
|
|
1601
|
+
}
|
|
1602
|
+
var SESSION_ID = null;
|
|
1603
|
+
function sessionId() {
|
|
1604
|
+
if (!SESSION_ID) {
|
|
1605
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:T]/g, (m) => m === "T" ? "-" : "").slice(0, 15);
|
|
1606
|
+
SESSION_ID = `${stamp}-${process.pid}`;
|
|
1647
1607
|
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1608
|
+
return SESSION_ID;
|
|
1609
|
+
}
|
|
1610
|
+
function sanitizeSegment(segment) {
|
|
1611
|
+
return segment.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
1612
|
+
}
|
|
1613
|
+
function projectSlug() {
|
|
1614
|
+
const cwd = process.cwd();
|
|
1615
|
+
const hash = createHash3("sha1").update(cwd).digest("hex").slice(0, 6);
|
|
1616
|
+
const name = sanitizeSegment(basename3(cwd)) || "root";
|
|
1617
|
+
return `${name}-${hash}`;
|
|
1618
|
+
}
|
|
1619
|
+
function artifactsRoot() {
|
|
1620
|
+
return process.env.ARGENT_ARTIFACTS_DIR ?? join8(tmpdir2(), "argent-artifacts");
|
|
1621
|
+
}
|
|
1622
|
+
function artifactDir(deviceId) {
|
|
1623
|
+
const parts = [artifactsRoot(), projectSlug(), sessionId()];
|
|
1624
|
+
if (deviceId) parts.push(sanitizeSegment(deviceId));
|
|
1625
|
+
return join8(...parts);
|
|
1626
|
+
}
|
|
1627
|
+
function durableBaseDir() {
|
|
1628
|
+
const projectRoot = findProjectRoot(process.cwd());
|
|
1629
|
+
return projectRoot ?? dirname5(argentHomeDir());
|
|
1630
|
+
}
|
|
1631
|
+
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize(".argent/recordings")]);
|
|
1632
|
+
var MAX_DURABLE_BYTES = 2 * 1024 * 1024 * 1024;
|
|
1633
|
+
async function readCapped(res, cap) {
|
|
1634
|
+
const headers = res.headers;
|
|
1635
|
+
const declared = Number(headers?.get?.("content-length"));
|
|
1636
|
+
if (Number.isFinite(declared) && declared > cap) return null;
|
|
1637
|
+
const body = res.body;
|
|
1638
|
+
if (!body?.getReader) {
|
|
1639
|
+
const buf = Buffer.from(await res.arrayBuffer());
|
|
1640
|
+
return buf.length > cap ? null : buf;
|
|
1678
1641
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1642
|
+
const reader = body.getReader();
|
|
1643
|
+
const chunks = [];
|
|
1644
|
+
let total = 0;
|
|
1645
|
+
for (; ; ) {
|
|
1646
|
+
const { done, value } = await reader.read();
|
|
1647
|
+
if (done) break;
|
|
1648
|
+
total += value.byteLength;
|
|
1649
|
+
if (total > cap) {
|
|
1650
|
+
await reader.cancel().catch(() => {
|
|
1651
|
+
});
|
|
1652
|
+
return null;
|
|
1685
1653
|
}
|
|
1686
|
-
|
|
1654
|
+
chunks.push(Buffer.from(value));
|
|
1687
1655
|
}
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1656
|
+
return Buffer.concat(chunks);
|
|
1657
|
+
}
|
|
1658
|
+
async function writeDurableUnique(dir, filename, write) {
|
|
1659
|
+
const ext = extname(filename);
|
|
1660
|
+
const stem = filename.slice(0, filename.length - ext.length);
|
|
1661
|
+
for (let i2 = 1; i2 <= 1e3; i2++) {
|
|
1662
|
+
const candidate = i2 === 1 ? filename : `${stem} (${i2})${ext}`;
|
|
1663
|
+
const path15 = join8(dir, candidate);
|
|
1664
|
+
try {
|
|
1665
|
+
await write(path15);
|
|
1666
|
+
return path15;
|
|
1667
|
+
} catch (err) {
|
|
1668
|
+
if (err?.code === "EEXIST") continue;
|
|
1669
|
+
throw err;
|
|
1693
1670
|
}
|
|
1694
|
-
return text2;
|
|
1695
|
-
}
|
|
1696
|
-
toJSON() {
|
|
1697
|
-
return this.toString();
|
|
1698
|
-
}
|
|
1699
|
-
getVariant() {
|
|
1700
|
-
const n2 = this.bytes[8] >>> 4;
|
|
1701
|
-
if (n2 < 0) throw new Error("unreachable");
|
|
1702
|
-
if (n2 <= 7) return this.bytes.every((e) => 0 === e) ? "NIL" : "VAR_0";
|
|
1703
|
-
if (n2 <= 11) return "VAR_10";
|
|
1704
|
-
if (n2 <= 13) return "VAR_110";
|
|
1705
|
-
if (n2 <= 15) return this.bytes.every((e) => 255 === e) ? "MAX" : "VAR_RESERVED";
|
|
1706
|
-
else throw new Error("unreachable");
|
|
1707
|
-
}
|
|
1708
|
-
getVersion() {
|
|
1709
|
-
return "VAR_10" === this.getVariant() ? this.bytes[6] >>> 4 : void 0;
|
|
1710
1671
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1672
|
+
return null;
|
|
1673
|
+
}
|
|
1674
|
+
function durableSaveTarget(handle) {
|
|
1675
|
+
if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
|
|
1676
|
+
const rel = normalize(handle.saveDir);
|
|
1677
|
+
if (isAbsolute3(rel) || rel === ".." || rel.startsWith(`..${sep2}`) || rel.split(sep2).includes("..")) {
|
|
1678
|
+
return null;
|
|
1713
1679
|
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1680
|
+
if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
|
|
1681
|
+
const base = durableBaseDir();
|
|
1682
|
+
const dir = join8(base, rel);
|
|
1683
|
+
return { dir, path: join8(dir, sanitizeSegment(handle.filename)), base, rel };
|
|
1684
|
+
}
|
|
1685
|
+
async function confineToRealBase(dir, base, rel) {
|
|
1686
|
+
try {
|
|
1687
|
+
const realDir = await realpath(dir);
|
|
1688
|
+
const realBase = await realpath(base);
|
|
1689
|
+
return realDir === join8(realBase, rel);
|
|
1690
|
+
} catch {
|
|
1691
|
+
return false;
|
|
1716
1692
|
}
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1693
|
+
}
|
|
1694
|
+
async function resolveLocalFile(handle) {
|
|
1695
|
+
if (!handle.hostPath) return null;
|
|
1696
|
+
try {
|
|
1697
|
+
const st = await stat2(handle.hostPath);
|
|
1698
|
+
if (handle.archive) {
|
|
1699
|
+
return st.isDirectory() ? handle.hostPath : null;
|
|
1721
1700
|
}
|
|
1722
|
-
return
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
}
|
|
1731
|
-
generate() {
|
|
1732
|
-
return this.generateOrResetCore(Date.now(), 1e4);
|
|
1701
|
+
if (!st.isFile()) return null;
|
|
1702
|
+
if (st.size !== handle.size) return null;
|
|
1703
|
+
if (handle.mtimeMs != null && Math.round(st.mtimeMs) !== Math.round(handle.mtimeMs)) {
|
|
1704
|
+
return null;
|
|
1705
|
+
}
|
|
1706
|
+
return handle.hostPath;
|
|
1707
|
+
} catch {
|
|
1708
|
+
return null;
|
|
1733
1709
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1710
|
+
}
|
|
1711
|
+
async function downloadAndExtractArchive(handle, data, dir) {
|
|
1712
|
+
const tarball2 = join8(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
1713
|
+
try {
|
|
1714
|
+
await writeFile4(tarball2, data);
|
|
1715
|
+
return await safeExtractTarGz(tarball2, dir, handle.filename);
|
|
1716
|
+
} catch {
|
|
1717
|
+
return null;
|
|
1718
|
+
} finally {
|
|
1719
|
+
await rm3(tarball2, { force: true }).catch(() => {
|
|
1720
|
+
});
|
|
1736
1721
|
}
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1722
|
+
}
|
|
1723
|
+
async function materializeArtifacts(result, ctx) {
|
|
1724
|
+
const images = [];
|
|
1725
|
+
const fetchFn = ctx.fetchImpl ?? fetch;
|
|
1726
|
+
const authHeaders3 = ctx.authToken ? { Authorization: `Bearer ${ctx.authToken}` } : {};
|
|
1727
|
+
const dir = artifactDir(ctx.deviceId);
|
|
1728
|
+
let dirReady = false;
|
|
1729
|
+
async function ensureDir() {
|
|
1730
|
+
if (!dirReady) {
|
|
1731
|
+
await mkdir4(dir, { recursive: true });
|
|
1732
|
+
dirReady = true;
|
|
1742
1733
|
}
|
|
1743
|
-
return value;
|
|
1744
1734
|
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1735
|
+
async function walk(value) {
|
|
1736
|
+
if (isArtifactHandle(value)) {
|
|
1737
|
+
const localPath = await resolveLocalFile(value);
|
|
1738
|
+
const saveTarget = durableSaveTarget(value);
|
|
1739
|
+
if (saveTarget) {
|
|
1740
|
+
const filename = basename3(saveTarget.path);
|
|
1741
|
+
try {
|
|
1742
|
+
await mkdir4(saveTarget.dir, { recursive: true });
|
|
1743
|
+
if (!await confineToRealBase(saveTarget.dir, saveTarget.base, saveTarget.rel)) {
|
|
1744
|
+
return null;
|
|
1745
|
+
}
|
|
1746
|
+
if (localPath) {
|
|
1747
|
+
const finalPath2 = await writeDurableUnique(
|
|
1748
|
+
saveTarget.dir,
|
|
1749
|
+
filename,
|
|
1750
|
+
(p) => copyFile(localPath, p, fsConstants.COPYFILE_EXCL)
|
|
1751
|
+
);
|
|
1752
|
+
if (!finalPath2) return null;
|
|
1753
|
+
if (value.mimeType.startsWith("image/")) {
|
|
1754
|
+
images.push({
|
|
1755
|
+
localPath: finalPath2,
|
|
1756
|
+
data: await readFile4(finalPath2),
|
|
1757
|
+
mimeType: value.mimeType
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
return finalPath2;
|
|
1761
|
+
}
|
|
1762
|
+
if (!Number.isInteger(value.size) || value.size <= 0 || value.size > MAX_DURABLE_BYTES) {
|
|
1763
|
+
return null;
|
|
1764
|
+
}
|
|
1765
|
+
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
1766
|
+
headers: authHeaders3
|
|
1767
|
+
});
|
|
1768
|
+
if (!res.ok) return null;
|
|
1769
|
+
const data = await readCapped(res, value.size);
|
|
1770
|
+
if (!data || data.length !== value.size) return null;
|
|
1771
|
+
const finalPath = await writeDurableUnique(
|
|
1772
|
+
saveTarget.dir,
|
|
1773
|
+
filename,
|
|
1774
|
+
(p) => writeFile4(p, data, { flag: "wx" })
|
|
1775
|
+
);
|
|
1776
|
+
if (!finalPath) return null;
|
|
1777
|
+
if (value.mimeType.startsWith("image/")) {
|
|
1778
|
+
images.push({ localPath: finalPath, data, mimeType: value.mimeType });
|
|
1779
|
+
}
|
|
1780
|
+
return finalPath;
|
|
1781
|
+
} catch {
|
|
1782
|
+
return null;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
if (localPath) {
|
|
1786
|
+
if (value.mimeType.startsWith("image/")) {
|
|
1787
|
+
images.push({ localPath, data: await readFile4(localPath), mimeType: value.mimeType });
|
|
1788
|
+
}
|
|
1789
|
+
return localPath;
|
|
1790
|
+
}
|
|
1791
|
+
try {
|
|
1792
|
+
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
1793
|
+
headers: authHeaders3
|
|
1794
|
+
});
|
|
1795
|
+
if (!res.ok) return null;
|
|
1796
|
+
const data = Buffer.from(await res.arrayBuffer());
|
|
1797
|
+
await ensureDir();
|
|
1798
|
+
if (value.archive === "tar.gz") {
|
|
1799
|
+
return await downloadAndExtractArchive(value, data, dir);
|
|
1800
|
+
}
|
|
1801
|
+
if (value.size > 0 && data.length !== value.size) return null;
|
|
1802
|
+
const downloadedPath = join8(dir, sanitizeSegment(value.filename));
|
|
1803
|
+
await writeFile4(downloadedPath, data);
|
|
1804
|
+
if (value.mimeType.startsWith("image/")) {
|
|
1805
|
+
images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
|
|
1806
|
+
}
|
|
1807
|
+
return downloadedPath;
|
|
1808
|
+
} catch {
|
|
1809
|
+
return null;
|
|
1758
1810
|
}
|
|
1759
1811
|
}
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
resetCounter() {
|
|
1763
|
-
this.counter = 1024 * this.random.nextUint32() + (1023 & this.random.nextUint32());
|
|
1764
|
-
}
|
|
1765
|
-
generateV4() {
|
|
1766
|
-
const bytes = new Uint8Array(Uint32Array.of(this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32()).buffer);
|
|
1767
|
-
bytes[6] = 64 | bytes[6] >>> 4;
|
|
1768
|
-
bytes[8] = 128 | bytes[8] >>> 2;
|
|
1769
|
-
return UUID.ofInner(bytes);
|
|
1770
|
-
}
|
|
1771
|
-
};
|
|
1772
|
-
var getDefaultRandom = () => ({
|
|
1773
|
-
nextUint32: () => 65536 * Math.trunc(65536 * Math.random()) + Math.trunc(65536 * Math.random())
|
|
1774
|
-
});
|
|
1775
|
-
var defaultGenerator;
|
|
1776
|
-
var uuidv7 = () => uuidv7obj().toString();
|
|
1777
|
-
var uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generate();
|
|
1778
|
-
|
|
1779
|
-
// ../../node_modules/@posthog/core/dist/utils/promise-queue.mjs
|
|
1780
|
-
var PromiseQueue = class {
|
|
1781
|
-
add(promise) {
|
|
1782
|
-
const promiseUUID = uuidv7();
|
|
1783
|
-
this.promiseByIds[promiseUUID] = promise;
|
|
1784
|
-
promise.catch(() => {
|
|
1785
|
-
}).finally(() => {
|
|
1786
|
-
delete this.promiseByIds[promiseUUID];
|
|
1787
|
-
});
|
|
1788
|
-
return promise;
|
|
1789
|
-
}
|
|
1790
|
-
async join() {
|
|
1791
|
-
let promises = Object.values(this.promiseByIds);
|
|
1792
|
-
let length = promises.length;
|
|
1793
|
-
while (length > 0) {
|
|
1794
|
-
await Promise.all(promises);
|
|
1795
|
-
promises = Object.values(this.promiseByIds);
|
|
1796
|
-
length = promises.length;
|
|
1812
|
+
if (Array.isArray(value)) {
|
|
1813
|
+
return Promise.all(value.map(walk));
|
|
1797
1814
|
}
|
|
1815
|
+
if (value && typeof value === "object") {
|
|
1816
|
+
const out = {};
|
|
1817
|
+
for (const [k, v] of Object.entries(value)) {
|
|
1818
|
+
out[k] = await walk(v);
|
|
1819
|
+
}
|
|
1820
|
+
return out;
|
|
1821
|
+
}
|
|
1822
|
+
return value;
|
|
1798
1823
|
}
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1824
|
+
const rewritten = await walk(result);
|
|
1825
|
+
return { result: rewritten, images };
|
|
1826
|
+
}
|
|
1827
|
+
function getDeviceIdFromArgs(args) {
|
|
1828
|
+
if (!args || typeof args !== "object") return void 0;
|
|
1829
|
+
const rec = args;
|
|
1830
|
+
if (typeof rec.udid === "string") return rec.udid;
|
|
1831
|
+
if (typeof rec.device_id === "string") return rec.device_id;
|
|
1832
|
+
return void 0;
|
|
1833
|
+
}
|
|
1806
1834
|
|
|
1807
|
-
// ../../node_modules
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1835
|
+
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
1836
|
+
import { dirname as dirname6, posix as posix2, sep as sep3 } from "path";
|
|
1837
|
+
function createModulerModifier() {
|
|
1838
|
+
const getModuleFromFileName = createGetModuleFromFilename();
|
|
1839
|
+
return async (frames) => {
|
|
1840
|
+
for (const frame of frames) frame.module = getModuleFromFileName(frame.filename);
|
|
1841
|
+
return frames;
|
|
1814
1842
|
};
|
|
1815
|
-
return lockedMethods;
|
|
1816
1843
|
}
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
});
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
},
|
|
1834
|
-
error: (...args) => {
|
|
1835
|
-
_log("error", ...args);
|
|
1836
|
-
},
|
|
1837
|
-
critical: (...args) => {
|
|
1838
|
-
consoleLike["error"](prefix, ...args);
|
|
1839
|
-
},
|
|
1840
|
-
createLogger: (additionalPrefix) => _createLogger(`${prefix} ${additionalPrefix}`, maybeCall, consoleLike)
|
|
1844
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname6(process.argv[1]) : process.cwd(), isWindows = "\\" === sep3) {
|
|
1845
|
+
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
1846
|
+
return (filename) => {
|
|
1847
|
+
if (!filename) return;
|
|
1848
|
+
const normalizedFilename = isWindows ? normalizeWindowsPath(filename) : filename;
|
|
1849
|
+
let { dir, base: file, ext } = posix2.parse(normalizedFilename);
|
|
1850
|
+
if (".js" === ext || ".mjs" === ext || ".cjs" === ext) file = file.slice(0, -1 * ext.length);
|
|
1851
|
+
const decodedFile = decodeURIComponent(file);
|
|
1852
|
+
if (!dir) dir = ".";
|
|
1853
|
+
const n2 = dir.lastIndexOf("/node_modules");
|
|
1854
|
+
if (n2 > -1) return `${dir.slice(n2 + 14).replace(/\//g, ".")}:${decodedFile}`;
|
|
1855
|
+
if (dir.startsWith(normalizedBase)) {
|
|
1856
|
+
const moduleName = dir.slice(normalizedBase.length + 1).replace(/\//g, ".");
|
|
1857
|
+
return moduleName ? `${moduleName}:${decodedFile}` : decodedFile;
|
|
1858
|
+
}
|
|
1859
|
+
return decodedFile;
|
|
1841
1860
|
};
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
function createLogger(prefix, maybeCall = passThrough) {
|
|
1846
|
-
return _createLogger(prefix, maybeCall, createConsole());
|
|
1861
|
+
}
|
|
1862
|
+
function normalizeWindowsPath(path15) {
|
|
1863
|
+
return path15.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
1847
1864
|
}
|
|
1848
1865
|
|
|
1849
|
-
// ../../node_modules/@posthog/core/dist/
|
|
1850
|
-
var
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1866
|
+
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
1867
|
+
var normalizeFlagsResponse = (flagsResponse) => {
|
|
1868
|
+
if ("flags" in flagsResponse) {
|
|
1869
|
+
const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
|
|
1870
|
+
const featureFlagPayloads = getPayloadsFromFlags(flagsResponse.flags);
|
|
1871
|
+
return {
|
|
1872
|
+
...flagsResponse,
|
|
1873
|
+
featureFlags,
|
|
1874
|
+
featureFlagPayloads
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
{
|
|
1878
|
+
const featureFlags = flagsResponse.featureFlags ?? {};
|
|
1879
|
+
const featureFlagPayloads = Object.fromEntries(Object.entries(flagsResponse.featureFlagPayloads || {}).map(([k, v]) => [
|
|
1880
|
+
k,
|
|
1881
|
+
parsePayload(v)
|
|
1882
|
+
]));
|
|
1883
|
+
const flags2 = Object.fromEntries(Object.entries(featureFlags).map(([key, value]) => [
|
|
1884
|
+
key,
|
|
1885
|
+
getFlagDetailFromFlagAndPayload(key, value, featureFlagPayloads[key])
|
|
1886
|
+
]));
|
|
1887
|
+
return {
|
|
1888
|
+
...flagsResponse,
|
|
1889
|
+
featureFlags,
|
|
1890
|
+
featureFlagPayloads,
|
|
1891
|
+
flags: flags2
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1895
|
+
function getFlagDetailFromFlagAndPayload(key, value, payload) {
|
|
1896
|
+
return {
|
|
1897
|
+
key,
|
|
1898
|
+
enabled: "string" == typeof value ? true : value,
|
|
1899
|
+
variant: "string" == typeof value ? value : void 0,
|
|
1900
|
+
reason: void 0,
|
|
1901
|
+
metadata: {
|
|
1902
|
+
id: void 0,
|
|
1903
|
+
version: void 0,
|
|
1904
|
+
payload: payload ? JSON.stringify(payload) : void 0,
|
|
1905
|
+
description: void 0
|
|
1906
|
+
}
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1909
|
+
var getFlagValuesFromFlags = (flags2) => Object.fromEntries(Object.entries(flags2 ?? {}).map(([key, detail]) => [
|
|
1910
|
+
key,
|
|
1911
|
+
getFeatureFlagValue(detail)
|
|
1912
|
+
]).filter(([, value]) => void 0 !== value));
|
|
1913
|
+
var getPayloadsFromFlags = (flags2) => {
|
|
1914
|
+
const safeFlags = flags2 ?? {};
|
|
1915
|
+
return Object.fromEntries(Object.keys(safeFlags).filter((flag) => {
|
|
1916
|
+
const details = safeFlags[flag];
|
|
1917
|
+
return details.enabled && details.metadata && void 0 !== details.metadata.payload;
|
|
1918
|
+
}).map((flag) => {
|
|
1919
|
+
const payload = safeFlags[flag].metadata?.payload;
|
|
1920
|
+
return [
|
|
1921
|
+
flag,
|
|
1922
|
+
payload ? parsePayload(payload) : void 0
|
|
1923
|
+
];
|
|
1924
|
+
}));
|
|
1925
|
+
};
|
|
1926
|
+
var getFeatureFlagValue = (detail) => void 0 === detail ? void 0 : detail.variant ?? detail.enabled;
|
|
1927
|
+
var parsePayload = (response) => {
|
|
1928
|
+
if ("string" != typeof response) return response;
|
|
1929
|
+
try {
|
|
1930
|
+
return JSON.parse(response);
|
|
1931
|
+
} catch {
|
|
1932
|
+
return response;
|
|
1933
|
+
}
|
|
1934
|
+
};
|
|
1935
|
+
|
|
1936
|
+
// ../../node_modules/@posthog/core/dist/types.mjs
|
|
1937
|
+
var types_PostHogPersistedProperty = /* @__PURE__ */ (function(PostHogPersistedProperty) {
|
|
1938
|
+
PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
|
|
1939
|
+
PostHogPersistedProperty["DistinctId"] = "distinct_id";
|
|
1940
|
+
PostHogPersistedProperty["Props"] = "props";
|
|
1941
|
+
PostHogPersistedProperty["EnablePersonProcessing"] = "enable_person_processing";
|
|
1942
|
+
PostHogPersistedProperty["PersonMode"] = "person_mode";
|
|
1943
|
+
PostHogPersistedProperty["FeatureFlagDetails"] = "feature_flag_details";
|
|
1944
|
+
PostHogPersistedProperty["FeatureFlags"] = "feature_flags";
|
|
1945
|
+
PostHogPersistedProperty["FeatureFlagPayloads"] = "feature_flag_payloads";
|
|
1946
|
+
PostHogPersistedProperty["BootstrapFeatureFlagDetails"] = "bootstrap_feature_flag_details";
|
|
1947
|
+
PostHogPersistedProperty["BootstrapFeatureFlags"] = "bootstrap_feature_flags";
|
|
1948
|
+
PostHogPersistedProperty["BootstrapFeatureFlagPayloads"] = "bootstrap_feature_flag_payloads";
|
|
1949
|
+
PostHogPersistedProperty["OverrideFeatureFlags"] = "override_feature_flags";
|
|
1950
|
+
PostHogPersistedProperty["Queue"] = "queue";
|
|
1951
|
+
PostHogPersistedProperty["LogsQueue"] = "logs_queue";
|
|
1952
|
+
PostHogPersistedProperty["OptedOut"] = "opted_out";
|
|
1953
|
+
PostHogPersistedProperty["SessionId"] = "session_id";
|
|
1954
|
+
PostHogPersistedProperty["SessionStartTimestamp"] = "session_start_timestamp";
|
|
1955
|
+
PostHogPersistedProperty["SessionLastTimestamp"] = "session_timestamp";
|
|
1956
|
+
PostHogPersistedProperty["PersonProperties"] = "person_properties";
|
|
1957
|
+
PostHogPersistedProperty["GroupProperties"] = "group_properties";
|
|
1958
|
+
PostHogPersistedProperty["InstalledAppBuild"] = "installed_app_build";
|
|
1959
|
+
PostHogPersistedProperty["InstalledAppVersion"] = "installed_app_version";
|
|
1960
|
+
PostHogPersistedProperty["SessionReplay"] = "session_replay";
|
|
1961
|
+
PostHogPersistedProperty["SessionReplayEventTriggerActivatedSession"] = "session_replay_event_trigger_activated_session";
|
|
1962
|
+
PostHogPersistedProperty["SurveyLastSeenDate"] = "survey_last_seen_date";
|
|
1963
|
+
PostHogPersistedProperty["SurveysSeen"] = "surveys_seen";
|
|
1964
|
+
PostHogPersistedProperty["Surveys"] = "surveys";
|
|
1965
|
+
PostHogPersistedProperty["RemoteConfig"] = "remote_config";
|
|
1966
|
+
PostHogPersistedProperty["FlagsEndpointWasHit"] = "flags_endpoint_was_hit";
|
|
1967
|
+
PostHogPersistedProperty["DeviceId"] = "device_id";
|
|
1968
|
+
return PostHogPersistedProperty;
|
|
1969
|
+
})({});
|
|
1970
|
+
|
|
1971
|
+
// ../../node_modules/@posthog/core/dist/gzip.mjs
|
|
1972
|
+
function isGzipSupported() {
|
|
1973
|
+
return "CompressionStream" in globalThis && "TextEncoder" in globalThis && "Response" in globalThis && "function" == typeof Response.prototype.blob;
|
|
1974
|
+
}
|
|
1975
|
+
var NATIVE_GZIP_VALIDATION_ERROR = "NativeGzipValidationError";
|
|
1976
|
+
var GZIP_MAGIC_FIRST_BYTE = 31;
|
|
1977
|
+
var GZIP_MAGIC_SECOND_BYTE = 139;
|
|
1978
|
+
var GZIP_DEFLATE_METHOD = 8;
|
|
1979
|
+
var hasGzipMagic = (bytes) => bytes.length >= 2 && bytes[0] === GZIP_MAGIC_FIRST_BYTE && bytes[1] === GZIP_MAGIC_SECOND_BYTE;
|
|
1980
|
+
var crc32Table;
|
|
1981
|
+
var getCrc32Table = () => {
|
|
1982
|
+
if (crc32Table) return crc32Table;
|
|
1983
|
+
crc32Table = [];
|
|
1984
|
+
for (let i2 = 0; i2 < 256; i2++) {
|
|
1985
|
+
let crc = i2;
|
|
1986
|
+
for (let j = 0; j < 8; j++) crc = 1 & crc ? 3988292384 ^ crc >>> 1 : crc >>> 1;
|
|
1987
|
+
crc32Table[i2] = crc >>> 0;
|
|
1988
|
+
}
|
|
1989
|
+
return crc32Table;
|
|
1990
|
+
};
|
|
1991
|
+
var crc32 = (bytes) => {
|
|
1992
|
+
const table = getCrc32Table();
|
|
1993
|
+
let crc = 4294967295;
|
|
1994
|
+
for (let i2 = 0; i2 < bytes.length; i2++) crc = table[(crc ^ bytes[i2]) & 255] ^ crc >>> 8;
|
|
1995
|
+
return (4294967295 ^ crc) >>> 0;
|
|
1996
|
+
};
|
|
1997
|
+
var throwNativeGzipValidationError = (reason) => {
|
|
1998
|
+
const error = new Error(`Native gzip produced invalid output: ${reason}`);
|
|
1999
|
+
error.name = NATIVE_GZIP_VALIDATION_ERROR;
|
|
2000
|
+
throw error;
|
|
2001
|
+
};
|
|
2002
|
+
var validateNativeGzip = async (compressed, inputBytes) => {
|
|
2003
|
+
if (compressed.size < 18) throwNativeGzipValidationError("too-short");
|
|
2004
|
+
const header = new Uint8Array(await compressed.slice(0, 10).arrayBuffer());
|
|
2005
|
+
if (!hasGzipMagic(header) || header[2] !== GZIP_DEFLATE_METHOD) throwNativeGzipValidationError("invalid-header");
|
|
2006
|
+
const trailer = new DataView(await compressed.slice(compressed.size - 8).arrayBuffer());
|
|
2007
|
+
if (trailer.getUint32(0, true) !== crc32(inputBytes)) throwNativeGzipValidationError("invalid-crc");
|
|
2008
|
+
const inputSize = inputBytes.length >>> 0;
|
|
2009
|
+
if (trailer.getUint32(4, true) !== inputSize) throwNativeGzipValidationError("invalid-size");
|
|
2010
|
+
};
|
|
2011
|
+
async function gzipCompress(input, isDebug = true, options) {
|
|
2012
|
+
try {
|
|
2013
|
+
const inputBytes = new TextEncoder().encode(input);
|
|
2014
|
+
const compressedStream = new CompressionStream("gzip");
|
|
2015
|
+
const writer = compressedStream.writable.getWriter();
|
|
2016
|
+
const writePromise = writer.write(inputBytes).then(() => writer.close()).catch(async (err) => {
|
|
2017
|
+
try {
|
|
2018
|
+
await writer.abort(err);
|
|
2019
|
+
} catch {
|
|
2020
|
+
}
|
|
2021
|
+
throw err;
|
|
2022
|
+
});
|
|
2023
|
+
const responsePromise = new Response(compressedStream.readable).blob();
|
|
2024
|
+
const [compressed] = await Promise.all([
|
|
2025
|
+
responsePromise,
|
|
2026
|
+
writePromise
|
|
2027
|
+
]);
|
|
2028
|
+
await validateNativeGzip(compressed, inputBytes);
|
|
2029
|
+
return compressed;
|
|
2030
|
+
} catch (error) {
|
|
2031
|
+
if (options?.rethrow) throw error;
|
|
2032
|
+
if (isDebug) console.error("Failed to gzip compress data", error);
|
|
2033
|
+
return null;
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
// ../../node_modules/@posthog/core/dist/utils/bot-detection.mjs
|
|
2038
|
+
var DEFAULT_BLOCKED_UA_STRS = [
|
|
2039
|
+
"amazonbot",
|
|
2040
|
+
"amazonproductbot",
|
|
2041
|
+
"app.hypefactors.com",
|
|
2042
|
+
"applebot",
|
|
2043
|
+
"archive.org_bot",
|
|
2044
|
+
"awariobot",
|
|
2045
|
+
"backlinksextendedbot",
|
|
2046
|
+
"baiduspider",
|
|
2047
|
+
"bingbot",
|
|
2048
|
+
"bingpreview",
|
|
2049
|
+
"chrome-lighthouse",
|
|
2050
|
+
"dataforseobot",
|
|
2051
|
+
"deepscan",
|
|
2052
|
+
"duckduckbot",
|
|
2053
|
+
"facebookexternal",
|
|
2054
|
+
"facebookcatalog",
|
|
2055
|
+
"http://yandex.com/bots",
|
|
2056
|
+
"hubspot",
|
|
2057
|
+
"ia_archiver",
|
|
2058
|
+
"leikibot",
|
|
2059
|
+
"linkedinbot",
|
|
2060
|
+
"meta-externalagent",
|
|
2061
|
+
"mj12bot",
|
|
2062
|
+
"msnbot",
|
|
2063
|
+
"nessus",
|
|
2064
|
+
"petalbot",
|
|
2065
|
+
"pinterest",
|
|
2066
|
+
"prerender",
|
|
2067
|
+
"rogerbot",
|
|
2068
|
+
"screaming frog",
|
|
2069
|
+
"sebot-wa",
|
|
2070
|
+
"sitebulb",
|
|
2071
|
+
"slackbot",
|
|
2072
|
+
"slurp",
|
|
2073
|
+
"trendictionbot",
|
|
2074
|
+
"turnitin",
|
|
2075
|
+
"twitterbot",
|
|
2076
|
+
"vercel-screenshot",
|
|
2077
|
+
"vercelbot",
|
|
2078
|
+
"yahoo! slurp",
|
|
2079
|
+
"yandexbot",
|
|
2080
|
+
"zoombot",
|
|
2081
|
+
"bot.htm",
|
|
2082
|
+
"bot.php",
|
|
2083
|
+
"(bot;",
|
|
2084
|
+
"bot/",
|
|
2085
|
+
"crawler",
|
|
2086
|
+
"ahrefsbot",
|
|
2087
|
+
"ahrefssiteaudit",
|
|
2088
|
+
"semrushbot",
|
|
2089
|
+
"siteauditbot",
|
|
2090
|
+
"splitsignalbot",
|
|
2091
|
+
"gptbot",
|
|
2092
|
+
"oai-searchbot",
|
|
2093
|
+
"chatgpt-user",
|
|
2094
|
+
"perplexitybot",
|
|
2095
|
+
"better uptime bot",
|
|
2096
|
+
"sentryuptimebot",
|
|
2097
|
+
"uptimerobot",
|
|
2098
|
+
"headlesschrome",
|
|
2099
|
+
"cypress",
|
|
2100
|
+
"google-hoteladsverifier",
|
|
2101
|
+
"adsbot-google",
|
|
2102
|
+
"apis-google",
|
|
2103
|
+
"duplexweb-google",
|
|
2104
|
+
"feedfetcher-google",
|
|
2105
|
+
"google favicon",
|
|
2106
|
+
"google web preview",
|
|
2107
|
+
"google-read-aloud",
|
|
2108
|
+
"googlebot",
|
|
2109
|
+
"googleother",
|
|
2110
|
+
"google-cloudvertexbot",
|
|
2111
|
+
"googleweblight",
|
|
2112
|
+
"mediapartners-google",
|
|
2113
|
+
"storebot-google",
|
|
2114
|
+
"google-inspectiontool",
|
|
2115
|
+
"bytespider"
|
|
2116
|
+
];
|
|
2117
|
+
var isBlockedUA = function(ua, customBlockedUserAgents = []) {
|
|
2118
|
+
if (!ua) return false;
|
|
2119
|
+
const uaLower = ua.toLowerCase();
|
|
2120
|
+
return DEFAULT_BLOCKED_UA_STRS.concat(customBlockedUserAgents).some((blockedUA) => {
|
|
2121
|
+
const blockedUaLower = blockedUA.toLowerCase();
|
|
2122
|
+
return -1 !== uaLower.indexOf(blockedUaLower);
|
|
2123
|
+
});
|
|
2124
|
+
};
|
|
2125
|
+
|
|
2126
|
+
// ../../node_modules/@posthog/core/dist/utils/type-utils.mjs
|
|
2127
|
+
var nativeIsArray = Array.isArray;
|
|
2128
|
+
var ObjProto = Object.prototype;
|
|
2129
|
+
var type_utils_hasOwnProperty = ObjProto.hasOwnProperty;
|
|
2130
|
+
var type_utils_toString = ObjProto.toString;
|
|
2131
|
+
var isArray = nativeIsArray || function(obj) {
|
|
2132
|
+
return "[object Array]" === type_utils_toString.call(obj);
|
|
2133
|
+
};
|
|
2134
|
+
var isObject = (x) => x === Object(x) && !isArray(x);
|
|
2135
|
+
var isUndefined = (x) => void 0 === x;
|
|
2136
|
+
var isString = (x) => "[object String]" == type_utils_toString.call(x);
|
|
2137
|
+
var isEmptyString = (x) => isString(x) && 0 === x.trim().length;
|
|
2138
|
+
var isNumber = (x) => "[object Number]" == type_utils_toString.call(x) && x === x;
|
|
2139
|
+
var isPlainError = (x) => x instanceof Error;
|
|
2140
|
+
function isPrimitive(value) {
|
|
2141
|
+
return null === value || "object" != typeof value;
|
|
2142
|
+
}
|
|
2143
|
+
function isBuiltin(candidate, className) {
|
|
2144
|
+
return Object.prototype.toString.call(candidate) === `[object ${className}]`;
|
|
2145
|
+
}
|
|
2146
|
+
function isErrorEvent(event) {
|
|
2147
|
+
return isBuiltin(event, "ErrorEvent");
|
|
2148
|
+
}
|
|
2149
|
+
function isEvent(candidate) {
|
|
2150
|
+
return "undefined" != typeof Event && isInstanceOf(candidate, Event);
|
|
2151
|
+
}
|
|
2152
|
+
function isPlainObject2(candidate) {
|
|
2153
|
+
return isBuiltin(candidate, "Object");
|
|
2154
|
+
}
|
|
2155
|
+
function isInstanceOf(candidate, base) {
|
|
2156
|
+
try {
|
|
2157
|
+
return candidate instanceof base;
|
|
2158
|
+
} catch {
|
|
2159
|
+
return false;
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
|
|
2163
|
+
// ../../node_modules/@posthog/core/dist/utils/number-utils.mjs
|
|
2164
|
+
function clampToRange(value, min, max, logger, fallbackValue) {
|
|
2165
|
+
if (min > max) {
|
|
2166
|
+
logger.warn("min cannot be greater than max.");
|
|
2167
|
+
min = max;
|
|
2168
|
+
}
|
|
2169
|
+
if (isNumber(value)) if (value > max) {
|
|
2170
|
+
logger.warn(" cannot be greater than max: " + max + ". Using max value instead.");
|
|
2171
|
+
return max;
|
|
2172
|
+
} else {
|
|
2173
|
+
if (!(value < min)) return value;
|
|
2174
|
+
logger.warn(" cannot be less than min: " + min + ". Using min value instead.");
|
|
2175
|
+
return min;
|
|
2176
|
+
}
|
|
2177
|
+
logger.warn(" must be a number. using max or fallback. max: " + max + ", fallback: " + fallbackValue);
|
|
2178
|
+
return clampToRange(fallbackValue || max, min, max, logger);
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
// ../../node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
|
|
2182
|
+
var ONE_DAY_IN_MS = 864e5;
|
|
2183
|
+
var BucketedRateLimiter = class {
|
|
2184
|
+
constructor(options) {
|
|
2185
|
+
this._buckets = {};
|
|
2186
|
+
this._onBucketRateLimited = options._onBucketRateLimited;
|
|
2187
|
+
this._bucketSize = clampToRange(options.bucketSize, 0, 100, options._logger);
|
|
2188
|
+
this._refillRate = clampToRange(options.refillRate, 0, this._bucketSize, options._logger);
|
|
2189
|
+
this._refillInterval = clampToRange(options.refillInterval, 0, ONE_DAY_IN_MS, options._logger);
|
|
2190
|
+
}
|
|
2191
|
+
_applyRefill(bucket, now) {
|
|
2192
|
+
const elapsedMs = now - bucket.lastAccess;
|
|
2193
|
+
const refillIntervals = Math.floor(elapsedMs / this._refillInterval);
|
|
2194
|
+
if (refillIntervals > 0) {
|
|
2195
|
+
const tokensToAdd = refillIntervals * this._refillRate;
|
|
2196
|
+
bucket.tokens = Math.min(bucket.tokens + tokensToAdd, this._bucketSize);
|
|
2197
|
+
bucket.lastAccess = bucket.lastAccess + refillIntervals * this._refillInterval;
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
consumeRateLimit(key) {
|
|
2201
|
+
const now = Date.now();
|
|
2202
|
+
const keyStr = String(key);
|
|
2203
|
+
let bucket = this._buckets[keyStr];
|
|
2204
|
+
if (bucket) this._applyRefill(bucket, now);
|
|
2205
|
+
else {
|
|
2206
|
+
bucket = {
|
|
2207
|
+
tokens: this._bucketSize,
|
|
2208
|
+
lastAccess: now
|
|
2209
|
+
};
|
|
2210
|
+
this._buckets[keyStr] = bucket;
|
|
2211
|
+
}
|
|
2212
|
+
if (0 === bucket.tokens) return true;
|
|
2213
|
+
bucket.tokens--;
|
|
2214
|
+
if (0 === bucket.tokens) this._onBucketRateLimited?.(key);
|
|
2215
|
+
return 0 === bucket.tokens;
|
|
2216
|
+
}
|
|
2217
|
+
stop() {
|
|
2218
|
+
this._buckets = {};
|
|
2219
|
+
}
|
|
2220
|
+
};
|
|
2221
|
+
|
|
2222
|
+
// ../../node_modules/@posthog/core/dist/vendor/uuidv7.mjs
|
|
2223
|
+
var DIGITS = "0123456789abcdef";
|
|
2224
|
+
var UUID = class _UUID {
|
|
2225
|
+
constructor(bytes) {
|
|
2226
|
+
this.bytes = bytes;
|
|
2227
|
+
}
|
|
2228
|
+
static ofInner(bytes) {
|
|
2229
|
+
if (16 === bytes.length) return new _UUID(bytes);
|
|
2230
|
+
throw new TypeError("not 128-bit length");
|
|
2231
|
+
}
|
|
2232
|
+
static fromFieldsV7(unixTsMs, randA, randBHi, randBLo) {
|
|
2233
|
+
if (!Number.isInteger(unixTsMs) || !Number.isInteger(randA) || !Number.isInteger(randBHi) || !Number.isInteger(randBLo) || unixTsMs < 0 || randA < 0 || randBHi < 0 || randBLo < 0 || unixTsMs > 281474976710655 || randA > 4095 || randBHi > 1073741823 || randBLo > 4294967295) throw new RangeError("invalid field value");
|
|
2234
|
+
const bytes = new Uint8Array(16);
|
|
2235
|
+
bytes[0] = unixTsMs / 2 ** 40;
|
|
2236
|
+
bytes[1] = unixTsMs / 2 ** 32;
|
|
2237
|
+
bytes[2] = unixTsMs / 2 ** 24;
|
|
2238
|
+
bytes[3] = unixTsMs / 2 ** 16;
|
|
2239
|
+
bytes[4] = unixTsMs / 256;
|
|
2240
|
+
bytes[5] = unixTsMs;
|
|
2241
|
+
bytes[6] = 112 | randA >>> 8;
|
|
2242
|
+
bytes[7] = randA;
|
|
2243
|
+
bytes[8] = 128 | randBHi >>> 24;
|
|
2244
|
+
bytes[9] = randBHi >>> 16;
|
|
2245
|
+
bytes[10] = randBHi >>> 8;
|
|
2246
|
+
bytes[11] = randBHi;
|
|
2247
|
+
bytes[12] = randBLo >>> 24;
|
|
2248
|
+
bytes[13] = randBLo >>> 16;
|
|
2249
|
+
bytes[14] = randBLo >>> 8;
|
|
2250
|
+
bytes[15] = randBLo;
|
|
2251
|
+
return new _UUID(bytes);
|
|
2252
|
+
}
|
|
2253
|
+
static parse(uuid) {
|
|
2254
|
+
let hex;
|
|
2255
|
+
switch (uuid.length) {
|
|
2256
|
+
case 32:
|
|
2257
|
+
hex = /^[0-9a-f]{32}$/i.exec(uuid)?.[0];
|
|
2258
|
+
break;
|
|
2259
|
+
case 36:
|
|
2260
|
+
hex = /^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(uuid)?.slice(1, 6).join("");
|
|
2261
|
+
break;
|
|
2262
|
+
case 38:
|
|
2263
|
+
hex = /^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(uuid)?.slice(1, 6).join("");
|
|
2264
|
+
break;
|
|
2265
|
+
case 45:
|
|
2266
|
+
hex = /^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(uuid)?.slice(1, 6).join("");
|
|
2267
|
+
break;
|
|
2268
|
+
default:
|
|
2269
|
+
break;
|
|
2270
|
+
}
|
|
2271
|
+
if (hex) {
|
|
2272
|
+
const inner = new Uint8Array(16);
|
|
2273
|
+
for (let i2 = 0; i2 < 16; i2 += 4) {
|
|
2274
|
+
const n2 = parseInt(hex.substring(2 * i2, 2 * i2 + 8), 16);
|
|
2275
|
+
inner[i2 + 0] = n2 >>> 24;
|
|
2276
|
+
inner[i2 + 1] = n2 >>> 16;
|
|
2277
|
+
inner[i2 + 2] = n2 >>> 8;
|
|
2278
|
+
inner[i2 + 3] = n2;
|
|
2279
|
+
}
|
|
2280
|
+
return new _UUID(inner);
|
|
2281
|
+
}
|
|
2282
|
+
throw new SyntaxError("could not parse UUID string");
|
|
2283
|
+
}
|
|
2284
|
+
toString() {
|
|
2285
|
+
let text2 = "";
|
|
2286
|
+
for (let i2 = 0; i2 < this.bytes.length; i2++) {
|
|
2287
|
+
text2 += DIGITS.charAt(this.bytes[i2] >>> 4);
|
|
2288
|
+
text2 += DIGITS.charAt(15 & this.bytes[i2]);
|
|
2289
|
+
if (3 === i2 || 5 === i2 || 7 === i2 || 9 === i2) text2 += "-";
|
|
2290
|
+
}
|
|
2291
|
+
return text2;
|
|
2292
|
+
}
|
|
2293
|
+
toHex() {
|
|
2294
|
+
let text2 = "";
|
|
2295
|
+
for (let i2 = 0; i2 < this.bytes.length; i2++) {
|
|
2296
|
+
text2 += DIGITS.charAt(this.bytes[i2] >>> 4);
|
|
2297
|
+
text2 += DIGITS.charAt(15 & this.bytes[i2]);
|
|
2298
|
+
}
|
|
2299
|
+
return text2;
|
|
2300
|
+
}
|
|
2301
|
+
toJSON() {
|
|
2302
|
+
return this.toString();
|
|
2303
|
+
}
|
|
2304
|
+
getVariant() {
|
|
2305
|
+
const n2 = this.bytes[8] >>> 4;
|
|
2306
|
+
if (n2 < 0) throw new Error("unreachable");
|
|
2307
|
+
if (n2 <= 7) return this.bytes.every((e) => 0 === e) ? "NIL" : "VAR_0";
|
|
2308
|
+
if (n2 <= 11) return "VAR_10";
|
|
2309
|
+
if (n2 <= 13) return "VAR_110";
|
|
2310
|
+
if (n2 <= 15) return this.bytes.every((e) => 255 === e) ? "MAX" : "VAR_RESERVED";
|
|
2311
|
+
else throw new Error("unreachable");
|
|
2312
|
+
}
|
|
2313
|
+
getVersion() {
|
|
2314
|
+
return "VAR_10" === this.getVariant() ? this.bytes[6] >>> 4 : void 0;
|
|
2315
|
+
}
|
|
2316
|
+
clone() {
|
|
2317
|
+
return new _UUID(this.bytes.slice(0));
|
|
2318
|
+
}
|
|
2319
|
+
equals(other) {
|
|
2320
|
+
return 0 === this.compareTo(other);
|
|
2321
|
+
}
|
|
2322
|
+
compareTo(other) {
|
|
2323
|
+
for (let i2 = 0; i2 < 16; i2++) {
|
|
2324
|
+
const diff = this.bytes[i2] - other.bytes[i2];
|
|
2325
|
+
if (0 !== diff) return Math.sign(diff);
|
|
2326
|
+
}
|
|
2327
|
+
return 0;
|
|
2328
|
+
}
|
|
2329
|
+
};
|
|
2330
|
+
var V7Generator = class {
|
|
2331
|
+
constructor(randomNumberGenerator) {
|
|
2332
|
+
this.timestamp = 0;
|
|
2333
|
+
this.counter = 0;
|
|
2334
|
+
this.random = randomNumberGenerator ?? getDefaultRandom();
|
|
2335
|
+
}
|
|
2336
|
+
generate() {
|
|
2337
|
+
return this.generateOrResetCore(Date.now(), 1e4);
|
|
2338
|
+
}
|
|
2339
|
+
generateOrAbort() {
|
|
2340
|
+
return this.generateOrAbortCore(Date.now(), 1e4);
|
|
2341
|
+
}
|
|
2342
|
+
generateOrResetCore(unixTsMs, rollbackAllowance) {
|
|
2343
|
+
let value = this.generateOrAbortCore(unixTsMs, rollbackAllowance);
|
|
2344
|
+
if (void 0 === value) {
|
|
2345
|
+
this.timestamp = 0;
|
|
2346
|
+
value = this.generateOrAbortCore(unixTsMs, rollbackAllowance);
|
|
2347
|
+
}
|
|
2348
|
+
return value;
|
|
2349
|
+
}
|
|
2350
|
+
generateOrAbortCore(unixTsMs, rollbackAllowance) {
|
|
2351
|
+
const MAX_COUNTER = 4398046511103;
|
|
2352
|
+
if (!Number.isInteger(unixTsMs) || unixTsMs < 1 || unixTsMs > 281474976710655) throw new RangeError("`unixTsMs` must be a 48-bit positive integer");
|
|
2353
|
+
if (rollbackAllowance < 0 || rollbackAllowance > 281474976710655) throw new RangeError("`rollbackAllowance` out of reasonable range");
|
|
2354
|
+
if (unixTsMs > this.timestamp) {
|
|
2355
|
+
this.timestamp = unixTsMs;
|
|
2356
|
+
this.resetCounter();
|
|
2357
|
+
} else {
|
|
2358
|
+
if (!(unixTsMs + rollbackAllowance >= this.timestamp)) return;
|
|
2359
|
+
this.counter++;
|
|
2360
|
+
if (this.counter > MAX_COUNTER) {
|
|
2361
|
+
this.timestamp++;
|
|
2362
|
+
this.resetCounter();
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
return UUID.fromFieldsV7(this.timestamp, Math.trunc(this.counter / 2 ** 30), this.counter & 2 ** 30 - 1, this.random.nextUint32());
|
|
2366
|
+
}
|
|
2367
|
+
resetCounter() {
|
|
2368
|
+
this.counter = 1024 * this.random.nextUint32() + (1023 & this.random.nextUint32());
|
|
2369
|
+
}
|
|
2370
|
+
generateV4() {
|
|
2371
|
+
const bytes = new Uint8Array(Uint32Array.of(this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32()).buffer);
|
|
2372
|
+
bytes[6] = 64 | bytes[6] >>> 4;
|
|
2373
|
+
bytes[8] = 128 | bytes[8] >>> 2;
|
|
2374
|
+
return UUID.ofInner(bytes);
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2377
|
+
var getDefaultRandom = () => ({
|
|
2378
|
+
nextUint32: () => 65536 * Math.trunc(65536 * Math.random()) + Math.trunc(65536 * Math.random())
|
|
2379
|
+
});
|
|
2380
|
+
var defaultGenerator;
|
|
2381
|
+
var uuidv7 = () => uuidv7obj().toString();
|
|
2382
|
+
var uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generate();
|
|
2383
|
+
|
|
2384
|
+
// ../../node_modules/@posthog/core/dist/utils/promise-queue.mjs
|
|
2385
|
+
var PromiseQueue = class {
|
|
2386
|
+
add(promise) {
|
|
2387
|
+
const promiseUUID = uuidv7();
|
|
2388
|
+
this.promiseByIds[promiseUUID] = promise;
|
|
2389
|
+
promise.catch(() => {
|
|
2390
|
+
}).finally(() => {
|
|
2391
|
+
delete this.promiseByIds[promiseUUID];
|
|
2392
|
+
});
|
|
2393
|
+
return promise;
|
|
2394
|
+
}
|
|
2395
|
+
async join() {
|
|
2396
|
+
let promises = Object.values(this.promiseByIds);
|
|
2397
|
+
let length = promises.length;
|
|
2398
|
+
while (length > 0) {
|
|
2399
|
+
await Promise.all(promises);
|
|
2400
|
+
promises = Object.values(this.promiseByIds);
|
|
2401
|
+
length = promises.length;
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
get length() {
|
|
2405
|
+
return Object.keys(this.promiseByIds).length;
|
|
2406
|
+
}
|
|
2407
|
+
constructor() {
|
|
2408
|
+
this.promiseByIds = {};
|
|
2409
|
+
}
|
|
2410
|
+
};
|
|
2411
|
+
|
|
2412
|
+
// ../../node_modules/@posthog/core/dist/utils/logger.mjs
|
|
2413
|
+
function createConsole(consoleLike = console) {
|
|
2414
|
+
const lockedMethods = {
|
|
2415
|
+
log: consoleLike.log.bind(consoleLike),
|
|
2416
|
+
warn: consoleLike.warn.bind(consoleLike),
|
|
2417
|
+
error: consoleLike.error.bind(consoleLike),
|
|
2418
|
+
debug: consoleLike.debug.bind(consoleLike)
|
|
2419
|
+
};
|
|
2420
|
+
return lockedMethods;
|
|
2421
|
+
}
|
|
2422
|
+
var _createLogger = (prefix, maybeCall, consoleLike) => {
|
|
2423
|
+
function _log(level, ...args) {
|
|
2424
|
+
maybeCall(() => {
|
|
2425
|
+
const consoleMethod = consoleLike[level];
|
|
2426
|
+
consoleMethod(prefix, ...args);
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2429
|
+
const logger = {
|
|
2430
|
+
debug: (...args) => {
|
|
2431
|
+
_log("debug", ...args);
|
|
2432
|
+
},
|
|
2433
|
+
info: (...args) => {
|
|
2434
|
+
_log("log", ...args);
|
|
2435
|
+
},
|
|
2436
|
+
warn: (...args) => {
|
|
2437
|
+
_log("warn", ...args);
|
|
2438
|
+
},
|
|
2439
|
+
error: (...args) => {
|
|
2440
|
+
_log("error", ...args);
|
|
2441
|
+
},
|
|
2442
|
+
critical: (...args) => {
|
|
2443
|
+
consoleLike["error"](prefix, ...args);
|
|
2444
|
+
},
|
|
2445
|
+
createLogger: (additionalPrefix) => _createLogger(`${prefix} ${additionalPrefix}`, maybeCall, consoleLike)
|
|
2446
|
+
};
|
|
2447
|
+
return logger;
|
|
2448
|
+
};
|
|
2449
|
+
var passThrough = (fn) => fn();
|
|
2450
|
+
function createLogger(prefix, maybeCall = passThrough) {
|
|
2451
|
+
return _createLogger(prefix, maybeCall, createConsole());
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
// ../../node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
|
|
2455
|
+
var MOBILE = "Mobile";
|
|
2456
|
+
var IOS = "iOS";
|
|
2457
|
+
var ANDROID = "Android";
|
|
2458
|
+
var TABLET = "Tablet";
|
|
2459
|
+
var ANDROID_TABLET = ANDROID + " " + TABLET;
|
|
2460
|
+
var APPLE = "Apple";
|
|
2461
|
+
var APPLE_WATCH = APPLE + " Watch";
|
|
2462
|
+
var SAFARI = "Safari";
|
|
2463
|
+
var BLACKBERRY = "BlackBerry";
|
|
2464
|
+
var SAMSUNG = "Samsung";
|
|
2465
|
+
var SAMSUNG_BROWSER = SAMSUNG + "Browser";
|
|
2466
|
+
var SAMSUNG_INTERNET = SAMSUNG + " Internet";
|
|
2467
|
+
var CHROME = "Chrome";
|
|
2468
|
+
var CHROME_OS = CHROME + " OS";
|
|
2469
|
+
var CHROME_IOS = CHROME + " " + IOS;
|
|
2470
|
+
var INTERNET_EXPLORER = "Internet Explorer";
|
|
2471
|
+
var INTERNET_EXPLORER_MOBILE = INTERNET_EXPLORER + " " + MOBILE;
|
|
2472
|
+
var OPERA = "Opera";
|
|
2473
|
+
var OPERA_MINI = OPERA + " Mini";
|
|
2474
|
+
var EDGE = "Edge";
|
|
2475
|
+
var MICROSOFT_EDGE = "Microsoft " + EDGE;
|
|
2476
|
+
var FIREFOX = "Firefox";
|
|
2477
|
+
var FIREFOX_IOS = FIREFOX + " " + IOS;
|
|
2478
|
+
var NINTENDO = "Nintendo";
|
|
2479
|
+
var PLAYSTATION = "PlayStation";
|
|
2480
|
+
var XBOX = "Xbox";
|
|
2481
|
+
var ANDROID_MOBILE = ANDROID + " " + MOBILE;
|
|
2482
|
+
var MOBILE_SAFARI = MOBILE + " " + SAFARI;
|
|
2483
|
+
var WINDOWS = "Windows";
|
|
2484
|
+
var WINDOWS_PHONE = WINDOWS + " Phone";
|
|
1880
2485
|
var GENERIC = "Generic";
|
|
1881
2486
|
var GENERIC_MOBILE = GENERIC + " " + MOBILE.toLowerCase();
|
|
1882
2487
|
var GENERIC_TABLET = GENERIC + " " + TABLET.toLowerCase();
|
|
@@ -3959,14 +4564,14 @@ function snipLine(line, colno) {
|
|
|
3959
4564
|
}
|
|
3960
4565
|
|
|
3961
4566
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
|
|
3962
|
-
import { isAbsolute as
|
|
4567
|
+
import { isAbsolute as isAbsolute4, relative as relative2, sep as sep4 } from "path";
|
|
3963
4568
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
3964
|
-
const isWindows = "\\" ===
|
|
4569
|
+
const isWindows = "\\" === sep4;
|
|
3965
4570
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
3966
4571
|
const normalizedBase = toUnix(basePath);
|
|
3967
4572
|
return async (frames) => {
|
|
3968
4573
|
for (const frame of frames) if (!(!frame.filename || frame.filename.startsWith("node:") || frame.filename.startsWith("data:"))) {
|
|
3969
|
-
if (
|
|
4574
|
+
if (isAbsolute4(frame.filename)) frame.filename = toUnix(relative2(normalizedBase, toUnix(frame.filename)));
|
|
3970
4575
|
}
|
|
3971
4576
|
return frames;
|
|
3972
4577
|
};
|
|
@@ -5780,7 +6385,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5780
6385
|
};
|
|
5781
6386
|
const personProperties = {};
|
|
5782
6387
|
const groupProperties = {};
|
|
5783
|
-
for (const [key, value] of Object.entries(eventProperties)) if (
|
|
6388
|
+
for (const [key, value] of Object.entries(eventProperties)) if (isPlainObject2(value) && groups && key in groups) {
|
|
5784
6389
|
const groupProps = {};
|
|
5785
6390
|
for (const [groupKey, groupValue] of Object.entries(value)) groupProps[String(groupKey)] = String(groupValue);
|
|
5786
6391
|
groupProperties[String(key)] = groupProps;
|
|
@@ -6120,8 +6725,8 @@ function resetClient() {
|
|
|
6120
6725
|
|
|
6121
6726
|
// ../registry/src/artifacts.ts
|
|
6122
6727
|
import { stat as stat3 } from "node:fs/promises";
|
|
6123
|
-
import { randomUUID as
|
|
6124
|
-
import { basename as basename4, extname } from "node:path";
|
|
6728
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
6729
|
+
import { basename as basename4, extname as extname2 } from "node:path";
|
|
6125
6730
|
|
|
6126
6731
|
// ../registry/src/failure-codes.ts
|
|
6127
6732
|
var FAILURE_CODES = {
|
|
@@ -6315,6 +6920,7 @@ var FAILURE_CODES = {
|
|
|
6315
6920
|
SCREEN_RECORDING_NO_ACTIVE_SESSION: "SCREEN_RECORDING_NO_ACTIVE_SESSION",
|
|
6316
6921
|
SCREEN_RECORDING_STOP_IN_PROGRESS: "SCREEN_RECORDING_STOP_IN_PROGRESS",
|
|
6317
6922
|
SCREEN_RECORDING_START_EXITED: "SCREEN_RECORDING_START_EXITED",
|
|
6923
|
+
SCREEN_RECORDING_START_TIMEOUT: "SCREEN_RECORDING_START_TIMEOUT",
|
|
6318
6924
|
SCREEN_RECORDING_PROCESS_ERROR: "SCREEN_RECORDING_PROCESS_ERROR",
|
|
6319
6925
|
SCREEN_RECORDING_OUTPUT_MISSING: "SCREEN_RECORDING_OUTPUT_MISSING",
|
|
6320
6926
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
@@ -6424,7 +7030,7 @@ var FAILURE_SIGNAL_NAME_SET = new Set(FAILURE_SIGNAL_NAMES);
|
|
|
6424
7030
|
var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
|
|
6425
7031
|
|
|
6426
7032
|
// ../registry/src/registry.ts
|
|
6427
|
-
import { randomUUID as
|
|
7033
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
6428
7034
|
|
|
6429
7035
|
// ../telemetry/src/events.ts
|
|
6430
7036
|
var PLATFORMS = [
|
|
@@ -6692,10 +7298,10 @@ function sanitize(event, raw) {
|
|
|
6692
7298
|
}
|
|
6693
7299
|
|
|
6694
7300
|
// ../telemetry/src/base-props.ts
|
|
6695
|
-
import { randomUUID as
|
|
7301
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
6696
7302
|
|
|
6697
7303
|
// ../telemetry/src/cloud-agent-detect.ts
|
|
6698
|
-
import { existsSync as
|
|
7304
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
6699
7305
|
var CLAUDE_CLOUD_ENV_KINDS = /* @__PURE__ */ new Set(["byoc", "anthropic_cloud"]);
|
|
6700
7306
|
var CLAUDE_REMOTE_ENTRYPOINTS = /* @__PURE__ */ new Set([
|
|
6701
7307
|
"remote",
|
|
@@ -6729,955 +7335,465 @@ var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
|
6729
7335
|
function safeExists(fileExists, path15) {
|
|
6730
7336
|
try {
|
|
6731
7337
|
return fileExists(path15);
|
|
6732
|
-
} catch {
|
|
6733
|
-
return false;
|
|
6734
|
-
}
|
|
6735
|
-
}
|
|
6736
|
-
function detectCloudAgent(env = process.env, opts = {}) {
|
|
6737
|
-
if (isClaudeCodeCloud(env)) return "claude_code";
|
|
6738
|
-
if (isCursorCloud(env)) return "cursor";
|
|
6739
|
-
if (isCopilotAgent(env)) return "copilot";
|
|
6740
|
-
if (isReplitAgent(env)) return "replit";
|
|
6741
|
-
const fileExists = opts.fileExists ??
|
|
6742
|
-
if (safeExists(fileExists, DEVIN_MARKER_PATH)) return "devin";
|
|
6743
|
-
if (safeExists(fileExists, JULES_MARKER_PATH)) return "jules";
|
|
6744
|
-
return null;
|
|
6745
|
-
}
|
|
6746
|
-
|
|
6747
|
-
// ../../node_modules/ci-info/vendors.json
|
|
6748
|
-
var vendors_default = [
|
|
6749
|
-
{
|
|
6750
|
-
name: "Agola CI",
|
|
6751
|
-
constant: "AGOLA",
|
|
6752
|
-
env: "AGOLA_GIT_REF",
|
|
6753
|
-
pr: "AGOLA_PULL_REQUEST_ID"
|
|
6754
|
-
},
|
|
6755
|
-
{
|
|
6756
|
-
name: "Alpic",
|
|
6757
|
-
constant: "ALPIC",
|
|
6758
|
-
env: "ALPIC_HOST"
|
|
6759
|
-
},
|
|
6760
|
-
{
|
|
6761
|
-
name: "Appcircle",
|
|
6762
|
-
constant: "APPCIRCLE",
|
|
6763
|
-
env: "AC_APPCIRCLE",
|
|
6764
|
-
pr: {
|
|
6765
|
-
env: "AC_GIT_PR",
|
|
6766
|
-
ne: "false"
|
|
6767
|
-
}
|
|
6768
|
-
},
|
|
6769
|
-
{
|
|
6770
|
-
name: "AppVeyor",
|
|
6771
|
-
constant: "APPVEYOR",
|
|
6772
|
-
env: "APPVEYOR",
|
|
6773
|
-
pr: "APPVEYOR_PULL_REQUEST_NUMBER"
|
|
6774
|
-
},
|
|
6775
|
-
{
|
|
6776
|
-
name: "AWS CodeBuild",
|
|
6777
|
-
constant: "CODEBUILD",
|
|
6778
|
-
env: "CODEBUILD_BUILD_ARN",
|
|
6779
|
-
pr: {
|
|
6780
|
-
env: "CODEBUILD_WEBHOOK_EVENT",
|
|
6781
|
-
any: [
|
|
6782
|
-
"PULL_REQUEST_CREATED",
|
|
6783
|
-
"PULL_REQUEST_UPDATED",
|
|
6784
|
-
"PULL_REQUEST_REOPENED"
|
|
6785
|
-
]
|
|
6786
|
-
}
|
|
6787
|
-
},
|
|
6788
|
-
{
|
|
6789
|
-
name: "Azure Pipelines",
|
|
6790
|
-
constant: "AZURE_PIPELINES",
|
|
6791
|
-
env: "TF_BUILD",
|
|
6792
|
-
pr: {
|
|
6793
|
-
BUILD_REASON: "PullRequest"
|
|
6794
|
-
}
|
|
6795
|
-
},
|
|
6796
|
-
{
|
|
6797
|
-
name: "Bamboo",
|
|
6798
|
-
constant: "BAMBOO",
|
|
6799
|
-
env: "bamboo_planKey"
|
|
6800
|
-
},
|
|
6801
|
-
{
|
|
6802
|
-
name: "Bitbucket Pipelines",
|
|
6803
|
-
constant: "BITBUCKET",
|
|
6804
|
-
env: "BITBUCKET_COMMIT",
|
|
6805
|
-
pr: "BITBUCKET_PR_ID"
|
|
6806
|
-
},
|
|
6807
|
-
{
|
|
6808
|
-
name: "Bitrise",
|
|
6809
|
-
constant: "BITRISE",
|
|
6810
|
-
env: "BITRISE_IO",
|
|
6811
|
-
pr: "BITRISE_PULL_REQUEST"
|
|
6812
|
-
},
|
|
6813
|
-
{
|
|
6814
|
-
name: "Buddy",
|
|
6815
|
-
constant: "BUDDY",
|
|
6816
|
-
env: "BUDDY_WORKSPACE_ID",
|
|
6817
|
-
pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
|
|
6818
|
-
},
|
|
6819
|
-
{
|
|
6820
|
-
name: "Buildkite",
|
|
6821
|
-
constant: "BUILDKITE",
|
|
6822
|
-
env: "BUILDKITE",
|
|
6823
|
-
pr: {
|
|
6824
|
-
env: "BUILDKITE_PULL_REQUEST",
|
|
6825
|
-
ne: "false"
|
|
6826
|
-
}
|
|
6827
|
-
},
|
|
6828
|
-
{
|
|
6829
|
-
name: "CircleCI",
|
|
6830
|
-
constant: "CIRCLE",
|
|
6831
|
-
env: "CIRCLECI",
|
|
6832
|
-
pr: "CIRCLE_PULL_REQUEST"
|
|
6833
|
-
},
|
|
6834
|
-
{
|
|
6835
|
-
name: "Cirrus CI",
|
|
6836
|
-
constant: "CIRRUS",
|
|
6837
|
-
env: "CIRRUS_CI",
|
|
6838
|
-
pr: "CIRRUS_PR"
|
|
6839
|
-
},
|
|
6840
|
-
{
|
|
6841
|
-
name: "Cloudflare Pages",
|
|
6842
|
-
constant: "CLOUDFLARE_PAGES",
|
|
6843
|
-
env: "CF_PAGES"
|
|
6844
|
-
},
|
|
6845
|
-
{
|
|
6846
|
-
name: "Cloudflare Workers",
|
|
6847
|
-
constant: "CLOUDFLARE_WORKERS",
|
|
6848
|
-
env: "WORKERS_CI"
|
|
6849
|
-
},
|
|
6850
|
-
{
|
|
6851
|
-
name: "Codefresh",
|
|
6852
|
-
constant: "CODEFRESH",
|
|
6853
|
-
env: "CF_BUILD_ID",
|
|
6854
|
-
pr: {
|
|
6855
|
-
any: [
|
|
6856
|
-
"CF_PULL_REQUEST_NUMBER",
|
|
6857
|
-
"CF_PULL_REQUEST_ID"
|
|
6858
|
-
]
|
|
6859
|
-
}
|
|
6860
|
-
},
|
|
6861
|
-
{
|
|
6862
|
-
name: "Codemagic",
|
|
6863
|
-
constant: "CODEMAGIC",
|
|
6864
|
-
env: "CM_BUILD_ID",
|
|
6865
|
-
pr: "CM_PULL_REQUEST"
|
|
6866
|
-
},
|
|
6867
|
-
{
|
|
6868
|
-
name: "Codeship",
|
|
6869
|
-
constant: "CODESHIP",
|
|
6870
|
-
env: {
|
|
6871
|
-
CI_NAME: "codeship"
|
|
6872
|
-
}
|
|
6873
|
-
},
|
|
6874
|
-
{
|
|
6875
|
-
name: "Drone",
|
|
6876
|
-
constant: "DRONE",
|
|
6877
|
-
env: "DRONE",
|
|
6878
|
-
pr: {
|
|
6879
|
-
DRONE_BUILD_EVENT: "pull_request"
|
|
6880
|
-
}
|
|
6881
|
-
},
|
|
6882
|
-
{
|
|
6883
|
-
name: "dsari",
|
|
6884
|
-
constant: "DSARI",
|
|
6885
|
-
env: "DSARI"
|
|
6886
|
-
},
|
|
6887
|
-
{
|
|
6888
|
-
name: "Earthly",
|
|
6889
|
-
constant: "EARTHLY",
|
|
6890
|
-
env: "EARTHLY_CI"
|
|
6891
|
-
},
|
|
6892
|
-
{
|
|
6893
|
-
name: "Expo Application Services",
|
|
6894
|
-
constant: "EAS",
|
|
6895
|
-
env: "EAS_BUILD"
|
|
6896
|
-
},
|
|
6897
|
-
{
|
|
6898
|
-
name: "Gerrit",
|
|
6899
|
-
constant: "GERRIT",
|
|
6900
|
-
env: "GERRIT_PROJECT"
|
|
6901
|
-
},
|
|
6902
|
-
{
|
|
6903
|
-
name: "Gitea Actions",
|
|
6904
|
-
constant: "GITEA_ACTIONS",
|
|
6905
|
-
env: "GITEA_ACTIONS"
|
|
6906
|
-
},
|
|
6907
|
-
{
|
|
6908
|
-
name: "GitHub Actions",
|
|
6909
|
-
constant: "GITHUB_ACTIONS",
|
|
6910
|
-
env: "GITHUB_ACTIONS",
|
|
6911
|
-
pr: {
|
|
6912
|
-
GITHUB_EVENT_NAME: "pull_request"
|
|
6913
|
-
}
|
|
6914
|
-
},
|
|
6915
|
-
{
|
|
6916
|
-
name: "GitLab CI",
|
|
6917
|
-
constant: "GITLAB",
|
|
6918
|
-
env: "GITLAB_CI",
|
|
6919
|
-
pr: "CI_MERGE_REQUEST_ID"
|
|
6920
|
-
},
|
|
6921
|
-
{
|
|
6922
|
-
name: "GoCD",
|
|
6923
|
-
constant: "GOCD",
|
|
6924
|
-
env: "GO_PIPELINE_LABEL"
|
|
6925
|
-
},
|
|
6926
|
-
{
|
|
6927
|
-
name: "Google Cloud Build",
|
|
6928
|
-
constant: "GOOGLE_CLOUD_BUILD",
|
|
6929
|
-
env: "BUILDER_OUTPUT"
|
|
6930
|
-
},
|
|
6931
|
-
{
|
|
6932
|
-
name: "Harness CI",
|
|
6933
|
-
constant: "HARNESS",
|
|
6934
|
-
env: "HARNESS_BUILD_ID"
|
|
6935
|
-
},
|
|
6936
|
-
{
|
|
6937
|
-
name: "Heroku",
|
|
6938
|
-
constant: "HEROKU",
|
|
6939
|
-
env: {
|
|
6940
|
-
env: "NODE",
|
|
6941
|
-
includes: "/app/.heroku/node/bin/node"
|
|
6942
|
-
}
|
|
6943
|
-
},
|
|
6944
|
-
{
|
|
6945
|
-
name: "Hudson",
|
|
6946
|
-
constant: "HUDSON",
|
|
6947
|
-
env: "HUDSON_URL"
|
|
6948
|
-
},
|
|
6949
|
-
{
|
|
6950
|
-
name: "Jenkins",
|
|
6951
|
-
constant: "JENKINS",
|
|
6952
|
-
env: [
|
|
6953
|
-
"JENKINS_URL",
|
|
6954
|
-
"BUILD_ID"
|
|
6955
|
-
],
|
|
6956
|
-
pr: {
|
|
6957
|
-
any: [
|
|
6958
|
-
"ghprbPullId",
|
|
6959
|
-
"CHANGE_ID"
|
|
6960
|
-
]
|
|
6961
|
-
}
|
|
6962
|
-
},
|
|
6963
|
-
{
|
|
6964
|
-
name: "LayerCI",
|
|
6965
|
-
constant: "LAYERCI",
|
|
6966
|
-
env: "LAYERCI",
|
|
6967
|
-
pr: "LAYERCI_PULL_REQUEST"
|
|
6968
|
-
},
|
|
7338
|
+
} catch {
|
|
7339
|
+
return false;
|
|
7340
|
+
}
|
|
7341
|
+
}
|
|
7342
|
+
function detectCloudAgent(env = process.env, opts = {}) {
|
|
7343
|
+
if (isClaudeCodeCloud(env)) return "claude_code";
|
|
7344
|
+
if (isCursorCloud(env)) return "cursor";
|
|
7345
|
+
if (isCopilotAgent(env)) return "copilot";
|
|
7346
|
+
if (isReplitAgent(env)) return "replit";
|
|
7347
|
+
const fileExists = opts.fileExists ?? existsSync3;
|
|
7348
|
+
if (safeExists(fileExists, DEVIN_MARKER_PATH)) return "devin";
|
|
7349
|
+
if (safeExists(fileExists, JULES_MARKER_PATH)) return "jules";
|
|
7350
|
+
return null;
|
|
7351
|
+
}
|
|
7352
|
+
|
|
7353
|
+
// ../../node_modules/ci-info/vendors.json
|
|
7354
|
+
var vendors_default = [
|
|
6969
7355
|
{
|
|
6970
|
-
name: "
|
|
6971
|
-
constant: "
|
|
6972
|
-
env: "
|
|
7356
|
+
name: "Agola CI",
|
|
7357
|
+
constant: "AGOLA",
|
|
7358
|
+
env: "AGOLA_GIT_REF",
|
|
7359
|
+
pr: "AGOLA_PULL_REQUEST_ID"
|
|
6973
7360
|
},
|
|
6974
7361
|
{
|
|
6975
|
-
name: "
|
|
6976
|
-
constant: "
|
|
6977
|
-
env: "
|
|
6978
|
-
pr: {
|
|
6979
|
-
env: "PULL_REQUEST",
|
|
6980
|
-
ne: "false"
|
|
6981
|
-
}
|
|
7362
|
+
name: "Alpic",
|
|
7363
|
+
constant: "ALPIC",
|
|
7364
|
+
env: "ALPIC_HOST"
|
|
6982
7365
|
},
|
|
6983
7366
|
{
|
|
6984
|
-
name: "
|
|
6985
|
-
constant: "
|
|
6986
|
-
env: "
|
|
7367
|
+
name: "Appcircle",
|
|
7368
|
+
constant: "APPCIRCLE",
|
|
7369
|
+
env: "AC_APPCIRCLE",
|
|
6987
7370
|
pr: {
|
|
6988
|
-
env: "
|
|
7371
|
+
env: "AC_GIT_PR",
|
|
6989
7372
|
ne: "false"
|
|
6990
7373
|
}
|
|
6991
7374
|
},
|
|
6992
7375
|
{
|
|
6993
|
-
name: "
|
|
6994
|
-
constant: "
|
|
6995
|
-
env: "
|
|
6996
|
-
|
|
6997
|
-
{
|
|
6998
|
-
name: "ReleaseHub",
|
|
6999
|
-
constant: "RELEASEHUB",
|
|
7000
|
-
env: "RELEASE_BUILD_ID"
|
|
7376
|
+
name: "AppVeyor",
|
|
7377
|
+
constant: "APPVEYOR",
|
|
7378
|
+
env: "APPVEYOR",
|
|
7379
|
+
pr: "APPVEYOR_PULL_REQUEST_NUMBER"
|
|
7001
7380
|
},
|
|
7002
7381
|
{
|
|
7003
|
-
name: "
|
|
7004
|
-
constant: "
|
|
7005
|
-
env: "
|
|
7382
|
+
name: "AWS CodeBuild",
|
|
7383
|
+
constant: "CODEBUILD",
|
|
7384
|
+
env: "CODEBUILD_BUILD_ARN",
|
|
7006
7385
|
pr: {
|
|
7007
|
-
|
|
7386
|
+
env: "CODEBUILD_WEBHOOK_EVENT",
|
|
7387
|
+
any: [
|
|
7388
|
+
"PULL_REQUEST_CREATED",
|
|
7389
|
+
"PULL_REQUEST_UPDATED",
|
|
7390
|
+
"PULL_REQUEST_REOPENED"
|
|
7391
|
+
]
|
|
7008
7392
|
}
|
|
7009
7393
|
},
|
|
7010
7394
|
{
|
|
7011
|
-
name: "
|
|
7012
|
-
constant: "
|
|
7013
|
-
env: "
|
|
7014
|
-
pr: "SAIL_PULL_REQUEST_NUMBER"
|
|
7015
|
-
},
|
|
7016
|
-
{
|
|
7017
|
-
name: "Screwdriver",
|
|
7018
|
-
constant: "SCREWDRIVER",
|
|
7019
|
-
env: "SCREWDRIVER",
|
|
7395
|
+
name: "Azure Pipelines",
|
|
7396
|
+
constant: "AZURE_PIPELINES",
|
|
7397
|
+
env: "TF_BUILD",
|
|
7020
7398
|
pr: {
|
|
7021
|
-
|
|
7022
|
-
ne: "false"
|
|
7399
|
+
BUILD_REASON: "PullRequest"
|
|
7023
7400
|
}
|
|
7024
7401
|
},
|
|
7025
7402
|
{
|
|
7026
|
-
name: "
|
|
7027
|
-
constant: "
|
|
7028
|
-
env: "
|
|
7029
|
-
pr: "PULL_REQUEST_NUMBER"
|
|
7030
|
-
},
|
|
7031
|
-
{
|
|
7032
|
-
name: "Sourcehut",
|
|
7033
|
-
constant: "SOURCEHUT",
|
|
7034
|
-
env: {
|
|
7035
|
-
CI_NAME: "sourcehut"
|
|
7036
|
-
}
|
|
7403
|
+
name: "Bamboo",
|
|
7404
|
+
constant: "BAMBOO",
|
|
7405
|
+
env: "bamboo_planKey"
|
|
7037
7406
|
},
|
|
7038
7407
|
{
|
|
7039
|
-
name: "
|
|
7040
|
-
constant: "
|
|
7041
|
-
env: "
|
|
7408
|
+
name: "Bitbucket Pipelines",
|
|
7409
|
+
constant: "BITBUCKET",
|
|
7410
|
+
env: "BITBUCKET_COMMIT",
|
|
7411
|
+
pr: "BITBUCKET_PR_ID"
|
|
7042
7412
|
},
|
|
7043
7413
|
{
|
|
7044
|
-
name: "
|
|
7045
|
-
constant: "
|
|
7046
|
-
env:
|
|
7047
|
-
|
|
7048
|
-
"RUN_ID"
|
|
7049
|
-
]
|
|
7414
|
+
name: "Bitrise",
|
|
7415
|
+
constant: "BITRISE",
|
|
7416
|
+
env: "BITRISE_IO",
|
|
7417
|
+
pr: "BITRISE_PULL_REQUEST"
|
|
7050
7418
|
},
|
|
7051
7419
|
{
|
|
7052
|
-
name: "
|
|
7053
|
-
constant: "
|
|
7054
|
-
env: "
|
|
7420
|
+
name: "Buddy",
|
|
7421
|
+
constant: "BUDDY",
|
|
7422
|
+
env: "BUDDY_WORKSPACE_ID",
|
|
7423
|
+
pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
|
|
7055
7424
|
},
|
|
7056
7425
|
{
|
|
7057
|
-
name: "
|
|
7058
|
-
constant: "
|
|
7059
|
-
env: "
|
|
7426
|
+
name: "Buildkite",
|
|
7427
|
+
constant: "BUILDKITE",
|
|
7428
|
+
env: "BUILDKITE",
|
|
7060
7429
|
pr: {
|
|
7061
|
-
env: "
|
|
7430
|
+
env: "BUILDKITE_PULL_REQUEST",
|
|
7062
7431
|
ne: "false"
|
|
7063
7432
|
}
|
|
7064
7433
|
},
|
|
7065
7434
|
{
|
|
7066
|
-
name: "
|
|
7067
|
-
constant: "
|
|
7068
|
-
env: "
|
|
7069
|
-
pr:
|
|
7070
|
-
|
|
7071
|
-
}
|
|
7072
|
-
},
|
|
7073
|
-
{
|
|
7074
|
-
name: "Vercel",
|
|
7075
|
-
constant: "VERCEL",
|
|
7076
|
-
env: {
|
|
7077
|
-
any: [
|
|
7078
|
-
"NOW_BUILDER",
|
|
7079
|
-
"VERCEL"
|
|
7080
|
-
]
|
|
7081
|
-
},
|
|
7082
|
-
pr: "VERCEL_GIT_PULL_REQUEST_ID"
|
|
7083
|
-
},
|
|
7084
|
-
{
|
|
7085
|
-
name: "Visual Studio App Center",
|
|
7086
|
-
constant: "APPCENTER",
|
|
7087
|
-
env: "APPCENTER_BUILD_ID"
|
|
7088
|
-
},
|
|
7089
|
-
{
|
|
7090
|
-
name: "Woodpecker",
|
|
7091
|
-
constant: "WOODPECKER",
|
|
7092
|
-
env: {
|
|
7093
|
-
CI: "woodpecker"
|
|
7094
|
-
},
|
|
7095
|
-
pr: {
|
|
7096
|
-
CI_BUILD_EVENT: "pull_request"
|
|
7097
|
-
}
|
|
7098
|
-
},
|
|
7099
|
-
{
|
|
7100
|
-
name: "Xcode Cloud",
|
|
7101
|
-
constant: "XCODE_CLOUD",
|
|
7102
|
-
env: "CI_XCODE_PROJECT",
|
|
7103
|
-
pr: "CI_PULL_REQUEST_NUMBER"
|
|
7104
|
-
},
|
|
7105
|
-
{
|
|
7106
|
-
name: "Xcode Server",
|
|
7107
|
-
constant: "XCODE_SERVER",
|
|
7108
|
-
env: "XCS"
|
|
7109
|
-
}
|
|
7110
|
-
];
|
|
7111
|
-
|
|
7112
|
-
// ../telemetry/src/ci-detect.ts
|
|
7113
|
-
var GENERIC_CI_ENV_VARS = [
|
|
7114
|
-
"BUILD_ID",
|
|
7115
|
-
"BUILD_NUMBER",
|
|
7116
|
-
"CI",
|
|
7117
|
-
"CI_APP_ID",
|
|
7118
|
-
"CI_BUILD_ID",
|
|
7119
|
-
"CI_BUILD_NUMBER",
|
|
7120
|
-
"CI_NAME",
|
|
7121
|
-
"CONTINUOUS_INTEGRATION",
|
|
7122
|
-
"RUN_ID"
|
|
7123
|
-
];
|
|
7124
|
-
function checkEnv(env, def) {
|
|
7125
|
-
if (typeof def === "string") return Boolean(env[def]);
|
|
7126
|
-
if ("env" in def) {
|
|
7127
|
-
const value = env[def.env];
|
|
7128
|
-
return Boolean(value && value.includes(def.includes));
|
|
7129
|
-
}
|
|
7130
|
-
if ("any" in def && Array.isArray(def.any)) {
|
|
7131
|
-
return def.any.some((key) => Boolean(env[key]));
|
|
7132
|
-
}
|
|
7133
|
-
return Object.entries(def).every(([key, value]) => env[key] === value);
|
|
7134
|
-
}
|
|
7135
|
-
function isKnownVendorCi(env) {
|
|
7136
|
-
return vendors_default.some((vendor) => {
|
|
7137
|
-
const defs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
|
|
7138
|
-
return defs.every((def) => checkEnv(env, def));
|
|
7139
|
-
});
|
|
7140
|
-
}
|
|
7141
|
-
function isCi(env = process.env) {
|
|
7142
|
-
if (env.CI === "false") return false;
|
|
7143
|
-
if (GENERIC_CI_ENV_VARS.some((name) => Boolean(env[name]))) return true;
|
|
7144
|
-
return isKnownVendorCi(env);
|
|
7145
|
-
}
|
|
7146
|
-
var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
7147
|
-
|
|
7148
|
-
// ../telemetry/src/base-props.ts
|
|
7149
|
-
var SESSION_ID2 = randomUUID4();
|
|
7150
|
-
function readCliVersion() {
|
|
7151
|
-
if (true) {
|
|
7152
|
-
return "0.16.1";
|
|
7153
|
-
}
|
|
7154
|
-
return "0.0.0";
|
|
7155
|
-
}
|
|
7156
|
-
function readNodeVersionMajor() {
|
|
7157
|
-
const m = /^v?(\d+)/.exec(process.version);
|
|
7158
|
-
return m ? m[1] : "unknown";
|
|
7159
|
-
}
|
|
7160
|
-
var invariantProps = null;
|
|
7161
|
-
function getInvariantProps() {
|
|
7162
|
-
if (!invariantProps) {
|
|
7163
|
-
invariantProps = {
|
|
7164
|
-
cli_version: readCliVersion(),
|
|
7165
|
-
node_version_major: readNodeVersionMajor(),
|
|
7166
|
-
os: process.platform,
|
|
7167
|
-
arch: process.arch,
|
|
7168
|
-
is_tty: Boolean(process.stdout.isTTY),
|
|
7169
|
-
is_ci: isCi(),
|
|
7170
|
-
cloud_agent: detectCloudAgent(),
|
|
7171
|
-
$process_person_profile: false
|
|
7172
|
-
};
|
|
7173
|
-
}
|
|
7174
|
-
return invariantProps;
|
|
7175
|
-
}
|
|
7176
|
-
function getBaseProps(runtime) {
|
|
7177
|
-
return {
|
|
7178
|
-
...getInvariantProps(),
|
|
7179
|
-
runtime,
|
|
7180
|
-
$session_id: SESSION_ID2
|
|
7181
|
-
};
|
|
7182
|
-
}
|
|
7183
|
-
|
|
7184
|
-
// ../telemetry/src/identity.ts
|
|
7185
|
-
import * as crypto2 from "node:crypto";
|
|
7186
|
-
import * as fs4 from "node:fs";
|
|
7187
|
-
import * as path8 from "node:path";
|
|
7188
|
-
|
|
7189
|
-
// ../telemetry/src/paths.ts
|
|
7190
|
-
import * as path7 from "node:path";
|
|
7191
|
-
|
|
7192
|
-
// ../configuration-core/src/flags.ts
|
|
7193
|
-
import * as fs2 from "node:fs";
|
|
7194
|
-
import * as path4 from "node:path";
|
|
7195
|
-
import { homedir as homedir3 } from "node:os";
|
|
7196
|
-
var FLAG_REGISTRY = [
|
|
7435
|
+
name: "CircleCI",
|
|
7436
|
+
constant: "CIRCLE",
|
|
7437
|
+
env: "CIRCLECI",
|
|
7438
|
+
pr: "CIRCLE_PULL_REQUEST"
|
|
7439
|
+
},
|
|
7197
7440
|
{
|
|
7198
|
-
name: "
|
|
7199
|
-
|
|
7441
|
+
name: "Cirrus CI",
|
|
7442
|
+
constant: "CIRRUS",
|
|
7443
|
+
env: "CIRRUS_CI",
|
|
7444
|
+
pr: "CIRRUS_PR"
|
|
7200
7445
|
},
|
|
7201
7446
|
{
|
|
7202
|
-
name: "
|
|
7203
|
-
|
|
7447
|
+
name: "Cloudflare Pages",
|
|
7448
|
+
constant: "CLOUDFLARE_PAGES",
|
|
7449
|
+
env: "CF_PAGES"
|
|
7204
7450
|
},
|
|
7205
7451
|
{
|
|
7206
|
-
name: "
|
|
7207
|
-
|
|
7452
|
+
name: "Cloudflare Workers",
|
|
7453
|
+
constant: "CLOUDFLARE_WORKERS",
|
|
7454
|
+
env: "WORKERS_CI"
|
|
7208
7455
|
},
|
|
7209
7456
|
{
|
|
7210
|
-
name: "
|
|
7211
|
-
|
|
7457
|
+
name: "Codefresh",
|
|
7458
|
+
constant: "CODEFRESH",
|
|
7459
|
+
env: "CF_BUILD_ID",
|
|
7460
|
+
pr: {
|
|
7461
|
+
any: [
|
|
7462
|
+
"CF_PULL_REQUEST_NUMBER",
|
|
7463
|
+
"CF_PULL_REQUEST_ID"
|
|
7464
|
+
]
|
|
7465
|
+
}
|
|
7212
7466
|
},
|
|
7213
7467
|
{
|
|
7214
|
-
name: "
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
let current = path4.resolve(startDir);
|
|
7225
|
-
while (true) {
|
|
7226
|
-
for (const marker of PROJECT_MARKERS) {
|
|
7227
|
-
if (fs2.existsSync(path4.join(current, marker))) return current;
|
|
7468
|
+
name: "Codemagic",
|
|
7469
|
+
constant: "CODEMAGIC",
|
|
7470
|
+
env: "CM_BUILD_ID",
|
|
7471
|
+
pr: "CM_PULL_REQUEST"
|
|
7472
|
+
},
|
|
7473
|
+
{
|
|
7474
|
+
name: "Codeship",
|
|
7475
|
+
constant: "CODESHIP",
|
|
7476
|
+
env: {
|
|
7477
|
+
CI_NAME: "codeship"
|
|
7228
7478
|
}
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
}
|
|
7237
|
-
function getFlagsPath(scope, options = {}) {
|
|
7238
|
-
const home = options.homeDir ?? homedir3();
|
|
7239
|
-
if (scope === "global") {
|
|
7240
|
-
return path4.join(home, ".argent", "flags.json");
|
|
7241
|
-
}
|
|
7242
|
-
const cwd = options.cwd ?? process.cwd();
|
|
7243
|
-
return path4.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
7244
|
-
}
|
|
7245
|
-
function readFlagsFile(filePath) {
|
|
7246
|
-
let raw;
|
|
7247
|
-
try {
|
|
7248
|
-
raw = fs2.readFileSync(filePath, "utf8");
|
|
7249
|
-
} catch {
|
|
7250
|
-
return {};
|
|
7251
|
-
}
|
|
7252
|
-
let parsed;
|
|
7253
|
-
try {
|
|
7254
|
-
parsed = JSON.parse(raw);
|
|
7255
|
-
} catch {
|
|
7256
|
-
return {};
|
|
7257
|
-
}
|
|
7258
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
7259
|
-
const flags2 = parsed.flags;
|
|
7260
|
-
if (!flags2 || typeof flags2 !== "object" || Array.isArray(flags2)) return {};
|
|
7261
|
-
const out = {};
|
|
7262
|
-
for (const [k, v] of Object.entries(flags2)) {
|
|
7263
|
-
if (typeof v === "boolean") out[k] = v;
|
|
7264
|
-
}
|
|
7265
|
-
return out;
|
|
7266
|
-
}
|
|
7267
|
-
function writeFlagsFile(filePath, flags2) {
|
|
7268
|
-
if (Object.keys(flags2).length === 0) {
|
|
7269
|
-
if (fs2.existsSync(filePath)) fs2.rmSync(filePath, { force: true });
|
|
7270
|
-
const parent = path4.dirname(filePath);
|
|
7271
|
-
try {
|
|
7272
|
-
if (fs2.existsSync(parent) && fs2.readdirSync(parent).length === 0) {
|
|
7273
|
-
fs2.rmdirSync(parent);
|
|
7274
|
-
}
|
|
7275
|
-
} catch {
|
|
7479
|
+
},
|
|
7480
|
+
{
|
|
7481
|
+
name: "Drone",
|
|
7482
|
+
constant: "DRONE",
|
|
7483
|
+
env: "DRONE",
|
|
7484
|
+
pr: {
|
|
7485
|
+
DRONE_BUILD_EVENT: "pull_request"
|
|
7276
7486
|
}
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
}
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
// ../configuration-core/src/paths.ts
|
|
7310
|
-
import * as os from "node:os";
|
|
7311
|
-
import * as path5 from "node:path";
|
|
7312
|
-
function nonEmpty(value) {
|
|
7313
|
-
if (value == void 0) return null;
|
|
7314
|
-
const trimmed = value.trim();
|
|
7315
|
-
return trimmed === "" ? null : value;
|
|
7316
|
-
}
|
|
7317
|
-
function argentHomeDir() {
|
|
7318
|
-
const home = process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
7319
|
-
return path5.join(home, ".argent");
|
|
7320
|
-
}
|
|
7321
|
-
function configDir(scope = "global", options = {}) {
|
|
7322
|
-
if (scope === "global") {
|
|
7323
|
-
return options.homeDir ? path5.join(options.homeDir, ".argent") : argentHomeDir();
|
|
7324
|
-
}
|
|
7325
|
-
const cwd = options.cwd ?? process.cwd();
|
|
7326
|
-
return path5.join(resolveProjectRoot(cwd), ".argent");
|
|
7327
|
-
}
|
|
7328
|
-
function configFilePath(scope = "global", options = {}) {
|
|
7329
|
-
return path5.join(configDir(scope, options), "config.json");
|
|
7330
|
-
}
|
|
7331
|
-
|
|
7332
|
-
// ../configuration-core/src/config.ts
|
|
7333
|
-
import * as crypto from "node:crypto";
|
|
7334
|
-
import * as fs3 from "node:fs";
|
|
7335
|
-
import * as path6 from "node:path";
|
|
7336
|
-
function readConfigObject(scope = "global", options = {}) {
|
|
7337
|
-
try {
|
|
7338
|
-
const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
|
|
7339
|
-
const json = JSON.parse(raw);
|
|
7340
|
-
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
7341
|
-
return json;
|
|
7487
|
+
},
|
|
7488
|
+
{
|
|
7489
|
+
name: "dsari",
|
|
7490
|
+
constant: "DSARI",
|
|
7491
|
+
env: "DSARI"
|
|
7492
|
+
},
|
|
7493
|
+
{
|
|
7494
|
+
name: "Earthly",
|
|
7495
|
+
constant: "EARTHLY",
|
|
7496
|
+
env: "EARTHLY_CI"
|
|
7497
|
+
},
|
|
7498
|
+
{
|
|
7499
|
+
name: "Expo Application Services",
|
|
7500
|
+
constant: "EAS",
|
|
7501
|
+
env: "EAS_BUILD"
|
|
7502
|
+
},
|
|
7503
|
+
{
|
|
7504
|
+
name: "Gerrit",
|
|
7505
|
+
constant: "GERRIT",
|
|
7506
|
+
env: "GERRIT_PROJECT"
|
|
7507
|
+
},
|
|
7508
|
+
{
|
|
7509
|
+
name: "Gitea Actions",
|
|
7510
|
+
constant: "GITEA_ACTIONS",
|
|
7511
|
+
env: "GITEA_ACTIONS"
|
|
7512
|
+
},
|
|
7513
|
+
{
|
|
7514
|
+
name: "GitHub Actions",
|
|
7515
|
+
constant: "GITHUB_ACTIONS",
|
|
7516
|
+
env: "GITHUB_ACTIONS",
|
|
7517
|
+
pr: {
|
|
7518
|
+
GITHUB_EVENT_NAME: "pull_request"
|
|
7342
7519
|
}
|
|
7343
|
-
}
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7520
|
+
},
|
|
7521
|
+
{
|
|
7522
|
+
name: "GitLab CI",
|
|
7523
|
+
constant: "GITLAB",
|
|
7524
|
+
env: "GITLAB_CI",
|
|
7525
|
+
pr: "CI_MERGE_REQUEST_ID"
|
|
7526
|
+
},
|
|
7527
|
+
{
|
|
7528
|
+
name: "GoCD",
|
|
7529
|
+
constant: "GOCD",
|
|
7530
|
+
env: "GO_PIPELINE_LABEL"
|
|
7531
|
+
},
|
|
7532
|
+
{
|
|
7533
|
+
name: "Google Cloud Build",
|
|
7534
|
+
constant: "GOOGLE_CLOUD_BUILD",
|
|
7535
|
+
env: "BUILDER_OUTPUT"
|
|
7536
|
+
},
|
|
7537
|
+
{
|
|
7538
|
+
name: "Harness CI",
|
|
7539
|
+
constant: "HARNESS",
|
|
7540
|
+
env: "HARNESS_BUILD_ID"
|
|
7541
|
+
},
|
|
7542
|
+
{
|
|
7543
|
+
name: "Heroku",
|
|
7544
|
+
constant: "HEROKU",
|
|
7545
|
+
env: {
|
|
7546
|
+
env: "NODE",
|
|
7547
|
+
includes: "/app/.heroku/node/bin/node"
|
|
7548
|
+
}
|
|
7549
|
+
},
|
|
7550
|
+
{
|
|
7551
|
+
name: "Hudson",
|
|
7552
|
+
constant: "HUDSON",
|
|
7553
|
+
env: "HUDSON_URL"
|
|
7554
|
+
},
|
|
7555
|
+
{
|
|
7556
|
+
name: "Jenkins",
|
|
7557
|
+
constant: "JENKINS",
|
|
7558
|
+
env: [
|
|
7559
|
+
"JENKINS_URL",
|
|
7560
|
+
"BUILD_ID"
|
|
7561
|
+
],
|
|
7562
|
+
pr: {
|
|
7563
|
+
any: [
|
|
7564
|
+
"ghprbPullId",
|
|
7565
|
+
"CHANGE_ID"
|
|
7566
|
+
]
|
|
7356
7567
|
}
|
|
7357
|
-
}
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
const part = parts[i2];
|
|
7377
|
-
const next = cur[part];
|
|
7378
|
-
if (!isPlainObject2(next)) {
|
|
7379
|
-
cur[part] = {};
|
|
7568
|
+
},
|
|
7569
|
+
{
|
|
7570
|
+
name: "LayerCI",
|
|
7571
|
+
constant: "LAYERCI",
|
|
7572
|
+
env: "LAYERCI",
|
|
7573
|
+
pr: "LAYERCI_PULL_REQUEST"
|
|
7574
|
+
},
|
|
7575
|
+
{
|
|
7576
|
+
name: "Magnum CI",
|
|
7577
|
+
constant: "MAGNUM",
|
|
7578
|
+
env: "MAGNUM"
|
|
7579
|
+
},
|
|
7580
|
+
{
|
|
7581
|
+
name: "Netlify CI",
|
|
7582
|
+
constant: "NETLIFY",
|
|
7583
|
+
env: "NETLIFY",
|
|
7584
|
+
pr: {
|
|
7585
|
+
env: "PULL_REQUEST",
|
|
7586
|
+
ne: "false"
|
|
7380
7587
|
}
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
const next = cur[parts[i2]];
|
|
7390
|
-
if (!isPlainObject2(next)) return false;
|
|
7391
|
-
cur = next;
|
|
7392
|
-
}
|
|
7393
|
-
const leaf = parts[parts.length - 1];
|
|
7394
|
-
if (!Object.hasOwn(cur, leaf)) return false;
|
|
7395
|
-
delete cur[leaf];
|
|
7396
|
-
return true;
|
|
7397
|
-
}
|
|
7398
|
-
var LOCK_STALE_MS2 = 1e4;
|
|
7399
|
-
var LOCK_MAX_WAIT_MS = 2e3;
|
|
7400
|
-
var LOCK_RETRY_MS = 25;
|
|
7401
|
-
function sleepSync(ms) {
|
|
7402
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
7403
|
-
}
|
|
7404
|
-
function acquireConfigLock(finalPath) {
|
|
7405
|
-
const lockPath = finalPath + ".lock";
|
|
7406
|
-
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
7407
|
-
for (; ; ) {
|
|
7408
|
-
try {
|
|
7409
|
-
const fd = fs3.openSync(lockPath, "wx", 384);
|
|
7410
|
-
try {
|
|
7411
|
-
fs3.writeSync(fd, `${process.pid}
|
|
7412
|
-
`);
|
|
7413
|
-
} catch {
|
|
7414
|
-
}
|
|
7415
|
-
return { fd, lockPath };
|
|
7416
|
-
} catch (err) {
|
|
7417
|
-
if (err.code !== "EEXIST") return null;
|
|
7418
|
-
try {
|
|
7419
|
-
if (Date.now() - fs3.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
|
|
7420
|
-
fs3.unlinkSync(lockPath);
|
|
7421
|
-
continue;
|
|
7422
|
-
}
|
|
7423
|
-
} catch {
|
|
7424
|
-
}
|
|
7425
|
-
if (Date.now() >= deadline) return null;
|
|
7426
|
-
sleepSync(LOCK_RETRY_MS);
|
|
7588
|
+
},
|
|
7589
|
+
{
|
|
7590
|
+
name: "Nevercode",
|
|
7591
|
+
constant: "NEVERCODE",
|
|
7592
|
+
env: "NEVERCODE",
|
|
7593
|
+
pr: {
|
|
7594
|
+
env: "NEVERCODE_PULL_REQUEST",
|
|
7595
|
+
ne: "false"
|
|
7427
7596
|
}
|
|
7428
|
-
}
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
}
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
}
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
try {
|
|
7446
|
-
const next = readConfigObject(scope, options);
|
|
7447
|
-
mutate(next);
|
|
7448
|
-
const tmpPath = path6.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
7449
|
-
const fd = fs3.openSync(tmpPath, "wx", 384);
|
|
7450
|
-
try {
|
|
7451
|
-
fs3.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
7452
|
-
fs3.fsyncSync(fd);
|
|
7453
|
-
} finally {
|
|
7454
|
-
fs3.closeSync(fd);
|
|
7597
|
+
},
|
|
7598
|
+
{
|
|
7599
|
+
name: "Prow",
|
|
7600
|
+
constant: "PROW",
|
|
7601
|
+
env: "PROW_JOB_ID"
|
|
7602
|
+
},
|
|
7603
|
+
{
|
|
7604
|
+
name: "ReleaseHub",
|
|
7605
|
+
constant: "RELEASEHUB",
|
|
7606
|
+
env: "RELEASE_BUILD_ID"
|
|
7607
|
+
},
|
|
7608
|
+
{
|
|
7609
|
+
name: "Render",
|
|
7610
|
+
constant: "RENDER",
|
|
7611
|
+
env: "RENDER",
|
|
7612
|
+
pr: {
|
|
7613
|
+
IS_PULL_REQUEST: "true"
|
|
7455
7614
|
}
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7615
|
+
},
|
|
7616
|
+
{
|
|
7617
|
+
name: "Sail CI",
|
|
7618
|
+
constant: "SAIL",
|
|
7619
|
+
env: "SAILCI",
|
|
7620
|
+
pr: "SAIL_PULL_REQUEST_NUMBER"
|
|
7621
|
+
},
|
|
7622
|
+
{
|
|
7623
|
+
name: "Screwdriver",
|
|
7624
|
+
constant: "SCREWDRIVER",
|
|
7625
|
+
env: "SCREWDRIVER",
|
|
7626
|
+
pr: {
|
|
7627
|
+
env: "SD_PULL_REQUEST",
|
|
7628
|
+
ne: "false"
|
|
7464
7629
|
}
|
|
7465
|
-
}
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
}
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
case "prioritize-local":
|
|
7505
|
-
return local ?? global2;
|
|
7506
|
-
case "prioritize-global":
|
|
7507
|
-
return global2 ?? local;
|
|
7508
|
-
case "prioritize-restrictive":
|
|
7509
|
-
return mergeRestrictive(local, global2);
|
|
7510
|
-
case "union":
|
|
7511
|
-
return mergeUnion(local, global2);
|
|
7512
|
-
case "intersection":
|
|
7513
|
-
return mergeIntersection(local, global2);
|
|
7514
|
-
default: {
|
|
7515
|
-
const _exhaustive = policy;
|
|
7516
|
-
return _exhaustive;
|
|
7630
|
+
},
|
|
7631
|
+
{
|
|
7632
|
+
name: "Semaphore",
|
|
7633
|
+
constant: "SEMAPHORE",
|
|
7634
|
+
env: "SEMAPHORE",
|
|
7635
|
+
pr: "PULL_REQUEST_NUMBER"
|
|
7636
|
+
},
|
|
7637
|
+
{
|
|
7638
|
+
name: "Sourcehut",
|
|
7639
|
+
constant: "SOURCEHUT",
|
|
7640
|
+
env: {
|
|
7641
|
+
CI_NAME: "sourcehut"
|
|
7642
|
+
}
|
|
7643
|
+
},
|
|
7644
|
+
{
|
|
7645
|
+
name: "Strider CD",
|
|
7646
|
+
constant: "STRIDER",
|
|
7647
|
+
env: "STRIDER"
|
|
7648
|
+
},
|
|
7649
|
+
{
|
|
7650
|
+
name: "TaskCluster",
|
|
7651
|
+
constant: "TASKCLUSTER",
|
|
7652
|
+
env: [
|
|
7653
|
+
"TASK_ID",
|
|
7654
|
+
"RUN_ID"
|
|
7655
|
+
]
|
|
7656
|
+
},
|
|
7657
|
+
{
|
|
7658
|
+
name: "TeamCity",
|
|
7659
|
+
constant: "TEAMCITY",
|
|
7660
|
+
env: "TEAMCITY_VERSION"
|
|
7661
|
+
},
|
|
7662
|
+
{
|
|
7663
|
+
name: "Travis CI",
|
|
7664
|
+
constant: "TRAVIS",
|
|
7665
|
+
env: "TRAVIS",
|
|
7666
|
+
pr: {
|
|
7667
|
+
env: "TRAVIS_PULL_REQUEST",
|
|
7668
|
+
ne: "false"
|
|
7517
7669
|
}
|
|
7518
|
-
}
|
|
7519
|
-
}
|
|
7520
|
-
|
|
7521
|
-
// ../configuration-core/src/config-schema.ts
|
|
7522
|
-
function asBoolean(raw) {
|
|
7523
|
-
return typeof raw === "boolean" ? raw : void 0;
|
|
7524
|
-
}
|
|
7525
|
-
function asString(raw) {
|
|
7526
|
-
if (typeof raw !== "string") return void 0;
|
|
7527
|
-
const trimmed = raw.trim();
|
|
7528
|
-
return trimmed === "" ? void 0 : trimmed;
|
|
7529
|
-
}
|
|
7530
|
-
var CONFIG_SCHEMA = [
|
|
7670
|
+
},
|
|
7531
7671
|
{
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
merge: "prioritize-restrictive",
|
|
7539
|
-
// Telemetry is opt-out: with nothing stored, consent.ts treats it as
|
|
7540
|
-
// enabled, and the config surface must report the same instead of "(unset)".
|
|
7541
|
-
default: true,
|
|
7542
|
-
// Read-only under `argent config`: opt-in/out goes through the dedicated
|
|
7543
|
-
// command so the live client is drained/reset, not just the file rewritten.
|
|
7544
|
-
manageCommand: "argent telemetry"
|
|
7672
|
+
name: "Vela",
|
|
7673
|
+
constant: "VELA",
|
|
7674
|
+
env: "VELA",
|
|
7675
|
+
pr: {
|
|
7676
|
+
VELA_PULL_REQUEST: "1"
|
|
7677
|
+
}
|
|
7545
7678
|
},
|
|
7546
7679
|
{
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7680
|
+
name: "Vercel",
|
|
7681
|
+
constant: "VERCEL",
|
|
7682
|
+
env: {
|
|
7683
|
+
any: [
|
|
7684
|
+
"NOW_BUILDER",
|
|
7685
|
+
"VERCEL"
|
|
7686
|
+
]
|
|
7687
|
+
},
|
|
7688
|
+
pr: "VERCEL_GIT_PULL_REQUEST_ID"
|
|
7689
|
+
},
|
|
7690
|
+
{
|
|
7691
|
+
name: "Visual Studio App Center",
|
|
7692
|
+
constant: "APPCENTER",
|
|
7693
|
+
env: "APPCENTER_BUILD_ID"
|
|
7694
|
+
},
|
|
7695
|
+
{
|
|
7696
|
+
name: "Woodpecker",
|
|
7697
|
+
constant: "WOODPECKER",
|
|
7698
|
+
env: {
|
|
7699
|
+
CI: "woodpecker"
|
|
7700
|
+
},
|
|
7701
|
+
pr: {
|
|
7702
|
+
CI_BUILD_EVENT: "pull_request"
|
|
7703
|
+
}
|
|
7704
|
+
},
|
|
7705
|
+
{
|
|
7706
|
+
name: "Xcode Cloud",
|
|
7707
|
+
constant: "XCODE_CLOUD",
|
|
7708
|
+
env: "CI_XCODE_PROJECT",
|
|
7709
|
+
pr: "CI_PULL_REQUEST_NUMBER"
|
|
7710
|
+
},
|
|
7711
|
+
{
|
|
7712
|
+
name: "Xcode Server",
|
|
7713
|
+
constant: "XCODE_SERVER",
|
|
7714
|
+
env: "XCS"
|
|
7555
7715
|
}
|
|
7556
7716
|
];
|
|
7557
|
-
function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
7558
|
-
return registry.find((def) => def.key === key);
|
|
7559
|
-
}
|
|
7560
7717
|
|
|
7561
|
-
// ../
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
function
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
const def = requireDefinition(key, registry);
|
|
7579
|
-
return getConfigValue(def, options);
|
|
7580
|
-
}
|
|
7581
|
-
function requireDefinition(key, registry = CONFIG_SCHEMA) {
|
|
7582
|
-
const def = getConfigDefinition(key, registry);
|
|
7583
|
-
if (!def) {
|
|
7584
|
-
throw new UnknownConfigKeyError(key);
|
|
7585
|
-
}
|
|
7586
|
-
return def;
|
|
7587
|
-
}
|
|
7588
|
-
var UnknownConfigKeyError = class extends Error {
|
|
7589
|
-
constructor(key) {
|
|
7590
|
-
super(`Unknown configuration key "${key}".`);
|
|
7591
|
-
this.key = key;
|
|
7592
|
-
this.name = "UnknownConfigKeyError";
|
|
7593
|
-
}
|
|
7594
|
-
key;
|
|
7595
|
-
};
|
|
7596
|
-
var ConfigScopeError = class extends Error {
|
|
7597
|
-
constructor(key, scope, allowed) {
|
|
7598
|
-
super(`Config key "${key}" cannot be set at ${scope} scope (allowed: ${allowed.join(", ")}).`);
|
|
7599
|
-
this.key = key;
|
|
7600
|
-
this.scope = scope;
|
|
7601
|
-
this.allowed = allowed;
|
|
7602
|
-
this.name = "ConfigScopeError";
|
|
7603
|
-
}
|
|
7604
|
-
key;
|
|
7605
|
-
scope;
|
|
7606
|
-
allowed;
|
|
7607
|
-
};
|
|
7608
|
-
var ConfigValidationError = class extends Error {
|
|
7609
|
-
constructor(key) {
|
|
7610
|
-
super(`Invalid value for config key "${key}".`);
|
|
7611
|
-
this.key = key;
|
|
7612
|
-
this.name = "ConfigValidationError";
|
|
7718
|
+
// ../telemetry/src/ci-detect.ts
|
|
7719
|
+
var GENERIC_CI_ENV_VARS = [
|
|
7720
|
+
"BUILD_ID",
|
|
7721
|
+
"BUILD_NUMBER",
|
|
7722
|
+
"CI",
|
|
7723
|
+
"CI_APP_ID",
|
|
7724
|
+
"CI_BUILD_ID",
|
|
7725
|
+
"CI_BUILD_NUMBER",
|
|
7726
|
+
"CI_NAME",
|
|
7727
|
+
"CONTINUOUS_INTEGRATION",
|
|
7728
|
+
"RUN_ID"
|
|
7729
|
+
];
|
|
7730
|
+
function checkEnv(env, def) {
|
|
7731
|
+
if (typeof def === "string") return Boolean(env[def]);
|
|
7732
|
+
if ("env" in def) {
|
|
7733
|
+
const value = env[def.env];
|
|
7734
|
+
return Boolean(value && value.includes(def.includes));
|
|
7613
7735
|
}
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
var ConfigManagedElsewhereError = class extends Error {
|
|
7617
|
-
constructor(key, command) {
|
|
7618
|
-
super(`Config key "${key}" is managed by \`${command}\`.`);
|
|
7619
|
-
this.key = key;
|
|
7620
|
-
this.command = command;
|
|
7621
|
-
this.name = "ConfigManagedElsewhereError";
|
|
7736
|
+
if ("any" in def && Array.isArray(def.any)) {
|
|
7737
|
+
return def.any.some((key) => Boolean(env[key]));
|
|
7622
7738
|
}
|
|
7623
|
-
key;
|
|
7624
|
-
command;
|
|
7625
|
-
};
|
|
7626
|
-
function setConfigValue(key, rawValue, scope = "global", options = {}, registry = CONFIG_SCHEMA) {
|
|
7627
|
-
const def = requireDefinition(key, registry);
|
|
7628
|
-
if (def.manageCommand) throw new ConfigManagedElsewhereError(key, def.manageCommand);
|
|
7629
|
-
if (!def.scopes.includes(scope)) throw new ConfigScopeError(key, scope, def.scopes);
|
|
7630
|
-
const parsed = def.parse(rawValue);
|
|
7631
|
-
if (parsed === void 0) throw new ConfigValidationError(key);
|
|
7632
|
-
updateConfig((config2) => setAtPath(config2, key, parsed), scope, options);
|
|
7633
|
-
return parsed;
|
|
7739
|
+
return Object.entries(def).every(([key, value]) => env[key] === value);
|
|
7634
7740
|
}
|
|
7635
|
-
function
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
let removed = false;
|
|
7641
|
-
updateConfig(
|
|
7642
|
-
(config2) => {
|
|
7643
|
-
removed = deleteAtPath(config2, key);
|
|
7644
|
-
},
|
|
7645
|
-
scope,
|
|
7646
|
-
options
|
|
7647
|
-
);
|
|
7648
|
-
return removed;
|
|
7741
|
+
function isKnownVendorCi(env) {
|
|
7742
|
+
return vendors_default.some((vendor) => {
|
|
7743
|
+
const defs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
|
|
7744
|
+
return defs.every((def) => checkEnv(env, def));
|
|
7745
|
+
});
|
|
7649
7746
|
}
|
|
7650
|
-
function
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
scopes: def.scopes,
|
|
7655
|
-
...def.manageCommand ? { manageCommand: def.manageCommand } : {},
|
|
7656
|
-
effective: getConfigValue(def, options),
|
|
7657
|
-
project: readScopeValue(def, "project", options),
|
|
7658
|
-
global: readScopeValue(def, "global", options)
|
|
7659
|
-
}));
|
|
7747
|
+
function isCi(env = process.env) {
|
|
7748
|
+
if (env.CI === "false") return false;
|
|
7749
|
+
if (GENERIC_CI_ENV_VARS.some((name) => Boolean(env[name]))) return true;
|
|
7750
|
+
return isKnownVendorCi(env);
|
|
7660
7751
|
}
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7752
|
+
var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
7753
|
+
|
|
7754
|
+
// ../telemetry/src/base-props.ts
|
|
7755
|
+
var SESSION_ID2 = randomUUID5();
|
|
7756
|
+
function readCliVersion() {
|
|
7757
|
+
if (true) {
|
|
7758
|
+
return "0.17.0";
|
|
7666
7759
|
}
|
|
7760
|
+
return "0.0.0";
|
|
7667
7761
|
}
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
return typeof value === "string" && value.trim() ? value : null;
|
|
7762
|
+
function readNodeVersionMajor() {
|
|
7763
|
+
const m = /^v?(\d+)/.exec(process.version);
|
|
7764
|
+
return m ? m[1] : "unknown";
|
|
7672
7765
|
}
|
|
7673
|
-
|
|
7674
|
-
|
|
7766
|
+
var invariantProps = null;
|
|
7767
|
+
function getInvariantProps() {
|
|
7768
|
+
if (!invariantProps) {
|
|
7769
|
+
invariantProps = {
|
|
7770
|
+
cli_version: readCliVersion(),
|
|
7771
|
+
node_version_major: readNodeVersionMajor(),
|
|
7772
|
+
os: process.platform,
|
|
7773
|
+
arch: process.arch,
|
|
7774
|
+
is_tty: Boolean(process.stdout.isTTY),
|
|
7775
|
+
is_ci: isCi(),
|
|
7776
|
+
cloud_agent: detectCloudAgent(),
|
|
7777
|
+
$process_person_profile: false
|
|
7778
|
+
};
|
|
7779
|
+
}
|
|
7780
|
+
return invariantProps;
|
|
7675
7781
|
}
|
|
7676
|
-
function
|
|
7677
|
-
|
|
7782
|
+
function getBaseProps(runtime) {
|
|
7783
|
+
return {
|
|
7784
|
+
...getInvariantProps(),
|
|
7785
|
+
runtime,
|
|
7786
|
+
$session_id: SESSION_ID2
|
|
7787
|
+
};
|
|
7678
7788
|
}
|
|
7679
7789
|
|
|
7790
|
+
// ../telemetry/src/identity.ts
|
|
7791
|
+
import * as crypto2 from "node:crypto";
|
|
7792
|
+
import * as fs4 from "node:fs";
|
|
7793
|
+
import * as path8 from "node:path";
|
|
7794
|
+
|
|
7680
7795
|
// ../telemetry/src/paths.ts
|
|
7796
|
+
import * as path7 from "node:path";
|
|
7681
7797
|
function identityFilePath() {
|
|
7682
7798
|
return path7.join(argentHomeDir(), "telemetry-id");
|
|
7683
7799
|
}
|
|
@@ -9700,12 +9816,12 @@ function isSessionAlive(session) {
|
|
|
9700
9816
|
// ../argent-cli/src/lens-pty.ts
|
|
9701
9817
|
import { chmodSync as chmodSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
9702
9818
|
import { createRequire } from "node:module";
|
|
9703
|
-
import { dirname as
|
|
9819
|
+
import { dirname as dirname8, join as join14 } from "node:path";
|
|
9704
9820
|
var nodeRequire = createRequire(import.meta.url);
|
|
9705
9821
|
function ensureSpawnHelperExecutable(req = nodeRequire) {
|
|
9706
9822
|
if (process.platform !== "darwin") return;
|
|
9707
9823
|
try {
|
|
9708
|
-
const prebuilds = join14(
|
|
9824
|
+
const prebuilds = join14(dirname8(req.resolve("node-pty/package.json")), "prebuilds");
|
|
9709
9825
|
for (const entry of readdirSync2(prebuilds)) {
|
|
9710
9826
|
try {
|
|
9711
9827
|
chmodSync2(join14(prebuilds, entry, "spawn-helper"), 493);
|
|
@@ -9850,10 +9966,10 @@ function parseSseBuffer(buffer) {
|
|
|
9850
9966
|
const events = [];
|
|
9851
9967
|
let rest = normalised;
|
|
9852
9968
|
for (; ; ) {
|
|
9853
|
-
const
|
|
9854
|
-
if (
|
|
9855
|
-
const rawFrame = rest.slice(0,
|
|
9856
|
-
rest = rest.slice(
|
|
9969
|
+
const sep5 = rest.indexOf("\n\n");
|
|
9970
|
+
if (sep5 === -1) break;
|
|
9971
|
+
const rawFrame = rest.slice(0, sep5);
|
|
9972
|
+
rest = rest.slice(sep5 + 2);
|
|
9857
9973
|
let event = "message";
|
|
9858
9974
|
const dataLines = [];
|
|
9859
9975
|
for (const line of rawFrame.split("\n")) {
|
|
@@ -11595,7 +11711,7 @@ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
|
11595
11711
|
import process$1 from "node:process";
|
|
11596
11712
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
11597
11713
|
import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as readdirSync3 } from "node:fs";
|
|
11598
|
-
import { dirname as
|
|
11714
|
+
import { dirname as dirname10, join as join17 } from "node:path";
|
|
11599
11715
|
function isUnicodeSupported() {
|
|
11600
11716
|
if (process$1.platform !== "win32") {
|
|
11601
11717
|
return process$1.env.TERM !== "linux";
|