agenttwin 0.3.9 → 0.3.10

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 (77) hide show
  1. package/README.md +3 -3
  2. package/dist/cli.js +22 -38
  3. package/dist/dashboard/assets/next/static/chunks/1255-b815b974120825e7.js +1 -0
  4. package/dist/dashboard/assets/next/static/chunks/1848-a6938ad74a8e409f.js +1 -0
  5. package/dist/dashboard/assets/next/static/chunks/3050-a8f395e3fe36d7b9.js +1 -0
  6. package/dist/dashboard/assets/next/static/chunks/4055.1056568a41510e92.js +1 -0
  7. package/dist/dashboard/assets/next/static/chunks/4343.023a18f52318dbad.js +1 -0
  8. package/dist/dashboard/assets/next/static/chunks/4542.0327d0da1c3ea200.js +1 -0
  9. package/dist/dashboard/assets/next/static/chunks/4bd1b696-f785427dddbba9fb.js +1 -0
  10. package/dist/dashboard/assets/next/static/chunks/6751.613adb085c9a5b06.js +1 -0
  11. package/dist/dashboard/assets/next/static/chunks/6787-6a8909259d0ac26c.js +1 -0
  12. package/dist/dashboard/assets/next/static/chunks/{772-85561381eedc95da.js → 7772-425e96278b46f6c9.js} +1 -1
  13. package/dist/dashboard/assets/next/static/chunks/8975.5be81ec8b09e3b45.js +1 -0
  14. package/dist/dashboard/assets/next/static/chunks/9013.0f2be1cc70029afa.js +10 -0
  15. package/dist/dashboard/assets/next/static/chunks/app/_not-found/page-43db8aef3fa81958.js +1 -0
  16. package/dist/dashboard/assets/next/static/chunks/app/account/password/page-c2ce3c796c817ca1.js +1 -0
  17. package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-28ee3093f86fc075.js +1 -0
  18. package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-03aac4c01adcda82.js +1 -0
  19. package/dist/dashboard/assets/next/static/chunks/app/demo/page-4dc63755e0013e7c.js +1 -0
  20. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-db473994608d5c77.js +1 -0
  21. package/dist/dashboard/assets/next/static/chunks/app/enterprise/page-9a33a4aec43377e0.js +1 -0
  22. package/dist/dashboard/assets/next/static/chunks/app/layout-dd5d4772c11d4cbb.js +1 -0
  23. package/dist/dashboard/assets/next/static/chunks/app/login/page-d6d4276397724d29.js +1 -0
  24. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-1b066c493c248f29.js +1 -0
  25. package/dist/dashboard/assets/next/static/chunks/app/page-950c663fd42544c0.js +1 -0
  26. package/dist/dashboard/assets/next/static/chunks/app/pricing/page-757fd3f59cd253fb.js +1 -0
  27. package/dist/dashboard/assets/next/static/chunks/app/signup/page-d6d4276397724d29.js +1 -0
  28. package/dist/dashboard/assets/next/static/chunks/app/sitemap.xml/route-83b9d0f0ad5575d4.js +1 -0
  29. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-a5cf565e017886d3.js +1 -0
  30. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-a99a9eeb03937d53.js +1 -0
  31. package/dist/dashboard/assets/next/static/chunks/app/v2/layout-abbd9f3b8811f559.js +1 -0
  32. package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-4f4a342a4c28f9de.js +1 -0
  33. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-f04c0b236abaead3.js +1 -0
  34. package/dist/dashboard/assets/next/static/chunks/app/v2/page-cf8af0afd0589c71.js +1 -0
  35. package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-4f4a342a4c28f9de.js +1 -0
  36. package/dist/dashboard/assets/next/static/chunks/framework-e54b663a2888b5de.js +1 -0
  37. package/dist/dashboard/assets/next/static/chunks/main-app-1ec13ceef4a34729.js +1 -0
  38. package/dist/dashboard/assets/next/static/chunks/main-d1fa84e2f669be1c.js +1 -0
  39. package/dist/dashboard/assets/next/static/chunks/pages/{_app-7d307437aca18ad4.js → _app-6c8c2371b16a04b8.js} +1 -1
  40. package/dist/dashboard/assets/next/static/chunks/pages/_error-94812ad32cad7365.js +1 -0
  41. package/dist/dashboard/assets/next/static/chunks/webpack-351162512698e56b.js +1 -0
  42. package/dist/dashboard/assets/next/static/css/448fc71b62e29403.css +1 -0
  43. package/dist/dashboard/assets/next/static/{xDiek0iCt0gykeKT7O5aO → puuDlswFkm304y1LsNJ98}/_buildManifest.js +1 -1
  44. package/dist/dashboard/index.html +2 -2
  45. package/package.json +1 -1
  46. package/dist/dashboard/assets/next/static/chunks/255-09fb0d129bb12f51.js +0 -1
  47. package/dist/dashboard/assets/next/static/chunks/4bd1b696-c023c6e3521b1417.js +0 -1
  48. package/dist/dashboard/assets/next/static/chunks/787-2d5f834d2374e355.js +0 -1
  49. package/dist/dashboard/assets/next/static/chunks/848-000d4eb3e2f5358f.js +0 -1
  50. package/dist/dashboard/assets/next/static/chunks/app/_not-found/page-95856eb81db7799b.js +0 -1
  51. package/dist/dashboard/assets/next/static/chunks/app/account/password/page-ff06be670b822cfe.js +0 -1
  52. package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-64afdd8a8798e3b6.js +0 -1
  53. package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-762d3d9f26e6c774.js +0 -1
  54. package/dist/dashboard/assets/next/static/chunks/app/demo/page-8a71f24127eb1e63.js +0 -1
  55. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-4edbabcdd90d97e8.js +0 -1
  56. package/dist/dashboard/assets/next/static/chunks/app/enterprise/page-018bb6762d3d7df4.js +0 -1
  57. package/dist/dashboard/assets/next/static/chunks/app/layout-9da6df58ef40be60.js +0 -1
  58. package/dist/dashboard/assets/next/static/chunks/app/login/page-caa5c579f14ec911.js +0 -1
  59. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-39cdf1f2e2ba688f.js +0 -1
  60. package/dist/dashboard/assets/next/static/chunks/app/page-02aaf1666f32d5c1.js +0 -1
  61. package/dist/dashboard/assets/next/static/chunks/app/pricing/page-f6fb7e78443d1220.js +0 -1
  62. package/dist/dashboard/assets/next/static/chunks/app/signup/page-caa5c579f14ec911.js +0 -1
  63. package/dist/dashboard/assets/next/static/chunks/app/sitemap.xml/route-ef5a216a578eb7a8.js +0 -1
  64. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-2936df21408f38fd.js +0 -1
  65. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-d23686e9489aa12d.js +0 -1
  66. package/dist/dashboard/assets/next/static/chunks/app/v2/layout-dc60420b4d88dd63.js +0 -1
  67. package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-d3a27a2684498e13.js +0 -1
  68. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-b48a6cab88bb7f78.js +0 -1
  69. package/dist/dashboard/assets/next/static/chunks/app/v2/page-c8aaddcc7111e5e3.js +0 -1
  70. package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-d3a27a2684498e13.js +0 -1
  71. package/dist/dashboard/assets/next/static/chunks/framework-292291387d6b2e39.js +0 -1
  72. package/dist/dashboard/assets/next/static/chunks/main-aea6e71289384293.js +0 -1
  73. package/dist/dashboard/assets/next/static/chunks/main-app-def27ec5d496405f.js +0 -1
  74. package/dist/dashboard/assets/next/static/chunks/pages/_error-cb2a52f75f2162e2.js +0 -1
  75. package/dist/dashboard/assets/next/static/chunks/webpack-7acd0493fe574225.js +0 -1
  76. package/dist/dashboard/assets/next/static/css/556c40e9d291ee02.css +0 -1
  77. /package/dist/dashboard/assets/next/static/{xDiek0iCt0gykeKT7O5aO → puuDlswFkm304y1LsNJ98}/_ssgManifest.js +0 -0
