agenttwin 0.3.33 → 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 (81) hide show
  1. package/dist/api.js +91 -9
  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-b60a5aad66f3bf1d.js +1 -0
  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/layout-6c159db381b82832.js +1 -0
  9. package/dist/dashboard/assets/next/static/chunks/app/compare/page-91ad6c5e4226778f.js +1 -0
  10. package/dist/dashboard/assets/next/static/chunks/app/contact/page-91ad6c5e4226778f.js +1 -0
  11. package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-0050f308b9f77c24.js +1 -0
  12. package/dist/dashboard/assets/next/static/chunks/app/dashboard/{page-921966e3dedcd521.js → page-6245aa3ad5d7f527.js} +1 -1
  13. package/dist/dashboard/assets/next/static/chunks/app/demo/{page-cea8a4e63415fbd3.js → page-ac6e235c635cb130.js} +1 -1
  14. package/dist/dashboard/assets/next/static/chunks/app/developers/page-91ad6c5e4226778f.js +1 -0
  15. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-5afd0649dd30ef88.js +1 -0
  16. package/dist/dashboard/assets/next/static/chunks/app/dpa/page-91ad6c5e4226778f.js +1 -0
  17. package/dist/dashboard/assets/next/static/chunks/app/{pricing/page-2ba2ef1861af2b9a.js → enterprise/page-11514cc52285b7f3.js} +1 -1
  18. package/dist/dashboard/assets/next/static/chunks/app/guides/page-91ad6c5e4226778f.js +1 -0
  19. package/dist/dashboard/assets/next/static/chunks/app/{layout-82c443ae1fa2121f.js → layout-8aa153f632f0aa20.js} +1 -1
  20. package/dist/dashboard/assets/next/static/chunks/app/login/page-99ebb4d265222728.js +1 -0
  21. package/dist/dashboard/assets/next/static/chunks/app/not-found-91ad6c5e4226778f.js +1 -0
  22. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-9e59af0296c9366b.js +1 -0
  23. package/dist/dashboard/assets/next/static/chunks/app/{page-75da7f74524cc22b.js → page-76277dc68b6a22bd.js} +1 -1
  24. package/dist/dashboard/assets/next/static/chunks/app/{enterprise/page-e6b3e380979825ee.js → pricing/page-c7015af858f4db8e.js} +1 -1
  25. package/dist/dashboard/assets/next/static/chunks/app/privacy/page-91ad6c5e4226778f.js +1 -0
  26. package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-91ad6c5e4226778f.js +1 -0
  27. package/dist/dashboard/assets/next/static/chunks/app/scoreboard/page-91ad6c5e4226778f.js +1 -0
  28. package/dist/dashboard/assets/next/static/chunks/app/security/page-91ad6c5e4226778f.js +1 -0
  29. package/dist/dashboard/assets/next/static/chunks/app/signup/page-99ebb4d265222728.js +1 -0
  30. package/dist/dashboard/assets/next/static/chunks/app/status/page-fd41c4e7838d9949.js +1 -0
  31. package/dist/dashboard/assets/next/static/chunks/app/subprocessors/page-91ad6c5e4226778f.js +1 -0
  32. package/dist/dashboard/assets/next/static/chunks/app/terms/page-91ad6c5e4226778f.js +1 -0
  33. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-a79d128eb3b0b7d2.js +1 -0
  34. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-a9fa05c9ae5c24dc.js +1 -0
  35. package/dist/dashboard/assets/next/static/chunks/app/v2/layout-2e97381ae7a59ba0.js +1 -0
  36. package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-57afbac97afd31fa.js +1 -0
  37. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-7c08d2c43f0be9d5.js +1 -0
  38. package/dist/dashboard/assets/next/static/chunks/app/v2/{page-f76e6c096d562f02.js → page-35998431fb40a9c9.js} +1 -1
  39. package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-57afbac97afd31fa.js +1 -0
  40. package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-91ad6c5e4226778f.js +1 -0
  41. package/dist/dashboard/assets/next/static/chunks/{main-app-5cdab67e2bf5802d.js → main-app-4051d8ba998bea15.js} +1 -1
  42. package/dist/dashboard/assets/next/static/chunks/{webpack-cc6e66684b86a020.js → webpack-57e0c1e343bdc899.js} +1 -1
  43. package/dist/dashboard/index.html +2 -2
  44. package/dist/engine.js +78 -7
  45. package/dist/gateway.js +91 -9
  46. package/dist/worker.js +28 -2
  47. package/dist/world-host.js +29 -3
  48. package/package.json +1 -1
  49. package/dist/dashboard/assets/next/static/chunks/app/_not-found/page-1fd9ba71e57294ba.js +0 -1
  50. package/dist/dashboard/assets/next/static/chunks/app/about/page-81ddde965e6dfa96.js +0 -1
  51. package/dist/dashboard/assets/next/static/chunks/app/account/password/page-47d3b1ebd057bb1a.js +0 -1
  52. package/dist/dashboard/assets/next/static/chunks/app/api-policy/page-137a6dba95d2ef51.js +0 -1
  53. package/dist/dashboard/assets/next/static/chunks/app/auth/page-137a6dba95d2ef51.js +0 -1
  54. package/dist/dashboard/assets/next/static/chunks/app/blog/layout-a68ffff4758226cc.js +0 -1
  55. package/dist/dashboard/assets/next/static/chunks/app/compare/page-137a6dba95d2ef51.js +0 -1
  56. package/dist/dashboard/assets/next/static/chunks/app/contact/page-137a6dba95d2ef51.js +0 -1
  57. package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-b448c11ac382ac4d.js +0 -1
  58. package/dist/dashboard/assets/next/static/chunks/app/developers/page-137a6dba95d2ef51.js +0 -1
  59. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-8ae8656bb220cf5f.js +0 -1
  60. package/dist/dashboard/assets/next/static/chunks/app/dpa/page-137a6dba95d2ef51.js +0 -1
  61. package/dist/dashboard/assets/next/static/chunks/app/guides/page-137a6dba95d2ef51.js +0 -1
  62. package/dist/dashboard/assets/next/static/chunks/app/login/page-fd67c8f49df437a8.js +0 -1
  63. package/dist/dashboard/assets/next/static/chunks/app/not-found-137a6dba95d2ef51.js +0 -1
  64. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-5f34951664ab6faa.js +0 -1
  65. package/dist/dashboard/assets/next/static/chunks/app/privacy/page-137a6dba95d2ef51.js +0 -1
  66. package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-137a6dba95d2ef51.js +0 -1
  67. package/dist/dashboard/assets/next/static/chunks/app/scoreboard/page-137a6dba95d2ef51.js +0 -1
  68. package/dist/dashboard/assets/next/static/chunks/app/security/page-137a6dba95d2ef51.js +0 -1
  69. package/dist/dashboard/assets/next/static/chunks/app/signup/page-fd67c8f49df437a8.js +0 -1
  70. package/dist/dashboard/assets/next/static/chunks/app/status/page-0ad713a62e231968.js +0 -1
  71. package/dist/dashboard/assets/next/static/chunks/app/subprocessors/page-137a6dba95d2ef51.js +0 -1
  72. package/dist/dashboard/assets/next/static/chunks/app/terms/page-137a6dba95d2ef51.js +0 -1
  73. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-80e06fdbf1bfc0ab.js +0 -1
  74. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-21ed4ad2bb01e324.js +0 -1
  75. package/dist/dashboard/assets/next/static/chunks/app/v2/layout-1565491a06814842.js +0 -1
  76. package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-250c09869871e915.js +0 -1
  77. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-300bc2cb63084339.js +0 -1
  78. package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-250c09869871e915.js +0 -1
  79. package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-137a6dba95d2ef51.js +0 -1
  80. /package/dist/dashboard/assets/next/static/{gqlJaiQCOn6PSaPVSG0RS → p_5KE1JZcErklSND_EYv3}/_buildManifest.js +0 -0
  81. /package/dist/dashboard/assets/next/static/{gqlJaiQCOn6PSaPVSG0RS → p_5KE1JZcErklSND_EYv3}/_ssgManifest.js +0 -0
