fastbrowse 0.7.4 → 0.8.0

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/README.md CHANGED
@@ -37,7 +37,9 @@ try {
37
37
  ```
38
38
 
39
39
  `run` resolves with the result whatever status the run ended in, and only `complete` is success. Read
40
- `result.status` before you use the answer.
40
+ `result.status` before you use the answer. A `needs_login` result, and a `blocked` one at a bot check, says what
41
+ stopped it in `result.wall`: `kind` is `password`, `one_time_code`, `sign_in` or `bot_check`, with the page's
42
+ `origin`, the labels of the `fields` it asked for and `seen_at_ms`.
41
43
 
42
44
  ## The rest
43
45
 
package/dist/callbacks.js CHANGED
@@ -113,5 +113,6 @@ function endedBy(failure) {
113
113
  final_url: null,
114
114
  would_fire: [],
115
115
  recordings: [],
116
+ wall: null,
116
117
  };
117
118
  }
@@ -22,6 +22,10 @@ export type Operation = 'click' | 'hover' | 'drag' | 'fill' | 'select' | 'enter'
22
22
  export type StepOutcome = 'executed' | 'covered' | 'stale' | 'failed';
23
23
  export type Status = 'complete' | 'unverified' | 'needs_confirmation' | 'needs_login' | 'blocked' | 'needs_input' | 'stuck' | 'budget_exceeded' | 'observation_limit' | 'unavailable' | 'error';
24
24
  export type Tripwire = 'no_progress' | 'action_repetition' | 'plan_stagnation';
25
+ /**
26
+ * What a sign-in or bot wall asks of the person who has to get the run past it.
27
+ */
28
+ export type WallKind = 'password' | 'one_time_code' | 'sign_in' | 'bot_check';
25
29
  export interface Artifact {
26
30
  kind: ArtifactKind;
27
31
  name: string;
@@ -284,6 +288,7 @@ export interface RunParams {
284
288
  run_id: string;
285
289
  task: string;
286
290
  start?: string | null;
291
+ context?: string | null;
287
292
  inputs?: {
288
293
  [k: string]: string;
289
294
  } | null;
@@ -341,6 +346,28 @@ export interface RunResult {
341
346
  * The videos this run finished writing, captioned then plain; empty when it recorded nothing or encoding failed.
342
347
  */
343
348
  recordings: string[];
349
+ /**
350
+ * The sign-in or bot wall a `needs_login` or `blocked` run stopped at, when the page showed one.
351
+ */
352
+ wall: Wall | null;
353
+ }
354
+ /**
355
+ * The wall a `needs_login` or `blocked` run stopped at, typed so a caller can route it without parsing `error`.
356
+ */
357
+ export interface Wall {
358
+ kind: WallKind;
359
+ /**
360
+ * The origin of the page that showed the wall.
361
+ */
362
+ origin: string;
363
+ /**
364
+ * The visible labels of the fields it asked for, redacted as the error is.
365
+ */
366
+ fields: string[];
367
+ /**
368
+ * When the run stopped at it, in UTC epoch milliseconds.
369
+ */
370
+ seen_at_ms: number;
344
371
  }
345
372
  /**
346
373
  * The params of `run/until`: the address a run ended on. The reply is a boolean, and false keeps the run
package/dist/run.d.ts CHANGED
@@ -54,6 +54,8 @@ export type PerRun<Options> = {
54
54
  export interface RunOptions extends PerRun<BrowserOptions> {
55
55
  /** The address to start on. Without one, the first address is proposed from the task. */
56
56
  start?: string;
57
+ /** Background the run may use but never treats as the task, such as where the request came from. */
58
+ context?: string;
57
59
  inputs?: Record<string, string>;
58
60
  /** Files the run may upload. */
59
61
  attachments?: Attachment[];
package/dist/run.js CHANGED
@@ -41,6 +41,7 @@ export function runParams(runId, task, defaults, options) {
41
41
  ...held({ ...defaults, ...browserFields(options) }),
42
42
  ...held({
43
43
  start: options.start,
44
+ context: options.context,
44
45
  inputs: options.inputs,
45
46
  attachments: options.attachments?.map(attachment => ({
46
47
  name: attachment.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastbrowse",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "Browser automation with cited answers, structured output and code-controlled credentials and authorization.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,10 +27,10 @@
27
27
  "test": "npm run build && node --test \"test/*.test.ts\""
28
28
  },
29
29
  "optionalDependencies": {
30
- "@fastbrowse/darwin-arm64": "0.7.4",
31
- "@fastbrowse/darwin-x64": "0.7.4",
32
- "@fastbrowse/linux-arm64": "0.7.4",
33
- "@fastbrowse/linux-x64": "0.7.4",
34
- "@fastbrowse/win32-x64": "0.7.4"
30
+ "@fastbrowse/darwin-arm64": "0.8.0",
31
+ "@fastbrowse/darwin-x64": "0.8.0",
32
+ "@fastbrowse/linux-arm64": "0.8.0",
33
+ "@fastbrowse/linux-x64": "0.8.0",
34
+ "@fastbrowse/win32-x64": "0.8.0"
35
35
  }
36
36
  }