@velmlabs/unstuck 0.1.3 → 0.1.5

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/index.d.ts CHANGED
@@ -38,6 +38,11 @@ declare class Unstuck {
38
38
  reason: string;
39
39
  timeoutS?: number;
40
40
  requireCode?: boolean;
41
+ /**
42
+ * The human can only navigate the page within its own site (example.com and its subdomains). List any other
43
+ * sites the flow needs, e.g. ['accounts.google.com'] for a Google sign-in or a 3-D Secure provider.
44
+ */
45
+ allowedSites?: string[];
41
46
  }): Promise<TakeoverResult>;
42
47
  /** Stops the engine (cancelling any running takeover). */
43
48
  close(): Promise<void>;
package/dist/index.js CHANGED
@@ -74,7 +74,7 @@ var UnstuckEngineError = class extends Error {
74
74
  };
75
75
 
76
76
  // src/version.ts
77
- var VERSION = "0.1.3";
77
+ var VERSION = "0.1.5";
78
78
 
79
79
  // src/engine-process.ts
80
80
  var requireFromHere = createRequire(import.meta.url);
@@ -166,7 +166,7 @@ async function spawnEngine(path, opts) {
166
166
  }
167
167
 
168
168
  // src/unstuck.ts
169
- var defaultOnLink = (l) => process.stderr.write(`Unstuck: a human is needed (${l.reason}) \u2192 ${l.url}${l.code ? ` (code ${l.code})` : ""}
169
+ var defaultOnLink = (l) => process.stderr.write(`Unstuck: a human is needed (${l.reason}) \u2192 ${l.url}
170
170
  `);
171
171
  function pageEvents(page) {
172
172
  const p = page;
@@ -192,6 +192,8 @@ var Unstuck = class {
192
192
  * Resolves with the outcome; rejects only with UnstuckEngineError if the engine can't run.
193
193
  */
194
194
  async takeover(page, opts) {
195
+ if ((opts.requireCode ?? this.opts.requireCode ?? process.env.UNSTUCK_REQUIRE_CODE === "1") && !this.opts.onLink)
196
+ throw new TypeError("requireCode needs an onLink handler that sends the 6-digit code by a different channel than the link (printed together, the code protects nothing)");
195
197
  const pageClosed = { status: "failed", sessionId: "", url: "", durationS: 0, detail: "page_closed" };
196
198
  let attached;
197
199
  try {
@@ -238,7 +240,8 @@ var Unstuck = class {
238
240
  reason: opts.reason,
239
241
  timeoutS: opts.timeoutS ?? this.opts.timeoutS,
240
242
  site: siteOf(attached.url()),
241
- ...requireCode !== void 0 ? { requireCode } : {}
243
+ ...requireCode !== void 0 ? { requireCode } : {},
244
+ ...opts.allowedSites?.length ? { allowedSites: opts.allowedSites } : {}
242
245
  };
243
246
  const died = engine.exited.then((code) => {
244
247
  throw new UnstuckEngineError(`engine exited with code ${code}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velmlabs/unstuck",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Human takeover for AI browser agents: when your agent gets stuck, a person takes over the live browser and hands it back.",
5
5
  "keywords": [
6
6
  "ai",
@@ -41,8 +41,8 @@
41
41
  "node": ">=20"
42
42
  },
43
43
  "dependencies": {
44
- "@velmlabs/unstuck-engine": "0.1.3",
45
- "@velmlabs/unstuck-protocol": "0.1.3"
44
+ "@velmlabs/unstuck-engine": "0.1.5",
45
+ "@velmlabs/unstuck-protocol": "0.1.5"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public"