package/README.md CHANGED
@@ -14,7 +14,7 @@ npx agenttwin init
14
14
 
15
15
  `init` discovers your repository and opens a persistent control menu. Bare `npx agenttwin` opens the same entry point. Select a reviewed world, inspect every service's support, run correctness checks, explore seeded faults, replay a failure, verify a source-only patch, save a regression, import an incident, or connect your account—all from this menu, without remembering flags or separate command names. `npx agenttwin refresh` updates discovery without executing application code. Existing advanced commands remain available to CI and coding agents.
16
16
 
17
- Discovery writes the inventory, workflow candidates, `agenttwin.config.json`, `ENVIRONMENT.md`, `REPLICATION.md`, and an offline browser report. A discovered candidate is not an executable specification: the menu accepts a reviewed `agenttwin.world.json` with explicit bundled Node files, synthetic services, invocation and required outcomes. The optional demo is clearly labeled as synthetic. Redirected input and `--yes` only perform discovery; they never start the interactive execution loop. `init --json --dry-run` writes nothing. Account sharing is explicit; having an existing token does not automatically upload evidence during init.
17
+ Discovery writes the inventory, workflow candidates, `agenttwin.config.json`, `ENVIRONMENT.md`, `REPLICATION.md`, and an offline browser report. A discovered candidate is not an executable specification: the menu accepts a reviewed `agenttwin.world.json` with explicit bundled Node files, synthetic services, invocation and required outcomes. The optional demo is clearly labeled as synthetic. Redirected input and `--yes` only perform discovery; they never start the interactive execution loop. `init --json --dry-run` writes nothing. Interactive init connects and syncs discovery after the first browser approval; saved connections sync without another approval. Noninteractive init never uploads automatically.
18
18
 
