agenttwin 0.3.13 → 0.3.15

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 (116) hide show
  1. package/dist/api.js +472 -93
  2. package/dist/cli.js +126 -19
  3. package/dist/dashboard/assets/next/static/RRU6kOWIag8OaxBjl6DjU/_buildManifest.js +1 -0
  4. package/dist/dashboard/assets/next/static/chunks/1255-d4ec8dbb0865c655.js +1 -0
  5. package/dist/dashboard/assets/next/static/chunks/1482.e664aba77631265d.js +1 -0
  6. package/dist/dashboard/assets/next/static/chunks/182-71d400a5d9e02879.js +1 -0
  7. package/dist/dashboard/assets/next/static/chunks/3050-bac69e3c6734beee.js +1 -0
  8. package/dist/dashboard/assets/next/static/chunks/3056.ffa9a4d44a274b29.js +1 -0
  9. package/dist/dashboard/assets/next/static/chunks/{2442.9a266da6229b8ae0.js → 4055.1056568a41510e92.js} +1 -1
  10. package/dist/dashboard/assets/next/static/chunks/4343.023a18f52318dbad.js +1 -0
  11. package/dist/dashboard/assets/next/static/chunks/4bd1b696-f785427dddbba9fb.js +1 -0
  12. package/dist/dashboard/assets/next/static/chunks/{5490.0d5d8d5ea3577f20.js → 6751.613adb085c9a5b06.js} +1 -1
  13. package/dist/dashboard/assets/next/static/chunks/6787-c85d7f794360b672.js +1 -0
  14. package/dist/dashboard/assets/next/static/chunks/7772-f2d773cd3e94eea6.js +67 -0
  15. package/dist/dashboard/assets/next/static/chunks/8093-90b99184c0a57c57.js +1 -0
  16. package/dist/dashboard/assets/next/static/chunks/{3454.d29ee7a49c2a4fba.js → 8975.5be81ec8b09e3b45.js} +1 -1
  17. package/dist/dashboard/assets/next/static/chunks/{7280.01b3f749332bb075.js → 9013.0f2be1cc70029afa.js} +2 -2
  18. package/dist/dashboard/assets/next/static/chunks/9376.42da54b90ff9f2d9.js +1 -0
  19. package/dist/dashboard/assets/next/static/chunks/9675.14739028910476e4.js +1 -0
  20. package/dist/dashboard/assets/next/static/chunks/971-f01a5b1fb6756f6c.js +1 -0
  21. package/dist/dashboard/assets/next/static/chunks/app/_not-found/page-43db8aef3fa81958.js +1 -0
  22. package/dist/dashboard/assets/next/static/chunks/app/about/page-3f5dbcdbf95bb2fc.js +1 -0
  23. package/dist/dashboard/assets/next/static/chunks/app/account/password/page-c2ce3c796c817ca1.js +1 -0
  24. package/dist/dashboard/assets/next/static/chunks/app/api-policy/page-3f5dbcdbf95bb2fc.js +1 -0
  25. package/dist/dashboard/assets/next/static/chunks/app/auth/page-3f5dbcdbf95bb2fc.js +1 -0
  26. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-mockoon/page-ba841d868e5d124a.js +1 -0
  27. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-pact/page-ba841d868e5d124a.js +1 -0
  28. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-testcontainers/page-ba841d868e5d124a.js +1 -0
  29. package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-wiremock/page-ba841d868e5d124a.js +1 -0
  30. package/dist/dashboard/assets/next/static/chunks/app/blog/keploy-alternatives-for-database-and-payment-workflows/page-ba841d868e5d124a.js +1 -0
  31. package/dist/dashboard/assets/next/static/chunks/app/blog/layout-563d8763d65d66b5.js +1 -0
  32. package/dist/dashboard/assets/next/static/chunks/app/blog/page-ba841d868e5d124a.js +1 -0
  33. package/dist/dashboard/assets/next/static/chunks/app/blog/reset-test-environment-between-runs/page-ba841d868e5d124a.js +1 -0
  34. package/dist/dashboard/assets/next/static/chunks/app/blog/simulate-timeouts-and-duplicate-events/page-ba841d868e5d124a.js +1 -0
  35. package/dist/dashboard/assets/next/static/chunks/app/compare/page-3f5dbcdbf95bb2fc.js +1 -0
  36. package/dist/dashboard/assets/next/static/chunks/app/contact/page-3f5dbcdbf95bb2fc.js +1 -0
  37. package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-1afe915ed22ac5ed.js +1 -0
  38. package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-d91fa87fbf634bc9.js +1 -0
  39. package/dist/dashboard/assets/next/static/chunks/app/demo/page-4dc63755e0013e7c.js +1 -0
  40. package/dist/dashboard/assets/next/static/chunks/app/developers/page-3f5dbcdbf95bb2fc.js +1 -0
  41. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-3c0d688140d910bd.js +1 -0
  42. package/dist/dashboard/assets/next/static/chunks/app/guides/page-3f5dbcdbf95bb2fc.js +1 -0
  43. package/dist/dashboard/assets/next/static/chunks/app/layout-993a96283a3ceb07.js +1 -0
  44. package/dist/dashboard/assets/next/static/chunks/app/login/page-d6d4276397724d29.js +1 -0
  45. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-bc480c9258e5cc4d.js +1 -0
  46. package/dist/dashboard/assets/next/static/chunks/app/page-e4fe99bcc001a517.js +1 -0
  47. package/dist/dashboard/assets/next/static/chunks/app/pricing/page-40f352fe5093a0ff.js +1 -0
  48. package/dist/dashboard/assets/next/static/chunks/app/privacy/page-3f5dbcdbf95bb2fc.js +1 -0
  49. package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-3f5dbcdbf95bb2fc.js +1 -0
  50. package/dist/dashboard/assets/next/static/chunks/app/signup/page-d6d4276397724d29.js +1 -0
  51. package/dist/dashboard/assets/next/static/chunks/app/sitemap.xml/route-ba841d868e5d124a.js +1 -0
  52. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-a5cf565e017886d3.js +1 -0
  53. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-ca68ba293cca7d75.js +1 -0
  54. package/dist/dashboard/assets/next/static/chunks/app/v2/layout-abbd9f3b8811f559.js +1 -0
  55. package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-4f4a342a4c28f9de.js +1 -0
  56. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-f04c0b236abaead3.js +1 -0
  57. package/dist/dashboard/assets/next/static/chunks/app/v2/page-3905446ec0206fb5.js +1 -0
  58. package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-4f4a342a4c28f9de.js +1 -0
  59. package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-3f5dbcdbf95bb2fc.js +1 -0
  60. package/dist/dashboard/assets/next/static/chunks/{48a1527b.6d52e40c5e62d9d5.js → b468fba8.437b212aae4abcf8.js} +1 -1
  61. package/dist/dashboard/assets/next/static/chunks/framework-e54b663a2888b5de.js +1 -0
  62. package/dist/dashboard/assets/next/static/chunks/main-5aa70aa3d6a46aa0.js +1 -0
  63. package/dist/dashboard/assets/next/static/chunks/main-app-1ec13ceef4a34729.js +1 -0
  64. package/dist/dashboard/assets/next/static/chunks/pages/_app-6c8c2371b16a04b8.js +1 -0
  65. package/dist/dashboard/assets/next/static/chunks/pages/_error-94812ad32cad7365.js +1 -0
  66. package/dist/dashboard/assets/next/static/chunks/webpack-1ac08e31899efefb.js +1 -0
  67. package/dist/dashboard/assets/next/static/css/15b28a76469ea7e5.css +3 -0
  68. package/dist/dashboard/assets/next/static/css/{eea0966f05042bde.css → 18afa3e32331c41d.css} +1 -1
  69. package/dist/dashboard/assets/next/static/css/6695e0f2ae2e5aaf.css +1 -0
  70. package/dist/dashboard/assets/next/static/css/ced6baae4dc4cbab.css +1 -0
  71. package/dist/dashboard/assets/next/static/css/d35115cc1039cc68.css +1 -0
  72. package/dist/dashboard/assets/next/static/css/f27d5fbb1f484d9d.css +1 -0
  73. package/dist/dashboard/index.html +2 -2
  74. package/dist/gateway.js +465 -86
  75. package/package.json +14 -2
  76. package/dist/dashboard/assets/next/static/BbTZs0rKnsmj45peSnlwJ/_buildManifest.js +0 -1
  77. package/dist/dashboard/assets/next/static/chunks/1981-2ce2c5edd154524a.js +0 -1
  78. package/dist/dashboard/assets/next/static/chunks/2529.07927d0600506985.js +0 -1
  79. package/dist/dashboard/assets/next/static/chunks/3916-2698a1a3ecb8649f.js +0 -67
  80. package/dist/dashboard/assets/next/static/chunks/4705-a6d249b4a5dcde26.js +0 -1
  81. package/dist/dashboard/assets/next/static/chunks/4816-45f42396ec2135cc.js +0 -1
  82. package/dist/dashboard/assets/next/static/chunks/650-3092bf29ff938e12.js +0 -1
  83. package/dist/dashboard/assets/next/static/chunks/6f3ce29d-af1469ba72f5d3e4.js +0 -1
  84. package/dist/dashboard/assets/next/static/chunks/794.a624e6be9e42a62b.js +0 -1
  85. package/dist/dashboard/assets/next/static/chunks/app/_not-found/page-471a6c74344187f9.js +0 -1
  86. package/dist/dashboard/assets/next/static/chunks/app/account/password/page-aaee6711085b485d.js +0 -1
  87. package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-09cb13657f62384f.js +0 -1
  88. package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-945c916b24f48675.js +0 -1
  89. package/dist/dashboard/assets/next/static/chunks/app/demo/page-3cba0aab460c8677.js +0 -1
  90. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-9f7b8dca8b973b15.js +0 -1
  91. package/dist/dashboard/assets/next/static/chunks/app/enterprise/page-4986698442bddc6b.js +0 -1
  92. package/dist/dashboard/assets/next/static/chunks/app/layout-09868e53e4f0541f.js +0 -1
  93. package/dist/dashboard/assets/next/static/chunks/app/login/page-2e29d4b17645c34c.js +0 -1
  94. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-af2c4768dc34ec92.js +0 -1
  95. package/dist/dashboard/assets/next/static/chunks/app/page-507229409812cedd.js +0 -1
  96. package/dist/dashboard/assets/next/static/chunks/app/pricing/page-c27282cd7bfb0fcf.js +0 -1
  97. package/dist/dashboard/assets/next/static/chunks/app/signup/page-2e29d4b17645c34c.js +0 -1
  98. package/dist/dashboard/assets/next/static/chunks/app/sitemap.xml/route-36bcc482b50fcb46.js +0 -1
  99. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-77a57cd622171076.js +0 -1
  100. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-df34bcef0394d10d.js +0 -1
  101. package/dist/dashboard/assets/next/static/chunks/app/v2/layout-d1d715b5b2dae3cd.js +0 -1
  102. package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-4f60d050bf954194.js +0 -1
  103. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-abfe2f36213848d7.js +0 -1
  104. package/dist/dashboard/assets/next/static/chunks/app/v2/page-df6a34eff716d18e.js +0 -1
  105. package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-4f60d050bf954194.js +0 -1
  106. package/dist/dashboard/assets/next/static/chunks/framework-cb37e134fe056fa5.js +0 -1
  107. package/dist/dashboard/assets/next/static/chunks/main-app-c83f3671ad6b824a.js +0 -1
  108. package/dist/dashboard/assets/next/static/chunks/main-b7d6352ee94d0dba.js +0 -1
  109. package/dist/dashboard/assets/next/static/chunks/pages/_app-9dd167be58cf5cbd.js +0 -1
  110. package/dist/dashboard/assets/next/static/chunks/pages/_error-5a8b1eb076dd7c95.js +0 -1
  111. package/dist/dashboard/assets/next/static/chunks/webpack-44457f45df749a89.js +0 -1
  112. package/dist/dashboard/assets/next/static/css/0856ee8c880d8b92.css +0 -1
  113. package/dist/dashboard/assets/next/static/css/0cf03e33b963e5cb.css +0 -1
  114. package/dist/dashboard/assets/next/static/css/81a1668ab34a36e8.css +0 -1
  115. package/dist/dashboard/assets/next/static/css/b15fa8a0e168d625.css +0 -1
  116. /package/dist/dashboard/assets/next/static/{BbTZs0rKnsmj45peSnlwJ → RRU6kOWIag8OaxBjl6DjU}/_ssgManifest.js +0 -0
