agenttwin 0.3.32 → 0.3.34

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.
Files changed (119) hide show
  1. package/dist/api.js +14217 -2453
  2. package/dist/dashboard/assets/next/static/chunks/{1937-6c86fddc443de922.js → 1937-2369d8ef2eae7700.js} +1 -1
  3. package/dist/dashboard/assets/next/static/chunks/app/_not-found/{page-5d1ba67144da5868.js → page-b60a5aad66f3bf1d.js} +1 -1
  4. package/dist/dashboard/assets/next/static/chunks/app/about/page-a30c6925cc9ac983.js +1 -0
  5. package/dist/dashboard/assets/next/static/chunks/app/account/password/page-0478a7f18cc5e31b.js +1 -0
  6. package/dist/dashboard/assets/next/static/chunks/app/api-policy/page-91ad6c5e4226778f.js +1 -0
  7. package/dist/dashboard/assets/next/static/chunks/app/auth/page-91ad6c5e4226778f.js +1 -0
  8. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-mockoon/page-46b9ffc514b56c84.js +1 -0
  9. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-pact/page-46b9ffc514b56c84.js +1 -0
  10. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-testcontainers/page-46b9ffc514b56c84.js +1 -0
  11. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-wiremock/page-46b9ffc514b56c84.js +1 -0
  12. package/dist/dashboard/assets/next/static/chunks/app/blog/choose-first-agent-workflow-test/page-46b9ffc514b56c84.js +1 -0
  13. package/dist/dashboard/assets/next/static/chunks/app/blog/clean-baseline-before-fault-injection/page-46b9ffc514b56c84.js +1 -0
  14. package/dist/dashboard/assets/next/static/chunks/app/blog/idempotency-keys-and-safe-retries/page-46b9ffc514b56c84.js +1 -0
  15. package/dist/dashboard/assets/next/static/chunks/app/blog/keep-real-service-tests-with-digital-twins/page-46b9ffc514b56c84.js +1 -0
  16. package/dist/dashboard/assets/next/static/chunks/app/blog/keploy-alternatives-for-database-and-payment-workflows/page-46b9ffc514b56c84.js +1 -0
  17. package/dist/dashboard/assets/next/static/chunks/app/blog/layout-6c159db381b82832.js +1 -0
  18. package/dist/dashboard/assets/next/static/chunks/app/blog/page-46b9ffc514b56c84.js +1 -0
  19. package/dist/dashboard/assets/next/static/chunks/app/blog/read-workflow-test-receipts/page-46b9ffc514b56c84.js +1 -0
  20. package/dist/dashboard/assets/next/static/chunks/app/blog/reset-test-environment-between-runs/page-46b9ffc514b56c84.js +1 -0
  21. package/dist/dashboard/assets/next/static/chunks/app/blog/simulate-timeouts-and-duplicate-events/page-46b9ffc514b56c84.js +1 -0
  22. package/dist/dashboard/assets/next/static/chunks/app/blog/test-boundaries-for-ai-agents/page-46b9ffc514b56c84.js +1 -0
  23. package/dist/dashboard/assets/next/static/chunks/app/blog/timeout-retry-double-charge/page-46b9ffc514b56c84.js +1 -0
  24. package/dist/dashboard/assets/next/static/chunks/app/blog/we-ran-50-real-incidents-through-agenttwin/page-46b9ffc514b56c84.js +1 -0
  25. package/dist/dashboard/assets/next/static/chunks/app/blog/why-ai-agents-delete-production-databases/page-46b9ffc514b56c84.js +1 -0
  26. package/dist/dashboard/assets/next/static/chunks/app/blog/workflow-testing-evaluation-checklist/page-46b9ffc514b56c84.js +1 -0
  27. package/dist/dashboard/assets/next/static/chunks/app/blog/write-better-workflow-assertions/page-46b9ffc514b56c84.js +1 -0
  28. package/dist/dashboard/assets/next/static/chunks/app/compare/page-91ad6c5e4226778f.js +1 -0
  29. package/dist/dashboard/assets/next/static/chunks/app/contact/page-91ad6c5e4226778f.js +1 -0
  30. package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-0050f308b9f77c24.js +1 -0
  31. package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-6245aa3ad5d7f527.js +1 -0
  32. package/dist/dashboard/assets/next/static/chunks/app/demo/{page-ef75632088a6ea0b.js → page-ac6e235c635cb130.js} +1 -1
  33. package/dist/dashboard/assets/next/static/chunks/app/developers/page-91ad6c5e4226778f.js +1 -0
  34. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-5afd0649dd30ef88.js +1 -0
  35. package/dist/dashboard/assets/next/static/chunks/app/dpa/page-91ad6c5e4226778f.js +1 -0
  36. package/dist/dashboard/assets/next/static/chunks/app/enterprise/{page-91c6176f28dfdccd.js → page-11514cc52285b7f3.js} +1 -1
  37. package/dist/dashboard/assets/next/static/chunks/app/guides/page-91ad6c5e4226778f.js +1 -0
  38. package/dist/dashboard/assets/next/static/chunks/app/{layout-be64d3e50db4b7a9.js → layout-8aa153f632f0aa20.js} +1 -1
  39. package/dist/dashboard/assets/next/static/chunks/app/login/page-99ebb4d265222728.js +1 -0
  40. package/dist/dashboard/assets/next/static/chunks/app/not-found-91ad6c5e4226778f.js +1 -0
  41. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-9e59af0296c9366b.js +1 -0
  42. package/dist/dashboard/assets/next/static/chunks/app/{page-ede77810f4904ea5.js → page-76277dc68b6a22bd.js} +1 -1
  43. package/dist/dashboard/assets/next/static/chunks/app/{blog/layout-b095a34d742bd1fd.js → pricing/page-c7015af858f4db8e.js} +1 -1
  44. package/dist/dashboard/assets/next/static/chunks/app/privacy/page-91ad6c5e4226778f.js +1 -0
  45. package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-91ad6c5e4226778f.js +1 -0
  46. package/dist/dashboard/assets/next/static/chunks/app/scoreboard/page-91ad6c5e4226778f.js +1 -0
  47. package/dist/dashboard/assets/next/static/chunks/app/security/page-91ad6c5e4226778f.js +1 -0
  48. package/dist/dashboard/assets/next/static/chunks/app/signup/page-99ebb4d265222728.js +1 -0
  49. package/dist/dashboard/assets/next/static/chunks/app/sitemap.xml/route-46b9ffc514b56c84.js +1 -0
  50. package/dist/dashboard/assets/next/static/chunks/app/status/{page-569ae36bd08d867c.js → page-fd41c4e7838d9949.js} +1 -1
  51. package/dist/dashboard/assets/next/static/chunks/app/subprocessors/page-91ad6c5e4226778f.js +1 -0
  52. package/dist/dashboard/assets/next/static/chunks/app/terms/page-91ad6c5e4226778f.js +1 -0
  53. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/{layout-b92ad482b0164f93.js → layout-a79d128eb3b0b7d2.js} +1 -1
  54. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-a9fa05c9ae5c24dc.js +1 -0
  55. package/dist/dashboard/assets/next/static/chunks/app/v2/layout-2e97381ae7a59ba0.js +1 -0
  56. package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-57afbac97afd31fa.js +1 -0
  57. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/{page-79cd80f87d39230d.js → page-7c08d2c43f0be9d5.js} +1 -1
  58. package/dist/dashboard/assets/next/static/chunks/app/v2/page-35998431fb40a9c9.js +1 -0
  59. package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-57afbac97afd31fa.js +1 -0
  60. package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-91ad6c5e4226778f.js +1 -0
  61. package/dist/dashboard/assets/next/static/chunks/{main-app-b4faf61f2e1c2b6d.js → main-app-4051d8ba998bea15.js} +1 -1
  62. package/dist/dashboard/assets/next/static/chunks/{webpack-53525dd96c1c1e70.js → webpack-57e0c1e343bdc899.js} +1 -1
  63. package/dist/dashboard/assets/next/static/p_5KE1JZcErklSND_EYv3/_buildManifest.js +1 -0
  64. package/dist/dashboard/index.html +2 -2
  65. package/dist/engine.js +1358 -565
  66. package/dist/gateway.js +14235 -2467
  67. package/dist/twins/catalog.json +113 -113
  68. package/dist/twins/packs/stripe/index.mjs +8 -8
  69. package/dist/worker.js +97 -20
  70. package/dist/world-host.js +140 -26
  71. package/package.json +1 -1
  72. package/dist/dashboard/assets/next/static/chunks/app/about/page-b09a2d8452522c20.js +0 -1
  73. package/dist/dashboard/assets/next/static/chunks/app/account/password/page-b9ca284314cace59.js +0 -1
  74. package/dist/dashboard/assets/next/static/chunks/app/api-policy/page-94d508052ae30dcb.js +0 -1
  75. package/dist/dashboard/assets/next/static/chunks/app/auth/page-94d508052ae30dcb.js +0 -1
  76. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-mockoon/page-11a5fdc2662ff51d.js +0 -1
  77. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-pact/page-11a5fdc2662ff51d.js +0 -1
  78. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-testcontainers/page-11a5fdc2662ff51d.js +0 -1
  79. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-wiremock/page-11a5fdc2662ff51d.js +0 -1
  80. package/dist/dashboard/assets/next/static/chunks/app/blog/choose-first-agent-workflow-test/page-11a5fdc2662ff51d.js +0 -1
  81. package/dist/dashboard/assets/next/static/chunks/app/blog/clean-baseline-before-fault-injection/page-11a5fdc2662ff51d.js +0 -1
  82. package/dist/dashboard/assets/next/static/chunks/app/blog/idempotency-keys-and-safe-retries/page-11a5fdc2662ff51d.js +0 -1
  83. package/dist/dashboard/assets/next/static/chunks/app/blog/keep-real-service-tests-with-digital-twins/page-11a5fdc2662ff51d.js +0 -1
  84. package/dist/dashboard/assets/next/static/chunks/app/blog/keploy-alternatives-for-database-and-payment-workflows/page-11a5fdc2662ff51d.js +0 -1
  85. package/dist/dashboard/assets/next/static/chunks/app/blog/page-11a5fdc2662ff51d.js +0 -1
  86. package/dist/dashboard/assets/next/static/chunks/app/blog/read-workflow-test-receipts/page-11a5fdc2662ff51d.js +0 -1
  87. package/dist/dashboard/assets/next/static/chunks/app/blog/reset-test-environment-between-runs/page-11a5fdc2662ff51d.js +0 -1
  88. package/dist/dashboard/assets/next/static/chunks/app/blog/simulate-timeouts-and-duplicate-events/page-11a5fdc2662ff51d.js +0 -1
  89. package/dist/dashboard/assets/next/static/chunks/app/blog/test-boundaries-for-ai-agents/page-11a5fdc2662ff51d.js +0 -1
  90. package/dist/dashboard/assets/next/static/chunks/app/blog/workflow-testing-evaluation-checklist/page-11a5fdc2662ff51d.js +0 -1
  91. package/dist/dashboard/assets/next/static/chunks/app/blog/write-better-workflow-assertions/page-11a5fdc2662ff51d.js +0 -1
  92. package/dist/dashboard/assets/next/static/chunks/app/compare/page-94d508052ae30dcb.js +0 -1
  93. package/dist/dashboard/assets/next/static/chunks/app/contact/page-94d508052ae30dcb.js +0 -1
  94. package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-820e83f47c1bfe08.js +0 -1
  95. package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-8b436163bc85e182.js +0 -1
  96. package/dist/dashboard/assets/next/static/chunks/app/developers/page-94d508052ae30dcb.js +0 -1
  97. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-c25a8cab5ab065c4.js +0 -1
  98. package/dist/dashboard/assets/next/static/chunks/app/dpa/page-94d508052ae30dcb.js +0 -1
  99. package/dist/dashboard/assets/next/static/chunks/app/guides/page-94d508052ae30dcb.js +0 -1
  100. package/dist/dashboard/assets/next/static/chunks/app/login/page-7ee25051f2743d68.js +0 -1
  101. package/dist/dashboard/assets/next/static/chunks/app/not-found-94d508052ae30dcb.js +0 -1
  102. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-26b963fb1dc02cc7.js +0 -1
  103. package/dist/dashboard/assets/next/static/chunks/app/pricing/page-535834810dc4bee1.js +0 -1
  104. package/dist/dashboard/assets/next/static/chunks/app/privacy/page-94d508052ae30dcb.js +0 -1
  105. package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-94d508052ae30dcb.js +0 -1
  106. package/dist/dashboard/assets/next/static/chunks/app/scoreboard/page-94d508052ae30dcb.js +0 -1
  107. package/dist/dashboard/assets/next/static/chunks/app/security/page-94d508052ae30dcb.js +0 -1
  108. package/dist/dashboard/assets/next/static/chunks/app/signup/page-7ee25051f2743d68.js +0 -1
  109. package/dist/dashboard/assets/next/static/chunks/app/sitemap.xml/route-11a5fdc2662ff51d.js +0 -1
  110. package/dist/dashboard/assets/next/static/chunks/app/subprocessors/page-94d508052ae30dcb.js +0 -1
  111. package/dist/dashboard/assets/next/static/chunks/app/terms/page-94d508052ae30dcb.js +0 -1
  112. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-b1341267b2478360.js +0 -1
  113. package/dist/dashboard/assets/next/static/chunks/app/v2/layout-edb84faba63372b4.js +0 -1
  114. package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-bfbe86a28adc6d30.js +0 -1
  115. package/dist/dashboard/assets/next/static/chunks/app/v2/page-1391f1ae01a91dc0.js +0 -1
  116. package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-bfbe86a28adc6d30.js +0 -1
  117. package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-94d508052ae30dcb.js +0 -1
  118. package/dist/dashboard/assets/next/static/dQPcd2gl7ABZiL9lr9ruM/_buildManifest.js +0 -1
  119. /package/dist/dashboard/assets/next/static/{dQPcd2gl7ABZiL9lr9ruM → p_5KE1JZcErklSND_EYv3}/_ssgManifest.js +0 -0
