agenttwin 0.3.45 → 0.3.46
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/api.js +153 -56
- package/dist/dashboard/assets/next/static/chunks/app/_not-found/{page-90e7c4625d67caa3.js → page-ca2a678442778cc4.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/about/{page-7b6ab8f6081f5e77.js → page-f12d76165cc1cfdb.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/account/password/{page-037fec5f56012be1.js → page-c2ce3c796c817ca1.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/{auth/page-540d65d1057a7527.js → api-policy/page-dc4de82f3c8b5ee5.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/{compare/page-540d65d1057a7527.js → auth/page-dc4de82f3c8b5ee5.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/{layout-1f35c9c8280d8e88.js → layout-52698c1f7512ab03.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/{contact/page-540d65d1057a7527.js → compare/page-dc4de82f3c8b5ee5.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/{api-policy/page-540d65d1057a7527.js → contact/page-dc4de82f3c8b5ee5.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-b5ef02cb8f06edca.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/{page-7ee71756cadd81da.js → page-e175e18f842b558f.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/demo/{page-fa467521a350a22e.js → page-4dc63755e0013e7c.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/developers/page-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/{page-2f02d1a4e3c44daa.js → page-ba0ec7ecc08eff9f.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/dpa/page-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/enterprise/page-4bc33047e4c9fe8e.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/guides/page-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/layout-cd911546738f01ed.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/login/page-d6d4276397724d29.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/not-found-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/onboarding/{page-0ef60a890802e3ea.js → page-40532b5cef9a88c1.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/page-a8275b37886e34a8.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/{enterprise/page-5d3aa113786c4257.js → pricing/page-8f3a108c73f12071.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/privacy/page-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/scoreboard/page-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/security/page-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/signup/page-d6d4276397724d29.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/status/page-b39797a55d029518.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/subprocessors/page-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/terms/page-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-09d48e9ba6876ea1.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-031ee9c843b9c428.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/layout-abbd9f3b8811f559.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-4f4a342a4c28f9de.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/{page-cb95f6e08d868cb9.js → page-efea46ea53572102.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/page-4c5b8b508cf0da4c.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-4f4a342a4c28f9de.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-dc4de82f3c8b5ee5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/{main-app-09f87cf7a6813e7b.js → main-app-1ec13ceef4a34729.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/{webpack-956fc59a9b8e1c9d.js → webpack-b34c6469f0501f3e.js} +1 -1
- package/dist/dashboard/index.html +2 -2
- package/dist/discover-worker.js +1 -1
- package/dist/engine.js +153 -56
- package/dist/gateway.js +153 -56
- package/dist/scan-worker.js +2 -1
- package/dist/worker.js +5 -0
- package/dist/world-host.js +5 -0
- package/package.json +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-0a7a4610c777d4ca.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/developers/page-540d65d1057a7527.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/dpa/page-540d65d1057a7527.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/guides/page-540d65d1057a7527.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/layout-f1fad0b3adfa8650.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/login/page-0fcaa825ae57072e.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/not-found-540d65d1057a7527.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/page-02d88045d016e184.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/pricing/page-b20818439dc8daa3.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/privacy/page-540d65d1057a7527.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-540d65d1057a7527.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/scoreboard/page-540d65d1057a7527.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/security/page-540d65d1057a7527.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/signup/page-0fcaa825ae57072e.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/status/page-477b90a47b806b39.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/subprocessors/page-540d65d1057a7527.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/terms/page-540d65d1057a7527.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-f3b848d905696aa6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-5114d5bc25cc925a.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/layout-c5a3a914ad02b396.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-391350c8e39d35fe.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/page-ba5549311d95d01d.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-391350c8e39d35fe.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-540d65d1057a7527.js +0 -1
- /package/dist/dashboard/assets/next/static/{iCEc5bCzyYUPa74FKyLIp → pGgp6m8IvF1eEP2vBkhqX}/_buildManifest.js +0 -0
- /package/dist/dashboard/assets/next/static/{iCEc5bCzyYUPa74FKyLIp → pGgp6m8IvF1eEP2vBkhqX}/_ssgManifest.js +0 -0
package/dist/gateway.js
CHANGED
|
@@ -3953,6 +3953,10 @@ function installRetry(step, output2) {
|
|
|
3953
3953
|
const pm = step.command === "corepack" || step.command === "npx" ? step.args.find((a) => /^(npm|pnpm|yarn|bun)(@|$)/.test(a))?.split("@")[0] : step.command;
|
|
3954
3954
|
const tail = step.command === "corepack" ? step.args.slice(1) : step.command === "npx" ? step.args.slice(2) : step.args;
|
|
3955
3955
|
const pinned = step.command === "corepack" || step.command === "npx" ? step.args.find((a) => /^(npm|pnpm|yarn|bun)(@|$)/.test(a)) : pm;
|
|
3956
|
+
if (pm === "pnpm" && /Failed to switch pnpm|ERR_PNPM_BAD_PM_VERSION|manage-package-manager-versions/i.test(output2) && !step.args.some((a) => a.includes("manage-package-manager-versions")))
|
|
3957
|
+
return { why: "pnpm could not switch to the pinned version", step: { ...step, args: ["--config.manage-package-manager-versions=false", ...step.args] } };
|
|
3958
|
+
if (pm === "pnpm" && /ERR_PNPM_UNUSED_PATCH/.test(output2) && !step.args.some((a) => a.includes("allow-unused-patches")))
|
|
3959
|
+
return { why: "pnpm rejected an unused patch in the lockfile", step: { ...step, args: [...step.args, "--config.allow-unused-patches=true"] } };
|
|
3956
3960
|
if (pm === "pnpm" && /ERR_PNPM_(OUTDATED_LOCKFILE|LOCKFILE_CONFIG_MISMATCH|LOCKFILE_MISSING_DEPENDENCY)|frozen.lockfile|specifiers in the lockfile/i.test(output2))
|
|
3957
3961
|
return { why: "The lockfile is behind package.json, so a frozen install stops", step: { ...step, args: [...step.args, "--no-frozen-lockfile"] } };
|
|
3958
3962
|
const lockfile = pm === "pnpm" ? /lockfileVersion[\s│|]+of[\s│|]+(\d+)(?:\.(\d+))?[\s│|]+is[\s│|]+incompatible/i.exec(output2) : null;
|
|
@@ -4014,8 +4018,8 @@ async function runSetup(cwd, opts) {
|
|
|
4014
4018
|
const buildLimitMs = Number(process.env.AGENTTWIN_SETUP_BUILD_TIMEOUT_MS) || 20 * 6e4;
|
|
4015
4019
|
let timedOut = false;
|
|
4016
4020
|
let installedManager;
|
|
4017
|
-
const exec12 = (step) => new Promise((resolve27) => {
|
|
4018
|
-
const child = spawn2(step.command, step.args, { cwd: step.dir, detached: process.platform !== "win32", stdio: ["ignore", "pipe", "pipe"], env: { ...BUILD_PLACEHOLDERS, ...process.env, CI: "1", COREPACK_ENABLE_DOWNLOAD_PROMPT: "0", ...shims ? { PATH: `${shims}${delimiter}${process.env.PATH ?? ""}` } : {} } });
|
|
4021
|
+
const exec12 = (step, extraEnv) => new Promise((resolve27) => {
|
|
4022
|
+
const child = spawn2(step.command, step.args, { cwd: step.dir, detached: process.platform !== "win32", stdio: ["ignore", "pipe", "pipe"], env: { ...BUILD_PLACEHOLDERS, ...process.env, ...extraEnv ?? {}, CI: "1", COREPACK_ENABLE_DOWNLOAD_PROMPT: "0", ...shims ? { PATH: `${shims}${delimiter}${process.env.PATH ?? ""}` } : {} } });
|
|
4019
4023
|
let tail = "";
|
|
4020
4024
|
const keep = (c) => {
|
|
4021
4025
|
tail = (tail + c.toString()).slice(-4e3);
|
|
@@ -4051,12 +4055,12 @@ async function runSetup(cwd, opts) {
|
|
|
4051
4055
|
opts.log(` The build was still running after ${Math.round(buildLimitMs / 6e4)} min, so it was stopped. What it finished stays built: run npx agenttwin again to carry on, or run it from the folder of the one service you want to test so only its packages are built. (Set AGENTTWIN_SETUP_BUILD_TIMEOUT_MS to change the limit.)`);
|
|
4052
4056
|
return false;
|
|
4053
4057
|
}
|
|
4054
|
-
for (let current2 = step, tries = 0; code !== 0 && step.id === "install" && tries < 3; tries++) {
|
|
4058
|
+
for (let current2 = step, tries = 0; code !== 0 && (step.id === "install" || /Failed to switch pnpm|ERR_PNPM_BAD_PM_VERSION|manage-package-manager-versions/i.test(tail)) && tries < 3; tries++) {
|
|
4055
4059
|
const retry = installRetry(current2, tail);
|
|
4056
4060
|
if (!retry) break;
|
|
4057
4061
|
opts.log(` ${retry.why}; running ${show(retry.step)}\u2026`);
|
|
4058
4062
|
current2 = retry.step;
|
|
4059
|
-
({ code, tail } = await exec12(retry.step));
|
|
4063
|
+
({ code, tail } = await exec12(retry.step, retry.step.args.some((a) => a.includes("manage-package-manager-versions")) ? { npm_config_manage_package_manager_versions: "false", pnpm_config_manage_package_manager_versions: "false" } : void 0));
|
|
4060
4064
|
}
|
|
4061
4065
|
let left = code !== 0 && step.id === "build" && plan.unbuilt ? unbuiltWorkspacePackages(cwd, opts.appDir) : void 0;
|
|
4062
4066
|
if (left?.length) {
|
|
@@ -11072,6 +11076,11 @@ var init_http_world = __esm({
|
|
|
11072
11076
|
const target2 = aliasRequest(name, host, req.url ?? "/");
|
|
11073
11077
|
const model = compatibleModel(name, body2);
|
|
11074
11078
|
const r = await twin(new Request(`https://${target2.host}${target2.url}`, { method, headers, ...model.body ? { body: model.body } : {} }));
|
|
11079
|
+
if ((r.status === 501 || r.status === 404) && name === "ai-gateway" && method === "GET" && /^\/(?:v1\/)?models\/([^/]+\/[^/]+)\/endpoints$/.test(target2.url.split("?")[0])) {
|
|
11080
|
+
const id2 = /^\/(?:v1\/)?models\/([^/]+\/[^/]+)\/endpoints$/.exec(target2.url.split("?")[0])[1];
|
|
11081
|
+
const payload = Buffer.from(JSON.stringify({ data: { id: id2, name: id2, endpoints: [{ name: id2, provider: id2.split("/")[0] || "openai", context_length: 128e3, pricing: { prompt: "0", completion: "0" }, supported_parameters: ["tools", "temperature", "max_tokens"] }] } }));
|
|
11082
|
+
return { status: 200, headers: new Headers({ "content-type": "application/json" }), bytes: payload, actions: [] };
|
|
11083
|
+
}
|
|
11075
11084
|
return { status: r.status, headers: r.headers, bytes: model.restore(Buffer.from(await r.arrayBuffer())), actions: log.drain() };
|
|
11076
11085
|
};
|
|
11077
11086
|
if (workspace && method !== "GET") this.causing[service.name] = 1;
|
|
@@ -20139,7 +20148,7 @@ var init_state_seeding = __esm({
|
|
|
20139
20148
|
if (/name/.test(name)) return "AgentTwin Test";
|
|
20140
20149
|
return `agenttwin-${name}-${n}`;
|
|
20141
20150
|
};
|
|
20142
|
-
NOT_A_SERVICE = /(^|\.)(registry\.npmjs\.org|registry\.yarnpkg\.com|npmjs\.(?:com|org)|pypi\.org|files\.pythonhosted\.org|crates\.io|proxy\.golang\.org|rubygems\.org|
|
|
20151
|
+
NOT_A_SERVICE = /(^|\.)(registry\.npmjs\.org|registry\.yarnpkg\.com|npmjs\.(?:com|org)|pypi\.org|files\.pythonhosted\.org|crates\.io|proxy\.golang\.org|rubygems\.org|githubusercontent\.com|amazonaws\.com)$/;
|
|
20143
20152
|
}
|
|
20144
20153
|
});
|
|
20145
20154
|
|
|
@@ -20324,11 +20333,12 @@ function packRecordSample(pack, resource2, id2, depth = 0, read2 = /* @__PURE__
|
|
|
20324
20333
|
}
|
|
20325
20334
|
return record8;
|
|
20326
20335
|
}
|
|
20327
|
-
function sourcesNear(root2, file2) {
|
|
20336
|
+
function sourcesNear(root2, file2, opts) {
|
|
20328
20337
|
const out = [], seen = /* @__PURE__ */ new Set();
|
|
20329
20338
|
const visit2 = (path2, level) => {
|
|
20330
20339
|
if (seen.has(path2) || level > 1) return;
|
|
20331
20340
|
seen.add(path2);
|
|
20341
|
+
if (opts?.excludeEnvFiles && level > 0 && SHARED_ENV_FILE.test(path2)) return;
|
|
20332
20342
|
let text5 = "";
|
|
20333
20343
|
try {
|
|
20334
20344
|
text5 = readFileSync8(join46(root2, path2), "utf8");
|
|
@@ -20434,14 +20444,15 @@ function inferredSignature(root2, route, file2, settings) {
|
|
|
20434
20444
|
const text5 = source + "\n" + sourcesNear(root2, file2).join("\n");
|
|
20435
20445
|
const envOf = (expr) => /process\.env\.([A-Z][A-Z0-9_]*)|process\.env\[['"`]([A-Z][A-Z0-9_]*)['"`]\]|\benv\.([A-Z][A-Z0-9_]*)/.exec(expr)?.slice(1).find(Boolean);
|
|
20436
20446
|
const secretNames = [.../* @__PURE__ */ new Set([...settings, ...[...text5.matchAll(/\b([A-Z][A-Z0-9_]*(?:WEBHOOK|SIGNING)[A-Z0-9_]*)\b/g)].map((m) => m[1])])].filter((n) => SECRET_NAME.test(n) && /(SECRET|KEY|TOKEN)/.test(n) && /(WEBHOOK|SIGNING)/.test(n));
|
|
20437
|
-
if (/from\s+['"`](?:svix|standardwebhooks)['"`]|require\(\s*['"`](?:svix|standardwebhooks)['"`]\s*\)|@clerk\/[\w-]+\/webhooks|['"`](?:svix|webhook)-signature['"`]/.test(text5) && secretNames.length) {
|
|
20447
|
+
if (/from\s+['"`](?:svix|standardwebhooks)['"`]|require\(\s*['"`](?:svix|standardwebhooks)['"`]\s*\)|@clerk\/[\w-]+\/webhooks|['"`](?:svix|webhook)-signature['"`]|\.webhooks\.unwrap\s*\(/.test(text5) && secretNames.length) {
|
|
20438
20448
|
const literals2 = [...source.matchAll(/(?:case\s*|===?\s*|!==?\s*)['"`]([a-z][a-z0-9_]*(?:\.[a-z0-9_]+){1,3})['"`]/g)].map((m) => m[1]);
|
|
20439
20449
|
const type = literals2[0] ?? "test.event", resource2 = type.split(".")[0].replace(/\W/g, "_");
|
|
20450
|
+
const callId = /\.call_id\b/.test(source) ? { call_id: "call_agenttwin_1" } : {};
|
|
20440
20451
|
return {
|
|
20441
20452
|
scheme: { kind: "webhook-id", header: "webhook-signature" },
|
|
20442
20453
|
secret: `whsec_${randomBytes8(24).toString("base64")}`,
|
|
20443
20454
|
settings: secretNames,
|
|
20444
|
-
body: { type, timestamp: new Date(1762257600 * 1e3).toISOString(), data: { id: `${resource2}_agenttwin_1`, object: resource2 } },
|
|
20455
|
+
body: { id: `evt_agenttwin_1`, object: "event", type, created_at: 1762257600, timestamp: new Date(1762257600 * 1e3).toISOString(), data: { id: `${resource2}_agenttwin_1`, object: resource2, ...callId } },
|
|
20445
20456
|
how: "Standard Webhooks signature (webhook-id, webhook-timestamp, webhook-signature)"
|
|
20446
20457
|
};
|
|
20447
20458
|
}
|
|
@@ -20463,9 +20474,15 @@ function inferredSignature(root2, route, file2, settings) {
|
|
|
20463
20474
|
}
|
|
20464
20475
|
function signedUnlessKnown(root2, route, file2, settings) {
|
|
20465
20476
|
const signed = signedWebhook(root2, route, file2, settings);
|
|
20466
|
-
|
|
20467
|
-
|
|
20468
|
-
|
|
20477
|
+
if (!signed?.guessed) return signed;
|
|
20478
|
+
if (webhookEvent(route, settings)) return void 0;
|
|
20479
|
+
const segments = route.path.toLowerCase().split("/").filter((s) => s && !GENERIC_WEBHOOK_SEGMENTS.has(s) && !/^\[/.test(s) && !/^:/.test(s));
|
|
20480
|
+
const packTokens = /* @__PURE__ */ new Set([signed.pack.toLowerCase(), signed.vendor.toLowerCase()]);
|
|
20481
|
+
if (segments.some((s) => !packTokens.has(s))) return void 0;
|
|
20482
|
+
if (!webhookPack(route.path, sourcesNear(root2, file2, { excludeEnvFiles: true }).join("\n"))) return void 0;
|
|
20483
|
+
return signed;
|
|
20484
|
+
}
|
|
20485
|
+
var statIsDir, SHARED_ENV_FILE, GENERIC_WEBHOOK_SEGMENTS, SIGNING_DRIVER, SECRET_NAME;
|
|
20469
20486
|
var init_webhook_signing = __esm({
|
|
20470
20487
|
"src/flow/webhook-signing.ts"() {
|
|
20471
20488
|
"use strict";
|
|
@@ -20479,6 +20496,8 @@ var init_webhook_signing = __esm({
|
|
|
20479
20496
|
return false;
|
|
20480
20497
|
}
|
|
20481
20498
|
};
|
|
20499
|
+
SHARED_ENV_FILE = /(?:^|\/|\\)env(?:\.[cm]?[jt]sx?|\/(?:index|server|client|schema)\.[cm]?[jt]sx?)?$/i;
|
|
20500
|
+
GENERIC_WEBHOOK_SEGMENTS = /* @__PURE__ */ new Set(["api", "v1", "v2", "v3", "webhook", "webhooks", "hook", "hooks", "events", "event", "callback", "callbacks", "notify", "incoming", "route", "public", "internal"]);
|
|
20482
20501
|
SIGNING_DRIVER = String.raw`
|
|
20483
20502
|
// Sign with the secret the app was given: a twin pack can issue its own (STRIPE_WEBHOOK_SECRET), and the scenario's
|
|
20484
20503
|
// value only fills a setting nothing else set.
|
|
@@ -42184,14 +42203,14 @@ var init_input_formats = __esm({
|
|
|
42184
42203
|
function missingInputFields(stderr, stdout = "") {
|
|
42185
42204
|
const found = /* @__PURE__ */ new Map();
|
|
42186
42205
|
const bodies = [];
|
|
42187
|
-
for (const m of stderr.matchAll(/HTTP 4\d\d from \S+ \S
|
|
42188
|
-
|
|
42189
|
-
|
|
42190
|
-
|
|
42191
|
-
|
|
42192
|
-
|
|
42193
|
-
|
|
42194
|
-
bodies.push(
|
|
42206
|
+
for (const m of stderr.matchAll(/HTTP 4\d\d from \S+ \S+:(?=\s|\{)\s*(.+)$/gm)) {
|
|
42207
|
+
const raw2 = m[1].trim();
|
|
42208
|
+
if (raw2.startsWith("{")) {
|
|
42209
|
+
try {
|
|
42210
|
+
bodies.push(JSON.parse(raw2));
|
|
42211
|
+
} catch {
|
|
42212
|
+
}
|
|
42213
|
+
} else bodies.push({ error: raw2 });
|
|
42195
42214
|
}
|
|
42196
42215
|
for (const line of stdout.split("\n")) {
|
|
42197
42216
|
try {
|
|
@@ -42236,10 +42255,10 @@ function missingInputFields(stderr, stdout = "") {
|
|
|
42236
42255
|
found.set(name, { name, ...expected ? { expected } : {} });
|
|
42237
42256
|
}
|
|
42238
42257
|
for (const x of Object.values(o)) if (typeof x === "string") {
|
|
42239
|
-
const t = /^\s*['"`]?([A-Za-z_][\w-]{0,63})['"`]?(?:\s+(array|string|object|number|field|parameter|list))?\s+(
|
|
42258
|
+
const t = /^\s*['"`]?([A-Za-z_][\w-]{0,63})['"`]?(?:\s+(array|string|object|number|boolean|field|parameter|list))?\s+(is|are)\s+(?:required|missing)\b/i.exec(x);
|
|
42240
42259
|
if (t && safeField(t[1]) && !/^(?:it|this|that|body|request|input|value|fields?|parameters?)$/i.test(t[1])) {
|
|
42241
|
-
const name = t[1].charAt(0).toLowerCase() + t[1].slice(1), kind = t[2]?.toLowerCase();
|
|
42242
|
-
if (!found.has(name)) found.set(name, { name, ...kind === "array" || kind === "list" ? { expected: "array" } : kind === "number" ? { expected: "number" } : {} });
|
|
42260
|
+
const name = t[1].charAt(0).toLowerCase() + t[1].slice(1), kind = t[2]?.toLowerCase(), plural5 = t[3].toLowerCase() === "are";
|
|
42261
|
+
if (!found.has(name)) found.set(name, { name, ...kind === "array" || kind === "list" || !kind && plural5 ? { expected: "array" } : kind === "number" ? { expected: "number" } : kind === "boolean" ? { expected: "boolean" } : {} });
|
|
42243
42262
|
}
|
|
42244
42263
|
}
|
|
42245
42264
|
for (const x of Object.values(o)) if (x && typeof x === "object") visit2(x);
|
|
@@ -42254,9 +42273,10 @@ function testValueFor(field2) {
|
|
|
42254
42273
|
if (/^(?:prompt|message|question|query|input|text|content)$/i.test(field2.name) && field2.expected !== "array" && field2.expected !== "object" && field2.expected !== "record") return CHAT_TEXT;
|
|
42255
42274
|
if (field2.expected === "number" || field2.expected === "integer") return 1;
|
|
42256
42275
|
if (field2.expected === "boolean") return true;
|
|
42257
|
-
if (field2.expected === "array") return [];
|
|
42276
|
+
if (field2.expected === "array") return ["test"];
|
|
42258
42277
|
if (field2.expected === "object" || field2.expected === "record") return {};
|
|
42259
42278
|
const n = field2.name.toLowerCase();
|
|
42279
|
+
if (/^(?:accept|agree|allow|confirm|enabled|active|ok|verified)$/.test(n)) return true;
|
|
42260
42280
|
if (/email/.test(n)) return "ada@example.com";
|
|
42261
42281
|
if (/url|uri|redirect/.test(n)) return "https://example.com/";
|
|
42262
42282
|
if (/(^|_)(amount|count|quantity|qty|limit|page)$/.test(n)) return 1;
|
|
@@ -42340,7 +42360,7 @@ var init_package = __esm({
|
|
|
42340
42360
|
"package.json"() {
|
|
42341
42361
|
package_default = {
|
|
42342
42362
|
name: "agenttwin",
|
|
42343
|
-
version: "0.3.
|
|
42363
|
+
version: "0.3.46",
|
|
42344
42364
|
description: "AgentTwin builds digital twins for testing AI agents. The current CLI prepares supported Node.js workflows with synthetic services, failures, and outcome checks.",
|
|
42345
42365
|
mcpName: "io.github.AgentTwin/agenttwin",
|
|
42346
42366
|
keywords: [
|
|
@@ -45856,7 +45876,8 @@ async function analyzeWorkflows(root2, opts = {}) {
|
|
|
45856
45876
|
for (const [exportName, local] of f.exports) {
|
|
45857
45877
|
const { calls: reached, env, files: touched, channels } = closure(file2, local);
|
|
45858
45878
|
const calls = reached.filter((c) => !/^use[A-Z]/.test(c.operation));
|
|
45859
|
-
if ((/\.[jt]sx$/.test(file2) && /^[A-Z]/.test(exportName) || /^use[A-Z]/.test(exportName)) && !ROUTE_FILE.test(file2)) continue;
|
|
45879
|
+
if ((/\.[jt]sx$/.test(file2) && (/^[A-Z]/.test(exportName) || exportName === "default") || /^use[A-Z]/.test(exportName)) && !ROUTE_FILE.test(file2) && !PAGES_API_FILE.test(file2)) continue;
|
|
45880
|
+
if (/(?:^|\/)(?:instrumentation(?:\.client)?|test-utils)\.[cm]?[jt]s$/i.test(file2)) continue;
|
|
45860
45881
|
const verifiesWebhook = (ROUTE_FILE.test(file2) || PAGES_API_FILE.test(file2) || SVELTE_ROUTE_FILE.test(file2)) && /\.webhooks\.constructEvent(Async)?\(|verifyWebhook|webhooks?\.verify\(|new Webhook\(|validateRequest\(|stripe-signature|x-hub-signature|svix-signature|x-slack-signature/i.test(byFile.get(file2).text);
|
|
45861
45882
|
if (!calls.length && !opts.all && !verifiesWebhook && !f.trpcHandler) continue;
|
|
45862
45883
|
const fn = f.functions.get(local);
|
|
@@ -46231,6 +46252,17 @@ async function analyzeWorkflows(root2, opts = {}) {
|
|
|
46231
46252
|
const python = await analyzePythonWorkflows(root2);
|
|
46232
46253
|
return [...unique.values(), ...scripts, ...python].map((c) => ({ ...c, score: c.score + (c.triggers.length ? 2 : 0) })).sort((a, b) => b.score - a.score || a.id.localeCompare(b.id));
|
|
46233
46254
|
}
|
|
46255
|
+
function collapseCandidates(inventory, analyzed) {
|
|
46256
|
+
const absorbed = /* @__PURE__ */ new Map();
|
|
46257
|
+
for (const workflow of inventory) {
|
|
46258
|
+
const [file2, member] = (workflow.entrypoint ?? "").split("#");
|
|
46259
|
+
const routeMatch = /^route:([^:]+):(.+?)@(\d+)$/i.exec(member ?? "");
|
|
46260
|
+
const routeMethod = routeMatch?.[1]?.toUpperCase(), routeLine = routeMatch?.[3];
|
|
46261
|
+
const match = analyzed.find((c) => c.entrypoint === workflow.entrypoint || routeLine && c.triggers.some((t) => t.file === file2 && String(t.line) === routeLine) || routeMethod && c.file === file2 && (c.web?.method.toUpperCase() === routeMethod || c.serve?.method.toUpperCase() === routeMethod) || (workflow.evidence ?? []).some((e) => e.ref === `${c.file}:${c.calls[0]?.line}`));
|
|
46262
|
+
if (match) absorbed.set(workflow.id, match.id);
|
|
46263
|
+
}
|
|
46264
|
+
return absorbed;
|
|
46265
|
+
}
|
|
46234
46266
|
var WHOLE_INPUT, PROVIDER_MODULES, FETCH_HOSTS, KNOWN_PROVIDERS, escapeHost, packHosts, fetchHosts, READ_OPS, SOURCE, SKIP3, SETTINGS_MODULE_SIZE, SOURCE_FILE_LIMIT, ROUTE_FILE, SVELTE_ROUTE_FILE, FUNCTION_FILE, PAGES_API_FILE, REQUEST_TARGET_KEYS, chain2, literal3, objectLiteral, templateSql, ENTRY_NAME, nextApps, LazyFunctions;
|
|
46235
46267
|
var init_analyze = __esm({
|
|
46236
46268
|
"src/flow/analyze.ts"() {
|
|
@@ -54222,6 +54254,7 @@ async function prepareWorkflow(cwd, candidate, ask, log, discovered) {
|
|
|
54222
54254
|
const slack = signed.pack === "slack" ? scenario.services.find((sv) => sv.name === signed.pack || String(sv.adapter ?? "") === "pack:slack") : void 0;
|
|
54223
54255
|
if (slack && typeof about?.channel === "string" && typeof about.ts === "string") {
|
|
54224
54256
|
for (const c of slackEventSeed({ channel: about.channel, ts: about.ts, user: about.user, text: about.text })) {
|
|
54257
|
+
if (!String(slack.adapter ?? "").startsWith("pack:") && c.path === "/channel_members") continue;
|
|
54225
54258
|
const have = slack.collections.find((x) => x.path === c.path);
|
|
54226
54259
|
if (!have) slack.collections.push(c);
|
|
54227
54260
|
else for (const r of c.seed) if (!have.seed.some((x) => x.id === r.id)) have.seed.push(r);
|
|
@@ -54541,7 +54574,7 @@ try{
|
|
|
54541
54574
|
:v[${JSON.stringify(SLACK_CLIENT)}]?await slack()
|
|
54542
54575
|
:typeof v[${JSON.stringify(SAY)}]==='string'?(()=>{const channel=v[${JSON.stringify(SAY)}];return async m=>(await slack()).chat.postMessage(typeof m==='string'?{channel,text:m}:{channel,...m});})()
|
|
54543
54576
|
:Object.fromEntries(await Promise.all(Object.entries(v).map(async([k,x])=>[k,await hydrate(x)])))):v;
|
|
54544
|
-
for(const [index,raw] of calls.entries()){const args=await hydrate(raw);
|
|
54577
|
+
for(const [index,raw] of calls.entries()){const args=await hydrate(raw);let result=await fn(...args);if(result&&typeof result[Symbol.asyncIterator]==='function'){const chunks=[];for await(const chunk of result)chunks.push(chunk);result=chunks.every(c=>typeof c==='string')?chunks.join(''):chunks;}console.log(JSON.stringify({schema:'agenttwin/call-result-v1',call:index+1,result:result??null,...(invoked.length?{invoked:invoked.splice(0)}:{})}));}
|
|
54545
54578
|
}catch(error){console.error(error);process.exitCode=1;}
|
|
54546
54579
|
// Open pools and sockets would keep the process alive; exit once the calls have settled.
|
|
54547
54580
|
setTimeout(()=>process.exit(),1000).unref();
|
|
@@ -54795,7 +54828,7 @@ setTimeout(()=>process.exit(),1000).unref();
|
|
|
54795
54828
|
` : void 0;
|
|
54796
54829
|
const nextDriver = web && web.appDir !== void 0 ? `// Generated by AgentTwin: starts the Next.js app in ${web.appDir || "."} and sends ${web.method} ${web.path} to it on twins.
|
|
54797
54830
|
import {spawn,spawnSync} from 'node:child_process';
|
|
54798
|
-
import {existsSync,readFileSync} from 'node:fs';
|
|
54831
|
+
import {existsSync,readFileSync,realpathSync} from 'node:fs';
|
|
54799
54832
|
import {createRequire} from 'node:module';
|
|
54800
54833
|
import net from 'node:net';
|
|
54801
54834
|
const environment=${JSON.stringify(scenario.environment)},calls=${JSON.stringify(calls)},appDir=${JSON.stringify(join67(cwd, web.appDir))};
|
|
@@ -54832,16 +54865,38 @@ try{
|
|
|
54832
54865
|
spawnSync(process.execPath,[file],{cwd:appDir,env,stdio:['ignore','ignore','pipe'],timeout:120000});
|
|
54833
54866
|
}
|
|
54834
54867
|
}catch{/* the dev script is optional */}
|
|
54835
|
-
const
|
|
54836
|
-
|
|
54837
|
-
|
|
54838
|
-
|
|
54839
|
-
|
|
54840
|
-
|
|
54868
|
+
const nextReq=createRequire(appDir+'/package.json');
|
|
54869
|
+
const next=nextReq.resolve('next/dist/bin/next');
|
|
54870
|
+
let nextMajor=0,nextOutsideRepo=false;
|
|
54871
|
+
try{
|
|
54872
|
+
const nextPkg=nextReq.resolve('next/package.json');
|
|
54873
|
+
nextMajor=Number(String(JSON.parse(readFileSync(nextPkg,'utf8')).version??'0').split('.')[0])||0;
|
|
54874
|
+
const repoReal=realpathSync(${JSON.stringify(cwd)}),nextReal=realpathSync(nextPkg);
|
|
54875
|
+
nextOutsideRepo=!nextReal.startsWith(repoReal+'/')&&!nextReal.startsWith(repoReal+'\\\\');
|
|
54876
|
+
}catch{}
|
|
54877
|
+
const startServer=async webpack=>{
|
|
54878
|
+
output='';exited=null;
|
|
54879
|
+
const args=[next,'dev',...(webpack?['--webpack']:[]),'-p',String(port)];
|
|
54880
|
+
server=spawn(process.execPath,args,{cwd:appDir,env,stdio:['ignore','pipe','pipe'],detached:process.platform!=='win32'});
|
|
54881
|
+
const keep=chunk=>{const text=chunk.toString();output=(output+text).slice(-20000);lastOutput=Date.now();process.stderr.write(text);};
|
|
54882
|
+
server.stdout.on('data',keep);server.stderr.on('data',keep);server.once('exit',code=>{exited=code??1;});
|
|
54883
|
+
const deadline=Date.now()+90000;
|
|
54884
|
+
while(!(await open())){if(exited!==null)throw new Error('The Next.js server stopped while starting (exit '+exited+').');if(Date.now()>deadline)throw new Error('The Next.js server did not start listening within 90 seconds.');await new Promise(r=>setTimeout(r,150));}
|
|
54885
|
+
};
|
|
54886
|
+
let usingWebpack=nextMajor>=16&&nextOutsideRepo;
|
|
54887
|
+
if(usingWebpack)console.error('[agenttwin] Next.js '+nextMajor+' resolves outside the repo; starting with --webpack.');
|
|
54888
|
+
try{await startServer(usingWebpack);}catch(err){if(!usingWebpack&&nextMajor>=16&&/Could not find the Next\\.js package/i.test(output)){usingWebpack=true;console.error('[agenttwin] Next.js Turbopack could not resolve next/package.json; retrying with --webpack.');await startServer(true);}else throw err;}
|
|
54841
54889
|
// A sign-in that fails does not stop the workflow: many (webhooks, crons) need no user, and one that does answers
|
|
54842
54890
|
// 401, which the password sign-in below handles.
|
|
54843
54891
|
let signedIn=false;
|
|
54844
|
-
if(signIn){try{await signInThroughApp(signIn);signedIn=true;}catch(e){
|
|
54892
|
+
if(signIn){try{await signInThroughApp(signIn);signedIn=true;}catch(e){
|
|
54893
|
+
if(!usingWebpack&&nextMajor>=16&&/Could not find the Next\\.js package/i.test(output)){
|
|
54894
|
+
usingWebpack=true;stop();await new Promise(r=>setTimeout(r,300));
|
|
54895
|
+
console.error('[agenttwin] Next.js Turbopack failed during sign-in; restarting with --webpack.');
|
|
54896
|
+
await startServer(true);
|
|
54897
|
+
try{await signInThroughApp(signIn);signedIn=true;}catch(e2){console.error('[agenttwin] '+(e2&&e2.message||e2)+' Sending the workflow request without a signed-in user.');}
|
|
54898
|
+
}else console.error('[agenttwin] '+(e&&e.message||e)+' Sending the workflow request without a signed-in user.');
|
|
54899
|
+
}}
|
|
54845
54900
|
if(signedIn){
|
|
54846
54901
|
console.error('[agenttwin] '+signIn.email+' signed in through the app ('+signIn.provider+').');
|
|
54847
54902
|
// Records the app creates after sign-in (mailbox, defaults) are often written in the background.
|
|
@@ -54875,6 +54930,14 @@ try{
|
|
|
54875
54930
|
const bodyText=trpc||!qNames.size?payload:JSON.stringify(bodyArg??{});
|
|
54876
54931
|
const send=()=>call(${JSON.stringify(web.path)}+(trpc?.kind==='query'?'?input='+encodeURIComponent(payload):(qs?'?'+qs:${JSON.stringify(scenario.query ? "?" + scenario.query : "")})),{method:${JSON.stringify(web.method)},headers:{...(slackForm?{'content-type':'application/x-www-form-urlencoded'}:form?{}:{'content-type':'application/json'}),'idempotency-key':'agenttwin-'+[...payload].reduce((h,c)=>(h*31+c.charCodeAt(0))>>>0,7).toString(16),...signed},...(['GET','HEAD'].includes(${JSON.stringify(web.method)})?{}:{body:slackForm?payload:form?formBody(bodyArg):bodyText})});
|
|
54877
54932
|
let response=await send();
|
|
54933
|
+
if(response.status>=500&&!usingWebpack&&nextMajor>=16&&/Could not find the Next\\.js package/i.test(output)){
|
|
54934
|
+
await response.text().catch(()=>{});
|
|
54935
|
+
usingWebpack=true;stop();await new Promise(r=>setTimeout(r,300));
|
|
54936
|
+
console.error('[agenttwin] Next.js Turbopack failed on route; restarting with --webpack.');
|
|
54937
|
+
await startServer(true);
|
|
54938
|
+
if(signIn&&!signedIn){try{await signInThroughApp(signIn);signedIn=true;}catch{}}
|
|
54939
|
+
response=await send();
|
|
54940
|
+
}
|
|
54878
54941
|
// A redirect to a sign-in or guest-session page: follow it as a browser would (the jar keeps its cookie), then ask again.
|
|
54879
54942
|
// Still sent to sign-in: the workflow never ran, so the run is not a pass.
|
|
54880
54943
|
const signInPath=l=>/\\/(?:api\\/)?(?:auth|login|log-in|signin|sign-in|session|guest)(?:\\/|\\?|$)/i.test(String(l).replace(/^https?:\\/\\/[^/]+/,''));
|
|
@@ -64699,7 +64762,7 @@ function routeWeight(method, path2) {
|
|
|
64699
64762
|
if (/(^|\/)(webhooks?|callback|events?|inbound|incoming|notifications?|push|hooks?)(\/|$)/i.test(path2)) weight += 14;
|
|
64700
64763
|
if (/(^|\/)(cron|jobs?|queue|tasks?|scheduled?|process|sync|digest)(\/|$)/i.test(path2)) weight += 6;
|
|
64701
64764
|
if (path2.toLowerCase().split("/").some((segment) => twinnedVendors().has(segment))) weight += 5;
|
|
64702
|
-
if (/(^|\/)(admin|debug|health|test|e2e|dev|internal|_next|og|sitemap|docs?|documentation)(\/|$)/i.test(path2)) weight -= 10;
|
|
64765
|
+
if (/(^|\/)(admin|debug|health|ping|status|version|metrics|ready|live|conf|config|settings|trace|test|e2e|dev|internal|_next|og|sitemap|docs?|documentation)(\/|$)/i.test(path2) || path2 === "/") weight -= 10;
|
|
64703
64766
|
return weight;
|
|
64704
64767
|
}
|
|
64705
64768
|
function workflowKind(c) {
|
|
@@ -64707,7 +64770,8 @@ function workflowKind(c) {
|
|
|
64707
64770
|
if (c.boltApp) return WORKFLOW_KINDS[0];
|
|
64708
64771
|
if (!route) return WORKFLOW_KINDS[4];
|
|
64709
64772
|
if (signInCallback(route, c.file)) return WORKFLOW_KINDS[3];
|
|
64710
|
-
|
|
64773
|
+
const isBrowserHook = /(^|\/)browser(\/|$)/i.test(c.file ?? "") && /(^|\/)hooks\/(dialog|file-chooser)(\/|$)/i.test(route.path) && !c.calls?.length;
|
|
64774
|
+
if (route.method !== "GET" && WEBHOOK_PATH.test(route.path) && !isBrowserHook) return WORKFLOW_KINDS[0];
|
|
64711
64775
|
if (JOB_PATH.test(route.path)) return WORKFLOW_KINDS[2];
|
|
64712
64776
|
if (route.method !== "GET" && (c.calls ?? []).some((call2) => call2.write && !DATABASE.test(call2.provider) && MONEY_OR_SEND.test(call2.operation))) return WORKFLOW_KINDS[1];
|
|
64713
64777
|
return WORKFLOW_KINDS[3];
|
|
@@ -64728,7 +64792,10 @@ function moneyWeight(c) {
|
|
|
64728
64792
|
function rankWorkflows(list5) {
|
|
64729
64793
|
const kind = (c) => WORKFLOW_KINDS.indexOf(workflowKind(c));
|
|
64730
64794
|
const callback = (c) => signInCallback(c.web ?? c.serve, c.file) ? 1 : 0;
|
|
64731
|
-
|
|
64795
|
+
const emptyOtherRoute = (c) => kind(c) === 3 && !c.calls?.length ? 1 : 0;
|
|
64796
|
+
const nonHelperFn = (c) => kind(c) === 4 && (c.calls?.length ?? 0) > 0 && (!c.exportName || nameWeight(c.exportName) >= 0);
|
|
64797
|
+
const tier = (c) => nonHelperFn(c) ? 3 : kind(c);
|
|
64798
|
+
return list5.sort((a, b) => tier(a) - tier(b) || callback(a) - callback(b) || emptyOtherRoute(a) - emptyOtherRoute(b) || b.score + moneyWeight(b) - (a.score + moneyWeight(a)));
|
|
64732
64799
|
}
|
|
64733
64800
|
function twinnedVendors() {
|
|
64734
64801
|
if (vendors) return vendors;
|
|
@@ -64789,7 +64856,8 @@ async function runOneCommand(opts) {
|
|
|
64789
64856
|
const ask = opts.ask ?? terminalAsk(interactive, log, emit2, Boolean(opts.emit));
|
|
64790
64857
|
const seed = normalizeSeed(opts.seed ?? "42");
|
|
64791
64858
|
const startedAt = opts.startedAt ?? Date.now();
|
|
64792
|
-
const
|
|
64859
|
+
const effectiveDeadline = opts.deadline === void 0 ? void 0 : opts.deadline + setupSpentMs;
|
|
64860
|
+
const budgetLeft = (cap) => effectiveDeadline === void 0 ? cap : Math.min(cap, Math.max(0, effectiveDeadline - Date.now()));
|
|
64793
64861
|
const caseStatus = (r) => r.status === "passed" ? "passed" : r.status === "failed" ? "found" : r.status === "incomplete" ? "skipped" : "error";
|
|
64794
64862
|
const calls = (r) => r.events.filter((e) => isApplicationWrite(e) || e.operation === "fault").map((e) => ({ service: e.service, operation: e.operation, path: e.path, fault: e.operation === "fault", ...e.operation === "fault" && e.detail ? { detail: e.detail } : {} }));
|
|
64795
64863
|
if (!opts.skipSetup) {
|
|
@@ -64841,9 +64909,10 @@ async function runOneCommand(opts) {
|
|
|
64841
64909
|
const { inventoryWorkflows, tools, exports } = await scan;
|
|
64842
64910
|
if (reused) log(dim(` Repository map from this run's first scan: ${tools.size} services and ${inventoryWorkflows.length} workflows.`));
|
|
64843
64911
|
const projectDashboard = await integrations.connectProject(cwd, { interactive, ask, log });
|
|
64844
|
-
const byEntry = new Map(exports.map((c) => [c.entrypoint, c]));
|
|
64912
|
+
const byEntry = new Map(exports.map((c) => [c.entrypoint, c])), byId = new Map(exports.map((c) => [c.id, c]));
|
|
64913
|
+
const collapsed = collapseCandidates(inventoryWorkflows, exports);
|
|
64845
64914
|
const stepsOf = (w) => w.steps.map((step) => ({ ...tools.get(step.tool), operations: step.operations, title: tools.get(step.tool)?.title ?? step.tool })).filter((step) => step.category === "dependency");
|
|
64846
|
-
const invocable = (w) => byEntry.get(w.entrypoint ?? "") ?? inventoryWorkflows.filter((x) => x.coveredBy === w.id).map((x) => byEntry.get(x.entrypoint ?? "")).find(Boolean);
|
|
64915
|
+
const invocable = (w) => byEntry.get(w.entrypoint ?? "") ?? byId.get(collapsed.get(w.id) ?? "") ?? inventoryWorkflows.filter((x) => x.coveredBy === w.id).map((x) => byEntry.get(x.entrypoint ?? "") ?? byId.get(collapsed.get(x.id) ?? "")).find(Boolean);
|
|
64847
64916
|
const steps = /* @__PURE__ */ new Map(), candidates = [], notRunnable = [];
|
|
64848
64917
|
let merged = 0;
|
|
64849
64918
|
for (const w of inventoryWorkflows.filter((w2) => !w2.coveredBy && w2.entrypoint && w2.steps.length)) {
|
|
@@ -64970,7 +65039,7 @@ async function runOneCommand(opts) {
|
|
|
64970
65039
|
const ownLock = ["package-lock.json", "pnpm-lock.yaml", "yarn.lock", "bun.lock", "bun.lockb"].some((f) => existsSync21(join90(cwd, appDir, f)));
|
|
64971
65040
|
const outside = appDir !== "." && !workspaceDirs(cwd).has(appDir);
|
|
64972
65041
|
at("installing dependencies", candidate.title);
|
|
64973
|
-
if (appDir !== "." && !existsSync21(join90(cwd, appDir, "node_modules")) && (ownLock || outside
|
|
65042
|
+
if (appDir !== "." && !existsSync21(join90(cwd, appDir, "node_modules")) && (ownLock || outside)) await runSetup(join90(cwd, appDir), { ask, log: trackCommand(log), interactive, only: "install" });
|
|
64974
65043
|
at("building workspace packages", candidate.title);
|
|
64975
65044
|
{
|
|
64976
65045
|
const t0 = Date.now();
|
|
@@ -65029,18 +65098,44 @@ async function runOneCommand(opts) {
|
|
|
65029
65098
|
log(bold("3/7 Run") + dim(liveHosts.length ? " real workflow code against twins\u2026" : " real workflow code against twins (no production calls)\u2026"));
|
|
65030
65099
|
if (liveHosts.length) log(yellow(` Connected for real: ${liveHosts.join(", ")}. Every case, including faults and duplicate runs, calls these with your key; use a sandbox account. agenttwin disconnect <host> returns a host to its twin.`));
|
|
65031
65100
|
let clean;
|
|
65032
|
-
|
|
65033
|
-
|
|
65034
|
-
|
|
65035
|
-
|
|
65036
|
-
|
|
65037
|
-
|
|
65038
|
-
|
|
65039
|
-
|
|
65040
|
-
|
|
65041
|
-
|
|
65042
|
-
|
|
65043
|
-
|
|
65101
|
+
for (let blockedTry = 0; ; blockedTry++) {
|
|
65102
|
+
try {
|
|
65103
|
+
clean = await track(void 0);
|
|
65104
|
+
break;
|
|
65105
|
+
} catch (error62) {
|
|
65106
|
+
const msg2 = error62 instanceof Error ? error62.message : String(error62);
|
|
65107
|
+
const blockedMatch = /AgentTwin blocked .*? to ([^\s(;]+)/i.exec(msg2);
|
|
65108
|
+
if (blockedMatch && blockedTry < 3) {
|
|
65109
|
+
const host = blockedMatch[1].toLowerCase().replace(/:\d+$/, "");
|
|
65110
|
+
const adapter = deepTwinForHost(host), collections = adapter ? ADAPTER_COLLECTIONS[adapter] : void 0;
|
|
65111
|
+
let added = false;
|
|
65112
|
+
if (adapter && collections) {
|
|
65113
|
+
const name = adapter.replaceAll("-", "_");
|
|
65114
|
+
if (!prepared.scenario.twins.some((t) => t.name === name)) {
|
|
65115
|
+
const service = { name, adapter, collections: collections.map((path2) => ({ path: path2, seed: [] })) };
|
|
65116
|
+
prepared.scenario.services.push(service);
|
|
65117
|
+
prepared.world.services.push(service);
|
|
65118
|
+
prepared.scenario.twins.push({ tier: "deep", provider: "hand-written twin", name, title: PROVIDER_TITLES[adapter] ?? adapter, note: `${host} \u2192 found while running (the scan did not see it)`, service });
|
|
65119
|
+
log(dim(` Found ${host} while running (the scan missed it); using the ${PROVIDER_TITLES[adapter] ?? adapter} twin and rerunning.`));
|
|
65120
|
+
added = true;
|
|
65121
|
+
}
|
|
65122
|
+
} else if (!prepared.scenario.twins.some((t) => t.generic?.hosts?.includes(host))) {
|
|
65123
|
+
prepared.scenario.twins.push({ tier: "inferred", provider: "stateful REST twin inferred from calls", name: serviceName3(host), title: host, generic: { hosts: [host] }, note: `${host} \u2192 found while running (the scan did not see it): stateful REST twin, vendor-specific behavior is not modelled` });
|
|
65124
|
+
log(dim(` Found ${host} while running (the scan missed it); twinning it as a stateful REST service and rerunning.`));
|
|
65125
|
+
added = true;
|
|
65126
|
+
}
|
|
65127
|
+
if (added) continue;
|
|
65128
|
+
}
|
|
65129
|
+
const reason = msg2.split("\n")[0].slice(0, 240);
|
|
65130
|
+
const tried = [...opts.triedWorkflows ?? [], { id: candidate.id, title: candidate.title, reason }];
|
|
65131
|
+
const triedFiles = new Set(tried.map((t) => candidates.find((c) => c.id === t.id)?.file).filter(Boolean));
|
|
65132
|
+
const open6 = candidates.filter((c) => !c.suite && !tried.some((t) => t.id === c.id) && !(opts.testedWorkflows ?? []).includes(c.id));
|
|
65133
|
+
const next = !candidate.suite && (!opts.workflow || opts.autoPicked) && tried.length < WORKFLOW_ATTEMPTS && Date.now() - startedAt < budgetLeft(WORKFLOW_BUDGET_MS) ? open6.find((c) => !triedFiles.has(c.file)) ?? open6[0] : void 0;
|
|
65134
|
+
if (!next) throw error62;
|
|
65135
|
+
log(yellow(` ${candidate.title} could not run here: ${reason}`));
|
|
65136
|
+
log(dim(` Trying the next workflow the scan found: ${next.title}. Test this one later with npx agenttwin --workflow "${candidate.title}".`));
|
|
65137
|
+
return runOneCommand({ ...opts, workflow: next.id, autoPicked: true, triedWorkflows: tried, skipSuites: true, startedAt });
|
|
65138
|
+
}
|
|
65044
65139
|
}
|
|
65045
65140
|
if (pickedSuite && clean.exitCode === null && !((suiteFacts(candidate, clean.stdout).suite?.passed ?? 0) > 0)) {
|
|
65046
65141
|
const fallback = candidates.find((c) => !c.suite && !(opts.testedWorkflows ?? []).includes(c.id));
|
|
@@ -65732,7 +65827,9 @@ ${clean.stdout ?? ""}`) : void 0;
|
|
|
65732
65827
|
}
|
|
65733
65828
|
}
|
|
65734
65829
|
const cleanEvents = clean.events;
|
|
65735
|
-
const
|
|
65830
|
+
const LOCAL_ENGINES = /* @__PURE__ */ new Set(["postgres", "sqlite", "mysql", "redis", "mongodb", "clickhouse"]);
|
|
65831
|
+
const hasExternalCall = cleanCalls.length > 0 || cleanEvents.some((e) => !LOCAL_ENGINES.has(e.service));
|
|
65832
|
+
const idle = (clean.status === "passed" || !!candidate.suite && suiteRan()) && !cleanEvents.some(isApplicationWrite) && !cleanCalls.some((c) => c.isWrite && c.committed === true) && !clean.assertions.some((a) => a.service !== "none") && !hasExternalCall;
|
|
65736
65833
|
const emptyReads = [...new Set(cleanEvents.filter((e) => e.operation === "read" && /^SELECT 0$/.test(e.detail ?? "")).map((e) => (e.path ?? "").replace(/^\//, "")))].filter(Boolean);
|
|
65737
65834
|
const autoSuite = !opts.workflow || opts.triedSuites !== void 0;
|
|
65738
65835
|
const routeFallback = candidates.find((c) => !c.suite && !(opts.testedWorkflows ?? []).includes(c.id));
|
|
@@ -65770,7 +65867,7 @@ ${clean.stdout ?? ""}`) : void 0;
|
|
|
65770
65867
|
if (runnable.length < supportedFaults.length) log(dim(` ${faultConcurrency > 1 ? `${faultConcurrency} failure scenarios run at a time, a wave takes about ${Math.round(cleanMs / 1e3)} s` : `One run takes about ${Math.round(cleanMs / 1e3)} s here`}, so ${runnable.length} of ${supportedFaults.length} failure scenarios fit the time. The rest: npx agenttwin --workflow "${candidate.title}" with AGENTTWIN_WORKFLOW_BUDGET_MS set higher.`));
|
|
65771
65868
|
const deferred = [];
|
|
65772
65869
|
const runFault = async (fault, deferStartupFailure) => {
|
|
65773
|
-
if (opts.deadline !== void 0 && Date.now() > opts.deadline - 15e3) {
|
|
65870
|
+
if (opts.deadline !== void 0 && Date.now() > opts.deadline + setupSpentMs - 15e3) {
|
|
65774
65871
|
skippedFaults.push({ id: fault.id, title: fault.title, why: "time" });
|
|
65775
65872
|
emit2({ type: "case-end", id: fault.id, status: "skipped", calls: [] });
|
|
65776
65873
|
log(` ${yellow("SKIP ")} ${fault.title}${dim(" (the run budget ended first)")}`);
|
|
@@ -65859,7 +65956,7 @@ ${clean.stdout ?? ""}`) : void 0;
|
|
|
65859
65956
|
log(dim(` Campaign: ${slice.length} of ${campaignCases.length} derived fault scenario${campaignCases.length === 1 ? "" : "s"} (network, filesystem, crash, clock), one per model.`));
|
|
65860
65957
|
const campaignStart = Date.now();
|
|
65861
65958
|
for (const fault of slice) {
|
|
65862
|
-
if (opts.deadline !== void 0 && Date.now() > opts.deadline - 15e3 || Date.now() - campaignStart > CAMPAIGN_BUDGET_MS) {
|
|
65959
|
+
if (opts.deadline !== void 0 && Date.now() > opts.deadline + setupSpentMs - 15e3 || Date.now() - campaignStart > CAMPAIGN_BUDGET_MS) {
|
|
65863
65960
|
skippedFaults.push({ id: fault.id, title: fault.title, why: "time" });
|
|
65864
65961
|
log(` ${yellow("SKIP ")} ${fault.title}${dim(" (the run budget ended first)")}`);
|
|
65865
65962
|
continue;
|
package/dist/scan-worker.js
CHANGED
|
@@ -23058,7 +23058,8 @@ async function analyzeWorkflows(root2, opts = {}) {
|
|
|
23058
23058
|
for (const [exportName, local] of f.exports) {
|
|
23059
23059
|
const { calls: reached, env, files: touched, channels } = closure(file2, local);
|
|
23060
23060
|
const calls = reached.filter((c) => !/^use[A-Z]/.test(c.operation));
|
|
23061
|
-
if ((/\.[jt]sx$/.test(file2) && /^[A-Z]/.test(exportName) || /^use[A-Z]/.test(exportName)) && !ROUTE_FILE.test(file2)) continue;
|
|
23061
|
+
if ((/\.[jt]sx$/.test(file2) && (/^[A-Z]/.test(exportName) || exportName === "default") || /^use[A-Z]/.test(exportName)) && !ROUTE_FILE.test(file2) && !PAGES_API_FILE.test(file2)) continue;
|
|
23062
|
+
if (/(?:^|\/)(?:instrumentation(?:\.client)?|test-utils)\.[cm]?[jt]s$/i.test(file2)) continue;
|
|
23062
23063
|
const verifiesWebhook = (ROUTE_FILE.test(file2) || PAGES_API_FILE.test(file2) || SVELTE_ROUTE_FILE.test(file2)) && /\.webhooks\.constructEvent(Async)?\(|verifyWebhook|webhooks?\.verify\(|new Webhook\(|validateRequest\(|stripe-signature|x-hub-signature|svix-signature|x-slack-signature/i.test(byFile.get(file2).text);
|
|
23063
23064
|
if (!calls.length && !opts.all && !verifiesWebhook && !f.trpcHandler) continue;
|
|
23064
23065
|
const fn = f.functions.get(local);
|
package/dist/worker.js
CHANGED
|
@@ -8315,6 +8315,11 @@ var HttpWorld = class {
|
|
|
8315
8315
|
const target2 = aliasRequest(name, host, req.url ?? "/");
|
|
8316
8316
|
const model = compatibleModel(name, body);
|
|
8317
8317
|
const r = await twin(new Request(`https://${target2.host}${target2.url}`, { method, headers, ...model.body ? { body: model.body } : {} }));
|
|
8318
|
+
if ((r.status === 501 || r.status === 404) && name === "ai-gateway" && method === "GET" && /^\/(?:v1\/)?models\/([^/]+\/[^/]+)\/endpoints$/.test(target2.url.split("?")[0])) {
|
|
8319
|
+
const id = /^\/(?:v1\/)?models\/([^/]+\/[^/]+)\/endpoints$/.exec(target2.url.split("?")[0])[1];
|
|
8320
|
+
const payload = Buffer.from(JSON.stringify({ data: { id, name: id, endpoints: [{ name: id, provider: id.split("/")[0] || "openai", context_length: 128e3, pricing: { prompt: "0", completion: "0" }, supported_parameters: ["tools", "temperature", "max_tokens"] }] } }));
|
|
8321
|
+
return { status: 200, headers: new Headers({ "content-type": "application/json" }), bytes: payload, actions: [] };
|
|
8322
|
+
}
|
|
8318
8323
|
return { status: r.status, headers: r.headers, bytes: model.restore(Buffer.from(await r.arrayBuffer())), actions: log.drain() };
|
|
8319
8324
|
};
|
|
8320
8325
|
if (workspace && method !== "GET") this.causing[service.name] = 1;
|
package/dist/world-host.js
CHANGED
|
@@ -8733,6 +8733,11 @@ var init_http_world = __esm({
|
|
|
8733
8733
|
const target2 = aliasRequest(name, host, req.url ?? "/");
|
|
8734
8734
|
const model = compatibleModel(name, body);
|
|
8735
8735
|
const r = await twin(new Request(`https://${target2.host}${target2.url}`, { method, headers, ...model.body ? { body: model.body } : {} }));
|
|
8736
|
+
if ((r.status === 501 || r.status === 404) && name === "ai-gateway" && method === "GET" && /^\/(?:v1\/)?models\/([^/]+\/[^/]+)\/endpoints$/.test(target2.url.split("?")[0])) {
|
|
8737
|
+
const id = /^\/(?:v1\/)?models\/([^/]+\/[^/]+)\/endpoints$/.exec(target2.url.split("?")[0])[1];
|
|
8738
|
+
const payload = Buffer.from(JSON.stringify({ data: { id, name: id, endpoints: [{ name: id, provider: id.split("/")[0] || "openai", context_length: 128e3, pricing: { prompt: "0", completion: "0" }, supported_parameters: ["tools", "temperature", "max_tokens"] }] } }));
|
|
8739
|
+
return { status: 200, headers: new Headers({ "content-type": "application/json" }), bytes: payload, actions: [] };
|
|
8740
|
+
}
|
|
8736
8741
|
return { status: r.status, headers: r.headers, bytes: model.restore(Buffer.from(await r.arrayBuffer())), actions: log.drain() };
|
|
8737
8742
|
};
|
|
8738
8743
|
if (workspace && method !== "GET") this.causing[service.name] = 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agenttwin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.46",
|
|
4
4
|
"description": "AgentTwin builds digital twins for testing AI agents. The current CLI prepares supported Node.js workflows with synthetic services, failures, and outcome checks.",
|
|
5
5
|
"mcpName": "io.github.AgentTwin/agenttwin",
|
|
6
6
|
"keywords": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1954],{657:()=>{},672:()=>{},744:()=>{},975:()=>{},1962:()=>{},2724:()=>{},3076:()=>{},3677:()=>{},4619:()=>{},4710:(e,s,n)=>{Promise.resolve().then(n.t.bind(n,4619,23)),Promise.resolve().then(n.t.bind(n,657,23)),Promise.resolve().then(n.t.bind(n,5798,23)),Promise.resolve().then(n.t.bind(n,4938,23)),Promise.resolve().then(n.t.bind(n,3677,23)),Promise.resolve().then(n.t.bind(n,672,23)),Promise.resolve().then(n.t.bind(n,8664,23)),Promise.resolve().then(n.t.bind(n,975,23)),Promise.resolve().then(n.t.bind(n,2724,23)),Promise.resolve().then(n.t.bind(n,7645,23)),Promise.resolve().then(n.t.bind(n,1962,23)),Promise.resolve().then(n.t.bind(n,744,23)),Promise.resolve().then(n.t.bind(n,9214,23)),Promise.resolve().then(n.t.bind(n,9095,23)),Promise.resolve().then(n.t.bind(n,3076,23)),Promise.resolve().then(n.t.bind(n,9639,23))},4938:()=>{},5798:()=>{},7645:()=>{},8664:()=>{},9095:()=>{},9214:()=>{},9639:()=>{}},e=>{e.O(0,[1133,54,8427,2865,8441,1255,7358],()=>e(e.s=4710)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[977,990,1369,2481,2882,3232,4345,6226,6402,6990,7006,7066,8365,9366,9877],{3652:e=>{e.exports={footer:"SiteFooter_footer__aUaTs",content:"SiteFooter_content__1J6Jy",wordmark:"SiteFooter_wordmark__B6_Tf",navigation:"SiteFooter_navigation__Zsq8o",main:"SiteFooter_main__EWvbi",brand:"SiteFooter_brand__HyIqL",groups:"SiteFooter_groups__tPgIM",group:"SiteFooter_group__FK9ik",more:"SiteFooter_more__LEh69",bottom:"SiteFooter_bottom__ADU2b",srOnly:"SiteFooter_srOnly__e7DbB"}},5662:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,3652,23)),Promise.resolve().then(n.bind(n,8765))},8765:(e,t,n)=>{"use strict";n.d(t,{default:()=>l});var a=n(5155),i=n(2115),r=n(1719);function o(){let[e,t]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{t("light"===document.documentElement.dataset.siteTheme)},[]),(0,a.jsxs)("button",{className:"site-theme-toggle",type:"button","aria-label":e?"Switch to dark mode":"Switch to light mode",title:e?"Switch to dark mode":"Switch to light mode",onClick:()=>{let e="light"!==document.documentElement.dataset.siteTheme,n=e?"light":"dark";document.documentElement.dataset.siteTheme=n,t(e);try{localStorage.setItem("agenttwin-site-theme",n)}catch(e){}},children:[(0,a.jsx)(r.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(r.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let s=[{href:"/what-is-agenttwin/",label:"Product"},{href:"/#how",label:"How it works"},{href:"/pricing/",label:"Pricing"},{href:"/about/",label:"About"},{href:"/docs/",label:"Docs"},{href:"/blog/",label:"Blog"}];function l(){let[e,t]=(0,i.useState)(!1),n=(0,i.useRef)(null),r=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=r.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=r.current)?void 0:n.contains(e.target))||t(!1)},i=matchMedia("(min-width: 1024px)"),o=()=>t(!1);return document.addEventListener("keydown",e),document.addEventListener("click",a),i.addEventListener("change",o),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",a),i.removeEventListener("change",o)}},[]),(0,a.jsxs)("header",{className:"site-header",ref:r,children:[(0,a.jsxs)("a",{className:"brand",href:"/","aria-label":"AgentTwin home",children:[(0,a.jsx)("img",{src:"assets/logo/mark-twin-rings.svg?v=white-rings",alt:"","aria-hidden":"true",width:29,height:29}),"AgentTwin"]}),(0,a.jsxs)("nav",{className:"main-nav".concat(e?" is-open":""),id:"navlinks","aria-label":"Main navigation",children:[s.map(e=>(0,a.jsx)("a",{href:e.href,onClick:()=>t(!1),children:e.label},e.href)),(0,a.jsx)("a",{className:"nav-mobile-dashboard",href:"/dashboard/",onClick:()=>t(!1),children:"Open dashboard"})]}),(0,a.jsxs)("div",{className:"nav-actions",children:[(0,a.jsx)("a",{href:"/login/",children:"Sign in"}),(0,a.jsxs)("a",{className:"button button-white button-small",href:"/signup/",children:["Get started ",(0,a.jsx)("span",{"aria-hidden":"true",children:"\xbb"})]})]}),(0,a.jsx)(o,{}),(0,a.jsxs)("button",{className:"menu-toggle",ref:n,type:"button","aria-label":e?"Close menu":"Open menu","aria-expanded":e,"aria-controls":"navlinks",onClick:()=>t(!e),children:[(0,a.jsx)("span",{}),(0,a.jsx)("span",{})]})]})}}},e=>{e.O(0,[4123,5105,8441,1255,7358],()=>e(e.s=5662)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[977,990,1369,2481,2882,3232,4345,6226,6402,6990,7006,7066,8365,9366,9877],{3652:e=>{e.exports={footer:"SiteFooter_footer__aUaTs",content:"SiteFooter_content__1J6Jy",wordmark:"SiteFooter_wordmark__B6_Tf",navigation:"SiteFooter_navigation__Zsq8o",main:"SiteFooter_main__EWvbi",brand:"SiteFooter_brand__HyIqL",groups:"SiteFooter_groups__tPgIM",group:"SiteFooter_group__FK9ik",more:"SiteFooter_more__LEh69",bottom:"SiteFooter_bottom__ADU2b",srOnly:"SiteFooter_srOnly__e7DbB"}},5662:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,3652,23)),Promise.resolve().then(n.bind(n,8765))},8765:(e,t,n)=>{"use strict";n.d(t,{default:()=>l});var a=n(5155),i=n(2115),r=n(1719);function o(){let[e,t]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{t("light"===document.documentElement.dataset.siteTheme)},[]),(0,a.jsxs)("button",{className:"site-theme-toggle",type:"button","aria-label":e?"Switch to dark mode":"Switch to light mode",title:e?"Switch to dark mode":"Switch to light mode",onClick:()=>{let e="light"!==document.documentElement.dataset.siteTheme,n=e?"light":"dark";document.documentElement.dataset.siteTheme=n,t(e);try{localStorage.setItem("agenttwin-site-theme",n)}catch(e){}},children:[(0,a.jsx)(r.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(r.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let s=[{href:"/what-is-agenttwin/",label:"Product"},{href:"/#how",label:"How it works"},{href:"/pricing/",label:"Pricing"},{href:"/about/",label:"About"},{href:"/docs/",label:"Docs"},{href:"/blog/",label:"Blog"}];function l(){let[e,t]=(0,i.useState)(!1),n=(0,i.useRef)(null),r=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=r.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=r.current)?void 0:n.contains(e.target))||t(!1)},i=matchMedia("(min-width: 1024px)"),o=()=>t(!1);return document.addEventListener("keydown",e),document.addEventListener("click",a),i.addEventListener("change",o),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",a),i.removeEventListener("change",o)}},[]),(0,a.jsxs)("header",{className:"site-header",ref:r,children:[(0,a.jsxs)("a",{className:"brand",href:"/","aria-label":"AgentTwin home",children:[(0,a.jsx)("img",{src:"assets/logo/mark-twin-rings.svg?v=white-rings",alt:"","aria-hidden":"true",width:29,height:29}),"AgentTwin"]}),(0,a.jsxs)("nav",{className:"main-nav".concat(e?" is-open":""),id:"navlinks","aria-label":"Main navigation",children:[s.map(e=>(0,a.jsx)("a",{href:e.href,onClick:()=>t(!1),children:e.label},e.href)),(0,a.jsx)("a",{className:"nav-mobile-dashboard",href:"/dashboard/",onClick:()=>t(!1),children:"Open dashboard"})]}),(0,a.jsxs)("div",{className:"nav-actions",children:[(0,a.jsx)("a",{href:"/login/",children:"Sign in"}),(0,a.jsxs)("a",{className:"button button-white button-small",href:"/signup/",children:["Get started ",(0,a.jsx)("span",{"aria-hidden":"true",children:"\xbb"})]})]}),(0,a.jsx)(o,{}),(0,a.jsxs)("button",{className:"menu-toggle",ref:n,type:"button","aria-label":e?"Close menu":"Open menu","aria-expanded":e,"aria-controls":"navlinks",onClick:()=>t(!e),children:[(0,a.jsx)("span",{}),(0,a.jsx)("span",{})]})]})}}},e=>{e.O(0,[4123,5105,8441,1255,7358],()=>e(e.s=5662)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[977,990,1369,2481,2882,3232,4345,6226,6402,6990,7006,7066,8365,9366,9877],{3652:e=>{e.exports={footer:"SiteFooter_footer__aUaTs",content:"SiteFooter_content__1J6Jy",wordmark:"SiteFooter_wordmark__B6_Tf",navigation:"SiteFooter_navigation__Zsq8o",main:"SiteFooter_main__EWvbi",brand:"SiteFooter_brand__HyIqL",groups:"SiteFooter_groups__tPgIM",group:"SiteFooter_group__FK9ik",more:"SiteFooter_more__LEh69",bottom:"SiteFooter_bottom__ADU2b",srOnly:"SiteFooter_srOnly__e7DbB"}},5662:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,3652,23)),Promise.resolve().then(n.bind(n,8765))},8765:(e,t,n)=>{"use strict";n.d(t,{default:()=>l});var a=n(5155),i=n(2115),r=n(1719);function o(){let[e,t]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{t("light"===document.documentElement.dataset.siteTheme)},[]),(0,a.jsxs)("button",{className:"site-theme-toggle",type:"button","aria-label":e?"Switch to dark mode":"Switch to light mode",title:e?"Switch to dark mode":"Switch to light mode",onClick:()=>{let e="light"!==document.documentElement.dataset.siteTheme,n=e?"light":"dark";document.documentElement.dataset.siteTheme=n,t(e);try{localStorage.setItem("agenttwin-site-theme",n)}catch(e){}},children:[(0,a.jsx)(r.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(r.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let s=[{href:"/what-is-agenttwin/",label:"Product"},{href:"/#how",label:"How it works"},{href:"/pricing/",label:"Pricing"},{href:"/about/",label:"About"},{href:"/docs/",label:"Docs"},{href:"/blog/",label:"Blog"}];function l(){let[e,t]=(0,i.useState)(!1),n=(0,i.useRef)(null),r=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=r.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=r.current)?void 0:n.contains(e.target))||t(!1)},i=matchMedia("(min-width: 1024px)"),o=()=>t(!1);return document.addEventListener("keydown",e),document.addEventListener("click",a),i.addEventListener("change",o),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",a),i.removeEventListener("change",o)}},[]),(0,a.jsxs)("header",{className:"site-header",ref:r,children:[(0,a.jsxs)("a",{className:"brand",href:"/","aria-label":"AgentTwin home",children:[(0,a.jsx)("img",{src:"assets/logo/mark-twin-rings.svg?v=white-rings",alt:"","aria-hidden":"true",width:29,height:29}),"AgentTwin"]}),(0,a.jsxs)("nav",{className:"main-nav".concat(e?" is-open":""),id:"navlinks","aria-label":"Main navigation",children:[s.map(e=>(0,a.jsx)("a",{href:e.href,onClick:()=>t(!1),children:e.label},e.href)),(0,a.jsx)("a",{className:"nav-mobile-dashboard",href:"/dashboard/",onClick:()=>t(!1),children:"Open dashboard"})]}),(0,a.jsxs)("div",{className:"nav-actions",children:[(0,a.jsx)("a",{href:"/login/",children:"Sign in"}),(0,a.jsxs)("a",{className:"button button-white button-small",href:"/signup/",children:["Get started ",(0,a.jsx)("span",{"aria-hidden":"true",children:"\xbb"})]})]}),(0,a.jsx)(o,{}),(0,a.jsxs)("button",{className:"menu-toggle",ref:n,type:"button","aria-label":e?"Close menu":"Open menu","aria-expanded":e,"aria-controls":"navlinks",onClick:()=>t(!e),children:[(0,a.jsx)("span",{}),(0,a.jsx)("span",{})]})]})}}},e=>{e.O(0,[4123,5105,8441,1255,7358],()=>e(e.s=5662)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{540:(e,t,n)=>{"use strict";n.d(t,{default:()=>l});var r=n(2115),i=n(5704);function l(){return(0,r.useEffect)(()=>{let e=i.env.NEXT_PUBLIC_POSTHOG_KEY;if(!e)return;let t=!1;return(async()=>{let{default:r}=await n.e(9432).then(n.bind(n,7385));t||r.init(e,{api_host:i.env.NEXT_PUBLIC_POSTHOG_HOST||"https://analytics.agenttwin.si",capture_pageview:!0,autocapture:!0,persistence:"localStorage+cookie",disable_session_recording:!0,advanced_disable_toolbar_metrics:!0})})(),()=>{t=!0}},[]),null}},1402:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return h},handleClientScriptLoad:function(){return b},initScriptLoader:function(){return y}});let r=n(8140),i=n(9417),l=n(5155),a=r._(n(7650)),s=i._(n(2115)),u=n(2073),o=n(4681),c=n(4853),d=n(9001),f=new Map,p=new Set,_=e=>{let{src:t,id:n,onLoad:r=()=>{},onReady:i=null,dangerouslySetInnerHTML:l,children:s="",strategy:u="afterInteractive",onError:c,stylesheets:d}=e,_=n||t;if(_&&p.has(_))return;if(f.has(t)){p.add(_),f.get(t).then(r,c);return}let b=()=>{i&&i(),p.add(_)},y=document.createElement("script"),g=new Promise((e,t)=>{y.addEventListener("load",function(t){e(),r&&r.call(this,t),b()}),y.addEventListener("error",function(e){t(e)})}).catch(function(e){c&&c(e)});l?(y.innerHTML=l.__html||"",b()):s?(y.textContent="string"==typeof s?s:Array.isArray(s)?s.join(""):"",b()):t&&(y.src=t,f.set(t,g)),(0,o.setAttributesFromProps)(y,e),"worker"===u&&y.setAttribute("type","text/partytown"),y.setAttribute("data-nscript",u),d&&(e=>{if(a.default.preinit)return e.forEach(e=>{a.default.preinit(e,{as:"style"})});{let t=document.head;e.forEach(e=>{let n=document.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,t.appendChild(n)})}})(d),document.body.appendChild(y)};function b(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,c.requestIdleCallback)(()=>_(e))}):_(e)}function y(e){e.forEach(b),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");p.add(t)})}function g(e){let{id:t,src:n="",onLoad:r=()=>{},onReady:i=null,strategy:o="afterInteractive",onError:f,stylesheets:b,...y}=e,{updateScripts:g,scripts:h,getIsSsr:m,appDir:v,nonce:O}=(0,s.useContext)(u.HeadManagerContext);O=y.nonce||O;let E=(0,s.useRef)(!1);(0,s.useEffect)(()=>{let e=t||n;E.current||(i&&e&&p.has(e)&&i(),E.current=!0)},[i,t,n]);let I=(0,s.useRef)(!1);if((0,s.useEffect)(()=>{if(!I.current){if("afterInteractive"===o)_(e);else"lazyOnload"===o&&("complete"===document.readyState?(0,c.requestIdleCallback)(()=>_(e)):window.addEventListener("load",()=>{(0,c.requestIdleCallback)(()=>_(e))}));I.current=!0}},[e,o]),("beforeInteractive"===o||"worker"===o)&&(g?(h[o]=(h[o]||[]).concat([{id:t,src:n,onLoad:r,onReady:i,onError:f,...y,nonce:O}]),g(h)):m&&m()?p.add(t||n):m&&!m()&&_({...e,nonce:O})),v){if(b&&b.forEach(e=>{a.default.preinit(e,{as:"style"})}),"beforeInteractive"===o)if(!n)return y.dangerouslySetInnerHTML&&(y.children=y.dangerouslySetInnerHTML.__html,delete y.dangerouslySetInnerHTML),(0,l.jsx)("script",{nonce:O,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+(0,d.htmlEscapeJsonString)(JSON.stringify([0,{...y,id:t}]))+")"}});else return a.default.preload(n,y.integrity?{as:"script",integrity:y.integrity,nonce:O,crossOrigin:y.crossOrigin}:{as:"script",nonce:O,crossOrigin:y.crossOrigin}),(0,l.jsx)("script",{nonce:O,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+(0,d.htmlEscapeJsonString)(JSON.stringify([n,{...y,id:t}]))+")"}});"afterInteractive"===o&&n&&a.default.preload(n,y.integrity?{as:"script",integrity:y.integrity,nonce:O,crossOrigin:y.crossOrigin}:{as:"script",nonce:O,crossOrigin:y.crossOrigin})}return null}Object.defineProperty(g,"__nextScript",{value:!0});let h=g;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1681:()=>{},4250:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,1402,23)),Promise.resolve().then(n.bind(n,540)),Promise.resolve().then(n.t.bind(n,1681,23)),Promise.resolve().then(n.t.bind(n,6837,23)),Promise.resolve().then(n.t.bind(n,4510,23)),Promise.resolve().then(n.t.bind(n,4730,23))},4510:()=>{},4730:()=>{},4853:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{cancelIdleCallback:function(){return r},requestIdleCallback:function(){return n}});let n="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(e){let t=Date.now();return self.setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},r="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(e){return clearTimeout(e)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6837:()=>{},9001:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ESCAPE_REGEX:function(){return r},htmlEscapeAttributeString:function(){return s},htmlEscapeJsonString:function(){return a}});let n={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},r=/[&><\u2028\u2029]/g,i={"&":"&",'"':""","'":"'","<":"<",">":">"},l=/[&"'<>]/g;function a(e){return e.replace(r,e=>n[e])}function s(e){return e.replace(l,e=>i[e])}}},e=>{e.O(0,[4203,8441,1255,7358],()=>e(e.s=4250)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[879,4520],{9105:(e,s,_)=>{Promise.resolve().then(_.bind(_,6787))}},e=>{e.O(0,[3935,6787,8441,1255,7358],()=>e(e.s=9105)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[977,990,1369,2481,2882,3232,4345,6226,6402,6990,7006,7066,8365,9366,9877],{3652:e=>{e.exports={footer:"SiteFooter_footer__aUaTs",content:"SiteFooter_content__1J6Jy",wordmark:"SiteFooter_wordmark__B6_Tf",navigation:"SiteFooter_navigation__Zsq8o",main:"SiteFooter_main__EWvbi",brand:"SiteFooter_brand__HyIqL",groups:"SiteFooter_groups__tPgIM",group:"SiteFooter_group__FK9ik",more:"SiteFooter_more__LEh69",bottom:"SiteFooter_bottom__ADU2b",srOnly:"SiteFooter_srOnly__e7DbB"}},5662:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,3652,23)),Promise.resolve().then(n.bind(n,8765))},8765:(e,t,n)=>{"use strict";n.d(t,{default:()=>l});var a=n(5155),i=n(2115),r=n(1719);function o(){let[e,t]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{t("light"===document.documentElement.dataset.siteTheme)},[]),(0,a.jsxs)("button",{className:"site-theme-toggle",type:"button","aria-label":e?"Switch to dark mode":"Switch to light mode",title:e?"Switch to dark mode":"Switch to light mode",onClick:()=>{let e="light"!==document.documentElement.dataset.siteTheme,n=e?"light":"dark";document.documentElement.dataset.siteTheme=n,t(e);try{localStorage.setItem("agenttwin-site-theme",n)}catch(e){}},children:[(0,a.jsx)(r.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(r.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let s=[{href:"/what-is-agenttwin/",label:"Product"},{href:"/#how",label:"How it works"},{href:"/pricing/",label:"Pricing"},{href:"/about/",label:"About"},{href:"/docs/",label:"Docs"},{href:"/blog/",label:"Blog"}];function l(){let[e,t]=(0,i.useState)(!1),n=(0,i.useRef)(null),r=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=r.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=r.current)?void 0:n.contains(e.target))||t(!1)},i=matchMedia("(min-width: 1024px)"),o=()=>t(!1);return document.addEventListener("keydown",e),document.addEventListener("click",a),i.addEventListener("change",o),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",a),i.removeEventListener("change",o)}},[]),(0,a.jsxs)("header",{className:"site-header",ref:r,children:[(0,a.jsxs)("a",{className:"brand",href:"/","aria-label":"AgentTwin home",children:[(0,a.jsx)("img",{src:"assets/logo/mark-twin-rings.svg?v=white-rings",alt:"","aria-hidden":"true",width:29,height:29}),"AgentTwin"]}),(0,a.jsxs)("nav",{className:"main-nav".concat(e?" is-open":""),id:"navlinks","aria-label":"Main navigation",children:[s.map(e=>(0,a.jsx)("a",{href:e.href,onClick:()=>t(!1),children:e.label},e.href)),(0,a.jsx)("a",{className:"nav-mobile-dashboard",href:"/dashboard/",onClick:()=>t(!1),children:"Open dashboard"})]}),(0,a.jsxs)("div",{className:"nav-actions",children:[(0,a.jsx)("a",{href:"/login/",children:"Sign in"}),(0,a.jsxs)("a",{className:"button button-white button-small",href:"/signup/",children:["Get started ",(0,a.jsx)("span",{"aria-hidden":"true",children:"\xbb"})]})]}),(0,a.jsx)(o,{}),(0,a.jsxs)("button",{className:"menu-toggle",ref:n,type:"button","aria-label":e?"Close menu":"Open menu","aria-expanded":e,"aria-controls":"navlinks",onClick:()=>t(!e),children:[(0,a.jsx)("span",{}),(0,a.jsx)("span",{})]})]})}}},e=>{e.O(0,[4123,5105,8441,1255,7358],()=>e(e.s=5662)),_N_E=e.O()}]);
|