@oya-ai/browser 1.0.76 → 1.0.78

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
@@ -44,14 +44,17 @@ const answer = await browser.ask("What are the top 3 stories and their points?")
44
44
  console.log(answer);
45
45
  ```
46
46
 
47
- ### Data pass-through: the model never sees your values
47
+ ### Data and secrets
48
48
 
49
49
  ```ts
50
- await browser.ask("Search for order {{orderNumber}} and download its invoice", {
51
- data: { orderNumber: "1042" }, // typed into the page; the LLM only reads {{orderNumber}}
50
+ await browser.ask("Log in as {{user}} with {{password}}, then book {{patient}} born {{dob}}", {
51
+ data: { patient: "John Smith", dob: "Jan 5, 1970" }, // the agent reads these
52
+ secrets: { user: "ops", password: process.env.PORTAL_PASSWORD! }, // the agent never sees these
52
53
  });
53
54
  ```
54
55
 
56
+ The agent types every value as a placeholder, transforming it with filters when a form needs a piece or another format: `{{patient|first}}`, `{{patient|last}}`, `{{dob|date:MM/DD/YYYY}}`, `{{dob|date:YYYY}}`, `{{phone|digits}}`. A playbook saved from the run stores the placeholders, never the values.
57
+
55
58
  ### Playbooks: ask once, replay without the LLM
56
59
 
57
60
  ```ts
package/dist/index.cjs CHANGED
@@ -187,15 +187,16 @@ var Browser = class {
187
187
  return result;
188
188
  }
189
189
  /**
190
- * Natural-language control, using this key's configured model. Refer to `data`
191
- * as `{{name}}` in the prompt: the agent types the placeholder, the page gets the
192
- * value, and the model never sees it.
190
+ * Natural-language control, using this key's configured model. Refer to values as
191
+ * `{{name}}` in the prompt. `data` the agent can read, so it can split a name or pick
192
+ * the matching option; `secrets` it never sees. It types both through placeholders,
193
+ * with filters like `{{name|first}}`, so a playbook saved from the run stores no values.
193
194
  */
194
- async ask(prompt, { data } = {}) {
195
+ async ask(prompt, { data, secrets } = {}) {
195
196
  const res = await this.http.request(
196
197
  "POST",
197
198
  `/api/browsers/${this.id}/chat`,
198
- { messages: [{ role: "user", content: prompt }], data },
199
+ { messages: [{ role: "user", content: prompt }], data, secrets },
199
200
  6e5
200
201
  );
201
202
  if (res.error) throw new OyaError(res.error, 500, res);
package/dist/index.d.cts CHANGED
@@ -83,7 +83,11 @@ interface PlaybookSummary extends Playbook {
83
83
  healedFrom: number;
84
84
  }) | null;
85
85
  }
86
- /** Values passed through to the page as `{{name}}` placeholders; the model never sees them. */
86
+ /**
87
+ * Task values, referred to as `{{name}}` in prompts. As `data` the agent can read them
88
+ * (to split a name or pick the right option); as `secrets` it never sees them. Either
89
+ * way they are typed through placeholders, so playbooks store no values.
90
+ */
87
91
  type RunData = Record<string, string | number>;
88
92
  interface AttentionRequest {
89
93
  id: string;
@@ -107,8 +111,10 @@ interface RunInfo {
107
111
  error?: string;
108
112
  }
109
113
  interface SubmitOptions {
110
- /** Passed through as `{{name}}` placeholders; for a playbook, its variables. */
114
+ /** Task values the agent can read; for a playbook, its variables (secret ones included). */
111
115
  data?: RunData;
116
+ /** Prompts only: values the agent never sees, like passwords. A playbook already knows which of its variables are secret. */
117
+ secrets?: RunData;
112
118
  /** Playbooks only: let the agent finish a broken replay and save its fix as a draft. Default true. */
113
119
  autoHeal?: boolean;
114
120
  onSuccess?: (result: RunResult) => unknown;
@@ -426,12 +432,14 @@ declare class Browser {
426
432
  */
427
433
  completeMfa(): Promise<MfaResult>;
428
434
  /**
429
- * Natural-language control, using this key's configured model. Refer to `data`
430
- * as `{{name}}` in the prompt: the agent types the placeholder, the page gets the
431
- * value, and the model never sees it.
435
+ * Natural-language control, using this key's configured model. Refer to values as
436
+ * `{{name}}` in the prompt. `data` the agent can read, so it can split a name or pick
437
+ * the matching option; `secrets` it never sees. It types both through placeholders,
438
+ * with filters like `{{name|first}}`, so a playbook saved from the run stores no values.
432
439
  */
433
- ask(prompt: string, { data }?: {
440
+ ask(prompt: string, { data, secrets }?: {
434
441
  data?: RunData;
442
+ secrets?: RunData;
435
443
  }): Promise<string>;
436
444
  /**
437
445
  * Save the last `ask()` on this browser as a named playbook. Values that came
package/dist/index.d.ts CHANGED
@@ -83,7 +83,11 @@ interface PlaybookSummary extends Playbook {
83
83
  healedFrom: number;
84
84
  }) | null;
85
85
  }
86
- /** Values passed through to the page as `{{name}}` placeholders; the model never sees them. */
86
+ /**
87
+ * Task values, referred to as `{{name}}` in prompts. As `data` the agent can read them
88
+ * (to split a name or pick the right option); as `secrets` it never sees them. Either
89
+ * way they are typed through placeholders, so playbooks store no values.
90
+ */
87
91
  type RunData = Record<string, string | number>;
88
92
  interface AttentionRequest {
89
93
  id: string;
@@ -107,8 +111,10 @@ interface RunInfo {
107
111
  error?: string;
108
112
  }
109
113
  interface SubmitOptions {
110
- /** Passed through as `{{name}}` placeholders; for a playbook, its variables. */
114
+ /** Task values the agent can read; for a playbook, its variables (secret ones included). */
111
115
  data?: RunData;
116
+ /** Prompts only: values the agent never sees, like passwords. A playbook already knows which of its variables are secret. */
117
+ secrets?: RunData;
112
118
  /** Playbooks only: let the agent finish a broken replay and save its fix as a draft. Default true. */
113
119
  autoHeal?: boolean;
114
120
  onSuccess?: (result: RunResult) => unknown;
@@ -426,12 +432,14 @@ declare class Browser {
426
432
  */
427
433
  completeMfa(): Promise<MfaResult>;
428
434
  /**
429
- * Natural-language control, using this key's configured model. Refer to `data`
430
- * as `{{name}}` in the prompt: the agent types the placeholder, the page gets the
431
- * value, and the model never sees it.
435
+ * Natural-language control, using this key's configured model. Refer to values as
436
+ * `{{name}}` in the prompt. `data` the agent can read, so it can split a name or pick
437
+ * the matching option; `secrets` it never sees. It types both through placeholders,
438
+ * with filters like `{{name|first}}`, so a playbook saved from the run stores no values.
432
439
  */
433
- ask(prompt: string, { data }?: {
440
+ ask(prompt: string, { data, secrets }?: {
434
441
  data?: RunData;
442
+ secrets?: RunData;
435
443
  }): Promise<string>;
436
444
  /**
437
445
  * Save the last `ask()` on this browser as a named playbook. Values that came
package/dist/index.js CHANGED
@@ -157,15 +157,16 @@ var Browser = class {
157
157
  return result;
158
158
  }
159
159
  /**
160
- * Natural-language control, using this key's configured model. Refer to `data`
161
- * as `{{name}}` in the prompt: the agent types the placeholder, the page gets the
162
- * value, and the model never sees it.
160
+ * Natural-language control, using this key's configured model. Refer to values as
161
+ * `{{name}}` in the prompt. `data` the agent can read, so it can split a name or pick
162
+ * the matching option; `secrets` it never sees. It types both through placeholders,
163
+ * with filters like `{{name|first}}`, so a playbook saved from the run stores no values.
163
164
  */
164
- async ask(prompt, { data } = {}) {
165
+ async ask(prompt, { data, secrets } = {}) {
165
166
  const res = await this.http.request(
166
167
  "POST",
167
168
  `/api/browsers/${this.id}/chat`,
168
- { messages: [{ role: "user", content: prompt }], data },
169
+ { messages: [{ role: "user", content: prompt }], data, secrets },
169
170
  6e5
170
171
  );
171
172
  if (res.error) throw new OyaError(res.error, 500, res);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oya-ai/browser",
3
- "version": "1.0.76",
3
+ "version": "1.0.78",
4
4
  "description": "Rotate thousands of browsers behind one API — personas, proxies, stealth, CAPTCHA and MFA.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://browser.getoya.ai",