@oya-ai/cli 1.0.111 → 1.0.113

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 (2) hide show
  1. package/dist/index.js +11 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1889,6 +1889,17 @@ var Browser = class {
1889
1889
  const path = `/api/browsers/${this.id}/chat`;
1890
1890
  return agentAnswer(await this.http.request("POST", path, body, AGENT_TIMEOUT_MS)).text;
1891
1891
  }
1892
+ /**
1893
+ * `ask()` for data: the agent does the task and answers in the shape of `schema`
1894
+ * (a JSON schema), instead of in words. Throws when the agent reports it could not.
1895
+ */
1896
+ async extract(prompt, schema, values = {}) {
1897
+ const body = { messages: [{ role: "user", content: prompt }], ...values, schema };
1898
+ const path = `/api/browsers/${this.id}/chat`;
1899
+ const res = agentAnswer(await this.http.request("POST", path, body, AGENT_TIMEOUT_MS));
1900
+ if (res.failed || res.data === void 0) throw new OyaError(res.text, Status3.UNPROCESSABLE, res);
1901
+ return res.data;
1902
+ }
1892
1903
  /**
1893
1904
  * Save the last `ask()` on this browser as a named playbook. Every value that was
1894
1905
  * typed, picked or clicked becomes a variable, with what the run used kept in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oya-ai/cli",
3
- "version": "1.0.111",
3
+ "version": "1.0.113",
4
4
  "description": "Command line for the Oya browser control plane.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://oyabrowser.com",
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "devDependencies": {
42
- "@oya-ai/browser": "1.0.111",
42
+ "@oya-ai/browser": "1.0.113",
43
43
  "@types/node": "^20.19.43",
44
44
  "tsup": "^8.0.0",
45
45
  "typescript": "^5.4.0"