donobu 2.26.0 → 2.27.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.
Files changed (113) hide show
  1. package/dist/apis/SpecialFlowsApi.d.ts.map +1 -1
  2. package/dist/apis/SpecialFlowsApi.js +60 -31
  3. package/dist/apis/SpecialFlowsApi.js.map +1 -1
  4. package/dist/apis/ToolsApi.d.ts.map +1 -1
  5. package/dist/apis/ToolsApi.js +2 -1
  6. package/dist/apis/ToolsApi.js.map +1 -1
  7. package/dist/assets/generated/version +1 -1
  8. package/dist/esm/apis/SpecialFlowsApi.d.ts.map +1 -1
  9. package/dist/esm/apis/SpecialFlowsApi.js +60 -31
  10. package/dist/esm/apis/SpecialFlowsApi.js.map +1 -1
  11. package/dist/esm/apis/ToolsApi.d.ts.map +1 -1
  12. package/dist/esm/apis/ToolsApi.js +2 -1
  13. package/dist/esm/apis/ToolsApi.js.map +1 -1
  14. package/dist/esm/assets/generated/version +1 -1
  15. package/dist/esm/lib/testExtension.js +1 -1
  16. package/dist/esm/lib/testExtension.js.map +1 -1
  17. package/dist/esm/lib/utils/selfHealing.d.ts.map +1 -1
  18. package/dist/esm/lib/utils/selfHealing.js +44 -45
  19. package/dist/esm/lib/utils/selfHealing.js.map +1 -1
  20. package/dist/esm/main.d.ts +2 -0
  21. package/dist/esm/main.d.ts.map +1 -1
  22. package/dist/esm/main.js +2 -0
  23. package/dist/esm/main.js.map +1 -1
  24. package/dist/esm/managers/DonobuFlowsManager.d.ts.map +1 -1
  25. package/dist/esm/managers/DonobuFlowsManager.js +2 -1
  26. package/dist/esm/managers/DonobuFlowsManager.js.map +1 -1
  27. package/dist/esm/managers/PageInspector.d.ts.map +1 -1
  28. package/dist/esm/managers/PageInspector.js +4 -2
  29. package/dist/esm/managers/PageInspector.js.map +1 -1
  30. package/dist/esm/managers/PluginLoader.d.ts.map +1 -1
  31. package/dist/esm/managers/PluginLoader.js +2 -1
  32. package/dist/esm/managers/PluginLoader.js.map +1 -1
  33. package/dist/esm/managers/ToolManager.d.ts +6 -2
  34. package/dist/esm/managers/ToolManager.d.ts.map +1 -1
  35. package/dist/esm/managers/ToolManager.js +90 -76
  36. package/dist/esm/managers/ToolManager.js.map +1 -1
  37. package/dist/esm/utils/PlaywrightUtils.d.ts.map +1 -1
  38. package/dist/esm/utils/PlaywrightUtils.js +42 -22
  39. package/dist/esm/utils/PlaywrightUtils.js.map +1 -1
  40. package/dist/lib/testExtension.js +1 -1
  41. package/dist/lib/testExtension.js.map +1 -1
  42. package/dist/lib/utils/selfHealing.d.ts.map +1 -1
  43. package/dist/lib/utils/selfHealing.js +44 -45
  44. package/dist/lib/utils/selfHealing.js.map +1 -1
  45. package/dist/main.d.ts +2 -0
  46. package/dist/main.d.ts.map +1 -1
  47. package/dist/main.js +2 -0
  48. package/dist/main.js.map +1 -1
  49. package/dist/managers/DonobuFlowsManager.d.ts.map +1 -1
  50. package/dist/managers/DonobuFlowsManager.js +2 -1
  51. package/dist/managers/DonobuFlowsManager.js.map +1 -1
  52. package/dist/managers/PageInspector.d.ts.map +1 -1
  53. package/dist/managers/PageInspector.js +4 -2
  54. package/dist/managers/PageInspector.js.map +1 -1
  55. package/dist/managers/PluginLoader.js +2 -2
  56. package/dist/managers/PluginLoader.js.map +1 -1
  57. package/dist/managers/ToolManager.d.ts +6 -2
  58. package/dist/managers/ToolManager.d.ts.map +1 -1
  59. package/dist/managers/ToolManager.js +90 -76
  60. package/dist/managers/ToolManager.js.map +1 -1
  61. package/dist/models/FlowMetadata.d.ts.map +1 -1
  62. package/dist/utils/PlaywrightUtils.d.ts.map +1 -1
  63. package/dist/utils/PlaywrightUtils.js +42 -22
  64. package/dist/utils/PlaywrightUtils.js.map +1 -1
  65. package/package.json +3 -2
  66. package/dist/esm/tools/AggregateExtractedStreetviewDataTool.d.ts +0 -22
  67. package/dist/esm/tools/AggregateExtractedStreetviewDataTool.d.ts.map +0 -1
  68. package/dist/esm/tools/AggregateExtractedStreetviewDataTool.js +0 -61
  69. package/dist/esm/tools/AggregateExtractedStreetviewDataTool.js.map +0 -1
  70. package/dist/esm/tools/ExtractGoogleStreetviewEntityDataTool.d.ts +0 -62
  71. package/dist/esm/tools/ExtractGoogleStreetviewEntityDataTool.d.ts.map +0 -1
  72. package/dist/esm/tools/ExtractGoogleStreetviewEntityDataTool.js +0 -164
  73. package/dist/esm/tools/ExtractGoogleStreetviewEntityDataTool.js.map +0 -1
  74. package/dist/esm/tools/ExtractPaymentProviderKeyTool.d.ts +0 -81
  75. package/dist/esm/tools/ExtractPaymentProviderKeyTool.d.ts.map +0 -1
  76. package/dist/esm/tools/ExtractPaymentProviderKeyTool.js +0 -316
  77. package/dist/esm/tools/ExtractPaymentProviderKeyTool.js.map +0 -1
  78. package/dist/esm/tools/ExtractPublicFacebookEntityDataTool.d.ts +0 -39
  79. package/dist/esm/tools/ExtractPublicFacebookEntityDataTool.d.ts.map +0 -1
  80. package/dist/esm/tools/ExtractPublicFacebookEntityDataTool.js +0 -228
  81. package/dist/esm/tools/ExtractPublicFacebookEntityDataTool.js.map +0 -1
  82. package/dist/esm/tools/GoToGoogleMapsStreetViewTool.d.ts +0 -47
  83. package/dist/esm/tools/GoToGoogleMapsStreetViewTool.d.ts.map +0 -1
  84. package/dist/esm/tools/GoToGoogleMapsStreetViewTool.js +0 -126
  85. package/dist/esm/tools/GoToGoogleMapsStreetViewTool.js.map +0 -1
  86. package/dist/esm/tools/NavigateWithinStreetView.d.ts +0 -54
  87. package/dist/esm/tools/NavigateWithinStreetView.d.ts.map +0 -1
  88. package/dist/esm/tools/NavigateWithinStreetView.js +0 -119
  89. package/dist/esm/tools/NavigateWithinStreetView.js.map +0 -1
  90. package/dist/tools/AggregateExtractedStreetviewDataTool.d.ts +0 -22
  91. package/dist/tools/AggregateExtractedStreetviewDataTool.d.ts.map +0 -1
  92. package/dist/tools/AggregateExtractedStreetviewDataTool.js +0 -61
  93. package/dist/tools/AggregateExtractedStreetviewDataTool.js.map +0 -1
  94. package/dist/tools/ExtractGoogleStreetviewEntityDataTool.d.ts +0 -62
  95. package/dist/tools/ExtractGoogleStreetviewEntityDataTool.d.ts.map +0 -1
  96. package/dist/tools/ExtractGoogleStreetviewEntityDataTool.js +0 -164
  97. package/dist/tools/ExtractGoogleStreetviewEntityDataTool.js.map +0 -1
  98. package/dist/tools/ExtractPaymentProviderKeyTool.d.ts +0 -81
  99. package/dist/tools/ExtractPaymentProviderKeyTool.d.ts.map +0 -1
  100. package/dist/tools/ExtractPaymentProviderKeyTool.js +0 -316
  101. package/dist/tools/ExtractPaymentProviderKeyTool.js.map +0 -1
  102. package/dist/tools/ExtractPublicFacebookEntityDataTool.d.ts +0 -39
  103. package/dist/tools/ExtractPublicFacebookEntityDataTool.d.ts.map +0 -1
  104. package/dist/tools/ExtractPublicFacebookEntityDataTool.js +0 -228
  105. package/dist/tools/ExtractPublicFacebookEntityDataTool.js.map +0 -1
  106. package/dist/tools/GoToGoogleMapsStreetViewTool.d.ts +0 -47
  107. package/dist/tools/GoToGoogleMapsStreetViewTool.d.ts.map +0 -1
  108. package/dist/tools/GoToGoogleMapsStreetViewTool.js +0 -126
  109. package/dist/tools/GoToGoogleMapsStreetViewTool.js.map +0 -1
  110. package/dist/tools/NavigateWithinStreetView.d.ts +0 -54
  111. package/dist/tools/NavigateWithinStreetView.d.ts.map +0 -1
  112. package/dist/tools/NavigateWithinStreetView.js +0 -119
  113. package/dist/tools/NavigateWithinStreetView.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"GoToGoogleMapsStreetViewTool.d.ts","sourceRoot":"","sources":["../../../src/tools/GoToGoogleMapsStreetViewTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAO1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kCAAkC;;;;;;;;;EAK7C,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;EAE7C,CAAC;AAEF;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,IAAI,CACpD,OAAO,kCAAkC,EACzC,OAAO,iCAAiC,CACzC;IACC,gBAAuB,IAAI,8BAA8B;;IAWnC,IAAI,CACxB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,GAC7D,OAAO,CAAC,cAAc,CAAC;IAsBV,WAAW,CACzB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,GAC5D,OAAO,CAAC,cAAc,CAAC;YAIZ,aAAa;YAab,uBAAuB;IA4BrC;;;OAGG;YACW,iBAAiB;CAkDhC"}