19
19
  Seeded exploration includes an unfaulted control and up to 31 timeout-after-write trials. A seed controls the selected service/path and delay, not OS scheduling or arbitrary application randomness. Each trial uses fresh service state. Captured application files, checks, fault cases and receipts stay under `.agenttwin/explorations/`. Replay uses the captured application; patch verification uses current application files with the captured checks and fault cases. Hash mismatches reject accidental snapshot edits. This is local evidence, not a tamper-proof security boundary; protected CI anchors saved regression checks in a trusted Git baseline. Unexercised fault targets and unsupported provider operations remain incomplete.
20
20
 
@@ -138,11 +138,11 @@ Older releases without this updater cannot update themselves. After the new rele
138
138
 
139
139
  ### Coding session and dashboard discovery
140
140
 
141
- Run `npx agenttwin init` inside your repository (Node.js 22.12+). Interactive init opens the guided repository menu and offers account connection and reviewed project sharing. It does not launch another coding agent automatically. `npx agenttwin init --agent opencode` launches OpenCode explicitly with your configured provider and its normal permission controls. Provider authentication and usage belong to your coding-agent account. Other coding agents can use `.agenttwin/AGENT-TASK.md`.
141
+ Run `npx agenttwin init` inside your repository (Node.js 22.12+). Interactive init connects your account, syncs project discovery and opens the guided repository menu. It does not launch another coding agent automatically. `npx agenttwin init --agent opencode` launches OpenCode explicitly with your configured provider and its normal permission controls. Provider authentication and usage belong to your coding-agent account. Other coding agents can use `.agenttwin/AGENT-TASK.md`.
142
142
 
143
143
  The session traces workflows across files, records intents and production failure hypotheses in `.agenttwin/WORKFLOWS.md`, and writes metadata to `.agenttwin/agent-discovery.json`. Static candidates retain their original evidence. Agent candidates remain unverified until the workflow is explicitly prepared and executed. Static discovery preserves distinct exported side-effect entrypoints, including repositories with 100 candidates; it does not prove that every business workflow has been found.
144
144
 
145
- Create a workspace at https://agenttwin.si/signup/ or run `npx agenttwin login` from your repository. Run `npx agenttwin init`, review discovery, then choose account connection and approve sharing in the guided menu. Sign in in your browser and enter the code shown in the terminal when prompted. Terminal credentials are stored with owner-only permissions in `~/.agenttwin/credentials.json`, outside your repository. You can still supply `AGENTTWIN_TOKEN` for automation. Optional `AGENTTWIN_API_URL` selects your API. The website loads account discovery after you connect in Settings, then refreshes while visible. Sync sends names, operations and relative entrypoint metadata; application source uploads happen separately through reviewed bundles. Avoid sensitive names or identifiers in discovery metadata.
145
+ Create a workspace at https://agenttwin.si/signup/ or run `npx agenttwin login` from your repository. Run `npx agenttwin init`. On first use, sign in in the browser, compare its prefilled connection code with your terminal, and click Connect terminal. Keep init running: project discovery syncs automatically, and onboarding refreshes to show it. Subsequent interactive init runs use the saved connection without another sharing prompt. Terminal credentials are stored with owner-only permissions in `~/.agenttwin/credentials.json`, outside your repository. You can still supply `AGENTTWIN_TOKEN` for automation. Optional `AGENTTWIN_API_URL` selects your API. The website loads account discovery after you connect in Settings, then refreshes while visible. Sync sends names, operations and relative entrypoint metadata; application source uploads happen separately through reviewed bundles. Avoid sensitive names or identifiers in discovery metadata.
146
146
 