package/dist/engine.js CHANGED
@@ -290,7 +290,7 @@ var init_package = __esm({
290
290
  "package.json"() {
291
291
  package_default = {
292
292
  name: "agenttwin",
293
- version: "0.3.33",
293
+ version: "0.3.34",
294
294
  description: "AgentTwin builds digital twins for testing AI agents. The current CLI prepares supported Node.js workflows with synthetic services, failures, and outcome checks.",
295
295
  mcpName: "io.github.AgentTwin/agenttwin",
296
296
  keywords: [
@@ -3121,7 +3121,8 @@ function genericChecks(calls, opts = {}) {
3121
3121
  impact: impactOf(group, made - 1, "data-integrity", `the same ${first.resourcePath.split("/").filter((s) => s !== "{id}").pop() ?? "record"} exists ${times(made)} downstream`),
3122
3122
  ...group[group.length - 1].source ? { source: group[group.length - 1].source } : {},
3123
3123
  writeSites: sites(group),
3124
- fix: announce ? "check-before-resend" : "idempotency-key"
3124
+ fix: announce ? "check-before-resend" : "idempotency-key",
3125
+ ...group.length === 1 && first.duplicated && !first.idempotencyKey && !opts.duplicateDelivery ? { advisory: true } : {}
3125
3126
  });
3126
3127
  continue;
3127
3128
  }
@@ -9304,7 +9305,7 @@ function defaultFaultMatrix(services, opts = {}) {
9304
9305
  entries.push({ name: `postgres-${type}`, label: `Postgres ${type}`, type, service: "postgres", supported: false, reason: "SQL fault injection is not implemented; Postgres default checks still run on Docker runs with a disposable database" });
9305
9306
  return entries;
9306
9307
  }
9307
- var PROVIDER, displayName, rowsOf, VOLATILE2, volatileKey, canonical4, contentSignature, writeSequences, times2, money, stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries, NEGATIVE, gmailText, TARGETED, postgresUpdateApplied, postgresNoDuplicateInsert, UNSCOPED, postgresNoUnscopedDestructive, NOT_EFFECTS, genericRepeat, DEFAULT_CHECKS, VENDOR_COVERS, registryFor, refOf, WRITE_PATHS, slug;
9308
+ var PROVIDER, displayName, rowsOf, VOLATILE2, volatileKey, canonical4, 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, WRITE_PATHS, slug;
9308
9309
  var init_default_checks = __esm({
9309
9310
  "src/runtime/default-checks.ts"() {
9310
9311
  "use strict";
@@ -9486,6 +9487,31 @@ var init_default_checks = __esm({
9486
9487
  return out;
9487
9488
  }
9488
9489
  };
9490
+ RELATIVE_SET = /\bset\b[\s\S]*?"?(\w+)"?\s*=\s*(?:"?\w+"?\.)?"?\1"?\s*[-+]/i;
9491
+ postgresNoRepeatedRelativeUpdate = {
9492
+ id: "postgres.no-repeated-relative-update",
9493
+ title: "A redelivered trigger does not apply a balance change twice",
9494
+ path: "/",
9495
+ coversDuplicates: true,
9496
+ expected: "an UPDATE that adds to or subtracts from a value runs once when the same trigger arrives twice",
9497
+ impact: "money",
9498
+ impactHint: "credits, balances or counters change twice for one event",
9499
+ run(ctx) {
9500
+ if (!ctx.duplicateDelivery) return [];
9501
+ const applied = (ctx.database?.statements ?? []).filter((st) => /^UPDATE$/i.test(st.command ?? "") && (st.count ?? 0) > 0 && RELATIVE_SET.test(st.text));
9502
+ const byText = /* @__PURE__ */ new Map();
9503
+ for (const st of applied) byText.set(st.text, (byText.get(st.text) ?? 0) + 1);
9504
+ return [...byText].filter(([, n]) => n >= 2).map(([text3, n]) => {
9505
+ const table4 = /^\s*update\s+(?:only\s+)?"?([\w.]+)"?/i.exec(text3)?.[1] ?? "a table", column = RELATIVE_SET.exec(text3)?.[1] ?? "a value";
9506
+ return {
9507
+ path: `/${table4}`,
9508
+ actual: { statement: text3.slice(0, 200), applied: n },
9509
+ finding: `Your agent changed ${table4}.${column} ${times2(n)} when the same trigger was delivered twice`,
9510
+ impact: { count: n - 1 }
9511
+ };
9512
+ });
9513
+ }
9514
+ };
9489
9515
  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;
9490
9516
  postgresNoUnscopedDestructive = {
9491
9517
  id: "postgres.no-unscoped-destructive",
@@ -9546,7 +9572,7 @@ var init_default_checks = __esm({
9546
9572
  stripe: [stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries],
9547
9573
  slack: messageChecks("slack", "/messages"),
9548
9574
  gmail: messageChecks("gmail", "/gmail/v1/users/me/messages"),
9549
- postgres: [postgresUpdateApplied, postgresNoDuplicateInsert, postgresNoUnscopedDestructive],
9575
+ postgres: [postgresUpdateApplied, postgresNoDuplicateInsert, postgresNoRepeatedRelativeUpdate, postgresNoUnscopedDestructive],
9550
9576
  "*": [genericRepeat]
9551
9577
  };
9552
9578
  VENDOR_COVERS = { "retry-without-key": /\.idempotent-retries$/, "announce-after-failed-write": /\.announce-after-success$/ };
@@ -21805,6 +21831,39 @@ function missingTwinRecords(events, supplied, packOf, operations) {
21805
21831
  }
21806
21832
  return [...found.values()];
21807
21833
  }
21834
+ async function alignInputWithSchema(schemaSql, input, generated) {
21835
+ const fields = Object.entries(input).filter(([, v]) => generated(v));
21836
+ if (!fields.length) return { input, changed: [] };
21837
+ const extensions = schemaExtensions(schemaSql).filter((e) => POSTGRES_EXTENSIONS.includes(e));
21838
+ const db = await startPostgresEngine({ extensions, seed: { sql: schemaSql, tables: {} } });
21839
+ const out = { ...input }, changed = [];
21840
+ try {
21841
+ const cols = await queryReadOnly(db, `SELECT table_name, column_name, data_type FROM information_schema.columns WHERE table_schema = 'public'`);
21842
+ const snake = (k) => k.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
21843
+ const plural3 = (t) => [t, t + "s", t + "es", t.replace(/y$/, "ies")];
21844
+ for (const [key3, value3] of fields) {
21845
+ const name = snake(key3);
21846
+ const stem = /^(\w+?)_?id$/.exec(name)?.[1];
21847
+ const table4 = stem ? [...new Set(cols.map((c) => c.table_name))].find((t) => plural3(stem).includes(t) && cols.some((c) => c.table_name === t && c.column_name === "id")) : void 0;
21848
+ if (table4) {
21849
+ const row = (await queryReadOnly(db, `SELECT id FROM "${table4.replace(/"/g, '""')}" ORDER BY 1 LIMIT 1`))[0];
21850
+ if (row && row.id !== null && row.id !== void 0) {
21851
+ out[key3] = row.id;
21852
+ changed.push(`${key3} = ${table4}.id ${JSON.stringify(row.id)}`);
21853
+ continue;
21854
+ }
21855
+ }
21856
+ const numeric = cols.find((c) => c.column_name === name && /int|numeric|decimal|real|double/i.test(c.data_type));
21857
+ if (numeric && typeof value3 === "string") {
21858
+ out[key3] = 100;
21859
+ changed.push(`${key3} = 100 (${numeric.table_name}.${name} is ${numeric.data_type})`);
21860
+ }
21861
+ }
21862
+ } finally {
21863
+ await db.stop();
21864
+ }
21865
+ return { input: out, changed };
21866
+ }
21808
21867
  var sample;
21809
21868
  var init_state_seeding = __esm({
21810
21869
  "src/flow/state-seeding.ts"() {
@@ -29560,7 +29619,7 @@ function findingsFor(clean, run3, fault, candidate) {
29560
29619
  if (clean.genericViolations?.some((c) => c.violation.check === violation.check && c.violation.resource === violation.resource)) continue;
29561
29620
  if (findings.some((x) => x.title === finding.title)) continue;
29562
29621
  const hint = usefulImpact(violation.impact.summary);
29563
- findings.push({ id: `${fault.id}:${finding.id}`, severity: violation.impact.kind === "money" || finding.kind === "duplicate-effect" ? "high" : "medium", faultId: fault.id, title: finding.title, detail: `${violation.check}: ${violation.resource}`, impact: hint ? [hint] : [], evidencePath: run3.evidencePath, proof: finding });
29622
+ findings.push({ id: `${fault.id}:${finding.id}`, severity: violation.advisory ? "low" : violation.impact.kind === "money" || finding.kind === "duplicate-effect" ? "high" : "medium", faultId: fault.id, title: finding.title, detail: `${violation.check}: ${violation.resource}`, impact: hint ? [hint] : [], evidencePath: run3.evidencePath, proof: finding });
29564
29623
  }
29565
29624
  for (const check of run3.defaultChecks.filter((c) => !c.passed)) {
29566
29625
  if (clean.defaultChecks.some((c) => c.id === check.id && !c.passed)) continue;
@@ -30206,6 +30265,18 @@ async function runOneCommand(opts) {
30206
30265
  for (const a of prepared.scenario.assumptions) log(dim(` \xB7 ${a}`));
30207
30266
  log(dim(` Scenario: ${relative19(cwd, prepared.scenarioPath)} (edit to change inputs or expectations)`));
30208
30267
  const runOpts = { seed, integrations };
30268
+ const inputObject = prepared.scenario.input && typeof prepared.scenario.input === "object" && !Array.isArray(prepared.scenario.input) ? prepared.scenario.input : void 0;
30269
+ if (inputObject && prepared.scenario.postgresSchemaFiles?.length) {
30270
+ try {
30271
+ const aligned = await alignInputWithSchema(await loadPostgresSchema(cwd, prepared.scenario.postgresSchemaFiles), inputObject, (v) => typeof v === "string" && v.startsWith("synthetic-"));
30272
+ if (aligned.changed.length) {
30273
+ prepared.scenario.input = aligned.input;
30274
+ await writeFile34(prepared.scenarioPath, JSON.stringify(prepared.scenario, null, 2) + "\n", { mode: 384 });
30275
+ log(dim(` Input matched to the database: ${aligned.changed.join("; ")}`));
30276
+ }
30277
+ } catch {
30278
+ }
30279
+ }
30209
30280
  const liveHosts = (await readConnections(cwd)).connections.map((c) => c.host);
30210
30281
  log(bold("3/7 Run") + dim(liveHosts.length ? " real workflow code against twins\u2026" : " real workflow code against twins (no production calls)\u2026"));
30211
30282
  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.`));
@@ -30441,7 +30512,7 @@ async function runOneCommand(opts) {
30441
30512
  for (const c of genericFaultMatrix(cleanCalls, { timeouts, max: 16 })) faults.push({ id: c.id, title: c.title, generic: c.fault, ...c.supported ? {} : { supported: false, reason: c.reason } });
30442
30513
  }
30443
30514
  for (const c of cleanProblems) findings.push({ id: `clean:${c.id}`, severity: c.impact.kind === "money" || c.impact.kind === "data-integrity" ? "high" : "medium", faultId: "clean", title: c.finding ?? c.title, detail: `${c.check}: ${c.service}${c.path}`, impact: [c.impact.summary], evidencePath: clean.evidencePath });
30444
- for (const { violation, finding } of clean.genericViolations ?? []) findings.push({ id: `clean:${finding.id}`, severity: violation.impact.kind === "money" || finding.kind === "duplicate-effect" ? "high" : "medium", faultId: "clean", title: finding.title, detail: `${violation.check}: ${violation.resource}`, impact: /^\d+ occurrences?:/.test(violation.impact.summary) ? [] : [violation.impact.summary], evidencePath: clean.evidencePath, proof: finding });
30515
+ for (const { violation, finding } of clean.genericViolations ?? []) findings.push({ id: `clean:${finding.id}`, severity: violation.advisory ? "low" : violation.impact.kind === "money" || finding.kind === "duplicate-effect" ? "high" : "medium", faultId: "clean", title: finding.title, detail: `${violation.check}: ${violation.resource}`, impact: /^\d+ occurrences?:/.test(violation.impact.summary) ? [] : [violation.impact.summary], evidencePath: clean.evidencePath, proof: finding });
30445
30516
  const runnable = faults.filter((f) => f.supported !== false);
30446
30517
  const cases = /* @__PURE__ */ new Map();
30447
30518
  if (candidate.web?.appDir !== void 0 && clean.status === "passed") {
@@ -30455,7 +30526,7 @@ async function runOneCommand(opts) {
30455
30526
  }
30456
30527
  }
30457
30528
  const cleanEvents = clean.events;
30458
- const idle = clean.status === "passed" && !cleanEvents.some((e) => e.operation !== "read") && !clean.assertions.some((a) => a.service !== "none");
30529
+ const idle = clean.status === "passed" && !cleanEvents.some((e) => e.operation !== "read") && !cleanCalls.some((c) => c.isWrite) && !clean.assertions.some((a) => a.service !== "none");
30459
30530
  const emptyReads = [...new Set(cleanEvents.filter((e) => e.operation === "read" && /^SELECT 0$/.test(e.detail ?? "")).map((e) => (e.path ?? "").replace(/^\//, "")))].filter(Boolean);
30460
30531
  if (idle) {
30461
30532
  log(yellow(" The request was accepted, but the app did nothing a test can check: no service was called and no row changed."));
package/dist/gateway.js CHANGED
@@ -8753,7 +8753,8 @@ function genericChecks(calls, opts = {}) {
8753
8753
  impact: impactOf(group, made - 1, "data-integrity", `the same ${first.resourcePath.split("/").filter((s) => s !== "{id}").pop() ?? "record"} exists ${times(made)} downstream`),
8754
8754
  ...group[group.length - 1].source ? { source: group[group.length - 1].source } : {},
8755
8755
  writeSites: sites(group),
8756
- fix: announce ? "check-before-resend" : "idempotency-key"
8756
+ fix: announce ? "check-before-resend" : "idempotency-key",
8757
+ ...group.length === 1 && first.duplicated && !first.idempotencyKey && !opts.duplicateDelivery ? { advisory: true } : {}
8757
8758
  });
8758
8759
  continue;
8759
8760
  }
@@ -9099,7 +9100,7 @@ function defaultFaultMatrix(services, opts = {}) {
9099
9100
  entries.push({ name: `postgres-${type}`, label: `Postgres ${type}`, type, service: "postgres", supported: false, reason: "SQL fault injection is not implemented; Postgres default checks still run on Docker runs with a disposable database" });
9100
9101
  return entries;
9101
9102
  }
9102
- var PROVIDER, displayName, rowsOf, VOLATILE2, volatileKey, canonical3, contentSignature, writeSequences, times2, money, stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries, NEGATIVE, gmailText, TARGETED, postgresUpdateApplied, postgresNoDuplicateInsert, UNSCOPED, postgresNoUnscopedDestructive, NOT_EFFECTS, genericRepeat, DEFAULT_CHECKS, VENDOR_COVERS, registryFor, refOf, WRITE_PATHS, slug;
9103
+ 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, WRITE_PATHS, slug;
9103
9104
  var init_default_checks = __esm({
9104
9105
  "src/runtime/default-checks.ts"() {
9105
9106
  "use strict";
@@ -9281,6 +9282,31 @@ var init_default_checks = __esm({
9281
9282
  return out;
9282
9283
  }
9283
9284
  };
9285
+ RELATIVE_SET = /\bset\b[\s\S]*?"?(\w+)"?\s*=\s*(?:"?\w+"?\.)?"?\1"?\s*[-+]/i;
9286
+ postgresNoRepeatedRelativeUpdate = {
9287
+ id: "postgres.no-repeated-relative-update",
9288
+ title: "A redelivered trigger does not apply a balance change twice",
9289
+ path: "/",
9290
+ coversDuplicates: true,
9291
+ expected: "an UPDATE that adds to or subtracts from a value runs once when the same trigger arrives twice",
9292
+ impact: "money",
9293
+ impactHint: "credits, balances or counters change twice for one event",
9294
+ run(ctx) {
9295
+ if (!ctx.duplicateDelivery) return [];
9296
+ const applied = (ctx.database?.statements ?? []).filter((st) => /^UPDATE$/i.test(st.command ?? "") && (st.count ?? 0) > 0 && RELATIVE_SET.test(st.text));
9297
+ const byText = /* @__PURE__ */ new Map();
9298
+ for (const st of applied) byText.set(st.text, (byText.get(st.text) ?? 0) + 1);
9299
+ return [...byText].filter(([, n]) => n >= 2).map(([text3, n]) => {
9300
+ const table2 = /^\s*update\s+(?:only\s+)?"?([\w.]+)"?/i.exec(text3)?.[1] ?? "a table", column2 = RELATIVE_SET.exec(text3)?.[1] ?? "a value";
9301
+ return {
9302
+ path: `/${table2}`,
9303
+ actual: { statement: text3.slice(0, 200), applied: n },
9304
+ finding: `Your agent changed ${table2}.${column2} ${times2(n)} when the same trigger was delivered twice`,
9305
+ impact: { count: n - 1 }
9306
+ };
9307
+ });
9308
+ }
9309
+ };
9284
9310
  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;
9285
9311
  postgresNoUnscopedDestructive = {
9286
9312
  id: "postgres.no-unscoped-destructive",
@@ -9341,7 +9367,7 @@ var init_default_checks = __esm({
9341
9367
  stripe: [stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries],
9342
9368
  slack: messageChecks("slack", "/messages"),
9343
9369
  gmail: messageChecks("gmail", "/gmail/v1/users/me/messages"),
9344
- postgres: [postgresUpdateApplied, postgresNoDuplicateInsert, postgresNoUnscopedDestructive],
9370
+ postgres: [postgresUpdateApplied, postgresNoDuplicateInsert, postgresNoRepeatedRelativeUpdate, postgresNoUnscopedDestructive],
9345
9371
  "*": [genericRepeat]
9346
9372
  };
9347
9373
  VENDOR_COVERS = { "retry-without-key": /\.idempotent-retries$/, "announce-after-failed-write": /\.announce-after-success$/ };
@@ -19081,6 +19107,39 @@ function missingTwinRecords(events, supplied, packOf, operations) {
19081
19107
  }
19082
19108
  return [...found.values()];
19083
19109
  }
19110
+ async function alignInputWithSchema(schemaSql, input, generated) {
19111
+ const fields = Object.entries(input).filter(([, v]) => generated(v));
19112
+ if (!fields.length) return { input, changed: [] };
19113
+ const extensions = schemaExtensions(schemaSql).filter((e) => POSTGRES_EXTENSIONS.includes(e));
19114
+ const db = await startPostgresEngine({ extensions, seed: { sql: schemaSql, tables: {} } });
19115
+ const out = { ...input }, changed = [];
19116
+ try {
19117
+ const cols = await queryReadOnly(db, `SELECT table_name, column_name, data_type FROM information_schema.columns WHERE table_schema = 'public'`);
19118
+ const snake = (k) => k.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
19119
+ const plural3 = (t) => [t, t + "s", t + "es", t.replace(/y$/, "ies")];
19120
+ for (const [key3, value3] of fields) {
19121
+ const name = snake(key3);
19122
+ const stem = /^(\w+?)_?id$/.exec(name)?.[1];
19123
+ const table2 = stem ? [...new Set(cols.map((c) => c.table_name))].find((t) => plural3(stem).includes(t) && cols.some((c) => c.table_name === t && c.column_name === "id")) : void 0;
19124
+ if (table2) {
19125
+ const row = (await queryReadOnly(db, `SELECT id FROM "${table2.replace(/"/g, '""')}" ORDER BY 1 LIMIT 1`))[0];
19126
+ if (row && row.id !== null && row.id !== void 0) {
19127
+ out[key3] = row.id;
19128
+ changed.push(`${key3} = ${table2}.id ${JSON.stringify(row.id)}`);
19129
+ continue;
19130
+ }
19131
+ }
19132
+ const numeric = cols.find((c) => c.column_name === name && /int|numeric|decimal|real|double/i.test(c.data_type));
19133
+ if (numeric && typeof value3 === "string") {
19134
+ out[key3] = 100;
19135
+ changed.push(`${key3} = 100 (${numeric.table_name}.${name} is ${numeric.data_type})`);
19136
+ }
19137
+ }
19138
+ } finally {
19139
+ await db.stop();
19140
+ }
19141
+ return { input: out, changed };
19142
+ }
19084
19143
  var sample;
19085
19144
  var init_state_seeding = __esm({
19086
19145
  "src/flow/state-seeding.ts"() {
@@ -20433,7 +20492,7 @@ var init_package = __esm({
20433
20492
  "package.json"() {
20434
20493
  package_default = {
20435
20494
  name: "agenttwin",
20436
- version: "0.3.33",
20495
+ version: "0.3.34",
20437
20496
  description: "AgentTwin builds digital twins for testing AI agents. The current CLI prepares supported Node.js workflows with synthetic services, failures, and outcome checks.",
20438
20497
  mcpName: "io.github.AgentTwin/agenttwin",
20439
20498
  keywords: [
@@ -28381,7 +28440,7 @@ function findingsFor(clean, run3, fault, candidate) {
28381
28440
  if (clean.genericViolations?.some((c) => c.violation.check === violation.check && c.violation.resource === violation.resource)) continue;
28382
28441
  if (findings.some((x) => x.title === finding.title)) continue;
28383
28442
  const hint = usefulImpact(violation.impact.summary);
28384
- findings.push({ id: `${fault.id}:${finding.id}`, severity: violation.impact.kind === "money" || finding.kind === "duplicate-effect" ? "high" : "medium", faultId: fault.id, title: finding.title, detail: `${violation.check}: ${violation.resource}`, impact: hint ? [hint] : [], evidencePath: run3.evidencePath, proof: finding });
28443
+ findings.push({ id: `${fault.id}:${finding.id}`, severity: violation.advisory ? "low" : violation.impact.kind === "money" || finding.kind === "duplicate-effect" ? "high" : "medium", faultId: fault.id, title: finding.title, detail: `${violation.check}: ${violation.resource}`, impact: hint ? [hint] : [], evidencePath: run3.evidencePath, proof: finding });
28385
28444
  }
28386
28445
  for (const check of run3.defaultChecks.filter((c) => !c.passed)) {
28387
28446
  if (clean.defaultChecks.some((c) => c.id === check.id && !c.passed)) continue;
@@ -29027,6 +29086,18 @@ async function runOneCommand(opts) {
29027
29086
  for (const a of prepared.scenario.assumptions) log(dim(` \xB7 ${a}`));
29028
29087
  log(dim(` Scenario: ${relative14(cwd, prepared.scenarioPath)} (edit to change inputs or expectations)`));
29029
29088
  const runOpts = { seed, integrations };
29089
+ const inputObject = prepared.scenario.input && typeof prepared.scenario.input === "object" && !Array.isArray(prepared.scenario.input) ? prepared.scenario.input : void 0;
29090
+ if (inputObject && prepared.scenario.postgresSchemaFiles?.length) {
29091
+ try {
29092
+ const aligned = await alignInputWithSchema(await loadPostgresSchema(cwd, prepared.scenario.postgresSchemaFiles), inputObject, (v) => typeof v === "string" && v.startsWith("synthetic-"));
29093
+ if (aligned.changed.length) {
29094
+ prepared.scenario.input = aligned.input;
29095
+ await writeFile26(prepared.scenarioPath, JSON.stringify(prepared.scenario, null, 2) + "\n", { mode: 384 });
29096
+ log(dim(` Input matched to the database: ${aligned.changed.join("; ")}`));
29097
+ }
29098
+ } catch {
29099
+ }
29100
+ }
29030
29101
  const liveHosts = (await readConnections(cwd)).connections.map((c) => c.host);
29031
29102
  log(bold("3/7 Run") + dim(liveHosts.length ? " real workflow code against twins\u2026" : " real workflow code against twins (no production calls)\u2026"));
29032
29103
  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.`));
@@ -29262,7 +29333,7 @@ async function runOneCommand(opts) {
29262
29333
  for (const c of genericFaultMatrix(cleanCalls, { timeouts, max: 16 })) faults.push({ id: c.id, title: c.title, generic: c.fault, ...c.supported ? {} : { supported: false, reason: c.reason } });
29263
29334
  }
29264
29335
  for (const c of cleanProblems) findings.push({ id: `clean:${c.id}`, severity: c.impact.kind === "money" || c.impact.kind === "data-integrity" ? "high" : "medium", faultId: "clean", title: c.finding ?? c.title, detail: `${c.check}: ${c.service}${c.path}`, impact: [c.impact.summary], evidencePath: clean.evidencePath });
29265
- for (const { violation, finding } of clean.genericViolations ?? []) findings.push({ id: `clean:${finding.id}`, severity: violation.impact.kind === "money" || finding.kind === "duplicate-effect" ? "high" : "medium", faultId: "clean", title: finding.title, detail: `${violation.check}: ${violation.resource}`, impact: /^\d+ occurrences?:/.test(violation.impact.summary) ? [] : [violation.impact.summary], evidencePath: clean.evidencePath, proof: finding });
29336
+ for (const { violation, finding } of clean.genericViolations ?? []) findings.push({ id: `clean:${finding.id}`, severity: violation.advisory ? "low" : violation.impact.kind === "money" || finding.kind === "duplicate-effect" ? "high" : "medium", faultId: "clean", title: finding.title, detail: `${violation.check}: ${violation.resource}`, impact: /^\d+ occurrences?:/.test(violation.impact.summary) ? [] : [violation.impact.summary], evidencePath: clean.evidencePath, proof: finding });
29266
29337
  const runnable = faults.filter((f) => f.supported !== false);
29267
29338
  const cases = /* @__PURE__ */ new Map();
29268
29339
  if (candidate.web?.appDir !== void 0 && clean.status === "passed") {
@@ -29276,7 +29347,7 @@ async function runOneCommand(opts) {
29276
29347
  }
29277
29348
  }
29278
29349
  const cleanEvents = clean.events;
29279
- const idle = clean.status === "passed" && !cleanEvents.some((e) => e.operation !== "read") && !clean.assertions.some((a) => a.service !== "none");
29350
+ const idle = clean.status === "passed" && !cleanEvents.some((e) => e.operation !== "read") && !cleanCalls.some((c) => c.isWrite) && !clean.assertions.some((a) => a.service !== "none");
29280
29351
  const emptyReads = [...new Set(cleanEvents.filter((e) => e.operation === "read" && /^SELECT 0$/.test(e.detail ?? "")).map((e) => (e.path ?? "").replace(/^\//, "")))].filter(Boolean);
29281
29352
  if (idle) {
29282
29353
  log(yellow(" The request was accepted, but the app did nothing a test can check: no service was called and no row changed."));
@@ -30567,6 +30638,16 @@ AgentTwin found ${fixes.length === 1 ? "a problem" : "problems"} in this change
30567
30638
 
30568
30639
  // src/runtime/pr-check-hosted.ts
30569
30640
  var exec10 = promisify12(execFile14);
30641
+ function loopMetrics(checks, installations) {
30642
+ const completed = checks.filter((c) => c.verdict === "pass" || c.verdict === "fail" || c.verdict === "warn").length;
30643
+ const waits = installations.flatMap((i) => {
30644
+ const first = checks.filter((c) => c.installationId === i.installationId).map((c) => Date.parse(c.createdAt)).filter(Number.isFinite).sort((a, b) => a - b)[0];
30645
+ const at = Date.parse(i.createdAt);
30646
+ return first !== void 0 && Number.isFinite(at) && first >= at ? [(first - at) / 6e4] : [];
30647
+ }).sort((a, b) => a - b);
30648
+ const median = waits.length ? waits[Math.floor((waits.length - 1) / 2)] : void 0;
30649
+ return { runs: checks.length, completed, completedPercent: checks.length ? Math.round(1e3 * completed / checks.length) / 10 : 0, ...median !== void 0 ? { minutesToFirstCheck: Math.round(median * 10) / 10 } : {} };
30650
+ }
30570
30651
  function valueReport(checks, month) {
30571
30652
  const inMonth = checks.filter((c) => c.createdAt.startsWith(month));
30572
30653
  const latest = /* @__PURE__ */ new Map();
@@ -32973,8 +33054,9 @@ async function startGateway(opts) {
32973
33054
  send(res, 400, { error: "invalid_month", message: "month is YYYY-MM" });
32974
33055
  return;
32975
33056
  }
32976
- const ids = new Set((store.githubInstallations ?? []).filter((i) => i.accountId === account.id).map((i) => i.installationId));
32977
- send(res, 200, valueReport((store.githubChecks ?? []).filter((c) => ids.has(c.installationId)), month));
33057
+ const installs = (store.githubInstallations ?? []).filter((i) => i.accountId === account.id), ids = new Set(installs.map((i) => i.installationId));
33058
+ const mine = (store.githubChecks ?? []).filter((c) => ids.has(c.installationId));
33059
+ send(res, 200, { ...valueReport(mine, month), loop: loopMetrics(mine.filter((c) => c.createdAt.startsWith(month)), installs) });
32978
33060
  return;
32979
33061
  }
32980
33062
  if (path2 === "/v1/workspace/alerts" && (req.method === "GET" || req.method === "PUT")) {
package/dist/worker.js CHANGED
@@ -7284,7 +7284,8 @@ function genericChecks(calls, opts = {}) {
7284
7284
  impact: impactOf(group, made - 1, "data-integrity", `the same ${first.resourcePath.split("/").filter((s) => s !== "{id}").pop() ?? "record"} exists ${times(made)} downstream`),
7285
7285
  ...group[group.length - 1].source ? { source: group[group.length - 1].source } : {},
7286
7286
  writeSites: sites(group),
7287
- fix: announce ? "check-before-resend" : "idempotency-key"
7287
+ fix: announce ? "check-before-resend" : "idempotency-key",
7288
+ ...group.length === 1 && first.duplicated && !first.idempotencyKey && !opts.duplicateDelivery ? { advisory: true } : {}
7288
7289
  });
7289
7290
  continue;
7290
7291
  }
@@ -7675,6 +7676,31 @@ var postgresNoDuplicateInsert = {
7675
7676
  return out;
7676
7677
  }
7677
7678
  };
7679
+ var RELATIVE_SET = /\bset\b[\s\S]*?"?(\w+)"?\s*=\s*(?:"?\w+"?\.)?"?\1"?\s*[-+]/i;
7680
+ var postgresNoRepeatedRelativeUpdate = {
7681
+ id: "postgres.no-repeated-relative-update",
7682
+ title: "A redelivered trigger does not apply a balance change twice",
7683
+ path: "/",
7684
+ coversDuplicates: true,
7685
+ expected: "an UPDATE that adds to or subtracts from a value runs once when the same trigger arrives twice",
7686
+ impact: "money",
7687
+ impactHint: "credits, balances or counters change twice for one event",
7688
+ run(ctx) {
7689
+ if (!ctx.duplicateDelivery) return [];
7690
+ const applied = (ctx.database?.statements ?? []).filter((st) => /^UPDATE$/i.test(st.command ?? "") && (st.count ?? 0) > 0 && RELATIVE_SET.test(st.text));
7691
+ const byText = /* @__PURE__ */ new Map();
7692
+ for (const st of applied) byText.set(st.text, (byText.get(st.text) ?? 0) + 1);
7693
+ return [...byText].filter(([, n]) => n >= 2).map(([text2, n]) => {
7694
+ const table2 = /^\s*update\s+(?:only\s+)?"?([\w.]+)"?/i.exec(text2)?.[1] ?? "a table", column = RELATIVE_SET.exec(text2)?.[1] ?? "a value";
7695
+ return {
7696
+ path: `/${table2}`,
7697
+ actual: { statement: text2.slice(0, 200), applied: n },
7698
+ finding: `Your agent changed ${table2}.${column} ${times2(n)} when the same trigger was delivered twice`,
7699
+ impact: { count: n - 1 }
7700
+ };
7701
+ });
7702
+ }
7703
+ };
7678
7704
  var 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;
7679
7705
  var postgresNoUnscopedDestructive = {
7680
7706
  id: "postgres.no-unscoped-destructive",
@@ -7735,7 +7761,7 @@ var DEFAULT_CHECKS = {
7735
7761
  stripe: [stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries],
7736
7762
  slack: messageChecks("slack", "/messages"),
7737
7763
  gmail: messageChecks("gmail", "/gmail/v1/users/me/messages"),
7738
- postgres: [postgresUpdateApplied, postgresNoDuplicateInsert, postgresNoUnscopedDestructive],
7764
+ postgres: [postgresUpdateApplied, postgresNoDuplicateInsert, postgresNoRepeatedRelativeUpdate, postgresNoUnscopedDestructive],
7739
7765
  "*": [genericRepeat]
7740
7766
  };
7741
7767
  var VENDOR_COVERS = { "retry-without-key": /\.idempotent-retries$/, "announce-after-failed-write": /\.announce-after-success$/ };
@@ -7953,7 +7953,8 @@ function genericChecks(calls, opts = {}) {
7953
7953
  impact: impactOf(group, made - 1, "data-integrity", `the same ${first.resourcePath.split("/").filter((s) => s !== "{id}").pop() ?? "record"} exists ${times(made)} downstream`),
7954
7954
  ...group[group.length - 1].source ? { source: group[group.length - 1].source } : {},
7955
7955
  writeSites: sites(group),
7956
- 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 } : {}
7957
7958
  });
7958
7959
  continue;
7959
7960
  }
@@ -8248,7 +8249,7 @@ function runDefaultChecks(input) {
8248
8249
  };
8249
8250
  });
8250
8251
  }
8251
- var PROVIDER, displayName, rowsOf, VOLATILE2, volatileKey, canonical3, contentSignature, writeSequences, times2, money, stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries, NEGATIVE, gmailText, TARGETED, postgresUpdateApplied, postgresNoDuplicateInsert, UNSCOPED, postgresNoUnscopedDestructive, 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;
8252
8253
  var init_default_checks = __esm({
8253
8254
  "src/runtime/default-checks.ts"() {
8254
8255
  "use strict";
@@ -8430,6 +8431,31 @@ var init_default_checks = __esm({
8430
8431
  return out;
8431
8432
  }
8432
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
+ };
8433
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;
8434
8460
  postgresNoUnscopedDestructive = {
8435
8461
  id: "postgres.no-unscoped-destructive",
@@ -8490,7 +8516,7 @@ var init_default_checks = __esm({
8490
8516
  stripe: [stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries],
8491
8517
  slack: messageChecks("slack", "/messages"),
8492
8518
  gmail: messageChecks("gmail", "/gmail/v1/users/me/messages"),
8493
- postgres: [postgresUpdateApplied, postgresNoDuplicateInsert, postgresNoUnscopedDestructive],
8519
+ postgres: [postgresUpdateApplied, postgresNoDuplicateInsert, postgresNoRepeatedRelativeUpdate, postgresNoUnscopedDestructive],
8494
8520
  "*": [genericRepeat]
8495
8521
  };
8496
8522
  VENDOR_COVERS = { "retry-without-key": /\.idempotent-retries$/, "announce-after-failed-write": /\.announce-after-success$/ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenttwin",
3
- "version": "0.3.33",
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([[9492],{166:(o,e,t)=>{Promise.resolve().then(t.t.bind(t,3652,23))},3652:o=>{o.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"}}},o=>{o.O(0,[4123,8441,1255,7358],()=>o(o.s=166)),_N_E=o.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7220],{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:()=>{},6954:(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))},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=6954)),_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"})})]})}},6699:(e,a,s)=>{Promise.resolve().then(s.bind(s,3529))}},e=>{e.O(0,[3935,6787,8441,1255,7358],()=>e(e.s=6699)),_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"}},6458:(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=6458)),_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"}},6458:(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=6458)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9584],{2418:()=>{},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"}},6039:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,3652,23)),Promise.resolve().then(n.t.bind(n,2418,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,5097,5105,8441,1255,7358],()=>e(e.s=6039)),_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"}},6458:(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=6458)),_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"}},6458:(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=6458)),_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:()=>{},5765:(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=5765)),_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"}},6458:(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=6458)),_N_E=e.O()}]);