@airtop/sdk 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.
Files changed (80) hide show
  1. package/api/resources/profiles/client/Client.js +4 -4
  2. package/api/resources/sessions/client/Client.d.ts +2 -2
  3. package/api/resources/sessions/client/Client.js +12 -12
  4. package/api/resources/windows/client/Client.d.ts +18 -2
  5. package/api/resources/windows/client/Client.js +85 -16
  6. package/api/resources/windows/client/requests/SessionSummaryHandlerRequestBody.d.ts +3 -0
  7. package/api/resources/windows/client/requests/index.d.ts +0 -1
  8. package/api/types/PageQueryConfig.d.ts +7 -0
  9. package/api/types/{PromptContentExperimentalConfig.d.ts → PageQueryExperimentalConfig.d.ts} +1 -1
  10. package/api/{resources/windows/client/requests/SessionContentPromptHandlerRequestBody.d.ts → types/SessionPageQueryHandlerRequestBody.d.ts} +6 -9
  11. package/api/types/SummaryConfig.d.ts +2 -2
  12. package/api/types/index.d.ts +3 -2
  13. package/api/types/index.js +3 -2
  14. package/dist/api/resources/profiles/client/Client.js +4 -4
  15. package/dist/api/resources/sessions/client/Client.d.ts +2 -2
  16. package/dist/api/resources/sessions/client/Client.js +12 -12
  17. package/dist/api/resources/windows/client/Client.d.ts +18 -2
  18. package/dist/api/resources/windows/client/Client.js +85 -16
  19. package/dist/api/resources/windows/client/requests/SessionSummaryHandlerRequestBody.d.ts +3 -0
  20. package/dist/api/resources/windows/client/requests/index.d.ts +0 -1
  21. package/dist/api/types/PageQueryConfig.d.ts +7 -0
  22. package/dist/api/types/{PromptContentExperimentalConfig.d.ts → PageQueryExperimentalConfig.d.ts} +1 -1
  23. package/dist/api/{resources/windows/client/requests/SessionContentPromptHandlerRequestBody.d.ts → types/SessionPageQueryHandlerRequestBody.d.ts} +6 -9
  24. package/dist/api/types/SummaryConfig.d.ts +2 -2
  25. package/dist/api/types/index.d.ts +3 -2
  26. package/dist/api/types/index.js +3 -2
  27. package/dist/serialization/resources/windows/client/requests/SessionSummaryHandlerRequestBody.d.ts +2 -0
  28. package/dist/serialization/resources/windows/client/requests/SessionSummaryHandlerRequestBody.js +2 -0
  29. package/dist/serialization/resources/windows/client/requests/index.d.ts +0 -1
  30. package/dist/serialization/resources/windows/client/requests/index.js +1 -3
  31. package/dist/serialization/types/PageQueryConfig.d.ts +12 -0
  32. package/dist/serialization/types/{PromptContentConfig.js → PageQueryConfig.js} +3 -4
  33. package/dist/serialization/types/{PromptContentExperimentalConfig.d.ts → PageQueryExperimentalConfig.d.ts} +2 -2
  34. package/dist/serialization/types/{PromptContentExperimentalConfig.js → PageQueryExperimentalConfig.js} +2 -2
  35. package/dist/serialization/types/SessionPageQueryHandlerRequestBody.d.ts +18 -0
  36. package/{serialization/resources/windows/client/requests/SessionContentPromptHandlerRequestBody.js → dist/serialization/types/SessionPageQueryHandlerRequestBody.js} +5 -3
  37. package/dist/serialization/types/SummaryConfig.d.ts +1 -2
  38. package/dist/serialization/types/SummaryConfig.js +1 -2
  39. package/dist/serialization/types/index.d.ts +3 -2
  40. package/dist/serialization/types/index.js +3 -2
  41. package/dist/wrapper/AirtopClient.d.ts +6 -5
  42. package/dist/wrapper/AirtopClient.js +11 -10
  43. package/dist/wrapper/AirtopSessions.d.ts +11 -11
  44. package/dist/wrapper/AirtopSessions.js +16 -17
  45. package/dist/wrapper/AirtopWindows.d.ts +62 -14
  46. package/dist/wrapper/AirtopWindows.js +73 -31
  47. package/package.json +3 -2
  48. package/reference.md +99 -3
  49. package/serialization/resources/windows/client/requests/SessionSummaryHandlerRequestBody.d.ts +2 -0
  50. package/serialization/resources/windows/client/requests/SessionSummaryHandlerRequestBody.js +2 -0
  51. package/serialization/resources/windows/client/requests/index.d.ts +0 -1
  52. package/serialization/resources/windows/client/requests/index.js +1 -3
  53. package/serialization/types/PageQueryConfig.d.ts +12 -0
  54. package/serialization/types/{PromptContentConfig.js → PageQueryConfig.js} +3 -4
  55. package/serialization/types/{PromptContentExperimentalConfig.d.ts → PageQueryExperimentalConfig.d.ts} +2 -2
  56. package/serialization/types/{PromptContentExperimentalConfig.js → PageQueryExperimentalConfig.js} +2 -2
  57. package/serialization/types/SessionPageQueryHandlerRequestBody.d.ts +18 -0
  58. package/{dist/serialization/resources/windows/client/requests/SessionContentPromptHandlerRequestBody.js → serialization/types/SessionPageQueryHandlerRequestBody.js} +5 -3
  59. package/serialization/types/SummaryConfig.d.ts +1 -2
  60. package/serialization/types/SummaryConfig.js +1 -2
  61. package/serialization/types/index.d.ts +3 -2
  62. package/serialization/types/index.js +3 -2
  63. package/wrapper/AirtopClient.d.ts +6 -5
  64. package/wrapper/AirtopClient.js +11 -10
  65. package/wrapper/AirtopSessions.d.ts +11 -11
  66. package/wrapper/AirtopSessions.js +16 -17
  67. package/wrapper/AirtopWindows.d.ts +62 -14
  68. package/wrapper/AirtopWindows.js +73 -31
  69. package/api/types/PromptContentConfig.d.ts +0 -8
  70. package/dist/api/types/PromptContentConfig.d.ts +0 -8
  71. package/dist/serialization/resources/windows/client/requests/SessionContentPromptHandlerRequestBody.d.ts +0 -16
  72. package/dist/serialization/types/PromptContentConfig.d.ts +0 -13
  73. package/serialization/resources/windows/client/requests/SessionContentPromptHandlerRequestBody.d.ts +0 -16
  74. package/serialization/types/PromptContentConfig.d.ts +0 -13
  75. /package/api/{resources/windows/client/requests/SessionContentPromptHandlerRequestBody.js → types/PageQueryConfig.js} +0 -0
  76. /package/api/types/{PromptContentConfig.js → PageQueryExperimentalConfig.js} +0 -0
  77. /package/api/types/{PromptContentExperimentalConfig.js → SessionPageQueryHandlerRequestBody.js} +0 -0
  78. /package/dist/api/{resources/windows/client/requests/SessionContentPromptHandlerRequestBody.js → types/PageQueryConfig.js} +0 -0
  79. /package/dist/api/types/{PromptContentConfig.js → PageQueryExperimentalConfig.js} +0 -0
  80. /package/dist/api/types/{PromptContentExperimentalConfig.js → SessionPageQueryHandlerRequestBody.js} +0 -0