147
147
  To execute a workflow, supply an executable Node entrypoint, reviewed supported dependency mappings, synthetic fixtures and expected observable outcomes. Run `npx agenttwin prepare --file preparation.json`, review the bundle, and run it through your AgentTwin API or E2B account. Browser/desktop automation and arbitrary vendor SDKs require additional runtimes/adapters. The CLI is the default runner; select a hosted runner only when the workflow requires it. No local Docker is used.
148
148
 
package/dist/cli.js CHANGED
@@ -1876,6 +1876,12 @@ function validVerificationUrl(base, value) {
1876
1876
  return false;
1877
1877
  }
1878
1878
  }
1879
+ function pairingUrl(base, verificationUrl, userCode) {
1880
+ if (!validVerificationUrl(base, verificationUrl) || !/^[A-F0-9]{10}$/.test(userCode)) throw new Error("Invalid pairing response.");
1881
+ const url = new URL(verificationUrl);
1882
+ url.hash = new URLSearchParams({ user_code: userCode }).toString();
1883
+ return url.toString();
1884
+ }
1879
1885
  async function runLogin(log) {
1880
1886
  const base = apiBase(process.env.AGENTTWIN_API_URL || "https://api.agenttwin.si");
1881
1887
  const request = async (path2, input = {}) => fetch(base + path2, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(input), redirect: "error", signal: AbortSignal.timeout(15e3) });