@@ -1,126 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoToGoogleMapsStreetViewTool = exports.GoToGoogleMapsStreetViewGptSchema = exports.GoToGoogleMapsStreetViewCoreSchema = void 0;
4
- const Tool_1 = require("./Tool");
5
- const ToolCallResult_1 = require("../models/ToolCallResult");
6
- const AggregateExtractedStreetviewDataTool_1 = require("./AggregateExtractedStreetviewDataTool");
7
- const ToolSchema_1 = require("../models/ToolSchema");
8
- const PlaywrightUtils_1 = require("../utils/PlaywrightUtils");
9
- const MiscUtils_1 = require("../utils/MiscUtils");
10
- const Logger_1 = require("../utils/Logger");
11
- const zod_1 = require("zod");
12
- exports.GoToGoogleMapsStreetViewCoreSchema = zod_1.z.object({
13
- entityName: zod_1.z.string().describe('The name of the business/entity to find.'),
14
- entityLocation: zod_1.z
15
- .string()
16
- .describe('The address of the business/entity to find.'),
17
- });
18
- exports.GoToGoogleMapsStreetViewGptSchema = ToolSchema_1.BaseGptArgsSchema.merge(exports.GoToGoogleMapsStreetViewCoreSchema);
19
- /**
20
- * Attempts to verify that the given business/entity exists at the given location by using a Google
21
- * Maps street view. If the business/entity is found, then a AggregateExtractedStreetviewDataTool
22
- * tool call is queued containing the results.
23
- */
24
- class GoToGoogleMapsStreetViewTool extends Tool_1.Tool {
25
- constructor() {
26
- super(GoToGoogleMapsStreetViewTool.NAME, 'Go to the Google Maps street view of a given business/entity by name and location.', exports.GoToGoogleMapsStreetViewCoreSchema, exports.GoToGoogleMapsStreetViewGptSchema);
27
- }
28
- async call(context, parameters) {
29
- const page = context.page.current;
30
- const entityName = parameters.entityName.trim();
31
- const entityLocation = parameters.entityLocation.trim();
32
- if (!(await this.setStreetView(entityName, entityLocation, page))) {
33
- context.proposedToolCalls.length = 0;
34
- context.proposedToolCalls.push({
35
- name: AggregateExtractedStreetviewDataTool_1.AggregateExtractedStreetviewDataTool.NAME,
36
- parameters: {},
37
- });
38
- return {
39
- isSuccessful: false,
40
- forLlm: 'Unable to set the street-view mode for Google Maps!',
41
- metadata: null,
42
- };
43
- }
44
- else {
45
- await PlaywrightUtils_1.PlaywrightUtils.waitForPageStability(page);
46
- return ToolCallResult_1.ToolCallResult.successful();
47
- }
48
- }
49
- callFromGpt(context, parameters) {
50
- return this.call(context, parameters);
51
- }
52
- async setStreetView(entityName, entityLocation, page) {
53
- const googleMapsCombinedQuery = `${entityName} ${entityLocation}`.trim();
54
- // TODO: Try using the peg-man if these calls fail.
55
- return ((await this.setStreetViewUsingQuery(googleMapsCombinedQuery, page)) ||
56
- (await this.setStreetViewUsingQuery(entityLocation, page)));
57
- }
58
- async setStreetViewUsingQuery(googleMapsQuery, page) {
59
- const encodedQuery = encodeURIComponent(googleMapsQuery);
60
- const googleMapsUrl = 'https://www.google.com/maps/search/?api=1&map_action=pano&query=' +
61
- encodedQuery;
62
- await page.goto(googleMapsUrl);
63
- await page.waitForLoadState();
64
- const streetViewButton = page.locator('button[aria-label="Street View"]');
65
- try {
66
- await streetViewButton.waitFor({ timeout: 10000 });
67
- await streetViewButton.click({
68
- delay: MiscUtils_1.MiscUtils.generateHumanLikeClickDurationInMs(),
69
- });
70
- await page.waitForLoadState();
71
- await page.waitForTimeout(2559);
72
- await this.cleanupUiElements(page);
73
- return true;
74
- }
75
- catch (error) {
76
- Logger_1.appLogger.error(`Failed to set street view for ${googleMapsUrl}`, error);
77
- return false;
78
- }
79
- }
80
- /**
81
- * Remove UI elements that can distract the GPT when performing an analysis. This is a fragile
82
- * script and will break depending on the device used and on the whims of Google.
83
- */
84
- async cleanupUiElements(page) {
85
- await page.evaluate(() => {
86
- const removeElement = (element) => {
87
- if (element) {
88
- element.remove();
89
- }
90
- };
91
- // This is the search box.
92
- removeElement(document.querySelector('#omnibox-singlebox'));
93
- // This is miscellaneous footer data.
94
- removeElement(document.querySelector('.id-fineprint'));
95
- // This is a display card overlay.
96
- removeElement(document.querySelector('#titlecard'));
97
- // This is the picture-in-picture box.
98
- removeElement(Array.from(document.querySelectorAll('div[style]')).find((el) => el.style.marginBottom === '20px'));
99
- // Remove the "Share" and "Close" buttons.
100
- removeElement(document.querySelector('#image-header'));
101
- // Collapse the side panel.
102
- let isSidePanelCollapsed = false;
103
- // Step 1: Select the button element using the aria-label and jsaction attributes
104
- const buttonElement = document.querySelector('button[aria-label="Collapse side panel"][jsaction*="drawer.close"]');
105
- // Check if the button element is selected
106
- if (buttonElement) {
107
- // Step 2: Find the img element within the button
108
- const imgElement = buttonElement.querySelector('img');
109
- // Check if the img element is found within the button
110
- if (imgElement) {
111
- // Step 3: Click!
112
- imgElement.click();
113
- isSidePanelCollapsed = true;
114
- }
115
- }
116
- if (!isSidePanelCollapsed) {
117
- // Hack it.
118
- removeElement(Array.from(document.querySelectorAll('div[style]')).find((el) => el.style.width === '480px'));
119
- }
120
- });
121
- await page.waitForLoadState();
122
- }
123
- }
124
- exports.GoToGoogleMapsStreetViewTool = GoToGoogleMapsStreetViewTool;
125
- GoToGoogleMapsStreetViewTool.NAME = 'goToGoogleMapsStreetView';
126
- //# sourceMappingURL=GoToGoogleMapsStre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jF,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAC1C,oEAAoE,CACrE,CAAC;YACF,0CAA0C;YAC1C,IAAI,aAAa,EAAE,CAAC;gBAClB,iDAAiD;gBACjD,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBACtD,sDAAsD;gBACtD,IAAI,UAAU,EAAE,CAAC;oBACf,iBAAiB;oBACjB,UAAU,CAAC,KAAK,EAAE,CAAC;oBACnB,oBAAoB,GAAG,IAAI,CAAC;gBAC9B,CAAC;YACH,CAAC;YAED,IAAI,CAAC,oBAAoB,EAAE,CAAC;gBAC1B,WAAW;gBACX,aAAa,CACX,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CACtD,CAAC,EAAE,EAAE,EAAE,CAAE,EAAkB,CAAC,KAAK,CAAC,KAAK,KAAK,OAAO,CACpD,CACF,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAChC,CAAC;;AA7IH,oEA8IC;AA1IwB,iCAAI,GAAG,0BAA0B,CAAC"}
@@ -1,54 +0,0 @@
1
- import { Tool } from './Tool';
2
- import { ToolCallContext } from '../models/ToolCallContext';
3
- import { ToolCallResult } from '../models/ToolCallResult';
4
- import { Page } from 'playwright';
5
- import { z } from 'zod';
6
- export declare const Action: z.ZodEnum<["ROTATE_CLOCKWISE", "ROTATE_COUNTERCLOCKWISE", "ZOOM_IN", "ZOOM_OUT"]>;
7
- export declare const NavigateWithinStreetViewCoreSchema: z.ZodObject<{
8
- /**
9
- * Choose a value that will most likely help towards the current objective.
10
- * - A value of ZOOM_IN will zoom in on current street maps view.
11
- * - A value of ZOOM_OUT will zoom out on current street maps view.
12
- * - A value of ROTATE_CLOCKWISE will rotate the current street maps view clockwise.
13
- * - A value of ROTATE_COUNTERCLOCKWISE will rotate the current street maps view counterclockwise.
14
- */
15
- action: z.ZodEnum<["ROTATE_CLOCKWISE", "ROTATE_COUNTERCLOCKWISE", "ZOOM_IN", "ZOOM_OUT"]>;
16
- }, "strip", z.ZodTypeAny, {
17
- action: "ROTATE_CLOCKWISE" | "ROTATE_COUNTERCLOCKWISE" | "ZOOM_IN" | "ZOOM_OUT";
18
- }, {
19
- action: "ROTATE_CLOCKWISE" | "ROTATE_COUNTERCLOCKWISE" | "ZOOM_IN" | "ZOOM_OUT";
20
- }>;
21
- export declare const NavigateWithinStreetViewGptSchema: z.ZodObject<{
22
- rationale: z.ZodString;
23
- } & {
24
- /**
25
- * Choose a value that will most likely help towards the current objective.
26
- * - A value of ZOOM_IN will zoom in on current street maps view.
27
- * - A value of ZOOM_OUT will zoom out on current street maps view.
28
- * - A value of ROTATE_CLOCKWISE will rotate the current street maps view clockwise.
29
- * - A value of ROTATE_COUNTERCLOCKWISE will rotate the current street maps view counterclockwise.
30
- */
31
- action: z.ZodEnum<["ROTATE_CLOCKWISE", "ROTATE_COUNTERCLOCKWISE", "ZOOM_IN", "ZOOM_OUT"]>;
32
- }, "strip", z.ZodTypeAny, {
33
- rationale: string;
34
- action: "ROTATE_CLOCKWISE" | "ROTATE_COUNTERCLOCKWISE" | "ZOOM_IN" | "ZOOM_OUT";
35
- }, {
36
- rationale: string;
37
- action: "ROTATE_CLOCKWISE" | "ROTATE_COUNTERCLOCKWISE" | "ZOOM_IN" | "ZOOM_OUT";
38
- }>;
39
- export declare class NavigateWithinStreetViewTool extends Tool<typeof NavigateWithinStreetViewCoreSchema, typeof NavigateWithinStreetViewGptSchema> {
40
- static readonly NAME = "navigateWithinStreetView";
41
- constructor();
42
- call(context: ToolCallContext, parameters: z.infer<typeof NavigateWithinStreetViewCoreSchema>): Promise<ToolCallResult>;
43
- callFromGpt(context: ToolCallContext, parameters: z.infer<typeof NavigateWithinStreetViewGptSchema>): Promise<ToolCallResult>;
44
- /**
45
- * Removes the Google Maps survey iframe from the given Page.
46
- * If no survey exists, this call has no effect.
47
- *
48
- * @param page - The Playwright Page object to remove the survey from
49
- */
50
- static removeGoogleMapsSurvey(page: Page): Promise<void>;
51
- private static rotateStreetView;
52
- private static zoomStreetView;
53
- }
54
- //# sourceMappingURL=NavigateWithinStreetView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NavigateWithinStreetView.d.ts","sourceRoot":"","sources":["../../../src/tools/NavigateWithinStreetView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AASlC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,MAAM,mFAKjB,CAAC;AAEH,eAAO,MAAM,kCAAkC;IAC7C;;;;;;OAMG;;;;;;EAEH,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;IAV5C;;;;;;OAMG;;;;;;;;EAMJ,CAAC;AAEF,qBAAa,4BAA6B,SAAQ,IAAI,CACpD,OAAO,kCAAkC,EACzC,OAAO,iCAAiC,CACzC;IACC,gBAAuB,IAAI,8BAA8B;;IAWnC,IAAI,CACxB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,GAC7D,OAAO,CAAC,cAAc,CAAC;IA8DV,WAAW,CACzB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,GAC5D,OAAO,CAAC,cAAc,CAAC;IAI1B;;;;;OAKG;WACiB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;mBAQhD,gBAAgB;mBAwBhB,cAAc;CAqBpC"}
@@ -1,119 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NavigateWithinStreetViewTool = exports.NavigateWithinStreetViewGptSchema = exports.NavigateWithinStreetViewCoreSchema = exports.Action = void 0;
4
- const Tool_1 = require("./Tool");
5
- const ToolCallResult_1 = require("../models/ToolCallResult");
6
- const GoToGoogleMapsStreetViewTool_1 = require("./GoToGoogleMapsStreetViewTool");
7
- const ExtractGoogleStreetviewEntityDataTool_1 = require("./ExtractGoogleStreetviewEntityDataTool");
8
- const ToolSchema_1 = require("../models/ToolSchema");
9
- const PlaywrightUtils_1 = require("../utils/PlaywrightUtils");
10
- const MiscUtils_1 = require("../utils/MiscUtils");
11
- const zod_1 = require("zod");
12
- exports.Action = zod_1.z.enum([
13
- 'ROTATE_CLOCKWISE',
14
- 'ROTATE_COUNTERCLOCKWISE',
15
- 'ZOOM_IN',
16
- 'ZOOM_OUT',
17
- ]);
18
- exports.NavigateWithinStreetViewCoreSchema = zod_1.z.object({
19
- /**
20
- * Choose a value that will most likely help towards the current objective.
21
- * - A value of ZOOM_IN will zoom in on current street maps view.
22
- * - A value of ZOOM_OUT will zoom out on current street maps view.
23
- * - A value of ROTATE_CLOCKWISE will rotate the current street maps view clockwise.
24
- * - A value of ROTATE_COUNTERCLOCKWISE will rotate the current street maps view counterclockwise.
25
- */
26
- action: exports.Action,
27
- });
28
- exports.NavigateWithinStreetViewGptSchema = ToolSchema_1.BaseGptArgsSchema.merge(exports.NavigateWithinStreetViewCoreSchema);
29
- class NavigateWithinStreetViewTool extends Tool_1.Tool {
30
- constructor() {
31
- super(NavigateWithinStreetViewTool.NAME, 'Zoom in or out or rotate clockwise or counterclockwise on Google Street View.', exports.NavigateWithinStreetViewCoreSchema, exports.NavigateWithinStreetViewGptSchema);
32
- }
33
- async call(context, parameters) {
34
- const page = context.page.current;
35
- await NavigateWithinStreetViewTool.removeGoogleMapsSurvey(page);
36
- let isSuccess;
37
- if (parameters.action === exports.Action.enum.ROTATE_CLOCKWISE ||
38
- parameters.action === exports.Action.enum.ROTATE_COUNTERCLOCKWISE) {
39
- // First zoom out before rotating so that we do not miss content.
40
- await NavigateWithinStreetViewTool.zoomStreetView(page, exports.Action.enum.ZOOM_OUT);
41
- isSuccess = await NavigateWithinStreetViewTool.rotateStreetView(page, parameters.action);
42
- }
43
- else {
44
- isSuccess = await NavigateWithinStreetViewTool.zoomStreetView(page, parameters.action);
45
- }
46
- const goToGoogleMapsStreetViewTool = new GoToGoogleMapsStreetViewTool_1.GoToGoogleMapsStreetViewTool();
47
- // Queue a ExtractGoogleStreetviewEntityDataTool call if one is not already planned.
48
- const isExtractToolAlreadyProposed = context.proposedToolCalls.some((call) => call.name === ExtractGoogleStreetviewEntityDataTool_1.ExtractGoogleStreetviewEntityDataTool.NAME);
49
- if (!isExtractToolAlreadyProposed) {
50
- // Extract the target business/entity name from the original GoToGoogleMapsStreetViewTool tool call.
51
- const originalToolCall = context.invokedToolCalls.find((tc) => tc.toolName === goToGoogleMapsStreetViewTool.name);
52
- if (originalToolCall) {
53
- const entityName = originalToolCall.parameters.entityName;
54
- const extractEntityDataProposedToolCall = {
55
- name: ExtractGoogleStreetviewEntityDataTool_1.ExtractGoogleStreetviewEntityDataTool.NAME,
56
- parameters: {
57
- entityName,
58
- },
59
- };
60
- context.proposedToolCalls.push(extractEntityDataProposedToolCall);
61
- }
62
- }
63
- await PlaywrightUtils_1.PlaywrightUtils.waitForPageStability(page);
64
- return isSuccess
65
- ? ToolCallResult_1.ToolCallResult.successful()
66
- : {
67
- isSuccessful: false,
68
- forLlm: 'FAILED',
69
- metadata: null,
70
- };
71
- }
72
- callFromGpt(context, parameters) {
73
- return this.call(context, parameters);
74
- }
75
- /**
76
- * Removes the Google Maps survey iframe from the given Page.
77
- * If no survey exists, this call has no effect.
78
- *
79
- * @param page - The Playwright Page object to remove the survey from
80
- */
81
- static async removeGoogleMapsSurvey(page) {
82
- return page.evaluate(() => {
83
- document.querySelectorAll('#google-hats-survey').forEach((element) => {
84
- element.remove();
85
- });
86
- });
87
- }
88
- static async rotateStreetView(googleMapsPage, direction) {
89
- const rotateDirection = direction === exports.Action.enum.ROTATE_COUNTERCLOCKWISE
90
- ? 'Rotate the view counterclockwise'
91
- : 'Rotate the view clockwise';
92
- const rotateStreetViewButton = await googleMapsPage.$(`button[aria-label="${rotateDirection}"]`);
93
- if (rotateStreetViewButton) {
94
- await rotateStreetViewButton.click({
95
- delay: MiscUtils_1.MiscUtils.generateHumanLikeClickDurationInMs(),
96
- });
97
- await googleMapsPage.waitForLoadState();
98
- await googleMapsPage.waitForTimeout(931);
99
- return true;
100
- }
101
- return false;
102
- }
103
- static async zoomStreetView(googleMapsPage, direction) {
104
- const zoomDirection = direction === exports.Action.enum.ZOOM_OUT ? 'Zoom out' : 'Zoom in';
105
- const zoomStreetViewButton = await googleMapsPage.$(`button[aria-label="${zoomDirection}"]`);
106
- if (zoomStreetViewButton && !(await zoomStreetViewButton.isDisabled())) {
107
- await zoomStreetViewButton.click({
108
- delay: MiscUtils_1.MiscUtils.generateHumanLikeClickDurationInMs(),
109
- });
110
- await googleMapsPage.waitForLoadState();
111
- await googleMapsPage.waitForTimeout(931);
112
- return true;
113
- }
114
- return false;
115
- }
116
- }
117
- exports.NavigateWithinStreetViewTool = NavigateWithinStreetViewTool;
118
- NavigateWithinStreetViewTool.NAME = 'navigateWithinStreetView';
119
- //# sourceMappingURL=NavigateWithinStreetView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NavigateWithinStreetView.js","sourceRoot":"","sources":["../../../src/tools/NavigateWithinStreetView.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAE9B,6DAA0D;AAE1D,iFAA8E;AAC9E,mGAGiD;AACjD,qDAAyD;AACzD,8DAA2D;AAC3D,kDAA+C;AAC/C,6BAAwB;AAEX,QAAA,MAAM,GAAG,OAAC,CAAC,IAAI,CAAC;IAC3B,kBAAkB;IAClB,yBAAyB;IACzB,SAAS;IACT,UAAU;CACX,CAAC,CAAC;AAEU,QAAA,kCAAkC,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../models/ToolCallContext';
3
- import { ToolCallResult } from '../models/ToolCallResult';
4
- import { ToolCall } from '../models/ToolCall';
5
- import { BaseGptArgsSchema, NoArgsSchema } from '../models/ToolSchema';
6
- import { z } from 'zod';
7
- /**
8
- * Ends the current flow by aggregating the data gathered by the ExtractGoogleStreetviewEntityDataTool
9
- * and GoToGoogleMapsStreetViewTool classes (likely kicked off by SpecialFlowsApi#extractGoogleStreetviewEntityData.
10
- * Note that there is special handling using the ExtractGoogleStreetviewEntityDataTool's
11
- * "recommendedNextStepForStreetViewNavigator", and "isBusinessMatch" fields. Additionally, there is
12
- * a check to see if GoToGoogleMapsStreetViewTool failed, since the entire flow is
13
- * predicated on that step succeeding.
14
- */
15
- export declare class AggregateExtractedStreetviewDataTool extends Tool<typeof NoArgsSchema, typeof BaseGptArgsSchema> {
16
- static readonly NAME = "aggregateExtractedStreetviewData";
17
- constructor();
18
- call(context: ToolCallContext, _parameters: z.infer<typeof NoArgsSchema>): Promise<ToolCallResult>;
19
- static aggregateStreetviewData(invokedToolCalls: ToolCall[], metadata: any): Record<string, any>;
20
- callFromGpt(context: ToolCallContext, parameters: z.infer<typeof BaseGptArgsSchema>): Promise<ToolCallResult>;
21
- }
22
- //# sourceMappingURL=AggregateExtractedStreetviewDataTool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AggregateExtractedStreetviewDataTool.d.ts","sourceRoot":"","sources":["../../src/tools/AggregateExtractedStreetviewDataTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AACH,qBAAa,oCAAqC,SAAQ,IAAI,CAC5D,OAAO,YAAY,EACnB,OAAO,iBAAiB,CACzB;IACC,gBAAuB,IAAI,sCAAsC;;IAgB3C,IAAI,CACxB,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,GACxC,OAAO,CAAC,cAAc,CAAC;WAaZ,uBAAuB,CACnC,gBAAgB,EAAE,QAAQ,EAAE,EAC5B,QAAQ,EAAE,GAAG,GACZ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IA2BA,WAAW,CAC/B,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,GAC5C,OAAO,CAAC,cAAc,CAAC;CAG3B"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AggregateExtractedStreetviewDataTool = void 0;
4
- const Tool_1 = require("./Tool");
5
- const ExtractGoogleStreetviewEntityDataTool_1 = require("./ExtractGoogleStreetviewEntityDataTool");
6
- const ToolSchema_1 = require("../models/ToolSchema");
7
- /**
8
- * Ends the current flow by aggregating the data gathered by the ExtractGoogleStreetviewEntityDataTool
9
- * and GoToGoogleMapsStreetViewTool classes (likely kicked off by SpecialFlowsApi#extractGoogleStreetviewEntityData.
10
- * Note that there is special handling using the ExtractGoogleStreetviewEntityDataTool's
11
- * "recommendedNextStepForStreetViewNavigator", and "isBusinessMatch" fields. Additionally, there is
12
- * a check to see if GoToGoogleMapsStreetViewTool failed, since the entire flow is
13
- * predicated on that step succeeding.
14
- */
15
- class AggregateExtractedStreetviewDataTool extends Tool_1.Tool {
16
- constructor() {
17
- const extractTool = new ExtractGoogleStreetviewEntityDataTool_1.ExtractGoogleStreetviewEntityDataTool();
18
- super(AggregateExtractedStreetviewDataTool.NAME, `Aggregate data extracted by the '${extractTool.name}' tool and end the flow.
19
-
20
- IMPORTANT: Only business/entity data extracted via the '${extractTool.name}' tool is considered for this operation! Do NOT
21
- call this tool until all the relevant business/entity data has been extracted via that tool! Note that you
22
- need to call the '${extractTool.name}' for each unique street view!`, ToolSchema_1.NoArgsSchema, ToolSchema_1.BaseGptArgsSchema);
23
- }
24
- async call(context, _parameters) {
25
- const resultMetadata = AggregateExtractedStreetviewDataTool.aggregateStreetviewData(context.invokedToolCalls, context.metadata);
26
- return {
27
- isSuccessful: true,
28
- forLlm: 'Successfully aggregated the extracted street view data.',
29
- metadata: resultMetadata,
30
- };
31
- }
32
- static aggregateStreetviewData(invokedToolCalls, metadata) {
33
- const extractBusinessDataTool = new ExtractGoogleStreetviewEntityDataTool_1.ExtractGoogleStreetviewEntityDataTool();
34
- const accumulatedResults = invokedToolCalls
35
- .filter((tc) => tc.toolName === extractBusinessDataTool.name)
36
- .map((tc) => tc.outcome)
37
- .filter((outcome) => outcome.metadata !== null)
38
- .map((outcome) => outcome.metadata)
39
- .filter((metadata) => metadata.businessSignage !== undefined)
40
- .sort((a, b) => {
41
- // Sort in reverse order (true values first)
42
- return b.isBusinessMatch - a.isBusinessMatch;
43
- })
44
- .map((metadata) => {
45
- const copy = { ...metadata };
46
- delete copy.recommendedNextStepForStreetViewNavigator;
47
- return copy;
48
- });
49
- metadata.nextState = 'SUCCESS';
50
- return {
51
- streetviews: accumulatedResults,
52
- flowId: metadata.id,
53
- };
54
- }
55
- async callFromGpt(context, parameters) {
56
- return this.call(context, parameters);
57
- }
58
- }
59
- exports.AggregateExtractedStreetviewDataTool = AggregateExtractedStreetviewDataTool;
60
- AggregateExtractedStreetviewDataTool.NAME = 'aggregateExtractedStreetviewData';
61
- //# sourceMappingURL=AggregateExtractedStreetviewDataTool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AggregateExtractedStreetviewDataTool.js","sourceRoot":"","sources":["../../src/tools/AggregateExtractedStreetviewDataTool.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAG9B,mGAA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AAC,CAAC,eAAe,GAAG,CAAC,CAAC,eAAe,CAAC;QAC/C,CAAC,CAAC;aACD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YAChB,MAAM,IAAI,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,yCAAyC,CAAC;YACtD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEL,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;QAE/B,OAAO;YACL,WAAW,EAAE,kBAAkB;YAC/B,MAAM,EAAE,QAAQ,CAAC,EAAE;SACpB,CAAC;IACJ,CAAC;IAEe,KAAK,CAAC,WAAW,CAC/B,OAAwB,EACxB,UAA6C;QAE7C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACxC,CAAC;;AAvEH,oFAwEC;AApEwB,yCAAI,GAAG,kCAAkC,CAAC"}
@@ -1,62 +0,0 @@
1
- import { Tool } from './Tool';
2
- import { ToolCallContext } from '../models/ToolCallContext';
3
- import { ToolCallResult } from '../models/ToolCallResult';
4
- import { z } from 'zod';
5
- export declare const PropertyTypeSchema: z.ZodEnum<["RESIDENTIAL", "RETAIL", "OFFICE_BUILDING", "INDUSTRIAL", "EMPTY_LOT"]>;
6
- export declare const ExtractGoogleStreetviewEntityDataCoreSchema: z.ZodObject<{
7
- entityName: z.ZodString;
8
- }, "strip", z.ZodTypeAny, {
9
- entityName: string;
10
- }, {
11
- entityName: string;
12
- }>;
13
- export declare const ExtractGoogleStreetviewEntityDataGptSchema: z.ZodObject<{
14
- rationale: z.ZodString;
15
- } & {
16
- entityName: z.ZodString;
17
- }, "strip", z.ZodTypeAny, {
18
- rationale: string;
19
- entityName: string;
20
- }, {
21
- rationale: string;
22
- entityName: string;
23
- }>;
24
- export declare const MetadataSchema: z.ZodObject<{
25
- businessSignage: z.ZodArray<z.ZodString, "many">;
26
- otherSignage: z.ZodArray<z.ZodString, "many">;
27
- isBusinessMatch: z.ZodBoolean;
28
- imageId: z.ZodString;
29
- googleMapsStreetviewUrl: z.ZodString;
30
- typeOfProperty: z.ZodEnum<["RESIDENTIAL", "RETAIL", "OFFICE_BUILDING", "INDUSTRIAL", "EMPTY_LOT"]>;
31
- recommendedNextStepForStreetViewNavigator: z.ZodEnum<["ROTATE_CLOCKWISE", "ROTATE_COUNTERCLOCKWISE", "ZOOM_IN", "ZOOM_OUT"]>;
32
- }, "strip", z.ZodTypeAny, {
33
- businessSignage: string[];
34
- otherSignage: string[];
35
- typeOfProperty: "RESIDENTIAL" | "RETAIL" | "OFFICE_BUILDING" | "INDUSTRIAL" | "EMPTY_LOT";
36
- recommendedNextStepForStreetViewNavigator: "ROTATE_CLOCKWISE" | "ROTATE_COUNTERCLOCKWISE" | "ZOOM_IN" | "ZOOM_OUT";
37
- isBusinessMatch: boolean;
38
- imageId: string;
39
- googleMapsStreetviewUrl: string;
40
- }, {
41
- businessSignage: string[];
42
- otherSignage: string[];
43
- typeOfProperty: "RESIDENTIAL" | "RETAIL" | "OFFICE_BUILDING" | "INDUSTRIAL" | "EMPTY_LOT";
44
- recommendedNextStepForStreetViewNavigator: "ROTATE_CLOCKWISE" | "ROTATE_COUNTERCLOCKWISE" | "ZOOM_IN" | "ZOOM_OUT";
45
- isBusinessMatch: boolean;
46
- imageId: string;
47
- googleMapsStreetviewUrl: string;
48
- }>;
49
- /**
50
- * Extracts data from the current Google Maps Street View. If the current page is not a Google Maps
51
- * Street View, then the operation is undefined.
52
- */
53
- export declare class ExtractGoogleStreetviewEntityDataTool extends Tool<typeof ExtractGoogleStreetviewEntityDataCoreSchema, typeof ExtractGoogleStreetviewEntityDataGptSchema> {
54
- static readonly NAME = "extractGoogleStreetviewEntityData";
55
- constructor();
56
- call(context: ToolCallContext, parameters: z.infer<typeof ExtractGoogleStreetviewEntityDataCoreSchema>): Promise<ToolCallResult>;
57
- callFromGpt(context: ToolCallContext, parameters: z.infer<typeof ExtractGoogleStreetviewEntityDataGptSchema>): Promise<ToolCallResult>;
58
- private wiggleMouseThenPause;
59
- private extractEntityData;
60
- private doesBusinessExistInSignage;
61
- }
62
- //# sourceMappingURL=ExtractGoogleStreetviewEntityDataTool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExtractGoogleStreetviewEntityDataTool.d.ts","sourceRoot":"","sources":["../../src/tools/ExtractGoogleStreetviewEntityDataTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAU1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB,oFAM7B,CAAC;AAEH,eAAO,MAAM,2CAA2C;;;;;;EAItD,CAAC;AAEH,eAAO,MAAM,0CAA0C;;;;;;;;;;EACe,CAAC;AAuBvE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;EAQzB,CAAC;AAEH;;;GAGG;AACH,qBAAa,qCAAsC,SAAQ,IAAI,CAC7D,OAAO,2CAA2C,EAClD,OAAO,0CAA0C,CAClD;IACC,gBAAuB,IAAI,uCAAuC;;IAa5C,IAAI,CACxB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,2CAA2C,CAAC,GACtE,OAAO,CAAC,cAAc,CAAC;IAkFV,WAAW,CACzB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,0CAA0C,CAAC,GACrE,OAAO,CAAC,cAAc,CAAC;YAIZ,oBAAoB;YAkBpB,iBAAiB;YAsBjB,0BAA0B;CAsBzC"}