@@ -17,24 +17,32 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.AirtopSessions = void 0;
20
- class AirtopSessions {
21
- constructor(airtopClient, debug = false) {
22
- this.airtopClient = airtopClient;
20
+ const Client_1 = require("../api/resources/sessions/client/Client");
21
+ class AirtopSessions extends Client_1.Sessions {
22
+ constructor(_options, debug = false) {
23
+ super(_options);
24
+ this._options = _options;
23
25
  this.debug = debug;
24
- this._sessions = airtopClient.sessions;
25
26
  }
26
27
  log(message) {
27
28
  if (this.debug) {
28
29
  console.log(message);
29
30
  }
30
31
  }
31
- list(request, requestOptions) {
32
- return this._sessions.list(request, requestOptions);
33
- }
32
+ /**
33
+ * @param {Airtop.SessionRestInputV1} request
34
+ * @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @example
37
+ * await client.sessions.create()
38
+ */
34
39
  create(request, requestOptions) {
40
+ const _super = Object.create(null, {
41
+ create: { get: () => super.create }
42
+ });
35
43
  var _a;
36
44
  return __awaiter(this, void 0, void 0, function* () {
37
- const createSessionResponse = yield this._sessions.create(request, requestOptions);
45
+ const createSessionResponse = yield _super.create.call(this, request, requestOptions);
38
46
  if (!createSessionResponse.data) {
39
47
  throw new Error(`Error creating browser session`);
40
48
  }
@@ -82,14 +90,5 @@ class AirtopSessions {
82
90
  return null;
83
91
  });
84
92
  }
85
- getInfo(id, requestOptions) {
86
- return this._sessions.getinfo(id, requestOptions);
87
- }
88
- terminate(id, requestOptions) {
89
- return this._sessions.terminate(id, requestOptions);
90
- }
91
- events(id, requestOptions) {
92
- return this._sessions.events(id, requestOptions);
93
- }
94
93
  }
95
94
  exports.AirtopSessions = AirtopSessions;
@@ -14,22 +14,70 @@ declare namespace seleniumWebdriver {
14
14
  createCDPConnection(domain: string): Promise<any>;
15
15
  }
16
16
  }
17
- import { AirtopClient as FernClient } from '../Client';
18
- import * as Airtop from '../api';
19
- import { Windows as WindowsNamespace } from '../api/resources/windows/client/Client';
20
- import * as core from '../core';
21
- export declare class AirtopWindows {
22
- private airtopClient;
17
+ import * as Airtop from "../api";
18
+ import { Windows as WindowsClass, Windows as WindowsNamespace } from "../api/resources/windows/client/Client";
19
+ import * as core from "../core";
20
+ export declare class AirtopWindows extends WindowsClass {
21
+ readonly _options: WindowsNamespace.Options;
23
22
  private apiKeySupplier;
24
- private _windows;
25
- constructor(airtopClient: FernClient, apiKeySupplier: core.Supplier<core.BearerToken | undefined>);
26
- create(sessionId: string, request: Airtop.CreateWindowInputV1Body, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.WindowIdResponse>;
27
- loadUrl(sessionId: string, windowId: string, request: Airtop.WindowLoadUrlV1Body, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.EmptyResponse>;
28
- close(sessionId: string, windowId: string, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.WindowIdResponse>;
29
- getWindowInfo(sessionId: string, windowId: string, request?: Airtop.GetWindowInfoRequest, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.WindowResponse>;
30
- promptContent(sessionId: string, windowId: string, request: Airtop.SessionContentPromptHandlerRequestBody, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
23
+ constructor(_options: WindowsNamespace.Options, apiKeySupplier: core.Supplier<core.BearerToken | undefined>);
24
+ /**
25
+ * @param {string} sessionId - The session id for the window.
26
+ * @param {string} windowId - The Airtop window id of the browser window to target with an Airtop AI prompt.
27
+ * @param {Airtop.SessionContentPromptHandlerRequestBody} request
28
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
29
+ *
30
+ * @deprecated Use pageQuery instead
31
+ * @example
32
+ * await client.windows.promptContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
33
+ * prompt: "What is the main idea of this page?"
34
+ * })
35
+ */
36
+ promptContent(sessionId: string, windowId: string, request: Omit<Airtop.SessionPageQueryHandlerRequestBody, "configuration"> & {
37
+ configuration?: Omit<Airtop.SessionPageQueryHandlerRequestBody["configuration"], "outputSchema"> & {
38
+ outputSchema?: string | object;
39
+ };
40
+ }, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
41
+ /**
42
+ * @param {string} sessionId - The session id for the window.
43
+ * @param {string} windowId - The Airtop window id of the browser window to target with an Airtop AI prompt.
44
+ * @param {Airtop.SessionPageQueryHandlerRequestBody} request
45
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
46
+ *
47
+ * @example
48
+ * await client.windows.pageQuery("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
49
+ * prompt: "What is the main idea of this page?"
50
+ * })
51
+ */
52
+ pageQuery(sessionId: string, windowId: string, request: Omit<Airtop.SessionPageQueryHandlerRequestBody, "configuration"> & {
53
+ configuration?: Omit<Airtop.SessionPageQueryHandlerRequestBody["configuration"], "outputSchema"> & {
54
+ outputSchema?: string | object;
55
+ };
56
+ }, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
57
+ /**
58
+ * @param {string} sessionId - The session id for the window.
59
+ * @param {string} windowId - The Airtop window id of the browser window to scrape.
60
+ * @param {Airtop.ScrapeContentRequest} request
61
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
62
+ *
63
+ * @example
64
+ * await client.windows.scrapeContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
65
+ */
31
66
  scrapeContent(sessionId: string, windowId: string, request?: Airtop.ScrapeContentRequest, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.ScrapeResponse>;
32
- summarizeContent(sessionId: string, windowId: string, request?: Airtop.SessionSummaryHandlerRequestBody, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
67
+ /**
68
+ * @param {string} sessionId - The session id for the window.
69
+ * @param {string} windowId - The Airtop window id of the browser window to summarize.
70
+ * @param {Airtop.SessionSummaryHandlerRequestBody} request
71
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
72
+ *
73
+ * @example
74
+ * await client.windows.summarizeContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
75
+ */
76
+ summarizeContent(sessionId: string, windowId: string, request?: Omit<Airtop.SessionSummaryHandlerRequestBody, "configuration"> & {
77
+ configuration?: Omit<Airtop.SessionSummaryHandlerRequestBody["configuration"], "outputSchema"> & {
78
+ outputSchema?: string | object;
79
+ };
80
+ }, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
33
81
  getWindowInfoForPuppeteerPage(session: Airtop.ExternalSessionWithConnectionInfo, page: puppeteer.Page, request?: Airtop.GetWindowInfoRequest, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.WindowResponse>;
34
82
  getWindowInfoForPlaywrightPage(session: Airtop.ExternalSessionWithConnectionInfo, page: playwright.Page, request?: Airtop.GetWindowInfoRequest, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.WindowResponse>;
35
83
  private executeSeleniumCDPCommand;
@@ -37,43 +37,85 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.AirtopWindows = void 0;
39
39
  const node_fetch_1 = __importDefault(require("node-fetch"));
40
+ const Client_1 = require("../api/resources/windows/client/Client");
40
41
  const core = __importStar(require("../core"));
41
- class AirtopWindows {
42
- constructor(airtopClient, apiKeySupplier) {
43
- this.airtopClient = airtopClient;
42
+ class AirtopWindows extends Client_1.Windows {
43
+ constructor(_options, apiKeySupplier) {
44
+ super(_options);
45
+ this._options = _options;
44
46
  this.apiKeySupplier = apiKeySupplier;
45
- this._windows = airtopClient.windows;
46
47
  }
47
- create(sessionId, request, requestOptions) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- return this._windows.create(sessionId, request, requestOptions);
50
- });
51
- }
52
- loadUrl(sessionId, windowId, request, requestOptions) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- return this._windows.loadUrl(sessionId, windowId, request, requestOptions);
48
+ /**
49
+ * @param {string} sessionId - The session id for the window.
50
+ * @param {string} windowId - The Airtop window id of the browser window to target with an Airtop AI prompt.
51
+ * @param {Airtop.SessionContentPromptHandlerRequestBody} request
52
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
53
+ *
54
+ * @deprecated Use pageQuery instead
55
+ * @example
56
+ * await client.windows.promptContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
57
+ * prompt: "What is the main idea of this page?"
58
+ * })
59
+ */
60
+ promptContent(sessionId, windowId, request, requestOptions) {
61
+ const _super = Object.create(null, {
62
+ promptContent: { get: () => super.promptContent }
55
63
  });
56
- }
57
- close(sessionId, windowId, requestOptions) {
64
+ var _a, _b;
58
65
  return __awaiter(this, void 0, void 0, function* () {
59
- return this._windows.close(sessionId, windowId, requestOptions);
66
+ return _super.promptContent.call(this, sessionId, windowId, Object.assign(Object.assign({}, request), { configuration: Object.assign(Object.assign({}, request.configuration), { outputSchema: typeof ((_a = request.configuration) === null || _a === void 0 ? void 0 : _a.outputSchema) === "object"
67
+ ? JSON.stringify(request.configuration.outputSchema)
68
+ : (_b = request.configuration) === null || _b === void 0 ? void 0 : _b.outputSchema }) }), Object.assign(Object.assign({ timeoutInSeconds: 600 }, requestOptions), { maxRetries: 0 }));
60
69
  });
61
70
  }
62
- getWindowInfo(sessionId, windowId, request, requestOptions) {
63
- return __awaiter(this, void 0, void 0, function* () {
64
- return this._windows.getWindowInfo(sessionId, windowId, request, requestOptions);
71
+ /**
72
+ * @param {string} sessionId - The session id for the window.
73
+ * @param {string} windowId - The Airtop window id of the browser window to target with an Airtop AI prompt.
74
+ * @param {Airtop.SessionPageQueryHandlerRequestBody} request
75
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
76
+ *
77
+ * @example
78
+ * await client.windows.pageQuery("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
79
+ * prompt: "What is the main idea of this page?"
80
+ * })
81
+ */
82
+ pageQuery(sessionId, windowId, request, requestOptions) {
83
+ const _super = Object.create(null, {
84
+ pageQuery: { get: () => super.pageQuery }
65
85
  });
66
- }
67
- promptContent(sessionId, windowId, request, requestOptions) {
86
+ var _a, _b;
68
87
  return __awaiter(this, void 0, void 0, function* () {
69
- return this._windows.promptContent(sessionId, windowId, request, Object.assign(Object.assign({ timeoutInSeconds: 600 }, requestOptions), { maxRetries: 0 }));
88
+ return _super.pageQuery.call(this, sessionId, windowId, Object.assign(Object.assign({}, request), { configuration: Object.assign(Object.assign({}, request.configuration), { outputSchema: typeof ((_a = request.configuration) === null || _a === void 0 ? void 0 : _a.outputSchema) === "object"
89
+ ? JSON.stringify(request.configuration.outputSchema)
90
+ : (_b = request.configuration) === null || _b === void 0 ? void 0 : _b.outputSchema }) }), Object.assign(Object.assign({ timeoutInSeconds: 600 }, requestOptions), { maxRetries: 0 }));
70
91
  });
71
92
  }
93
+ /**
94
+ * @param {string} sessionId - The session id for the window.
95
+ * @param {string} windowId - The Airtop window id of the browser window to scrape.
96
+ * @param {Airtop.ScrapeContentRequest} request
97
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
98
+ *
99
+ * @example
100
+ * await client.windows.scrapeContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
101
+ */
72
102
  scrapeContent(sessionId, windowId, request, requestOptions) {
73
- return this._windows.scrapeContent(sessionId, windowId, request, Object.assign({ timeoutInSeconds: 600 }, requestOptions));
103
+ return super.scrapeContent(sessionId, windowId, request, Object.assign({ timeoutInSeconds: 600 }, requestOptions));
74
104
  }
105
+ /**
106
+ * @param {string} sessionId - The session id for the window.
107
+ * @param {string} windowId - The Airtop window id of the browser window to summarize.
108
+ * @param {Airtop.SessionSummaryHandlerRequestBody} request
109
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
110
+ *
111
+ * @example
112
+ * await client.windows.summarizeContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
113
+ */
75
114
  summarizeContent(sessionId, windowId, request, requestOptions) {
76
- return this._windows.summarizeContent(sessionId, windowId, request, Object.assign(Object.assign({ timeoutInSeconds: 600 }, requestOptions), { maxRetries: 0 }));
115
+ var _a, _b, _c;
116
+ return super.summarizeContent(sessionId, windowId, Object.assign(Object.assign({}, request), { configuration: Object.assign(Object.assign({}, request === null || request === void 0 ? void 0 : request.configuration), { outputSchema: typeof ((_a = request === null || request === void 0 ? void 0 : request.configuration) === null || _a === void 0 ? void 0 : _a.outputSchema) === "object"
117
+ ? JSON.stringify((_b = request === null || request === void 0 ? void 0 : request.configuration) === null || _b === void 0 ? void 0 : _b.outputSchema)
118
+ : (_c = request === null || request === void 0 ? void 0 : request.configuration) === null || _c === void 0 ? void 0 : _c.outputSchema }) }), Object.assign(Object.assign({ timeoutInSeconds: 600 }, requestOptions), { maxRetries: 0 }));
77
119
  }
78
120
  getWindowInfoForPuppeteerPage(session, page, request, requestOptions) {
79
121
  return __awaiter(this, void 0, void 0, function* () {
@@ -85,10 +127,10 @@ class AirtopWindows {
85
127
  return __awaiter(this, void 0, void 0, function* () {
86
128
  // Retrieve target information
87
129
  const cdpSession = yield page.context().newCDPSession(page);
88
- const { targetInfo } = yield cdpSession.send('Target.getTargetInfo');
130
+ const { targetInfo } = yield cdpSession.send("Target.getTargetInfo");
89
131
  const targetId = targetInfo.targetId;
90
132
  if (!targetId) {
91
- throw new Error('TargetId not found');
133
+ throw new Error("TargetId not found");
92
134
  }
93
135
  return yield this.getWindowInfo(session.id, targetId, request, requestOptions);
94
136
  });
@@ -98,17 +140,17 @@ class AirtopWindows {
98
140
  // Get the current WebDriver session ID
99
141
  const webDriverSessionId = (yield driver.getSession()).getId();
100
142
  if (!webDriverSessionId) {
101
- throw new Error('No WebDriver session available');
143
+ throw new Error("No WebDriver session available");
102
144
  }
103
145
  const chromedriverSessionUrl = `${session.chromedriverUrl}/session/${webDriverSessionId}/chromium/send_command_and_get_result`;
104
146
  const response = yield (0, node_fetch_1.default)(chromedriverSessionUrl, {
105
- method: 'POST',
147
+ method: "POST",
106
148
  headers: {
107
- 'Content-Type': 'application/json',
149
+ "Content-Type": "application/json",
108
150
  Authorization: `Bearer ${apiKey}`,
109
151
  },
110
152
  body: JSON.stringify({
111
- cmd: 'Target.getTargetInfo',
153
+ cmd: "Target.getTargetInfo",
112
154
  params: {},
113
155
  }),
114
156
  });
@@ -119,10 +161,10 @@ class AirtopWindows {
119
161
  var _a, _b;
120
162
  return __awaiter(this, void 0, void 0, function* () {
121
163
  const apiKey = yield core.Supplier.get(this.apiKeySupplier);
122
- const result = yield this.executeSeleniumCDPCommand(driver, session, apiKey || '');
164
+ const result = yield this.executeSeleniumCDPCommand(driver, session, apiKey || "");
123
165
  const targetId = (_b = (_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.targetInfo) === null || _b === void 0 ? void 0 : _b.targetId;
124
166
  if (!targetId) {
125
- throw new Error('TargetId not found');
167
+ throw new Error("TargetId not found");
126
168
  }
127
169
  return yield this.getWindowInfo(session.id, targetId, request, requestOptions);
128
170
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airtop/sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "repository": "https://github.com/airtop-ai/airtop-node-sdk",
6
6
  "main": "./index.js",
@@ -9,7 +9,8 @@
9
9
  "format": "prettier . --write --ignore-unknown",
10
10
  "build": "tsc",
11
11
  "prepack": "cp -rv dist/. .",
12
- "test": "jest"
12
+ "test": "jest",
13
+ "prepublish": "yarn build"
13
14
  },
14
15
  "dependencies": {
15
16
  "url-join": "4.0.1",
package/reference.md CHANGED
@@ -244,7 +244,7 @@ await client.sessions.create();
244
244
  </dl>
245
245
  </details>
246
246
 
247
- <details><summary><code>client.sessions.<a href="/src/api/resources/sessions/client/Client.ts">getinfo</a>(id) -> Airtop.SessionResponse</code></summary>
247
+ <details><summary><code>client.sessions.<a href="/src/api/resources/sessions/client/Client.ts">getInfo</a>(id) -> Airtop.SessionResponse</code></summary>
248
248
  <dl>
249
249
  <dd>
250
250
 
@@ -272,7 +272,7 @@ Get a session by ID
272
272
  <dd>
273
273
 
274
274
  ```typescript
275
- await client.sessions.getinfo("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b");
275
+ await client.sessions.getInfo("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b");
276
276
  ```
277
277
 
278
278
  </dd>
@@ -679,10 +679,91 @@ await client.windows.close("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "7334da2a-91b
679
679
  </dl>
680
680
  </details>
681
681
 
682
+ <details><summary><code>client.windows.<a href="/src/api/resources/windows/client/Client.ts">pageQuery</a>(sessionId, windowId, { ...params }) -> Airtop.AiPromptResponse</code></summary>
683
+ <dl>
684
+ <dd>
685
+
686
+ #### 🔌 Usage
687
+
688
+ <dl>
689
+ <dd>
690
+
691
+ <dl>
692
+ <dd>
693
+
694
+ ```typescript
695
+ await client.windows.pageQuery("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
696
+ prompt: "What is the main idea of this page?",
697
+ });
698
+ ```
699
+
700
+ </dd>
701
+ </dl>
702
+ </dd>
703
+ </dl>
704
+
705
+ #### ⚙️ Parameters
706
+
707
+ <dl>
708
+ <dd>
709
+
710
+ <dl>
711
+ <dd>
712
+
713
+ **sessionId:** `string` — The session id for the window.
714
+
715
+ </dd>
716
+ </dl>
717
+
718
+ <dl>
719
+ <dd>
720
+
721
+ **windowId:** `string` — The Airtop window id of the browser window to target with an Airtop AI prompt.
722
+
723
+ </dd>
724
+ </dl>
725
+
726
+ <dl>
727
+ <dd>
728
+
729
+ **request:** `Airtop.SessionPageQueryHandlerRequestBody`
730
+
731
+ </dd>
732
+ </dl>
733
+
734
+ <dl>
735
+ <dd>
736
+
737
+ **requestOptions:** `Windows.RequestOptions`
738
+
739
+ </dd>
740
+ </dl>
741
+ </dd>
742
+ </dl>
743
+
744
+ </dd>
745
+ </dl>
746
+ </details>
747
+
682
748
  <details><summary><code>client.windows.<a href="/src/api/resources/windows/client/Client.ts">promptContent</a>(sessionId, windowId, { ...params }) -> Airtop.AiPromptResponse</code></summary>
683
749
  <dl>
684
750
  <dd>
685
751
 
752
+ #### 📝 Description
753
+
754
+ <dl>
755
+ <dd>
756
+
757
+ <dl>
758
+ <dd>
759
+
760
+ This endpoint is deprecated. Please use the `pageQuery` endpoint instead.
761
+
762
+ </dd>
763
+ </dl>
764
+ </dd>
765
+ </dl>
766
+
686
767
  #### 🔌 Usage
687
768
 
688
769
  <dl>
@@ -726,7 +807,7 @@ await client.windows.promptContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334
726
807
  <dl>
727
808
  <dd>
728
809
 
729
- **request:** `Airtop.SessionContentPromptHandlerRequestBody`
810
+ **request:** `Airtop.SessionPageQueryHandlerRequestBody`
730
811
 
731
812
  </dd>
732
813
  </dl>
@@ -813,6 +894,21 @@ await client.windows.scrapeContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334
813
894
  <dl>
814
895
  <dd>
815
896
 
897
+ #### 📝 Description
898
+
899
+ <dl>
900
+ <dd>
901
+
902
+ <dl>
903
+ <dd>
904
+
905
+ This endpoint is deprecated. Please use the `pageQuery` endpoint and ask for a summary in the prompt instead.
906
+
907
+ </dd>
908
+ </dl>
909
+ </dd>
910
+ </dl>
911
+
816
912
  #### 🔌 Usage
817
913
 
818
914
  <dl>
@@ -4,10 +4,12 @@
4
4
  import * as serializers from "../../../../index";
5
5
  import * as Airtop from "../../../../../api/index";
6
6
  import * as core from "../../../../../core";
7
+ import { SummaryConfig } from "../../../../types/SummaryConfig";
7
8
  export declare const SessionSummaryHandlerRequestBody: core.serialization.Schema<serializers.SessionSummaryHandlerRequestBody.Raw, Airtop.SessionSummaryHandlerRequestBody>;
8
9
  export declare namespace SessionSummaryHandlerRequestBody {
9
10
  interface Raw {
10
11
  clientRequestId?: string | null;
12
+ configuration?: SummaryConfig.Raw | null;
11
13
  costThresholdCredits?: number | null;
12
14
  prompt?: string | null;
13
15
  timeThresholdSeconds?: number | null;
@@ -28,8 +28,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.SessionSummaryHandlerRequestBody = void 0;
30
30
  const core = __importStar(require("../../../../../core"));
31
+ const SummaryConfig_1 = require("../../../../types/SummaryConfig");
31
32
  exports.SessionSummaryHandlerRequestBody = core.serialization.object({
32
33
  clientRequestId: core.serialization.string().optional(),
34
+ configuration: SummaryConfig_1.SummaryConfig.optional(),
33
35
  costThresholdCredits: core.serialization.number().optional(),
34
36
  prompt: core.serialization.string().optional(),
35
37
  timeThresholdSeconds: core.serialization.number().optional(),
@@ -1,5 +1,4 @@
1
1
  export { CreateWindowInputV1Body } from "./CreateWindowInputV1Body";
2
2
  export { WindowLoadUrlV1Body } from "./WindowLoadUrlV1Body";
3
- export { SessionContentPromptHandlerRequestBody } from "./SessionContentPromptHandlerRequestBody";
4
3
  export { ScrapeContentRequest } from "./ScrapeContentRequest";
5
4
  export { SessionSummaryHandlerRequestBody } from "./SessionSummaryHandlerRequestBody";
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SessionSummaryHandlerRequestBody = exports.ScrapeContentRequest = exports.SessionContentPromptHandlerRequestBody = exports.WindowLoadUrlV1Body = exports.CreateWindowInputV1Body = void 0;
3
+ exports.SessionSummaryHandlerRequestBody = exports.ScrapeContentRequest = exports.WindowLoadUrlV1Body = exports.CreateWindowInputV1Body = void 0;
4
4
  var CreateWindowInputV1Body_1 = require("./CreateWindowInputV1Body");
5
5
  Object.defineProperty(exports, "CreateWindowInputV1Body", { enumerable: true, get: function () { return CreateWindowInputV1Body_1.CreateWindowInputV1Body; } });
6
6
  var WindowLoadUrlV1Body_1 = require("./WindowLoadUrlV1Body");
7
7
  Object.defineProperty(exports, "WindowLoadUrlV1Body", { enumerable: true, get: function () { return WindowLoadUrlV1Body_1.WindowLoadUrlV1Body; } });
8
- var SessionContentPromptHandlerRequestBody_1 = require("./SessionContentPromptHandlerRequestBody");
9
- Object.defineProperty(exports, "SessionContentPromptHandlerRequestBody", { enumerable: true, get: function () { return SessionContentPromptHandlerRequestBody_1.SessionContentPromptHandlerRequestBody; } });
10
8
  var ScrapeContentRequest_1 = require("./ScrapeContentRequest");
11
9
  Object.defineProperty(exports, "ScrapeContentRequest", { enumerable: true, get: function () { return ScrapeContentRequest_1.ScrapeContentRequest; } });
12
10
  var SessionSummaryHandlerRequestBody_1 = require("./SessionSummaryHandlerRequestBody");
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index";
5
+ import * as Airtop from "../../api/index";
6
+ import * as core from "../../core";
7
+ export declare const PageQueryConfig: core.serialization.ObjectSchema<serializers.PageQueryConfig.Raw, Airtop.PageQueryConfig>;
8
+ export declare namespace PageQueryConfig {
9
+ interface Raw {
10
+ outputSchema?: string | null;
11
+ }
12
+ }
@@ -26,9 +26,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.PromptContentConfig = void 0;
29
+ exports.PageQueryConfig = void 0;
30
30
  const core = __importStar(require("../../core"));
31
- const PromptContentExperimentalConfig_1 = require("./PromptContentExperimentalConfig");
32
- exports.PromptContentConfig = core.serialization.object({
33
- experimental: PromptContentExperimentalConfig_1.PromptContentExperimentalConfig.optional(),
31
+ exports.PageQueryConfig = core.serialization.object({
32
+ outputSchema: core.serialization.string().optional(),
34
33
  });
@@ -4,8 +4,8 @@
4
4
  import * as serializers from "../index";
5
5
  import * as Airtop from "../../api/index";
6
6
  import * as core from "../../core";
7
- export declare const PromptContentExperimentalConfig: core.serialization.ObjectSchema<serializers.PromptContentExperimentalConfig.Raw, Airtop.PromptContentExperimentalConfig>;
8
- export declare namespace PromptContentExperimentalConfig {
7
+ export declare const PageQueryExperimentalConfig: core.serialization.ObjectSchema<serializers.PageQueryExperimentalConfig.Raw, Airtop.PageQueryExperimentalConfig>;
8
+ export declare namespace PageQueryExperimentalConfig {
9
9
  interface Raw {
10
10
  includeVisualAnalysis?: string | null;
11
11
  }
@@ -26,8 +26,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.PromptContentExperimentalConfig = void 0;
29
+ exports.PageQueryExperimentalConfig = void 0;
30
30
  const core = __importStar(require("../../core"));
31
- exports.PromptContentExperimentalConfig = core.serialization.object({
31
+ exports.PageQueryExperimentalConfig = core.serialization.object({
32
32
  includeVisualAnalysis: core.serialization.string().optional(),
33
33
  });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index";
5
+ import * as Airtop from "../../api/index";
6
+ import * as core from "../../core";
7
+ import { PageQueryConfig } from "./PageQueryConfig";
8
+ export declare const SessionPageQueryHandlerRequestBody: core.serialization.ObjectSchema<serializers.SessionPageQueryHandlerRequestBody.Raw, Airtop.SessionPageQueryHandlerRequestBody>;
9
+ export declare namespace SessionPageQueryHandlerRequestBody {
10
+ interface Raw {
11
+ clientRequestId?: string | null;
12
+ configuration?: PageQueryConfig.Raw | null;
13
+ costThresholdCredits?: number | null;
14
+ followPaginationLinks?: boolean | null;
15
+ prompt: string;
16
+ timeThresholdSeconds?: number | null;
17
+ }
18
+ }
@@ -26,10 +26,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.SessionContentPromptHandlerRequestBody = void 0;
30
- const core = __importStar(require("../../../../../core"));
31
- exports.SessionContentPromptHandlerRequestBody = core.serialization.object({
29
+ exports.SessionPageQueryHandlerRequestBody = void 0;
30
+ const core = __importStar(require("../../core"));
31
+ const PageQueryConfig_1 = require("./PageQueryConfig");
32
+ exports.SessionPageQueryHandlerRequestBody = core.serialization.object({
32
33
  clientRequestId: core.serialization.string().optional(),
34
+ configuration: PageQueryConfig_1.PageQueryConfig.optional(),
33
35
  costThresholdCredits: core.serialization.number().optional(),
34
36
  followPaginationLinks: core.serialization.boolean().optional(),
35
37
  prompt: core.serialization.string(),
@@ -4,10 +4,9 @@
4
4
  import * as serializers from "../index";
5
5
  import * as Airtop from "../../api/index";
6
6
  import * as core from "../../core";
7
- import { SummaryExperimentalConfig } from "./SummaryExperimentalConfig";
8
7
  export declare const SummaryConfig: core.serialization.ObjectSchema<serializers.SummaryConfig.Raw, Airtop.SummaryConfig>;
9
8
  export declare namespace SummaryConfig {
10
9
  interface Raw {
11
- experimental?: SummaryExperimentalConfig.Raw | null;
10
+ outputSchema?: string | null;
12
11
  }
13
12
  }
@@ -28,7 +28,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.SummaryConfig = void 0;
30
30
  const core = __importStar(require("../../core"));
31
- const SummaryExperimentalConfig_1 = require("./SummaryExperimentalConfig");
32
31
  exports.SummaryConfig = core.serialization.object({
33
- experimental: SummaryExperimentalConfig_1.SummaryExperimentalConfig.optional(),
32
+ outputSchema: core.serialization.string().optional(),
34
33
  });
@@ -16,10 +16,10 @@ export * from "./ExternalSessionAiResponseMetadataUsage";
16
16
  export * from "./ExternalSessionConfig";
17
17
  export * from "./ExternalSessionWithConnectionInfo";
18
18
  export * from "./Issue";
19
+ export * from "./PageQueryConfig";
20
+ export * from "./PageQueryExperimentalConfig";
19
21
  export * from "./Pagination";
20
22
  export * from "./ProfilesResponse";
21
- export * from "./PromptContentConfig";
22
- export * from "./PromptContentExperimentalConfig";
23
23
  export * from "./ScrapeResponse";
24
24
  export * from "./ScrapeResponseContent";
25
25
  export * from "./ScrapeResponseEnvelope";
@@ -29,6 +29,7 @@ export * from "./CustomProxy";
29
29
  export * from "./SessionConfigV1ProxyItem";
30
30
  export * from "./SessionConfigV1Proxy";
31
31
  export * from "./SessionConfigV1";
32
+ export * from "./SessionPageQueryHandlerRequestBody";
32
33
  export * from "./SessionResponse";
33
34
  export * from "./SessionsResponse";
34
35
  export * from "./SessionsWithPagination";