agenttwin 0.3.24 → 0.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +710 -192
- package/dist/dashboard/assets/next/static/chunks/{1018.4871a8dd0f112c38.js → 1018.66d31bb49c376d17.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/1937-f5553afe6a14cf73.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/5663-661e38f3ed101571.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/{6751.613adb085c9a5b06.js → 6751.d9c97d8c374550b0.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-73183e77e91eaaa0.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-3a3a934622d409c3.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/webpack-c3ef4a63a3242476.js +1 -0
- package/dist/dashboard/assets/next/static/css/aa701337c7b34139.css +1 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/engine.js +20 -7
- package/dist/gateway.js +761 -196
- package/package.json +1 -1
- package/dist/dashboard/assets/next/static/chunks/1250-a3c859fd20517500.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/5663-2ba656663ac4643f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-2d0408d8f22d7921.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-0e0392368e0a891e.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/webpack-ecd761d72719adb3.js +0 -1
- package/dist/dashboard/assets/next/static/css/1d1b20bd9fb076d4.css +0 -1
- /package/dist/dashboard/assets/next/static/{ztFPFZw3-M7E56BfRipIn → KSAqb4jD1gnp0t5kzwmoJ}/_buildManifest.js +0 -0
- /package/dist/dashboard/assets/next/static/{ztFPFZw3-M7E56BfRipIn → KSAqb4jD1gnp0t5kzwmoJ}/_ssgManifest.js +0 -0
package/dist/engine.js
CHANGED
|
@@ -170,7 +170,7 @@ var init_package = __esm({
|
|
|
170
170
|
"package.json"() {
|
|
171
171
|
package_default = {
|
|
172
172
|
name: "agenttwin",
|
|
173
|
-
version: "0.3.
|
|
173
|
+
version: "0.3.26",
|
|
174
174
|
description: "AgentTwin builds digital twins for testing AI agents. The current CLI prepares supported Node.js workflows with synthetic services, failures, and outcome checks.",
|
|
175
175
|
mcpName: "io.github.Sashank-Singh/agenttwin",
|
|
176
176
|
keywords: [
|
|
@@ -9710,6 +9710,9 @@ var init_run = __esm({
|
|
|
9710
9710
|
import { createHash as createHash13, randomUUID as randomUUID6 } from "crypto";
|
|
9711
9711
|
import { mkdir as mkdir11, readFile as readFile20, rm as rm12, writeFile as writeFile16 } from "fs/promises";
|
|
9712
9712
|
import { isAbsolute as isAbsolute3, join as join25, relative as relative5, resolve as resolve7, sep as sep4 } from "path";
|
|
9713
|
+
function seededCount(state, service, path2, where) {
|
|
9714
|
+
return (state?.[service]?.[path2] ?? []).filter((row) => matches3(row, where)).length;
|
|
9715
|
+
}
|
|
9713
9716
|
function createdRecords(r, service, path2, where) {
|
|
9714
9717
|
const before = new Set((r.initialState?.[service]?.[path2] ?? []).map((row) => JSON.stringify(row?.id ?? row)));
|
|
9715
9718
|
return (r.finalState?.[service]?.[path2] ?? []).filter((row) => matches3(row, where) && !before.has(JSON.stringify(row?.id ?? row)));
|
|
@@ -9752,6 +9755,8 @@ function findingsFromReceipt(r, world) {
|
|
|
9752
9755
|
const created2 = createdRecords(r, c.service, c.path, c.where);
|
|
9753
9756
|
const records = kind === "duplicate-effect" && expected !== void 0 && actual !== void 0 ? created2.slice(Math.max(0, created2.length - (actual - expected) - Math.min(expected, 1))) : kind === "missing-effect" ? [] : created2;
|
|
9754
9757
|
const located = (kind === "duplicate-effect" ? [...writes].reverse() : writes).find((e) => e.source) ?? r.events.find((e) => related(e) && e.source);
|
|
9758
|
+
const existing = seededCount(r.initialState, c.service, c.path, c.where);
|
|
9759
|
+
const handled = kind === "missing-effect" && !!fault?.triggered && ["server-error", "blackhole"].includes(fault.type) && typeof r.application?.exitCode === "number" && r.application.exitCode !== 0;
|
|
9755
9760
|
findings.push({
|
|
9756
9761
|
id: c.id ?? `check_${index + 1}`,
|
|
9757
9762
|
kind,
|
|
@@ -9761,7 +9766,9 @@ function findingsFromReceipt(r, world) {
|
|
|
9761
9766
|
expected,
|
|
9762
9767
|
actual,
|
|
9763
9768
|
records,
|
|
9764
|
-
|
|
9769
|
+
...existing ? { existing } : {},
|
|
9770
|
+
...handled ? { handled } : {},
|
|
9771
|
+
title: handled ? `The ${serviceName2(c.service)} ${(c.path.split("/").filter(Boolean).pop() ?? "record").replace(/_/g, " ").replace(/s$/, "")} was not made when ${serviceName2(fault.service ?? c.service)} ${FAULT_PHRASE[fault.type] ?? `hit ${fault.type}`}, and your code stopped with an error` : titleFor(kind, c.service, c.path, actual, expected, records, fault, seeded),
|
|
9765
9772
|
timeline: timeline(related),
|
|
9766
9773
|
...located?.source ? { source: located.source } : {},
|
|
9767
9774
|
...kind === "duplicate-effect" ? { writeSites: [...new Map(writes.filter((e) => e.source).map((e) => [`${e.source.file}:${e.source.line}`, { file: e.source.file, line: e.source.line, column: e.source.column }])).values()] } : {},
|
|
@@ -9839,8 +9846,11 @@ function impactSummary(findings) {
|
|
|
9839
9846
|
continue;
|
|
9840
9847
|
}
|
|
9841
9848
|
out.push(`Would have created ${f.actual} ${serviceName2(f.service)} ${(f.path.split("/").pop() ?? "records").replace(/_/g, " ")} instead of ${f.expected}`);
|
|
9842
|
-
} else if (f.kind === "missing-effect")
|
|
9843
|
-
|
|
9849
|
+
} else if (f.kind === "missing-effect") {
|
|
9850
|
+
const what = `${serviceName2(f.service)} ${(f.path.split("/").pop() ?? "").replace(/_/g, " ")}`, base = f.existing ?? 0;
|
|
9851
|
+
const wanted = Math.max(0, (f.expected ?? 0) - base), made = Math.max(0, (f.actual ?? 0) - base);
|
|
9852
|
+
out.push(f.handled ? `${what}: ${made} of ${wanted} new ${wanted === 1 ? "write" : "writes"} made; your code stopped with an error, so make sure that error reaches someone who can retry` : `${what}: ${made} of ${wanted} new ${wanted === 1 ? "write" : "writes"} made, and nothing reported an error, so the failure was silent`);
|
|
9853
|
+
} else if (f.kind === "unconfirmed-announce") out.push(`${serviceName2(f.service)} would have announced work that never happened`);
|
|
9844
9854
|
else if (f.kind === "forbidden-effect") out.push(`Would have changed ${serviceName2(f.service)} ${f.path}${f.actual !== void 0 ? ` (${plural2(Number(f.actual), "write")})` : ""}, which this workflow must not touch`);
|
|
9845
9855
|
else if (f.kind === "partial-commit") out.push("Database changes would have stayed committed while the notification failed");
|
|
9846
9856
|
else out.push(`${serviceName2(f.service)} ${f.path} would have ended in a state the checks do not allow`);
|
|
@@ -23201,7 +23211,7 @@ function findingsFor(clean, run3, fault, candidate) {
|
|
|
23201
23211
|
if (!cleanChecks.some((c) => c.passed && sameCheck(c, f))) continue;
|
|
23202
23212
|
if (findings.some((x) => x.proof && sameCheck(x.proof, f))) continue;
|
|
23203
23213
|
const money2 = f.service === "stripe" || /refunds|charges|payment_intents|payouts/.test(f.path);
|
|
23204
|
-
findings.push({ id: `${fault.id}:${f.id}`, severity: money2 && f.kind === "duplicate-effect" ? "high" : "medium", faultId: fault.id, title: f.title, detail: `${f.service}${f.path}${f.where ? " " + JSON.stringify(f.where) : ""}: expected ${f.expected}, recorded ${f.actual}`, impact: impactSummary([f]), evidencePath: run3.evidencePath, proof: { ...f, id: `${fault.id}.${f.id}` } });
|
|
23214
|
+
findings.push({ id: `${fault.id}:${f.id}`, severity: f.handled ? "low" : money2 && f.kind === "duplicate-effect" ? "high" : "medium", faultId: fault.id, title: f.title, detail: `${f.service}${f.path}${f.where ? " " + JSON.stringify(f.where) : ""}: expected ${(f.expected ?? 0) - (f.existing ?? 0)} new, recorded ${(f.actual ?? 0) - (f.existing ?? 0)} new`, impact: impactSummary([f]), evidencePath: run3.evidencePath, proof: { ...f, id: `${fault.id}.${f.id}` } });
|
|
23205
23215
|
}
|
|
23206
23216
|
for (const { violation, finding } of run3.genericViolations ?? []) {
|
|
23207
23217
|
if (clean.genericViolations?.some((c) => c.violation.check === violation.check && c.violation.resource === violation.resource)) continue;
|
|
@@ -23590,7 +23600,10 @@ async function runOneCommand(opts) {
|
|
|
23590
23600
|
clean = await runCase(cwd, prepared, void 0, runOpts);
|
|
23591
23601
|
}
|
|
23592
23602
|
log(` ${statusMark(clean.status)} clean run ${dim(relative22(cwd, clean.evidencePath))}`);
|
|
23593
|
-
for (const a of clean.assertions)
|
|
23603
|
+
for (const a of clean.assertions) {
|
|
23604
|
+
const had = seededCount(clean.initialState, a.service, a.path, a.where);
|
|
23605
|
+
log(` ${a.passed ? green("\u2713") : red("\u2717")} ${a.service}${a.path}${a.where ? " " + JSON.stringify(a.where) : ""} ${dim(had ? `expected ${a.count - had} new, saw ${a.actual - had} new (${had} already there)` : `expected ${a.count}, saw ${a.actual}`)}`);
|
|
23606
|
+
}
|
|
23594
23607
|
for (const c of clean.defaultChecks.filter((c2) => !c2.passed)) log(` ${red("\u2717")} ${c.finding ?? c.title}`);
|
|
23595
23608
|
if (clean.unsupported.length) log(yellow(` Unsupported by twins: ${clean.unsupported.slice(0, 3).join("; ")}`));
|
|
23596
23609
|
for (const b of [...clean.blocked.map((b2) => `Blocked ${b2.origin} (${b2.reason})`), ...clean.blockedCalls.map((b2) => `Blocked ${b2.method} ${b2.host}`)]) log(yellow(` ${b}`));
|
|
@@ -23650,7 +23663,7 @@ async function runOneCommand(opts) {
|
|
|
23650
23663
|
const steps2 = (f.proof?.timeline ?? []).filter((t) => t.highlight).slice(0, 4).map((t) => `${t.operation === "fault" ? `fault: ${t.detail}` : `${t.service} ${t.operation} ${t.path}`}${t.source ? ` (${t.source})` : ""}`);
|
|
23651
23664
|
log(dim(` ${steps2.length ? "Evidence: " + steps2.join(" \u2192 ") : f.detail}`));
|
|
23652
23665
|
}
|
|
23653
|
-
const impact = integrations.impactSummary(findings);
|
|
23666
|
+
const impact = integrations.impactSummary(findings.filter((f) => f.severity !== "low"));
|
|
23654
23667
|
log(bold("6/7 Fix"));
|
|
23655
23668
|
const serious = findings.filter((f) => f.severity !== "low");
|
|
23656
23669
|
let proposal = null, outcome, proofDir, after = [];
|