@@ -123,7 +123,9 @@ function esbuildBinary(real){const match=real.match(/^(.*[\/\\]node_modules[\/\\
123
123
  // the same name inside a project or earlier on PATH is still reported.
124
124
  const SYSTEM_INFO_BINARIES=new Set(['/usr/bin/uname','/bin/uname','/usr/bin/sw_vers','/usr/bin/arch','/usr/bin/nproc','/usr/bin/getconf']);
125
125
  function systemInfoBinary(real){return process.platform!=='win32'&&SYSTEM_INFO_BINARIES.has(real);}
126
- function trustedExecutable(file,options){const real=nodeFs.realpathSync(file);const key=real+'\0'+String(envPath((options&&options.env)||process.env)||'');if(executableTrust.has(key))return executableTrust.get(key);let trusted=real===nodeReal||esbuildBinary(real)||systemInfoBinary(real);if(!trusted&&isRunnable(real)){const fd=nodeFs.openSync(real,'r');try{const head=Buffer.alloc(256);const read=nodeFs.readSync(fd,head,0,256,0);trusted=nodeShebang(head.subarray(0,read).toString('latin1'),options);}finally{nodeFs.closeSync(fd);}}if(executableTrust.size<1000)executableTrust.set(key,trusted);return trusted;}
126
+ // pnpm's node_modules/.bin entries are sh scripts that exec node on the package's JS: the child is Node and loads the hook.
127
+ function pnpmNodeShim(real,text){if(!/[\\/]node_modules[\\/]\.bin[\\/]/.test(real)||!/^#!\/bin\/sh/.test(text))return false;const execs=[...text.matchAll(/\bexec\s+(\S+)/g)].map(m=>m[1]);return execs.length>0&&execs.every(e=>/^(?:node|"\$basedir\/node)(?:\.exe)?"?$/.test(e));}
128
+ function trustedExecutable(file,options){const real=nodeFs.realpathSync(file);const key=real+'\0'+String(envPath((options&&options.env)||process.env)||'');if(executableTrust.has(key))return executableTrust.get(key);let trusted=real===nodeReal||esbuildBinary(real)||systemInfoBinary(real);if(!trusted&&isRunnable(real)){const fd=nodeFs.openSync(real,'r');try{const head=Buffer.alloc(8192);const read=nodeFs.readSync(fd,head,0,8192,0);const text=head.subarray(0,read).toString('latin1');trusted=nodeShebang(text.slice(0,256),options)||pnpmNodeShim(real,text);}finally{nodeFs.closeSync(fd);}}if(executableTrust.size<1000)executableTrust.set(key,trusted);return trusted;}
127
129
  const reportedSubprocesses=new Set();
128
130
  function hookedEnv(options){const env={...((options&&options.env)||process.env)};const current=env.NODE_OPTIONS||'';if(!current.includes(__filename))env.NODE_OPTIONS=(current+' '+hookOption).trim();env.AGENTTWIN_HOOK_CHILD='1';return {...(options||{}),env};}
129
131
  // Never throws: an unclassifiable command is reported, and the application's spawn proceeds unchanged.
@@ -155,7 +157,9 @@ if(originalFetch)globalThis.fetch=async function(input,init){
155
157
  const target=route?route.endpoint+url.pathname+url.search:url.href;
156
158
  // Forward the body as bytes: copying a keepalive Request whose body is a stream throws in Node's fetch.
157
159
  const body=request.method==='GET'||request.method==='HEAD'?undefined:await request.arrayBuffer();
158
- return originalFetch(target,{method:request.method,headers,body,signal:request.signal,redirect:'error'});
160
+ const signal=init?.signal??(input instanceof Request?input.signal:undefined),sent=originalFetch(target,{method:request.method,headers,body,signal:request.signal,redirect:'error'});
161
+ if(!signal)return sent;if(signal.aborted)throw signal.reason;
162
+ return new Promise((resolve,reject)=>{const stop=()=>reject(signal.reason);signal.addEventListener('abort',stop,{once:true});sent.then(v=>{signal.removeEventListener('abort',stop);resolve(v);},e=>{signal.removeEventListener('abort',stop);reject(e);});});
159
163
  };
160
164
  const plainHttp={request:http.request,get:http.get};
161
165
  const loopback=host=>['127.0.0.1','localhost','::1','[::1]'].includes(host);
@@ -5271,6 +5275,7 @@ function parseWorld(value) {
5271
5275
  if (v.applicationClock !== void 0 && !validApplicationClock(v.applicationClock)) invalid("applicationClock requires only now as a canonical UTC timestamp with milliseconds");
5272
5276
  if (!Array.isArray(v.services) || !v.services.length || v.services.length > 10) invalid("services must contain 1\u201310 HTTP services");
5273
5277
  const services = /* @__PURE__ */ new Map();
5278
+ const requestPathFaults = /* @__PURE__ */ new Set();
5274
5279
  for (const service of v.services) {
5275
5280
  if (!object2(service) || typeof service.name !== "string" || !namePattern.test(service.name) || services.has(service.name)) invalid("service names must be unique lowercase identifiers");
5276
5281
  const item = service;
@@ -5289,6 +5294,7 @@ function parseWorld(value) {
5289
5294
  if (item.account !== void 0 && (!isPackAdapter(item.adapter) || !object2(item.account) || Object.keys(item.account).length > 10 || !Object.entries(item.account).every(([k, val]) => /^_?[a-z][a-z0-9_]{0,40}$/.test(k) && ["string", "number", "boolean"].includes(typeof val) && String(val).length <= 200))) invalid("account is for twin packs only: up to 10 simple fields with string, number or boolean values");
5290
5295
  if (item.doorRecords !== void 0 && (!isPackAdapter(item.adapter) || !Array.isArray(item.doorRecords) || item.doorRecords.length > 5 || !item.doorRecords.every((r) => object2(r) && typeof r.type === "string" && /^[a-z][a-z0-9_]{0,40}$/.test(r.type) && typeof r.id === "string" && /^[A-Za-z0-9_.:-]{1,80}$/.test(r.id) && object2(r.fields) && JSON.stringify(r.fields).length <= 2e4))) invalid("doorRecords is for twin packs only: up to 5 records with a type, an id and their fields");
5291
5296
  services.set(item.name, /* @__PURE__ */ new Set([...paths, ...optional]));
5297
+ if (typeof item.adapter === "string" && ADAPTER_COLLECTIONS[item.adapter] && !["stripe", "slack", "json-collection"].includes(item.adapter)) requestPathFaults.add(item.name);
5292
5298
  }
5293
5299
  const known2 = (entry) => typeof entry.service === "string" && typeof entry.path === "string" && services.get(entry.service)?.has(entry.path);
5294
5300
  if (!Array.isArray(v.assertions) || !v.assertions.length || v.assertions.length > 100) invalid("at least one final-state assertion is required (maximum 100)");
@@ -5334,7 +5340,7 @@ function parseWorld(value) {
5334
5340
  }
5335
5341
  }
5336
5342
  if (v.fault !== void 0) {
5337
- if (!object2(v.fault) || !known2(v.fault) || !FAULT_TYPES.includes(v.fault.type)) invalid("fault requires an existing service/path and a supported type: timeout-after-write, blackhole, server-error, duplicate-write or slow-response");
5343
+ if (!object2(v.fault) || !(known2(v.fault) || requestPathFaults.has(String(v.fault.service)) && typeof v.fault.path === "string" && /^\/[a-zA-Z0-9_.:/-]+$/.test(v.fault.path) && !v.fault.path.includes("//")) || !FAULT_TYPES.includes(v.fault.type)) invalid("fault requires an existing service/path and a supported type: timeout-after-write, blackhole, server-error, duplicate-write or slow-response");
5338
5344
  const f = v.fault;
5339
5345
  const allowed = ["service", "path", "type"];
5340
5346
  const count = f.count, windowMs = f.windowMs;
@@ -5777,7 +5783,7 @@ import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
5777
5783
  import { mkdir, mkdtemp as mkdtemp3, rm as rm3, writeFile as writeFile2 } from "fs/promises";
5778
5784
  import { tmpdir as tmpdir3 } from "os";
5779
5785
  import { join as join6 } from "path";
5780
- var slackDirectMessageId, idempotencyKeyDigest, HttpWorld;
5786
+ var KEYED_PACKS, slackDirectMessageId, idempotencyKeyDigest, HttpWorld;
5781
5787
  var init_http_world = __esm({
5782
5788
  "src/runtime/http-world.ts"() {
5783
5789
  "use strict";
@@ -5794,6 +5800,7 @@ var init_http_world = __esm({
5794
5800
  init_pack_log();
5795
5801
  init_pack_aliases();
5796
5802
  init_compatible_packs();
5803
+ KEYED_PACKS = /* @__PURE__ */ new Set(["resend"]);
5797
5804
  slackDirectMessageId = (user) => `D${createHash6("sha256").update(user).digest("hex").slice(0, 16).toUpperCase()}`;
5798
5805
  idempotencyKeyDigest = (key2) => typeof key2 === "string" && key2 ? `sha256:${createHash6("sha256").update(key2).digest("hex").slice(0, 16)}` : void 0;
5799
5806
  HttpWorld = class {
@@ -6192,7 +6199,7 @@ var init_http_world = __esm({
6192
6199
  return;
6193
6200
  }
6194
6201
  }
6195
- if (!this.fired && result.operation === "write" && fault?.type === "timeout-after-write" && fault.service === service.name && fault.path === result.collection) {
6202
+ if (!this.fired && result.operation === "write" && fault?.type === "timeout-after-write" && fault.service === service.name && (fault.path === result.collection || matchesFault(normalPath(req.url ?? "/", req.method)))) {
6196
6203
  this.fired = true;
6197
6204
  this.faultActions++;
6198
6205
  this.record(service.name, "fault", result.collection, `write committed; response delayed ${fault.delayMs}ms`);
@@ -6354,6 +6361,8 @@ var init_http_world = __esm({
6354
6361
  rawServers = [];
6355
6362
  /** Each pack service's plain-TCP port for clients that open their own TLS sockets (see startPack). */
6356
6363
  packTcp = /* @__PURE__ */ Object.create(null);
6364
+ /** Saved responses by service, path and Idempotency-Key, for packs whose vendor replays keyed requests. */
6365
+ packReplays = /* @__PURE__ */ new Map();
6357
6366
  /**
6358
6367
  * A twin pack served behind this world: the run token is checked and swapped for the credential the pack issued,
6359
6368
  * seeded fault schedules apply around the pack's own handler, and every action the pack logs becomes evidence — writes
@@ -6461,7 +6470,7 @@ var init_http_world = __esm({
6461
6470
  const row = { id, ...a.fields ?? {} };
6462
6471
  if (removed) {
6463
6472
  if (at >= 0) rows2.splice(at, 1);
6464
- } else if (at >= 0) rows2[at] = row;
6473
+ } else if (at >= 0) rows2[at] = { ...rows2[at], ...row };
6465
6474
  else rows2.push(row);
6466
6475
  if (!evidence) continue;
6467
6476
  const byApp = a.actor?.kind === "agent" && !byWorld;
@@ -6608,6 +6617,13 @@ var init_http_world = __esm({
6608
6617
  return { status: r.status, headers: r.headers, bytes: model.restore(Buffer.from(await r.arrayBuffer())), actions: log.drain() };
6609
6618
  };
6610
6619
  if (workspace && method !== "GET") this.causing[service.name] = 1;
6620
+ const replayKey = !workspace && method === "POST" && typeof requestKey === "string" && requestKey && KEYED_PACKS.has(name) ? `${service.name}:${path}:${requestKey}` : void 0;
6621
+ const replay = replayKey ? this.packReplays.get(replayKey) : void 0;
6622
+ if (replay) {
6623
+ this.record(service.name, "twin", path, `replayed the first response for Idempotency-Key ${requestKey}; nothing written`);
6624
+ respond(replay.status, replay.out, replay.bytes);
6625
+ return;
6626
+ }
6611
6627
  const first = await serialized(call).finally(() => {
6612
6628
  if (workspace) this.causing[service.name] = 0;
6613
6629
  });
@@ -6653,13 +6669,14 @@ var init_http_world = __esm({
6653
6669
  first.headers.forEach((v, k) => {
6654
6670
  if (!/^(content-length|transfer-encoding|connection)$/i.test(k)) out[k] = v;
6655
6671
  });
6656
- if (target && !this.fired && fault?.type === "timeout-after-write" && fault.service === service.name && matchesFault(target)) {
6672
+ if (replayKey && first.status < 500) this.packReplays.set(replayKey, { status: first.status, out, bytes: first.bytes });
6673
+ if (target && !this.fired && fault?.type === "timeout-after-write" && fault.service === service.name && (matchesFault(target) || matchesFault(path))) {
6657
6674
  this.fired = true;
6658
6675
  this.faultActions++;
6659
6676
  this.record(service.name, "fault", target, `write committed; response delayed ${fault.delayMs}ms`);
6660
6677
  this.keyed(requestKey);
6661
6678
  later(fault.delayMs, () => send(first.status, out, first.bytes));
6662
- } else if (fault?.type === "slow-response" && faultOrdinalsFor && matchesFault(target ?? path) && faultOrdinalsFor.includes(this.candidateIndex(faultKey))) {
6679
+ } else if (fault?.type === "slow-response" && faultOrdinalsFor && (matchesFault(target ?? path) || matchesFault(path)) && faultOrdinalsFor.includes(this.candidateIndex(faultKey))) {
6663
6680
  this.faultActions++;
6664
6681
  this.record(service.name, "fault", target ?? path, `slow-response: ${target ? "write" : "request"} applied; response delayed ${fault.delayMs}ms`);
6665
6682
  this.keyed(requestKey);
@@ -7936,7 +7953,8 @@ function genericChecks(calls, opts = {}) {
7936
7953
  impact: impactOf(group, made - 1, "data-integrity", `the same ${first.resourcePath.split("/").filter((s) => s !== "{id}").pop() ?? "record"} exists ${times(made)} downstream`),
7937
7954
  ...group[group.length - 1].source ? { source: group[group.length - 1].source } : {},
7938
7955
  writeSites: sites(group),
7939
- fix: announce ? "check-before-resend" : "idempotency-key"
7956
+ fix: announce ? "check-before-resend" : "idempotency-key",
7957
+ ...group.length === 1 && first.duplicated && !first.idempotencyKey && !opts.duplicateDelivery ? { advisory: true } : {}
7940
7958
  });
7941
7959
  continue;
7942
7960
  }
@@ -7969,9 +7987,9 @@ function genericChecks(calls, opts = {}) {
7969
7987
  fix: "respect-retry-after"
7970
7988
  });
7971
7989
  }
7972
- const unrecoveredBefore = (seq) => writes.filter((w) => w.sequence < seq && !announcementSeqs.has(w.sequence) && FAILED.includes(w.outcome) && w.outcome !== "lost-response" && !(w.outcome === "timeout" && w.committed) && !writes.some((r) => r.sequence > w.sequence && r.sequence < seq && sameRequest(w, r) && succeeded(r)));
7990
+ const unrecoveredBefore = (seq, via) => writes.filter((w) => w.sequence < seq && !(via && sameRequest(w, via) && succeeded(via)) && !announcementSeqs.has(w.sequence) && FAILED.includes(w.outcome) && w.outcome !== "lost-response" && !(w.outcome === "timeout" && w.committed) && !writes.some((r) => r.sequence > w.sequence && r.sequence < seq && sameRequest(w, r) && succeeded(r)));
7973
7991
  for (const claim of claims.filter((c) => c.polarity === "success")) {
7974
- const failed = unrecoveredBefore(claim.sequence)[0], via = claim.via !== void 0 ? ordered.find((c) => c.sequence === claim.via) : void 0;
7992
+ const via = claim.via !== void 0 ? ordered.find((c) => c.sequence === claim.via) : void 0, failed = unrecoveredBefore(claim.sequence, via)[0];
7975
7993
  if (!failed || covered(via?.service ?? failed.service, "announce-after-failed-write")) continue;
7976
7994
  out.push({
7977
7995
  check: "announce-after-failed-write",
@@ -8018,7 +8036,7 @@ function genericChecks(calls, opts = {}) {
8018
8036
  break;
8019
8037
  }
8020
8038
  }
8021
- for (const failed of writes.filter((w) => FAILED.includes(w.outcome) && !(w.outcome === "timeout" && w.committed) && w.outcome !== "lost-response")) {
8039
+ for (const failed of writes.filter((w) => FAILED.includes(w.outcome) && !(w.outcome === "timeout" && w.committed) && w.outcome !== "lost-response" && !announcementSeqs.has(w.sequence) && !isAnnouncement(w) && !MESSAGING.test(w.path))) {
8022
8040
  if (writes.some((r) => r.sequence > failed.sequence && sameRequest(failed, r) && succeeded(r))) continue;
8023
8041
  const committed = writes.find((a) => a.sequence < failed.sequence && a.service !== failed.service && effects(a) > 0 && !announcementSeqs.has(a.sequence) && !isAnnouncement(a) && !writes.some((x) => x.sequence > failed.sequence && x.service === a.service && (x.resourceId ? x.resourceId === a.resourceId : x.resourcePath === a.resourcePath) && effects(x) > 0));
8024
8042
  if (!committed || covered(committed.service, "partial-commit")) continue;
@@ -8210,7 +8228,7 @@ function defaultChecksFor(services, opts = {}) {
8210
8228
  }
8211
8229
  function runDefaultChecks(input) {
8212
8230
  const services = input.spec.services.map((s) => ({ name: s.name, adapter: s.adapter ?? "json-collection", collections: s.collections }));
8213
- return defaultChecksFor(services, { postgres: !!input.database && !!input.spec.postgres }).map(({ service, check }) => {
8231
+ return defaultChecksFor(services, { postgres: !!input.database }).map(({ service, check }) => {
8214
8232
  const violations = check.run({ service, services, initialState: input.initialState, finalState: input.finalState, events: input.events, fault: input.fault, database: input.database, duplicateDelivery: input.duplicateDelivery });
8215
8233
  const base = { id: `default.${check.id}.${service.name}`, kind: "default", check: check.id, title: check.title, service: service.name, expected: check.expected };
8216
8234
  if (!violations.length) return { ...base, path: check.path, passed: true, actual: "no violations" };
@@ -8231,7 +8249,7 @@ function runDefaultChecks(input) {
8231
8249
  };
8232
8250
  });
8233
8251
  }
8234
- var PROVIDER, displayName, rowsOf, VOLATILE2, volatileKey, canonical3, contentSignature, writeSequences, times2, money, stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries, NEGATIVE, gmailText, postgresUpdateApplied, postgresNoDuplicateInsert, NOT_EFFECTS, genericRepeat, DEFAULT_CHECKS, VENDOR_COVERS, registryFor, refOf;
8252
+ var PROVIDER, displayName, rowsOf, VOLATILE2, volatileKey, canonical3, contentSignature, writeSequences, times2, money, stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries, NEGATIVE, gmailText, TARGETED, postgresUpdateApplied, postgresNoDuplicateInsert, RELATIVE_SET, postgresNoRepeatedRelativeUpdate, UNSCOPED, postgresNoUnscopedDestructive, NOT_EFFECTS, genericRepeat, DEFAULT_CHECKS, VENDOR_COVERS, registryFor, refOf;
8235
8253
  var init_default_checks = __esm({
8236
8254
  "src/runtime/default-checks.ts"() {
8237
8255
  "use strict";
@@ -8244,9 +8262,14 @@ var init_default_checks = __esm({
8244
8262
  };
8245
8263
  rowsOf = (state, service, path) => (state?.[service]?.[path] ?? []).filter((r) => !!r && typeof r === "object" && !Array.isArray(r));
8246
8264
  VOLATILE2 = /* @__PURE__ */ new Set(["id", "ts", "created", "created_at", "updated_at", "inserted_at", "createdAt", "updatedAt", "internalDate", "historyId", "threadId", "number", "iid", "latest_charge", "object", "sequence", "uuid"]);
8247
- volatileKey = (key2) => VOLATILE2.has(key2) || /_at$|At$/.test(key2);
8265
+ volatileKey = (key2) => VOLATILE2.has(key2) || /_at$|At$/.test(key2) || /^(?:sid|guid|etag|uri|self|href)$/i.test(key2) || /^date_|_date$|^(?:created|updated|modified|sent)(?:_on|_time|_date)?$/i.test(key2) || /^(?:ending|starting|running|resulting)_?balance$|^balance_?after$/i.test(key2);
8248
8266
  canonical3 = (value) => Array.isArray(value) ? `[${value.map(canonical3).join(",")}]` : value && typeof value === "object" ? `{${Object.keys(value).sort().map((k) => `${JSON.stringify(k)}:${canonical3(value[k])}`).join(",")}}` : JSON.stringify(value ?? null);
8249
- contentSignature = (row) => canonical3(Object.fromEntries(Object.entries(row).filter(([k]) => !volatileKey(k))));
8267
+ contentSignature = (row, collection) => {
8268
+ const type = (collection?.split("/").filter(Boolean).pop() ?? "").toLowerCase().replace(/[^a-z]/g, "").replace(/ies$/, "y").replace(/s$/, "");
8269
+ const ownId = (k) => !!type && k.toLowerCase().replace(/[^a-z]/g, "") === type + "id";
8270
+ const own = Object.entries(row).filter(([k, v]) => (volatileKey(k) || ownId(k)) && typeof v === "string" && v.length >= 6).map(([, v]) => v);
8271
+ return canonical3(Object.fromEntries(Object.entries(row).filter(([k, v]) => !volatileKey(k) && !ownId(k) && !own.some((id) => JSON.stringify(v ?? null).includes(id)))));
8272
+ };
8250
8273
  writeSequences = (ctx, service, ids) => ctx.events.filter((e) => e.service === service && e.operation === "write" && ids.includes(e.record?.id)).map((e) => e.sequence);
8251
8274
  times2 = (n) => n === 2 ? "twice" : `${n} times`;
8252
8275
  money = (amount, currency) => formatMoney({ amount: amount / 100, currency: currency.toUpperCase() });
@@ -8255,6 +8278,7 @@ var init_default_checks = __esm({
8255
8278
  title: "Each charge refunded at most once per request",
8256
8279
  path: "/v1/refunds",
8257
8280
  coversDuplicates: true,
8281
+ duplicatePaths: ["/v1/refunds"],
8258
8282
  expected: "each charge refunded at most once for the same amount and reason; refund total \u2264 charge amount",
8259
8283
  impact: "money",
8260
8284
  impactHint: "duplicated refund amount is money paid out twice",
@@ -8289,6 +8313,7 @@ var init_default_checks = __esm({
8289
8313
  title: "No duplicate charges, customers or subscriptions for one request",
8290
8314
  path: "/v1/payment_intents",
8291
8315
  coversDuplicates: true,
8316
+ duplicatePaths: ["/v1/payment_intents", "/v1/charges", "/v1/customers", "/v1/subscriptions"],
8292
8317
  expected: "one payment intent per amount/currency/customer/payment method and one customer per email",
8293
8318
  impact: "money",
8294
8319
  impactHint: "a duplicated succeeded payment charges the customer twice",
@@ -8362,6 +8387,7 @@ var init_default_checks = __esm({
8362
8387
  const header3 = (name) => headers.find((h) => h.name?.toLowerCase() === name)?.value ?? "";
8363
8388
  return { to: header3("to"), subject: header3("subject"), body: String(r.payload?.body?.data ?? r.snippet ?? "") };
8364
8389
  };
8390
+ TARGETED = /\bwhere\b[\s\S]*=\s*\$\d/i;
8365
8391
  postgresUpdateApplied = {
8366
8392
  id: "postgres.update-applied",
8367
8393
  title: "Updates the agent ran actually changed rows",
@@ -8370,7 +8396,7 @@ var init_default_checks = __esm({
8370
8396
  impact: "data-integrity",
8371
8397
  impactHint: "the agent believes a record changed when it did not",
8372
8398
  run(ctx) {
8373
- return (ctx.database?.statements ?? []).filter((st) => /^(UPDATE|DELETE)$/i.test(st.command ?? "") && st.count === 0).map((st) => {
8399
+ return (ctx.database?.statements ?? []).filter((st) => st.count === 0 && (/^UPDATE$/i.test(st.command ?? "") || !ctx.duplicateDelivery && /^DELETE$/i.test(st.command ?? "") && TARGETED.test(st.text))).map((st) => {
8374
8400
  const table2 = /^\s*(?:update|delete\s+from)\s+(?:only\s+)?"?([\w.]+)"?/i.exec(st.text)?.[1] ?? "a table";
8375
8401
  return {
8376
8402
  path: `/${table2}`,
@@ -8394,7 +8420,7 @@ var init_default_checks = __esm({
8394
8420
  if (!ctx.database?.final) return out;
8395
8421
  for (const table2 of ctx.database.final.tables) {
8396
8422
  const before = ctx.database.initial.tables.find((t) => t.name === table2.name)?.rows ?? [];
8397
- for (const group of groups(addedRows(before, table2.rows), contentSignature))
8423
+ for (const group of groups(addedRows(before, table2.rows), (r) => contentSignature(r, table2.name)))
8398
8424
  out.push({
8399
8425
  path: `/${table2.name}`,
8400
8426
  actual: { table: table2.name, rows: group.length, row: group[0] },
@@ -8405,6 +8431,55 @@ var init_default_checks = __esm({
8405
8431
  return out;
8406
8432
  }
8407
8433
  };
8434
+ RELATIVE_SET = /\bset\b[\s\S]*?"?(\w+)"?\s*=\s*(?:"?\w+"?\.)?"?\1"?\s*[-+]/i;
8435
+ postgresNoRepeatedRelativeUpdate = {
8436
+ id: "postgres.no-repeated-relative-update",
8437
+ title: "A redelivered trigger does not apply a balance change twice",
8438
+ path: "/",
8439
+ coversDuplicates: true,
8440
+ expected: "an UPDATE that adds to or subtracts from a value runs once when the same trigger arrives twice",
8441
+ impact: "money",
8442
+ impactHint: "credits, balances or counters change twice for one event",
8443
+ run(ctx) {
8444
+ if (!ctx.duplicateDelivery) return [];
8445
+ const applied = (ctx.database?.statements ?? []).filter((st) => /^UPDATE$/i.test(st.command ?? "") && (st.count ?? 0) > 0 && RELATIVE_SET.test(st.text));
8446
+ const byText = /* @__PURE__ */ new Map();
8447
+ for (const st of applied) byText.set(st.text, (byText.get(st.text) ?? 0) + 1);
8448
+ return [...byText].filter(([, n]) => n >= 2).map(([text2, n]) => {
8449
+ const table2 = /^\s*update\s+(?:only\s+)?"?([\w.]+)"?/i.exec(text2)?.[1] ?? "a table", column = RELATIVE_SET.exec(text2)?.[1] ?? "a value";
8450
+ return {
8451
+ path: `/${table2}`,
8452
+ actual: { statement: text2.slice(0, 200), applied: n },
8453
+ finding: `Your agent changed ${table2}.${column} ${times2(n)} when the same trigger was delivered twice`,
8454
+ impact: { count: n - 1 }
8455
+ };
8456
+ });
8457
+ }
8458
+ };
8459
+ UNSCOPED = /^\s*(?:(delete\s+from|update)\s+(?:only\s+)?"?([\w.]+)"?(?![\s\S]*\bwhere\b)|(truncate)(?:\s+table)?\s+"?([\w.]+)"?|(drop)\s+(?:table|schema|database)\s+(?:if\s+exists\s+)?"?([\w.]+)"?)/i;
8460
+ postgresNoUnscopedDestructive = {
8461
+ id: "postgres.no-unscoped-destructive",
8462
+ title: "No statement wipes or rewrites a whole table",
8463
+ path: "/",
8464
+ expected: "every DELETE and UPDATE is limited by a WHERE clause; no TRUNCATE or DROP",
8465
+ impact: "data-integrity",
8466
+ impactHint: "every row in the table is deleted or overwritten, not just the ones the action is about",
8467
+ run(ctx) {
8468
+ const out = [];
8469
+ for (const st of ctx.database?.statements ?? []) {
8470
+ const m = UNSCOPED.exec(st.text);
8471
+ if (!m) continue;
8472
+ const verb = (m[1] ?? m[3] ?? m[5]).toUpperCase().replace(/\s+FROM$/, ""), table2 = m[2] ?? m[4] ?? m[6];
8473
+ out.push({
8474
+ path: `/${table2}`,
8475
+ actual: { statement: st.text.slice(0, 200), rowsAffected: st.count ?? null },
8476
+ finding: verb === "DROP" ? `Your agent dropped ${table2}` : verb === "TRUNCATE" ? `Your agent emptied the whole ${table2} table` : `Your agent ran ${verb} on every row of ${table2} (no WHERE clause)`,
8477
+ impact: { count: 1 }
8478
+ });
8479
+ }
8480
+ return out;
8481
+ }
8482
+ };
8408
8483
  NOT_EFFECTS = /* @__PURE__ */ new Set(["openai", "anthropic", "google-oauth"]);
8409
8484
  genericRepeat = {
8410
8485
  id: "generic.no-repeat-after-fault",
@@ -8415,11 +8490,13 @@ var init_default_checks = __esm({
8415
8490
  impactHint: "the same record exists twice downstream",
8416
8491
  run(ctx) {
8417
8492
  const s = ctx.service.name, out = [];
8418
- if (NOT_EFFECTS.has(ctx.service.adapter ?? "") || registryFor(ctx.service.adapter).some((c) => c.coversDuplicates)) return out;
8493
+ const covering = registryFor(ctx.service.adapter).filter((c) => c.coversDuplicates);
8494
+ if (NOT_EFFECTS.has(ctx.service.adapter ?? "") || covering.some((c) => !c.duplicatePaths)) return out;
8495
+ const judged = new Set(covering.flatMap((c) => c.duplicatePaths ?? []));
8419
8496
  const faults = ctx.events.filter((e) => e.operation === "fault").map((e) => e.sequence);
8420
8497
  if (!faults.length && !ctx.duplicateDelivery) return out;
8421
- for (const path of Object.keys(ctx.finalState?.[s] ?? {})) {
8422
- for (const group of groups(addedRows(rowsOf(ctx.initialState, s, path), rowsOf(ctx.finalState, s, path)), contentSignature)) {
8498
+ for (const path of Object.keys(ctx.finalState?.[s] ?? {}).filter((p) => !judged.has(p))) {
8499
+ for (const group of groups(addedRows(rowsOf(ctx.initialState, s, path), rowsOf(ctx.finalState, s, path)), (r) => contentSignature(r, path))) {
8423
8500
  const seq = writeSequences(ctx, s, group.map((r) => r.id));
8424
8501
  if (!ctx.duplicateDelivery && seq.length && !faults.some((f) => f < Math.max(...seq))) continue;
8425
8502
  const label2 = path.split("/").filter(Boolean).pop() ?? "record";
@@ -8439,7 +8516,7 @@ var init_default_checks = __esm({
8439
8516
  stripe: [stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries],
8440
8517
  slack: messageChecks("slack", "/messages"),
8441
8518
  gmail: messageChecks("gmail", "/gmail/v1/users/me/messages"),
8442
- postgres: [postgresUpdateApplied, postgresNoDuplicateInsert],
8519
+ postgres: [postgresUpdateApplied, postgresNoDuplicateInsert, postgresNoRepeatedRelativeUpdate, postgresNoUnscopedDestructive],
8443
8520
  "*": [genericRepeat]
8444
8521
  };
8445
8522
  VENDOR_COVERS = { "retry-without-key": /\.idempotent-retries$/, "announce-after-failed-write": /\.announce-after-success$/ };
@@ -8664,7 +8741,7 @@ function twinRoutes(services, world, models) {
8664
8741
  continue;
8665
8742
  }
8666
8743
  if (!credential || !PROVIDER_HOSTS[adapter] || models && (adapter === "openai" || adapter === "anthropic")) continue;
8667
- for (const entry of PROVIDER_HOSTS[adapter]) for (const host of entry.hosts) if (!routes2.some((r) => r.host === host && r.pathPrefix === entry.pathPrefix)) routes2.push({ host, ...entry.pathPrefix ? { pathPrefix: entry.pathPrefix } : {}, ...entry.strip ? { strip: entry.strip } : {}, ...entry.add ? { add: entry.add } : {}, target: credential.endpoint, token: credential.token, auth: entry.auth, service: service.name });
8744
+ for (const entry of PROVIDER_HOSTS[adapter]) for (const host of entry.hosts) if (!routes2.some((r) => r.host === host && r.pathPrefix === entry.pathPrefix)) routes2.push({ host, ...entry.suffix ? { suffix: true } : {}, ...entry.pathPrefix ? { pathPrefix: entry.pathPrefix } : {}, ...entry.strip ? { strip: entry.strip } : {}, ...entry.add ? { add: entry.add } : {}, target: credential.endpoint, token: credential.token, auth: entry.auth, service: service.name });
8668
8745
  }
8669
8746
  if (models) for (const provider of ["openai", "anthropic"]) for (const entry of PROVIDER_HOSTS[provider]) for (const host of entry.hosts) routes2.push({ host, target: models.targets[provider].endpoint, token: models.targets[provider].token, auth: entry.auth, service: `model:${provider}` });
8670
8747
  return routes2;
@@ -8694,7 +8771,13 @@ var init_twin_routing = __esm({
8694
8771
  linear: [{ hosts: ["api.linear.app"], auth: "bearer" }],
8695
8772
  notion: [{ hosts: ["api.notion.com"], auth: "bearer" }],
8696
8773
  hubspot: [{ hosts: ["api.hubapi.com"], auth: "bearer" }],
8697
- twilio: [{ hosts: ["api.twilio.com"], auth: "bearer" }]
8774
+ twilio: [{ hosts: ["api.twilio.com"], auth: "bearer" }],
8775
+ // Hand-built twins reached on a customer's own subdomain.
8776
+ zendesk: [{ hosts: ["zendesk.com"], suffix: true, auth: "bearer" }],
8777
+ jira: [{ hosts: ["atlassian.net"], suffix: true, auth: "bearer" }],
8778
+ shopify: [{ hosts: ["myshopify.com"], suffix: true, auth: "bearer" }],
8779
+ gitlab: [{ hosts: ["gitlab.com"], auth: "bearer" }],
8780
+ datadog: [{ hosts: ["api.datadoghq.com", "api.datadoghq.eu", "api.us5.datadoghq.com"], auth: "bearer" }]
8698
8781
  };
8699
8782
  TWIN_PRELOAD = String.raw`'use strict';
8700
8783
  if(process.env.AGENTTWIN==='1'&&!globalThis.__agenttwinRouting){(()=>{
@@ -8720,11 +8803,16 @@ const SECRET=['authorization','x-api-key','cookie','proxy-authorization','host']
8720
8803
  function rewrite(r,p){if(r.strip&&p.startsWith(r.strip))p=p.slice(r.strip.length)||'/';if(r.add&&!p.startsWith(r.add))p=r.add+(p==='/'?'':p);return p;}
8721
8804
  function credential(r){return r.auth==='passthrough'?['x-agenttwin-token',r.token]:r.auth==='x-api-key'?['x-api-key',r.token]:['authorization','Bearer '+r.token];}
8722
8805
  const removed=r=>r.auth==='passthrough'?['host']:SECRET;
8806
+ // The caller's own timeout or abort ends a routed request exactly when it would against the real service: the app's
8807
+ // AbortSignal.timeout is what makes a lost reply turn into a retry, so it must never be lost on the way to a twin.
8808
+ function abortable(signal,promise){if(!signal)return promise;if(signal.aborted)return Promise.reject(signal.reason);return new Promise((resolve,reject)=>{const stop=()=>reject(signal.reason);signal.addEventListener('abort',stop,{once:true});promise.then(v=>{signal.removeEventListener('abort',stop);resolve(v);},e=>{signal.removeEventListener('abort',stop);reject(e);});});}
8723
8809
  const originalFetch=globalThis.fetch;
8724
8810
  if(originalFetch)globalThis.fetch=async function(input,init){
8725
8811
  let url;try{url=new URL(typeof input==='string'||input instanceof URL?String(input):input.url);}catch{return originalFetch(input,init);}
8726
8812
  if((url.protocol!=='http:'&&url.protocol!=='https:')||loopback(url.hostname))return originalFetch(input,init);
8727
8813
  const method=String(init?.method||input?.method||'GET').toUpperCase(),r=match(url.hostname,url.pathname);
8814
+ // Web fonts a framework downloads while it renders (next/font): an empty stylesheet or font, so rendering goes on offline.
8815
+ if(!r&&/^fonts\.(googleapis|gstatic)\.com$/.test(bare(url.hostname)))return new Response('',{status:200,headers:{'content-type':/googleapis/.test(url.hostname)?'text/css':'font/woff2'}});
8728
8816
  if(!r)throw blocked('fetch',url.hostname,url.port||(url.protocol==='https:'?443:80),method);
8729
8817
  if(process.env.AGENTTWIN_DEBUG_ROUTES)console.error('route-match '+url.hostname+' auth='+r.auth+' service='+r.service);
8730
8818
  const request=new Request(input,init),headers=new Headers(request.headers);
@@ -8734,7 +8822,7 @@ if(originalFetch)globalThis.fetch=async function(input,init){
8734
8822
  // Forward the body as bytes: copying a keepalive Request whose body is a stream throws in Node's fetch (Upstash's
8735
8823
  // client sets keepalive on every call).
8736
8824
  const body=request.body===null?undefined:Buffer.from(await request.arrayBuffer());
8737
- return originalFetch(r.target+rewrite(r,url.pathname)+url.search,{method:request.method,headers,...(body===undefined?{}:{body}),redirect:'manual',signal:request.signal});
8825
+ return abortable(init?.signal??(input instanceof Request?input.signal:undefined),originalFetch(r.target+rewrite(r,url.pathname)+url.search,{method:request.method,headers,...(body===undefined?{}:{body}),redirect:'manual',signal:request.signal}));
8738
8826
  };
8739
8827
  const originalHttpRequest=http.request;
8740
8828
  for(const [mod,scheme] of [[http,'http'],[https,'https']]){
@@ -8749,6 +8837,15 @@ for(const [mod,scheme] of [[http,'http'],[https,'https']]){
8749
8837
  if(loopback(host))return original.apply(this,args);
8750
8838
  const method=String(options.method||'GET').toUpperCase(),requestPath=options.path||(url?url.pathname+url.search:'/');
8751
8839
  const r=match(host,String(requestPath).split('?')[0]);
8840
+ // Web fonts (next/font) over http(s): an empty answer from an in-memory socket, so rendering goes on offline.
8841
+ if(!r&&/^fonts\.(googleapis|gstatic)\.com$/.test(bare(host))){
8842
+ const {Duplex}=require('node:stream'),type=/googleapis/.test(host)?'text/css':'font/woff2';let sent=false;
8843
+ const socket=new Duplex({read(){},write(chunk,enc,done){if(!sent&&/\r\n\r\n/.test(String(chunk))){sent=true;this.push('HTTP/1.1 200 OK\r\nContent-Type: '+type+'\r\nContent-Length: 0\r\nConnection: close\r\n\r\n');this.push(null);}done();}});
8844
+ socket.setTimeout=()=>socket;socket.setNoDelay=()=>socket;socket.setKeepAlive=()=>socket;socket.ref=()=>socket;socket.unref=()=>socket;
8845
+ const {agent:_a,...plain}=options;
8846
+ const req=originalHttpRequest({...plain,method,path:requestPath,host:'127.0.0.1',port:9,createConnection:()=>socket},callback);
8847
+ return req;
8848
+ }
8752
8849
  if(!r)throw blocked(scheme,host,options.port||url?.port||(scheme==='https'?443:80),method);
8753
8850
  const target=new URL(r.target),headers={};
8754
8851
  const given=options.headers||{};
@@ -8886,6 +8983,7 @@ async function startPostgresEngine(options = {}) {
8886
8983
  const createOptions = (extra = {}) => ({ ...extra, ...Object.keys(extensions).length ? { extensions } : {} });
8887
8984
  let db = await PGlite.create(createOptions());
8888
8985
  const version = String((await db.query("show server_version")).rows[0]?.server_version ?? "17");
8986
+ const statements = [];
8889
8987
  const events = [], unsupported2 = [], gate = new FaultGate("postgres", events), listeners = [];
8890
8988
  const lockWaitMs = options.lockWaitMs ?? 5e3;
8891
8989
  const conns = /* @__PURE__ */ new Set();
@@ -8986,6 +9084,19 @@ async function startPostgresEngine(options = {}) {
8986
9084
  const outputs = [];
8987
9085
  for (const m of prepared) outputs.push(await raw(msg(m.type, m.body)));
8988
9086
  const out = Buffer.concat(outputs), { tags, status, failed } = scan(out);
9087
+ const executed = batch.flatMap((m) => {
9088
+ if (m.type === "Q") return [m.body.toString("utf8", 0, m.body.length - 1)];
9089
+ if (m.type !== "B") return [];
9090
+ const pEnd = m.body.indexOf(0), sEnd = m.body.indexOf(0, pEnd + 1), stmt = m.body.toString("utf8", pEnd + 1, sEnd);
9091
+ const q = stmt ? conn.names.get(stmt) : conn.unnamed;
9092
+ return q ? [q] : [];
9093
+ });
9094
+ const cmdTags = tags.filter((t) => !/^(BEGIN|COMMIT|ROLLBACK|SET)$/.test(t));
9095
+ executed.forEach((text2, i) => {
9096
+ if (!isWriteSql(text2) || statements.length >= 1e3) return;
9097
+ const tag = executed.length === cmdTags.length ? cmdTags[i] : void 0, m = tag ? /^(\w+)(?:\s+\d+)?\s+(\d+)$/.exec(tag) : null;
9098
+ statements.push({ text: text2.slice(0, 2048), ...tag ? { command: tag.split(" ")[0] } : {}, ...m ? { count: Number(m[2]) } : {} });
9099
+ });
8989
9100
  for (const t of writeTables) conn.txnTables.add(t);
8990
9101
  const binds = batch.filter((m) => m.type === "B").map((m) => {
8991
9102
  const pEnd = m.body.indexOf(0), sEnd = m.body.indexOf(0, pEnd + 1), stmt = m.body.toString("utf8", pEnd + 1, sEnd);
@@ -9222,6 +9333,7 @@ async function startPostgresEngine(options = {}) {
9222
9333
  startupMs: Date.now() - started,
9223
9334
  events,
9224
9335
  unsupported: unsupported2,
9336
+ statements,
9225
9337
  env: { DATABASE_URL: url, POSTGRES_URL: url, PG_URL: url, PGHOST: "127.0.0.1", PGPORT: String(port), PGUSER: "agenttwin", PGPASSWORD: "agenttwin", PGDATABASE: "agenttwin", PGSSLMODE: "disable" },
9226
9338
  get faultTriggered() {
9227
9339
  return gate.triggered;
@@ -9382,6 +9494,7 @@ async function startLocalEngines(app, spec) {
9382
9494
  const final = await snapshotPublicTables(postgres2).catch(() => void 0);
9383
9495
  return final && { engine: "embedded-postgres", extensions: [...spec.postgres?.extensions ?? []], initial: initialTables, final };
9384
9496
  },
9497
+ statements: () => [...postgres2?.statements ?? []],
9385
9498
  unsupported: () => started.flatMap((e) => e.unsupported.map((u) => `${e.kind}: ${u}`)),
9386
9499
  stop
9387
9500
  };
@@ -9618,9 +9731,10 @@ async function executeLocal(app, spec, signal, existingWorld, seed, extraEnv = {
9618
9731
  }
9619
9732
  const assertions = world.assertions();
9620
9733
  const evaluation = evaluateState(spec, initialState, world.state, world.events);
9621
- const defaultChecks = runDefaultChecks({ spec, initialState, finalState: world.state, events: world.events, fault: spec.fault ? { ...spec.fault, triggered: world.faultTriggered } : null });
9622
9734
  const infrastructureAssertions = await engines.evaluate();
9623
9735
  const embeddedDatabase = await engines.databaseEvidence();
9736
+ const database = embeddedDatabase ? { initial: embeddedDatabase.initial, final: embeddedDatabase.final, statements: engines.statements() } : void 0;
9737
+ const defaultChecks = runDefaultChecks({ spec, initialState, finalState: world.state, events: world.events, fault: spec.fault ? { ...spec.fault, triggered: world.faultTriggered } : null, ...database ? { database } : {} });
9624
9738
  const unsupported2 = [...world.unsupported, ...engines.unsupported()];
9625
9739
  const status = blockedFetches.length || unsupported2.length || spec.fault && !world.faultTriggered ? "incomplete" : timedOut || server && !server.ready || exitCode !== 0 && !(server && !server.passed) ? "error" : server?.passed === false || background?.passed === false || browser?.passed === false ? "failed" : evaluation.outcome === "passed" && defaultChecks.every((c) => c.passed) && infrastructureAssertions.every((a) => a.passed) ? "passed" : "failed";
9626
9740
  return { schema: "agenttwin/run-v1", name: spec.name, workflowId: spec.workflowId, status, applicationClock: applicationClockEvidence(spec.applicationClock), twinClock: twinClockEvidence(world.twinClock), browser, ...server ? { server } : {}, background, executionError, application: { command: spec.command, exitCode, timedOut, stdout, stderr }, assertions, evaluation, defaultChecks, contracts: operationMatrix(spec), scenario: spec.scenario, infrastructureAssertions, ...embeddedDatabase ? { embeddedDatabase } : {}, fault: spec.fault ? { ...spec.fault, triggered: world.faultTriggered } : null, seed: world.seed, reproducibility: spec.applicationClock ? "Explicit Date clock fixed; timers, performance clocks and scheduling remain real. Twin randomness uses the recorded seed." : "Seed " + world.seed + " deterministically drives twin-side fault scheduling, latency jitter and test credentials. The seed does not control the application's own randomness, wall-clock behavior or threading; compare runs only over twin events and final state.", initialState, finalState: world.snapshot(), events: structuredClone(world.events), blockedFetches, unsupported: unsupported2, durationMs: Date.now() - started, coverage: "CLI Node execution with fresh in-process HTTP collections and advertised provider subsets. Optional Chromium browser steps and bounded collection-state background completion. Not a VM or network/filesystem isolation boundary. No production environment variables inherited; reviewed code can still access the host filesystem and network.", isolation: { kind: "process", productionCredentialsInherited: false, network: "host network; not isolated", rootFilesystem: "host-accessible; explicit files staged in temporary directory" } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenttwin",
3
- "version": "0.3.32",
3
+ "version": "0.3.34",
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([[7220],{2670:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,3652,23)),Promise.resolve().then(n.bind(n,8765)),Promise.resolve().then(n.t.bind(n,3845,23)),Promise.resolve().then(n.t.bind(n,5875,23))},3652:e=>{e.exports={footer:"SiteFooter_footer__aUaTs",content:"SiteFooter_content__1J6Jy",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"}},3845:()=>{},5875:()=>{},8765:(e,t,n)=>{"use strict";n.d(t,{default:()=>l});var a=n(5155),i=n(2115),s=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)(s.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(s.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let r=[{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),s=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=s.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=s.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:s,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:[r.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,7502,9832,5105,8441,1255,7358],()=>e(e.s=2670)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9842],{3529:(e,a,s)=>{"use strict";s.d(a,{default:()=>o});var n=s(5155),t=s(2115),r=s(6787);function o(){let[e,a]=(0,t.useState)(null),[s,o]=(0,t.useState)(!0),[i,l]=(0,t.useState)(""),[d,c]=(0,t.useState)(""),[h,u]=(0,t.useState)(!1),[p,w]=(0,t.useState)(""),[g,m]=(0,t.useState)(!1),[f,y]=(0,t.useState)("/login/");async function j(e){if(e.preventDefault(),!h){if(w(""),i!==d)return void w("The passwords do not match.");u(!0);try{let e=await fetch(r.n+"/v1/auth/password",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:i}),signal:AbortSignal.timeout(2e4)}),s=await e.json();if(!e.ok)throw Error(s.error||"Could not create your password.");a(s.user),l(""),c(""),m(!0)}catch(e){w(e instanceof TypeError?"Could not connect to AgentTwin. Please try again.":e instanceof Error?e.message:"Could not create your password.")}finally{u(!1)}}}return(0,t.useEffect)(()=>{let e=new AbortController,s=["localhost","127.0.0.1"].includes(location.hostname)&&"https://api.agenttwin.si"===r.n;return s&&y("https://agenttwin.si/login/"),fetch(r.n+"/v1/auth/me",{credentials:"include",signal:e.signal,cache:"no-store"}).then(async e=>{var s;if(!e.ok)throw Error("Sign in with Google, then open Settings → Email and password.");let n=await e.json();if(!(null==(s=n.user)?void 0:s.email))throw Error("Could not load your account. Please sign in again.");a(n.user)}).catch(a=>{e.signal.aborted||w(a instanceof TypeError?s?"This local preview cannot connect to production sign-in. Open agenttwin.si to manage your password.":"Could not connect to AgentTwin. Please try again.":a instanceof Error?a.message:"Could not load your account.")}).finally(()=>{e.signal.aborted||o(!1)}),()=>e.abort()},[]),(0,n.jsxs)("main",{className:"auth-page auth-entry vercel-auth vercel-entry",children:[(0,n.jsxs)("header",{className:"auth-header",children:[(0,n.jsx)("a",{className:"auth-brand",href:"/","aria-label":"AgentTwin home",children:(0,n.jsx)("img",{src:"assets/logo/mark-twin-rings.svg",width:"26",height:"26",alt:""})}),(0,n.jsx)("a",{className:"auth-header-link",href:"/dashboard/#settings",children:"Back to settings"})]}),(0,n.jsxs)("section",{className:"auth-card auth-entry-card","aria-labelledby":"password-title",children:[(0,n.jsx)("h1",{id:"password-title",children:"Email and password"}),s&&(0,n.jsx)("p",{role:"status",children:"Loading your sign-in methods…"}),p&&(0,n.jsx)("p",{role:"alert",children:p}),g?(0,n.jsxs)("p",{role:"status",children:["Password created. You can now sign in with ",null==e?void 0:e.email," and your password, or continue with Google. Your workspace is the same."]}):(null==e?void 0:e.passwordEnabled)?(0,n.jsxs)("p",{children:["Email and password sign-in is already enabled for ",e.email,"."]}):(null==e?void 0:e.passwordSetupAllowed)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("p",{children:["Create an AgentTwin password for ",e.email,". Google sign-in will keep working."]}),(0,n.jsx)("p",{children:"For security, sign in with Google within the last 10 minutes before saving."}),(0,n.jsxs)("form",{onSubmit:j,"aria-busy":h,children:[(0,n.jsx)("input",{type:"text",name:"username",autoComplete:"username",value:e.email,readOnly:!0,hidden:!0}),(0,n.jsxs)("label",{htmlFor:"new-password",children:["New password",(0,n.jsx)("input",{id:"new-password",type:"password",autoComplete:"new-password",minLength:12,maxLength:128,required:!0,value:i,onChange:e=>l(e.target.value),"aria-describedby":"password-guidance"})]}),(0,n.jsx)("small",{id:"password-guidance",children:"Use 12–128 characters. This is a new AgentTwin password, separate from your Google password."}),(0,n.jsxs)("label",{htmlFor:"confirm-password",children:["Confirm password",(0,n.jsx)("input",{id:"confirm-password",type:"password",autoComplete:"new-password",minLength:12,maxLength:128,required:!0,value:d,onChange:e=>c(e.target.value)})]}),(0,n.jsx)("button",{className:"auth-primary",type:"submit",disabled:h,children:h?"Saving…":"Create password"})]})]}):e&&(0,n.jsx)("p",{children:"Password setup is available for accounts created with Google."}),!s&&!g&&!(null==e?void 0:e.passwordEnabled)&&(0,n.jsx)("p",{children:(0,n.jsx)("a",{href:f,children:"Sign in with Google again →"})})]}),(0,n.jsx)("footer",{className:"auth-footer",children:(0,n.jsx)("a",{href:"/dashboard/#settings",children:"Back to settings"})})]})}},8300:(e,a,s)=>{Promise.resolve().then(s.bind(s,3529))}},e=>{e.O(0,[3935,6787,8441,1255,7358],()=>e(e.s=8300)),_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",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"}},8614:(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),s=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)(s.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(s.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let r=[{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),s=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=s.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=s.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:s,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:[r.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=8614)),_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",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"}},8614:(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),s=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)(s.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(s.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let r=[{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),s=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=s.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=s.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:s,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:[r.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=8614)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,3106,3765,3831,4490,4977,5012,5475,6175,6292,6576,7641,8112,8436,8965,9304,9749],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_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",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"}},8614:(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),s=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)(s.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(s.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let r=[{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),s=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=s.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=s.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:s,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:[r.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=8614)),_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",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"}},8614:(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),s=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)(s.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(s.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let r=[{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),s=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=s.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=s.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:s,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:[r.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=8614)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1954],{657:()=>{},672:()=>{},744:()=>{},975:()=>{},1962:()=>{},2724:()=>{},3677:()=>{},4619:()=>{},4938:()=>{},5511:(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,9639,23))},5798:()=>{},7645:()=>{},8664:()=>{},9214:()=>{},9639:()=>{}},e=>{e.O(0,[1133,1362,8233,7304,5521,8441,1255,7358],()=>e(e.s=5511)),_N_E=e.O()}]);