package/dist/cli.js CHANGED
@@ -1929,7 +1929,7 @@ import { join as join34 } from "path";
1929
1929
  // package.json
1930
1930
  var package_default = {
1931
1931
  name: "agenttwin",
1932
- version: "0.3.13",
1932
+ version: "0.3.15",
1933
1933
  description: "Give your agent a test world before it touches the real one.",
1934
1934
  keywords: [
1935
1935
  "agent",
@@ -1938,7 +1938,14 @@ var package_default = {
1938
1938
  "simulation",
1939
1939
  "sandbox",
1940
1940
  "twin",
1941
- "cli"
1941
+ "cli",
1942
+ "agenttwin",
1943
+ "agent-testing",
1944
+ "workflow-testing",
1945
+ "nodejs",
1946
+ "digital-twin",
1947
+ "test-automation",
1948
+ "agent-testing-tool"
1942
1949
  ],
1943
1950
  type: "module",
1944
1951
  bin: {
@@ -1980,6 +1987,11 @@ var package_default = {
1980
1987
  tsx: "^4.23.15",
1981
1988
  typescript: "^7.0.2",
1982
1989
  vitest: "^5.0.3"
1990
+ },
1991
+ homepage: "https://agenttwin.si/",
1992
+ repository: {
1993
+ type: "git",
1994
+ url: "git+https://github.com/Sashank-Singh/AgentTwin.git"
1983
1995
  }
1984
1996
  };
1985
1997
 
@@ -2055,7 +2067,7 @@ async function runSync(cwd) {
2055
2067
  if (!response.ok) throw new Error(result.error || "Discovery sync failed: " + response.status);
2056
2068
  if (git) await writeFile5(join8(cwd, ".agenttwin/git.json"), JSON.stringify(git) + "\n", { mode: 384 });
2057
2069
  const receipts = await syncReceipts(cwd, base, token);
2058
- return { receipts, synced: true, tools: payload.tools.length, workflows: payload.workflows.length, dashboard: "https://agenttwin.si/dashboard/", uploaded: "discovery, Git metadata and run evidence; no application source or credentials" };
2070
+ return { receipts, synced: true, tools: payload.tools.length, workflows: payload.workflows.length, dashboard: base === "http://localhost:8080" ? "http://localhost:3000/dashboard/" : "https://agenttwin.si/dashboard/", uploaded: "discovery, Git metadata and run evidence; no application source or credentials" };
2059
2071
  }
2060
2072
 
2061
2073
  // src/commands/prepare.ts
@@ -9134,6 +9146,7 @@ async function runInit(opts) {
9134
9146
  if (opts.agent && (opts.dryRun || opts.json)) throw new Error("A coding session requires a writing, interactive init (omit --dry-run and --json).");
9135
9147
  setQuiet(opts.json);
9136
9148
  const interactive = !opts.json && !opts.yes && !opts.dryRun && (opts.interactive === true || !opts.json && process.stdin.isTTY === true && process.stdout.isTTY === true);
9149
+ const quickInit = interactive && opts.finishAfterSync === true;
9137
9150
  const log = (message) => {
9138
9151
  if (!message.startsWith("inspect ")) process.stderr.write(`${message}
9139
9152
  `);
@@ -9159,7 +9172,12 @@ async function runInit(opts) {
9159
9172
  inventory = applyInventoryAnswers(inventory, Object.fromEntries(excludedTools.map((t) => [`tool.exclude:${t.id}`, false])));
9160
9173
  if (!opts.json) {
9161
9174
  info("");
9162
- info(renderOverview(inventory));
9175
+ if (quickInit) {
9176
+ const integrations = inventory.tools.filter((tool2) => tool2.category === "dependency").length;
9177
+ const gaps = inventory.coverage.sources.filter((source) => source.status !== "ok" && source.status !== "skipped");
9178
+ info(`Detected ${inventory.services.length} applications, ${integrations} referenced integrations and ${inventory.workflows.length} code paths.`);
9179
+ if (gaps.length) warn(`Scan limitations: ${gaps.map((source) => `${source.id}=${source.status}`).join(", ")}`);
9180
+ } else info(renderOverview(inventory));
9163
9181
  info("");
9164
9182
  }
9165
9183
  const decisions = (await readDecisions(opts.cwd))?.items ?? [];
@@ -9170,14 +9188,14 @@ async function runInit(opts) {
9170
9188
  const { parseAnswersFile: parseAnswersFile2 } = await Promise.resolve().then(() => (init_answers(), answers_exports));
9171
9189
  answers = parseAnswersFile2(readFileSync2(opts.answers, "utf8"));
9172
9190
  }
9173
- if (interactive && questions.length > 0) {
9191
+ if (interactive && !quickInit && questions.length > 0) {
9174
9192
  const asked = await askQuestions(questions);
9175
9193
  answers = { ...answers, ...asked.answers };
9176
9194
  }
9177
9195
  answers = { ...stored, ...defaultAnswers(questions), ...answers };
9178
9196
  const finalInventory = applyInventoryAnswers(inventory, answers);
9179
9197
  const plan = buildPlan(finalInventory);
9180
- if (interactive) {
9198
+ if (interactive && !quickInit) {
9181
9199
  const proceed = await confirm(`Write ${CONFIG_FILENAME}, ENVIRONMENT.md and REPLICATION.md?`);
9182
9200
  if (!proceed) {
9183
9201
  info("Aborted \u2014 nothing written.");
@@ -9203,16 +9221,18 @@ async function runInit(opts) {
9203
9221
  await writeConfig(opts.cwd, config, { force: opts.force });
9204
9222
  await writeFile20(join25(opts.cwd, "ENVIRONMENT.md"), renderEnvironment(finalInventory), "utf8");
9205
9223
  await writeFile20(join25(opts.cwd, "REPLICATION.md"), renderReplication(finalInventory, plan), "utf8");
9206
- reportPath = await writeBrowserReport(opts.cwd, finalInventory, plan);
9207
- dashboardPath = await writeDashboard(opts.cwd, finalInventory);
9224
+ if (!quickInit) {
9225
+ reportPath = await writeBrowserReport(opts.cwd, finalInventory, plan);
9226
+ dashboardPath = await writeDashboard(opts.cwd, finalInventory);
9227
+ }
9208
9228
  wrote = true;
9209
9229
  if (!opts.json) {
9210
9230
  info("");
9211
9231
  ok2(`Wrote ${CONFIG_FILENAME}`);
9212
9232
  ok2("Wrote ENVIRONMENT.md");
9213
9233
  ok2("Wrote REPLICATION.md");
9214
- ok2(`Browser report: ${reportPath}`);
9215
- ok2(`Dashboard: ${dashboardPath}`);
9234
+ if (reportPath) ok2(`Browser report: ${reportPath}`);
9235
+ if (dashboardPath) ok2(`Dashboard: ${dashboardPath}`);
9216
9236
  }
9217
9237
  } else if (!opts.json) {
9218
9238
  warn("Dry run \u2014 nothing written.");
@@ -9348,6 +9368,52 @@ async function saveExplorationRegression(cwd, explorationId, trialIndex, id) {
9348
9368
 
9349
9369
  // src/commands/control.ts
9350
9370
  init_repair_evidence();
9371
+
9372
+ // src/inventory/workflow-picker.ts
9373
+ function workflowRoute(workflow) {
9374
+ const match = (workflow.entrypoint ?? workflow.title).match(/(?:#|^)route:([A-Z]+):(.+)@\d+$/);
9375
+ return match ? { method: match[1], path: match[2] } : void 0;
9376
+ }
9377
+ function workflowLabel(workflow) {
9378
+ const route = workflowRoute(workflow);
9379
+ return route ? `${route.method} ${route.path}` : workflow.title;
9380
+ }
9381
+ function workflowArea(workflow) {
9382
+ const route = workflowRoute(workflow);
9383
+ if (!route) return void 0;
9384
+ const path2 = route.path.toLowerCase();
9385
+ if (/\/(?:internal|admin)(?:\/|$)/.test(path2) || /\/(?:healthz?|readyz|status|evals)(?:\/|$)/.test(path2)) return "Internal and maintenance";
9386
+ if (/\/(?:mail|email|gmail)(?:\/|$)/.test(path2)) return "Email";
9387
+ if (/\/(?:calendar|meetings?|events?)(?:\/|$)/.test(path2)) return "Calendar";
9388
+ if (/\/(?:billing|payments?|subscriptions?|checkout)(?:\/|$)/.test(path2)) return "Payments and billing";
9389
+ if (/\/(?:auth|login|logout|signup|account|me)(?:\/|$)/.test(path2)) return "Accounts and sign-in";
9390
+ if (/\/(?:chat|messages?|conversations?)(?:\/|$)/.test(path2)) return "Chat and messages";
9391
+ if (/\/(?:tasks?|work|reminders?)(?:\/|$)/.test(path2)) return "Tasks and reminders";
9392
+ return "Other application endpoints";
9393
+ }
9394
+ function workflowAreas(workflows) {
9395
+ const grouped = /* @__PURE__ */ new Map();
9396
+ for (const workflow of workflows) {
9397
+ const area = workflowArea(workflow);
9398
+ if (area) grouped.set(area, [...grouped.get(area) ?? [], workflow]);
9399
+ }
9400
+ return [...grouped.entries()].sort(([a], [b]) => Number(a === "Internal and maintenance") - Number(b === "Internal and maintenance") || a.localeCompare(b));
9401
+ }
9402
+
9403
+ // src/runtime/local-workspace.ts
9404
+ async function detectLocalWorkspace(request = fetch) {
9405
+ try {
9406
+ const response = await request("http://localhost:8080/v1/dev/workspace", { redirect: "error", signal: AbortSignal.timeout(700) });
9407
+ if (!response.ok) return null;
9408
+ const data = await response.json();
9409
+ if (data.schema !== "agenttwin/local-workspace-v1" || data.dashboard !== "http://localhost:3000/onboarding/") return null;
9410
+ return { api: "http://localhost:8080", dashboard: data.dashboard, onboarding: data.onboarding === true };
9411
+ } catch {
9412
+ return null;
9413
+ }
9414
+ }
9415
+
9416
+ // src/commands/control.ts
9351
9417
  var CONTROL_ACTIONS = [
9352
9418
  "Review service coverage and provider contracts",
9353
9419
  "Prepare or select your reviewed workflow world",
@@ -9377,6 +9443,11 @@ async function runControl(opts) {
9377
9443
  const wrote = await runInit({ ...opts, interactive, controller: true });
9378
9444
  if (!interactive || !wrote) return;
9379
9445
  const state = await readState(opts.cwd);
9446
+ const originalApi = process.env.AGENTTWIN_API_URL;
9447
+ if (!originalApi && !process.env.AGENTTWIN_TOKEN) {
9448
+ const local = await detectLocalWorkspace();
9449
+ if (local?.onboarding) process.env.AGENTTWIN_API_URL = local.api;
9450
+ }
9380
9451
  const rl = createInterface3({ input: process.stdin, output: process.stdout });
9381
9452
  const log = (message) => process.stdout.write(message + "\n");
9382
9453
  const ask = async (prompt) => (await rl.question(prompt + " ")).trim();
@@ -9400,9 +9471,32 @@ async function runControl(opts) {
9400
9471
  log("No workflow candidates found. Refresh discovery in Advanced options, or load an existing test file.");
9401
9472
  return;
9402
9473
  }
9403
- log(`${workflows.length} workflow candidates found. These are code paths, not tested workflows yet.`);
9404
- const query = (await ask("Find a workflow (for example mail, calendar or billing; Enter shows all):")).toLowerCase();
9405
- const matches2 = workflows.filter((w) => `${w.title} ${w.entrypoint ?? ""}`.toLowerCase().includes(query));
9474
+ const areas = workflowAreas(workflows);
9475
+ let matches2 = workflows;
9476
+ if (areas.length) {
9477
+ log("\nWhich part of your application do you want to test?");
9478
+ areas.forEach(([name, items], i) => log(` ${i + 1}. ${name} (${items.length} endpoints)`));
9479
+ log(" a. All code paths, including helpers");
9480
+ log(" 0. Back");
9481
+ const area = await ask("Choose an area, or type a search:");
9482
+ if (!area || area === "0") return;
9483
+ const selectedArea = /^\d+$/.test(area) ? areas[Number(area) - 1] : void 0;
9484
+ if (selectedArea) {
9485
+ matches2 = selectedArea[1];
9486
+ log(`
9487
+ ${selectedArea[0]} \u2014 choose an endpoint to prepare. These have not been tested yet.`);
9488
+ } else if (area.toLowerCase() !== "a") {
9489
+ if (/^\d+$/.test(area)) {
9490
+ log("Choose a listed area.");
9491
+ return;
9492
+ }
9493
+ matches2 = workflows.filter((w) => `${w.title} ${w.entrypoint ?? ""}`.toLowerCase().includes(area.toLowerCase()));
9494
+ }
9495
+ } else {
9496
+ log(`${workflows.length} code paths found. These have not been tested yet.`);
9497
+ const query = (await ask("Find a workflow (for example mail, calendar or billing; Enter shows all):")).toLowerCase();
9498
+ matches2 = workflows.filter((w) => `${w.title} ${w.entrypoint ?? ""}`.toLowerCase().includes(query));
9499
+ }
9406
9500
  if (!matches2.length) {
9407
9501
  log("No matching workflows. Try another search.");
9408
9502
  return;
@@ -9410,7 +9504,7 @@ async function runControl(opts) {
9410
9504
  let offset = 0;
9411
9505
  while (true) {
9412
9506
  const page2 = matches2.slice(offset, offset + 10);
9413
- page2.forEach((w, i) => log(` ${i + 1}. ${w.title}${w.entrypoint ? ` \xB7 ${w.entrypoint}` : ""}`));
9507
+ page2.forEach((w, i) => log(` ${i + 1}. ${workflowLabel(w)}`));
9414
9508
  log(`Showing ${offset + 1}\u2013${offset + page2.length} of ${matches2.length}. n: next page \xB7 p: previous page \xB7 0: back`);
9415
9509
  const selected = await ask("Choose a workflow [0]:");
9416
9510
  if (!selected || selected === "0") return;
@@ -9428,12 +9522,13 @@ async function runControl(opts) {
9428
9522
  continue;
9429
9523
  }
9430
9524
  state.workflowId = workflow.id;
9431
- state.workflowTitle = workflow.title;
9525
+ state.workflowTitle = workflowLabel(workflow);
9432
9526
  delete state.world;
9433
9527
  delete state.exploration;
9434
9528
  delete state.receipt;
9435
9529
  await save();
9436
- log(`Selected: ${workflow.title}`);
9530
+ log(`Selected: ${workflowLabel(workflow)}`);
9531
+ if (workflow.entrypoint) log(`Source: ${workflow.entrypoint}`);
9437
9532
  log("Next: prepare its test. AgentTwin cannot yet turn every detected code path into a runnable test automatically.");
9438
9533
  log("Give your coding agent this request:");
9439
9534
  log(`Read .agenttwin/AGENT-TASK.md and .agenttwin/inventory.json. Prepare workflow ${JSON.stringify(workflow.id)} (${JSON.stringify(workflow.title)}) as agenttwin.world.json, with bundled application files, supported service operations, synthetic records and reviewed expected outcomes. Report unsupported dependencies; do not replace the application with a demo.`);
@@ -9444,8 +9539,17 @@ async function runControl(opts) {
9444
9539
  try {
9445
9540
  try {
9446
9541
  await connectAndShare();
9542
+ if (opts.finishAfterSync) {
9543
+ log("Setup complete. Project synced; your onboarding page updates automatically. Continue in your browser.");
9544
+ log("For terminal testing later, run npx agenttwin.");
9545
+ return;
9546
+ }
9447
9547
  } catch (error) {
9448
- log(`Connection stopped: ${error instanceof Error ? error.message : String(error)}. Local discovery is saved. Retry Connect project in Advanced options.`);
9548
+ log(`Connection stopped: ${error instanceof Error ? error.message : String(error)}. Local discovery is saved. Run npx agenttwin init to retry.`);
9549
+ if (opts.finishAfterSync) {
9550
+ process.exitCode = 1;
9551
+ return;
9552
+ }
9449
9553
  }
9450
9554
  while (true) {
9451
9555
  log(`
@@ -9610,6 +9714,8 @@ AgentTwin \xB7 ${basename4(opts.cwd)}`);
9610
9714
  }
9611
9715
  } finally {
9612
9716
  rl.close();
9717
+ if (originalApi === void 0) delete process.env.AGENTTWIN_API_URL;
9718
+ else process.env.AGENTTWIN_API_URL = originalApi;
9613
9719
  }
9614
9720
  }
9615
9721
 
@@ -10936,7 +11042,7 @@ function helpText() {
10936
11042
  ` ${"services".padEnd(12)}list | coverage | confirm --host HOST --decision include|exclude`,
10937
11043
  ` ${"example".padEnd(12)}Write an editable multi-service workflow (--out directory)`,
10938
11044
  ` ${"sync".padEnd(12)}Sync discovery, Git metadata and CLI test results to your dashboard`,
10939
- ` ${"init".padEnd(12)}Discover and open the guided repository control center`,
11045
+ ` ${"init".padEnd(12)}Discover, connect and sync; continue in your browser`,
10940
11046
  ` ${"refresh".padEnd(12)}Update discovery without executing application code`,
10941
11047
  ` ${"discover".padEnd(12)}Build the company inventory (writes .agenttwin/inventory.json)`,
10942
11048
  ` ${"decide".padEnd(12)}Apply structured decisions (--file or --stdin)`,
@@ -11249,7 +11355,8 @@ ${result.uploaded}`);
11249
11355
  agent: str2("agent"),
11250
11356
  sync: flag("sync"),
11251
11357
  exclude: arr("exclude"),
11252
- controller: true
11358
+ controller: true,
11359
+ finishAfterSync: positionals[0] === "init"
11253
11360
  });
11254
11361
  return;
11255
11362
  case "logout": {
@@ -0,0 +1 @@
1
+ self.__BUILD_MANIFEST=function(e,r,t,_){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:33,errorRate:1e-4,numBits:633,numHashes:14,bitArray:[1,1,e,e,e,e,0,e,e,e,e,e,0,r,e,e,e,e,r,r,e,r,e,e,e,e,e,r,e,e,r,e,e,r,r,e,e,e,r,e,r,e,r,r,e,e,e,r,r,r,r,r,r,r,r,r,e,r,e,e,r,r,e,r,r,e,r,e,e,e,e,r,r,r,e,e,e,r,r,r,r,r,r,e,r,e,r,e,e,e,r,e,r,r,r,e,e,e,r,e,e,r,e,r,e,r,r,r,e,e,r,e,e,r,e,r,e,r,e,r,e,r,r,e,e,r,e,e,e,r,r,e,e,r,e,r,e,e,e,e,r,e,r,e,r,e,e,e,e,e,e,r,e,r,e,e,e,r,r,e,e,r,e,r,r,e,r,r,r,r,e,r,e,r,r,r,r,e,e,r,e,r,r,e,r,e,e,e,e,e,r,r,r,e,r,r,r,r,e,e,e,e,e,e,e,r,e,e,r,r,e,r,e,e,e,r,e,e,e,e,r,e,e,e,e,e,e,e,e,r,e,r,e,e,e,r,e,e,e,r,e,r,e,r,e,r,r,r,r,e,e,e,e,r,e,r,r,e,r,r,e,r,e,r,r,e,e,r,e,r,r,e,r,r,e,r,e,r,e,e,e,e,e,e,r,r,e,e,e,r,r,r,r,e,r,r,e,e,r,r,e,e,e,r,r,r,r,r,r,e,e,r,e,e,r,e,e,r,r,r,e,r,e,r,e,r,e,e,e,r,e,e,r,e,e,e,r,e,e,e,e,r,r,e,e,r,e,r,e,e,e,r,r,e,e,e,r,e,e,r,r,r,r,r,e,r,e,e,r,r,r,e,r,e,e,r,e,r,r,r,r,e,r,e,r,e,r,r,e,r,e,e,r,r,e,r,r,e,r,r,e,r,e,r,e,e,r,e,r,e,r,r,e,r,r,r,r,e,e,e,r,e,r,e,e,e,r,r,r,r,r,e,e,r,r,e,r,e,r,r,r,e,r,e,r,e,r,e,r,e,r,e,e,r,r,r,e,r,r,e,r,r,r,r,r,e,r,r,r,r,e,e,e,r,r,r,r,e,r,e,e,e,e,r,e,e,r,r,r,e,r,r,e,e,e,e,e,e,r,e,r,r,r,e,e,r,r,e,r,e,r,e,r,r,e,e,e,e,r,r,e,e,r,e,r,r,e,r,e,e,e,r,e,e,r,e,e,e,r,e,r,e,e,r,e,r,r,e,r,e,r,e,e,r,e,e,e,e,r,e,r,e,e,r,r,r,r,e,r,r,r,r,r,e,r,r,e,e,r,r,r,r,r,r,r,e,r,e,r,e,e,r,e,r,e,e,e,e,r,r,e,e,r,e,e,r,r,r,r,r,e,r,r,e,e,r,e,r,r,e,r,r,r,r,r,r,e,e,e,e,e,r,e]},__routerFilterDynamic:{numItems:e,errorRate:1e-4,numBits:20,numHashes:14,bitArray:[r,r,e,e,r,r,e,e,e,e,r,r,e,e,r,e,r,e,e,r]},"/_error":["static/chunks/pages/_error-94812ad32cad7365.js"],sortedPages:["/_app","/_error"]}}(1,0,1e-4,14),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();