@@ -1883,12 +1889,13 @@ async function runLogin(log) {
1883
1889
  if (!response.ok) throw new Error("Cannot start sign in. Please try again.");
1884
1890
  const device = await response.json();
1885
1891
  if (!/^[a-f0-9]{64}$/.test(device.deviceCode) || !/^[A-F0-9]{10}$/.test(device.userCode) || !validVerificationUrl(base, device.verificationUrl)) throw new Error("Invalid pairing response.");
1886
- log(`Sign in or create an account at ${device.verificationUrl}`);
1892
+ const browserUrl = pairingUrl(base, device.verificationUrl, device.userCode);
1893
+ log(`Sign in or create an account at ${browserUrl}`);
1887
1894
  log(`Enter this code to connect this terminal: ${device.userCode}`);
1888
- log("Only approve the code shown in this terminal. No passwords or API keys to paste.");
1889
- if (process.platform === "darwin") execFile("open", [device.verificationUrl], () => {
1895
+ log("Compare the browser code with this terminal, then choose Connect terminal. No passwords or API keys to paste.");
1896
+ if (process.platform === "darwin") execFile("open", [browserUrl], () => {
1890
1897
  });
1891
- else if (process.platform === "linux") execFile("xdg-open", [device.verificationUrl], () => {
1898
+ else if (process.platform === "linux") execFile("xdg-open", [browserUrl], () => {
1892
1899
  });
1893
1900
  const deadline = Date.now() + 6e5;
1894
1901
  while (Date.now() < deadline) {
@@ -1899,7 +1906,7 @@ async function runLogin(log) {
1899
1906
  if (!poll.ok || !/^at_user_[a-f0-9]{64}$/.test(data.token ?? "")) throw new Error(data.error || "Unable to finish sign in.");
1900
1907
  await saveConnection(base, data.token);
1901
1908
  log(`Connected to ${data.workspace}. Login saved privately outside your repository.`);
1902
- log("Return to the guided menu to review and share this repository.");
1909
+ log("Terminal approved. Continuing project connection\u2026");
1903
1910
  return;
1904
1911
  }
1905
1912
  throw new Error("Sign in expired. Run npx agenttwin login again.");
@@ -1922,7 +1929,7 @@ import { join as join34 } from "path";
1922
1929
  // package.json
1923
1930
  var package_default = {
1924
1931
  name: "agenttwin",
1925
- version: "0.3.9",
1932
+ version: "0.3.10",
1926
1933
  description: "Give your agent a test world before it touches the real one.",
1927
1934
  keywords: [
1928
1935
  "agent",
@@ -9056,7 +9063,7 @@ async function runInit(opts) {
9056
9063
  if (opts.sync) {
9057
9064
  const synced = await runSync(opts.cwd);
9058
9065
  if (!opts.json) ok2(`Synced ${synced.workflows} candidates: ${synced.dashboard}`);
9059
- } else if (!opts.json) info(opts.controller ? "Account connection and reviewed sharing are available in the control menu. Nothing was uploaded." : "Connect this terminal: npx agenttwin login. Then send reviewed discovery: npx agenttwin sync.");
9066
+ } else if (!opts.json) info(opts.controller ? "Discovery saved locally. Interactive init will now connect your account and sync this project." : "Connect this terminal: npx agenttwin login. Then send reviewed discovery: npx agenttwin sync.");
9060
9067
  }
9061
9068
  process.exitCode = result.exitCode;
9062
9069
  return wrote;
@@ -9066,21 +9073,6 @@ async function runInit(opts) {
9066
9073
  import { createInterface as createInterface3 } from "readline/promises";
9067
9074
  import { readFile as readFile23, writeFile as writeFile22 } from "fs/promises";
9068
9075
  import { join as join27, resolve as resolve14 } from "path";
9069
-
9070
- // src/runtime/local-workspace.ts
9071
- async function detectLocalWorkspace(request = fetch) {
9072
- try {
9073
- const response = await request("http://localhost:8080/v1/dev/workspace", { redirect: "error", signal: AbortSignal.timeout(700) });
9074
- if (!response.ok) return null;
9075
- const data = await response.json();
9076
- if (data.schema !== "agenttwin/local-workspace-v1" || data.dashboard !== "http://localhost:3000/onboarding/") return null;
9077
- return { api: "http://localhost:8080", dashboard: data.dashboard };
9078
- } catch {
9079
- return null;
9080
- }
9081
- }
9082
-
9083
- // src/commands/control.ts
9084
9076
  init_store();
9085
9077
  init_contracts();
9086
9078
 
@@ -9201,25 +9193,17 @@ async function runControl(opts) {
9201
9193
  };
9202
9194
  const connectAndShare = async () => {
9203
9195
  const connection = await savedConnection();
9196
+ const destination = process.env.AGENTTWIN_API_URL || connection?.base || "https://api.agenttwin.si";
9197
+ log(`Connecting this project to ${destination}. Sync sends detected service names, workflow metadata, Git metadata and test evidence; application source and credentials stay local.`);
9204
9198
  if (!process.env.AGENTTWIN_TOKEN && (!connection || process.env.AGENTTWIN_API_URL && connection.base !== process.env.AGENTTWIN_API_URL)) await runLogin(log);
9205
- log("Discovery is local until you share it. Sharing sends detected service names, workflow metadata, Git metadata and test evidence; application source and credentials stay local.");
9206
- if ((await ask("Share this repository with your workspace? [y/N]")).toLowerCase() === "y") {
9207
- const result = await runSync(opts.cwd);
9208
- log(`Project shared: ${opts.cwd}. Open your workspace and check for your project. ${result.dashboard}`);
9209
- } else log("Kept on this computer. This repository will not appear in your online workspace yet.");
9199
+ const result = await runSync(opts.cwd);
9200
+ log(`Project connected: ${result.tools} services and ${result.workflows} workflow candidates synced. ${result.dashboard}`);
9210
9201
  };
9211
9202
  try {
9212
- if (!process.env.AGENTTWIN_API_URL && !process.env.AGENTTWIN_TOKEN) {
9213
- const local = await detectLocalWorkspace();
9214
- if (local && (await ask(`Local AgentTwin workspace detected at ${local.dashboard}. Connect to it instead of production for this session? [y/N]`)).toLowerCase() === "y") process.env.AGENTTWIN_API_URL = local.api;
9215
- }
9216
- log("Repository discovered locally. To see it in onboarding, connect this terminal and share its reviewed discovery.");
9217
- if ((await ask("Connect and share this project now? [y/N]")).toLowerCase() === "y") {
9218
- try {
9219
- await connectAndShare();
9220
- } catch (error) {
9221
- log(`Connection stopped: ${error instanceof Error ? error.message : String(error)}. Retry with option 9.`);
9222
- }
9203
+ try {
9204
+ await connectAndShare();
9205
+ } catch (error) {
9206
+ log(`Connection stopped: ${error instanceof Error ? error.message : String(error)}. Local discovery is saved. Retry with option 9.`);
9223
9207
  }
9224
9208
  while (true) {
9225
9209
  log("\nAgentTwin \xB7 your repository control center");