openclaw-cascade-plugin 1.0.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 (98) hide show
  1. package/PHASE1_SUMMARY.md +191 -0
  2. package/PHASE3_SUMMARY.md +195 -0
  3. package/README.md +43 -0
  4. package/dist/a2a-client.d.ts +17 -0
  5. package/dist/a2a-client.d.ts.map +1 -0
  6. package/dist/a2a-client.js +47 -0
  7. package/dist/a2a-client.js.map +1 -0
  8. package/dist/cascade-client.d.ts +53 -0
  9. package/dist/cascade-client.d.ts.map +1 -0
  10. package/dist/cascade-client.js +179 -0
  11. package/dist/cascade-client.js.map +1 -0
  12. package/dist/config.d.ts +26 -0
  13. package/dist/config.d.ts.map +1 -0
  14. package/dist/config.js +116 -0
  15. package/dist/config.js.map +1 -0
  16. package/dist/index.d.ts +29 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +136 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/python-manager.d.ts +59 -0
  21. package/dist/python-manager.d.ts.map +1 -0
  22. package/dist/python-manager.js +190 -0
  23. package/dist/python-manager.js.map +1 -0
  24. package/dist/test-utils/helpers.d.ts +20 -0
  25. package/dist/test-utils/helpers.d.ts.map +1 -0
  26. package/dist/test-utils/helpers.js +89 -0
  27. package/dist/test-utils/helpers.js.map +1 -0
  28. package/dist/test-utils/index.d.ts +3 -0
  29. package/dist/test-utils/index.d.ts.map +1 -0
  30. package/dist/test-utils/index.js +19 -0
  31. package/dist/test-utils/index.js.map +1 -0
  32. package/dist/test-utils/mocks.d.ts +51 -0
  33. package/dist/test-utils/mocks.d.ts.map +1 -0
  34. package/dist/test-utils/mocks.js +84 -0
  35. package/dist/test-utils/mocks.js.map +1 -0
  36. package/dist/tools/a2a-tools.d.ts +9 -0
  37. package/dist/tools/a2a-tools.d.ts.map +1 -0
  38. package/dist/tools/a2a-tools.js +147 -0
  39. package/dist/tools/a2a-tools.js.map +1 -0
  40. package/dist/tools/api-tools.d.ts +9 -0
  41. package/dist/tools/api-tools.d.ts.map +1 -0
  42. package/dist/tools/api-tools.js +102 -0
  43. package/dist/tools/api-tools.js.map +1 -0
  44. package/dist/tools/desktop-automation.d.ts +10 -0
  45. package/dist/tools/desktop-automation.d.ts.map +1 -0
  46. package/dist/tools/desktop-automation.js +330 -0
  47. package/dist/tools/desktop-automation.js.map +1 -0
  48. package/dist/tools/index.d.ts +12 -0
  49. package/dist/tools/index.d.ts.map +1 -0
  50. package/dist/tools/index.js +35 -0
  51. package/dist/tools/index.js.map +1 -0
  52. package/dist/tools/response-helpers.d.ts +25 -0
  53. package/dist/tools/response-helpers.d.ts.map +1 -0
  54. package/dist/tools/response-helpers.js +71 -0
  55. package/dist/tools/response-helpers.js.map +1 -0
  56. package/dist/tools/sandbox-tools.d.ts +9 -0
  57. package/dist/tools/sandbox-tools.d.ts.map +1 -0
  58. package/dist/tools/sandbox-tools.js +79 -0
  59. package/dist/tools/sandbox-tools.js.map +1 -0
  60. package/dist/tools/tool-registry.d.ts +34 -0
  61. package/dist/tools/tool-registry.d.ts.map +1 -0
  62. package/dist/tools/tool-registry.js +50 -0
  63. package/dist/tools/tool-registry.js.map +1 -0
  64. package/dist/tools/web-automation.d.ts +9 -0
  65. package/dist/tools/web-automation.d.ts.map +1 -0
  66. package/dist/tools/web-automation.js +471 -0
  67. package/dist/tools/web-automation.js.map +1 -0
  68. package/dist/types/index.d.ts +111 -0
  69. package/dist/types/index.d.ts.map +1 -0
  70. package/dist/types/index.js +38 -0
  71. package/dist/types/index.js.map +1 -0
  72. package/jest.setup.js +19 -0
  73. package/openclaw-cascade-plugin-1.0.0.tgz +0 -0
  74. package/openclaw.plugin.json +116 -0
  75. package/package.json +74 -0
  76. package/src/a2a-client.ts +66 -0
  77. package/src/cascade-client.test.ts +400 -0
  78. package/src/cascade-client.ts +198 -0
  79. package/src/config.test.ts +194 -0
  80. package/src/config.ts +135 -0
  81. package/src/index.ts +164 -0
  82. package/src/python-manager.test.ts +187 -0
  83. package/src/python-manager.ts +230 -0
  84. package/src/test-utils/helpers.ts +107 -0
  85. package/src/test-utils/index.ts +2 -0
  86. package/src/test-utils/mocks.ts +101 -0
  87. package/src/tools/a2a-tools.ts +162 -0
  88. package/src/tools/api-tools.ts +110 -0
  89. package/src/tools/desktop-automation.test.ts +305 -0
  90. package/src/tools/desktop-automation.ts +366 -0
  91. package/src/tools/index.ts +13 -0
  92. package/src/tools/response-helpers.ts +78 -0
  93. package/src/tools/sandbox-tools.ts +83 -0
  94. package/src/tools/tool-registry.ts +51 -0
  95. package/src/tools/web-automation.test.ts +177 -0
  96. package/src/tools/web-automation.ts +518 -0
  97. package/src/types/index.ts +132 -0
  98. package/tsconfig.json +27 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-helpers.js","sourceRoot":"","sources":["../../src/tools/response-helpers.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAOH,0CAIC;AAKD,oCAIC;AAKD,sCAqBC;AAKD,sCAcC;AAKD,sCAKC;AAvED;;GAEG;AACH,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KAClC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,IAAS;IACpC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAC3B,UAAkB,EAClB,SAAyB,KAAK,EAC9B,IAAa;IAEb,MAAM,OAAO,GAAU;QACrB;YACE,IAAI,EAAE,OAAO;YACb,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,SAAS,MAAM,EAAE;gBAC7B,IAAI,EAAE,UAAU;aACjB;SACF;KACF,CAAC;IAEF,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,OAAe,EAAE,UAAmB;IAChE,MAAM,QAAQ,GAAQ;QACpB,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO;KACf,CAAC;IAEF,IAAI,UAAU,EAAE,CAAC;QACf,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;IACnC,CAAC;IAED,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QACpE,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,MAAW;IACvC,OAAO,YAAY,CAAC;QAClB,OAAO,EAAE,IAAI;QACb,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Sandbox Tools
3
+ *
4
+ * 1 tool for executing Python code in sandbox
5
+ */
6
+ import { ToolRegistry } from './tool-registry';
7
+ import { CascadeMcpClient } from '../cascade-client';
8
+ export declare function registerSandboxTools(registry: ToolRegistry, client: CascadeMcpClient): void;
9
+ //# sourceMappingURL=sandbox-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-tools.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIrD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAuE3F"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ /**
3
+ * Sandbox Tools
4
+ *
5
+ * 1 tool for executing Python code in sandbox
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.registerSandboxTools = registerSandboxTools;
9
+ const response_helpers_1 = require("./response-helpers");
10
+ function registerSandboxTools(registry, client) {
11
+ registry.register({
12
+ name: 'cascade_execute_sandbox_skill',
13
+ description: 'Execute a Python sandbox skill for programmatic file automation',
14
+ inputSchema: {
15
+ type: 'object',
16
+ properties: {
17
+ skill_id: {
18
+ type: 'string',
19
+ description: 'Skill ID to execute'
20
+ },
21
+ task: {
22
+ type: 'string',
23
+ description: 'Task description to guide execution'
24
+ },
25
+ inputs: {
26
+ type: 'object',
27
+ description: 'Runtime inputs for the operation',
28
+ additionalProperties: true
29
+ },
30
+ files: {
31
+ type: 'array',
32
+ description: 'Files to copy in/out of sandbox',
33
+ items: {
34
+ type: 'object',
35
+ properties: {
36
+ name: { type: 'string' },
37
+ local_path: { type: 'string' },
38
+ sandbox_path: { type: 'string' },
39
+ mode: { type: 'string', enum: ['input', 'output', 'inout'] }
40
+ },
41
+ required: ['name', 'local_path', 'mode']
42
+ }
43
+ },
44
+ local_path: {
45
+ type: 'string',
46
+ description: 'Primary file path (convenience when using single file)'
47
+ },
48
+ python_code: {
49
+ type: 'string',
50
+ description: 'Optional Python code to execute (auto-generated if not provided)'
51
+ }
52
+ },
53
+ required: ['skill_id', 'task']
54
+ },
55
+ handler: async (args) => {
56
+ try {
57
+ if (!args.skill_id) {
58
+ return (0, response_helpers_1.errorResponse)('skill_id is required');
59
+ }
60
+ if (!args.task) {
61
+ return (0, response_helpers_1.errorResponse)('task is required');
62
+ }
63
+ const result = await client.callTool('execute_sandbox_skill', {
64
+ skill_id: args.skill_id,
65
+ task: args.task,
66
+ inputs: args.inputs || {},
67
+ files: args.files || [],
68
+ local_path: args.local_path,
69
+ python_code: args.python_code
70
+ });
71
+ return (0, response_helpers_1.formatSuccess)(result);
72
+ }
73
+ catch (error) {
74
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to execute sandbox skill', 'Check that the skill exists and E2B_API_KEY is set');
75
+ }
76
+ }
77
+ });
78
+ }
79
+ //# sourceMappingURL=sandbox-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-tools.js","sourceRoot":"","sources":["../../src/tools/sandbox-tools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAOH,oDAuEC;AAzED,yDAAkE;AAElE,SAAgB,oBAAoB,CAAC,QAAsB,EAAE,MAAwB;IACnF,QAAQ,CAAC,QAAQ,CAAC;QAChB,IAAI,EAAE,+BAA+B;QACrC,WAAW,EAAE,iEAAiE;QAC9E,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qBAAqB;iBACnC;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qCAAqC;iBACnD;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kCAAkC;oBAC/C,oBAAoB,EAAE,IAAI;iBAC3B;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,iCAAiC;oBAC9C,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;4BACxB,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;4BAC9B,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;4BAChC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE;yBAC7D;wBACD,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC;qBACzC;iBACF;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wDAAwD;iBACtE;gBACD,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kEAAkE;iBAChF;aACF;YACD,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;SAC/B;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAyB,EAAE;YAC7C,IAAI,CAAC;gBACH,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACnB,OAAO,IAAA,gCAAa,EAAC,sBAAsB,CAAC,CAAC;gBAC/C,CAAC;gBACD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;oBACf,OAAO,IAAA,gCAAa,EAAC,kBAAkB,CAAC,CAAC;gBAC3C,CAAC;gBAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,uBAAuB,EAAE;oBAC5D,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;oBACzB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;oBACvB,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;iBAC9B,CAAC,CAAC;gBACH,OAAO,IAAA,gCAAa,EAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,IAAA,gCAAa,EAClB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,iCAAiC,EAC1E,oDAAoD,CACrD,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Tool Registry for managing OpenClaw tools
3
+ */
4
+ import { ToolSchema, ToolHandler, ToolResponse } from '../types';
5
+ export declare class ToolRegistry {
6
+ private tools;
7
+ /**
8
+ * Register a tool with the registry
9
+ */
10
+ register(tool: ToolSchema & {
11
+ handler: ToolHandler;
12
+ }): void;
13
+ /**
14
+ * Get all registered tools
15
+ */
16
+ getAll(): Array<ToolSchema & {
17
+ handler: ToolHandler;
18
+ }>;
19
+ /**
20
+ * Get a specific tool by name
21
+ */
22
+ get(name: string): (ToolSchema & {
23
+ handler: ToolHandler;
24
+ }) | undefined;
25
+ /**
26
+ * Check if a tool exists
27
+ */
28
+ has(name: string): boolean;
29
+ /**
30
+ * Call a tool by name with arguments
31
+ */
32
+ call(name: string, args: Record<string, any>): Promise<ToolResponse>;
33
+ }
34
+ //# sourceMappingURL=tool-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../src/tools/tool-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEjE,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAA4D;IAEzE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,GAAG,IAAI;IAO3D;;OAEG;IACH,MAAM,IAAI,KAAK,CAAC,UAAU,GAAG;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC;IAItD;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,UAAU,GAAG;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC,GAAG,SAAS;IAItE;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;CAO3E"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /**
3
+ * Tool Registry for managing OpenClaw tools
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ToolRegistry = void 0;
7
+ class ToolRegistry {
8
+ constructor() {
9
+ this.tools = new Map();
10
+ }
11
+ /**
12
+ * Register a tool with the registry
13
+ */
14
+ register(tool) {
15
+ if (this.tools.has(tool.name)) {
16
+ throw new Error(`Tool ${tool.name} is already registered`);
17
+ }
18
+ this.tools.set(tool.name, tool);
19
+ }
20
+ /**
21
+ * Get all registered tools
22
+ */
23
+ getAll() {
24
+ return Array.from(this.tools.values());
25
+ }
26
+ /**
27
+ * Get a specific tool by name
28
+ */
29
+ get(name) {
30
+ return this.tools.get(name);
31
+ }
32
+ /**
33
+ * Check if a tool exists
34
+ */
35
+ has(name) {
36
+ return this.tools.has(name);
37
+ }
38
+ /**
39
+ * Call a tool by name with arguments
40
+ */
41
+ async call(name, args) {
42
+ const tool = this.get(name);
43
+ if (!tool) {
44
+ throw new Error(`Tool ${name} not found`);
45
+ }
46
+ return tool.handler(args);
47
+ }
48
+ }
49
+ exports.ToolRegistry = ToolRegistry;
50
+ //# sourceMappingURL=tool-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../src/tools/tool-registry.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,MAAa,YAAY;IAAzB;QACU,UAAK,GAAG,IAAI,GAAG,EAAiD,CAAC;IA2C3E,CAAC;IAzCC;;OAEG;IACH,QAAQ,CAAC,IAA2C;QAClD,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,CAAC,IAAI,wBAAwB,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,IAAyB;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,YAAY,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF;AA5CD,oCA4CC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Web Automation Tools (Playwright)
3
+ *
4
+ * 14 tools for web browser automation
5
+ */
6
+ import { ToolRegistry } from './tool-registry';
7
+ import { CascadeMcpClient } from '../cascade-client';
8
+ export declare function registerWebTools(registry: ToolRegistry, client: CascadeMcpClient): void;
9
+ //# sourceMappingURL=web-automation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-automation.d.ts","sourceRoot":"","sources":["../../src/tools/web-automation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIrD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CA0fvF"}
@@ -0,0 +1,471 @@
1
+ "use strict";
2
+ /**
3
+ * Web Automation Tools (Playwright)
4
+ *
5
+ * 14 tools for web browser automation
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.registerWebTools = registerWebTools;
9
+ const response_helpers_1 = require("./response-helpers");
10
+ function registerWebTools(registry, client) {
11
+ // Navigation Tools (5)
12
+ // 1. cascade_pw_goto
13
+ registry.register({
14
+ name: 'cascade_pw_goto',
15
+ description: 'Navigate to a URL in the browser',
16
+ inputSchema: {
17
+ type: 'object',
18
+ properties: {
19
+ url: {
20
+ type: 'string',
21
+ description: 'URL to navigate to'
22
+ },
23
+ wait_until: {
24
+ type: 'string',
25
+ enum: ['load', 'domcontentloaded', 'networkidle'],
26
+ default: 'networkidle',
27
+ description: 'When to consider navigation complete'
28
+ }
29
+ },
30
+ required: ['url']
31
+ },
32
+ handler: async (args) => {
33
+ try {
34
+ if (!args.url) {
35
+ return (0, response_helpers_1.errorResponse)('url is required');
36
+ }
37
+ const result = await client.callTool('pw_goto', {
38
+ url: args.url,
39
+ wait_until: args.wait_until || 'networkidle'
40
+ });
41
+ return (0, response_helpers_1.formatSuccess)(result);
42
+ }
43
+ catch (error) {
44
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to navigate', 'Check that the URL is valid and accessible');
45
+ }
46
+ }
47
+ });
48
+ // 2. cascade_pw_back
49
+ registry.register({
50
+ name: 'cascade_pw_back',
51
+ description: 'Go back to the previous page in browser history',
52
+ inputSchema: {
53
+ type: 'object',
54
+ properties: {}
55
+ },
56
+ handler: async () => {
57
+ try {
58
+ const result = await client.callTool('pw_back', {});
59
+ return (0, response_helpers_1.formatSuccess)(result);
60
+ }
61
+ catch (error) {
62
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to go back');
63
+ }
64
+ }
65
+ });
66
+ // 3. cascade_pw_forward
67
+ registry.register({
68
+ name: 'cascade_pw_forward',
69
+ description: 'Go forward to the next page in browser history',
70
+ inputSchema: {
71
+ type: 'object',
72
+ properties: {}
73
+ },
74
+ handler: async () => {
75
+ try {
76
+ const result = await client.callTool('pw_forward', {});
77
+ return (0, response_helpers_1.formatSuccess)(result);
78
+ }
79
+ catch (error) {
80
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to go forward');
81
+ }
82
+ }
83
+ });
84
+ // 4. cascade_pw_reload
85
+ registry.register({
86
+ name: 'cascade_pw_reload',
87
+ description: 'Reload the current page',
88
+ inputSchema: {
89
+ type: 'object',
90
+ properties: {
91
+ wait_until: {
92
+ type: 'string',
93
+ enum: ['load', 'domcontentloaded', 'networkidle'],
94
+ default: 'networkidle'
95
+ }
96
+ }
97
+ },
98
+ handler: async (args) => {
99
+ try {
100
+ const result = await client.callTool('pw_reload', {
101
+ wait_until: args.wait_until || 'networkidle'
102
+ });
103
+ return (0, response_helpers_1.formatSuccess)(result);
104
+ }
105
+ catch (error) {
106
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to reload page');
107
+ }
108
+ }
109
+ });
110
+ // 5. cascade_pw_wait_for_url
111
+ registry.register({
112
+ name: 'cascade_pw_wait_for_url',
113
+ description: 'Wait for the current URL to match a pattern',
114
+ inputSchema: {
115
+ type: 'object',
116
+ properties: {
117
+ url: {
118
+ type: 'string',
119
+ description: 'URL pattern to wait for (glob or regex)'
120
+ },
121
+ timeout_ms: {
122
+ type: 'integer',
123
+ default: 10000,
124
+ description: 'Timeout in milliseconds'
125
+ }
126
+ },
127
+ required: ['url']
128
+ },
129
+ handler: async (args) => {
130
+ try {
131
+ if (!args.url) {
132
+ return (0, response_helpers_1.errorResponse)('url is required');
133
+ }
134
+ const result = await client.callTool('pw_wait_for_url', {
135
+ url: args.url,
136
+ timeout_ms: args.timeout_ms || 10000
137
+ });
138
+ return (0, response_helpers_1.formatSuccess)(result);
139
+ }
140
+ catch (error) {
141
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to wait for URL', 'The page may be loading slowly or the URL pattern may not match');
142
+ }
143
+ }
144
+ });
145
+ // Locator Tools (2)
146
+ // 6. cascade_pw_locator_count
147
+ registry.register({
148
+ name: 'cascade_pw_locator_count',
149
+ description: 'Count elements matching a selector',
150
+ inputSchema: {
151
+ type: 'object',
152
+ properties: {
153
+ selector: {
154
+ type: 'string',
155
+ description: 'CSS selector or Playwright locator'
156
+ }
157
+ },
158
+ required: ['selector']
159
+ },
160
+ handler: async (args) => {
161
+ try {
162
+ if (!args.selector) {
163
+ return (0, response_helpers_1.errorResponse)('selector is required');
164
+ }
165
+ const result = await client.callTool('pw_locator_count', {
166
+ selector: args.selector
167
+ });
168
+ return (0, response_helpers_1.formatSuccess)({ count: result.count });
169
+ }
170
+ catch (error) {
171
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to count elements');
172
+ }
173
+ }
174
+ });
175
+ // 7. cascade_pw_locator_text
176
+ registry.register({
177
+ name: 'cascade_pw_locator_text',
178
+ description: 'Get text content of the first matching element',
179
+ inputSchema: {
180
+ type: 'object',
181
+ properties: {
182
+ selector: {
183
+ type: 'string',
184
+ description: 'CSS selector or Playwright locator'
185
+ },
186
+ timeout_ms: {
187
+ type: 'integer',
188
+ default: 8000,
189
+ description: 'Timeout in milliseconds'
190
+ }
191
+ },
192
+ required: ['selector']
193
+ },
194
+ handler: async (args) => {
195
+ try {
196
+ if (!args.selector) {
197
+ return (0, response_helpers_1.errorResponse)('selector is required');
198
+ }
199
+ const result = await client.callTool('pw_locator_text', {
200
+ selector: args.selector,
201
+ timeout_ms: args.timeout_ms || 8000
202
+ });
203
+ return (0, response_helpers_1.formatSuccess)({ text: result.text });
204
+ }
205
+ catch (error) {
206
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to get element text');
207
+ }
208
+ }
209
+ });
210
+ // Interaction Tools (5)
211
+ // 8. cascade_pw_click
212
+ registry.register({
213
+ name: 'cascade_pw_click',
214
+ description: 'Click on an element',
215
+ inputSchema: {
216
+ type: 'object',
217
+ properties: {
218
+ selector: {
219
+ type: 'string',
220
+ description: 'CSS selector or Playwright locator'
221
+ },
222
+ timeout_ms: {
223
+ type: 'integer',
224
+ default: 8000
225
+ }
226
+ },
227
+ required: ['selector']
228
+ },
229
+ handler: async (args) => {
230
+ try {
231
+ if (!args.selector) {
232
+ return (0, response_helpers_1.errorResponse)('selector is required');
233
+ }
234
+ const result = await client.callTool('pw_click', {
235
+ selector: args.selector,
236
+ timeout_ms: args.timeout_ms || 8000
237
+ });
238
+ return (0, response_helpers_1.formatSuccess)(result);
239
+ }
240
+ catch (error) {
241
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to click element', 'Make sure the element exists and is visible');
242
+ }
243
+ }
244
+ });
245
+ // 9. cascade_pw_fill
246
+ registry.register({
247
+ name: 'cascade_pw_fill',
248
+ description: 'Fill a form field with text',
249
+ inputSchema: {
250
+ type: 'object',
251
+ properties: {
252
+ selector: {
253
+ type: 'string',
254
+ description: 'CSS selector or Playwright locator'
255
+ },
256
+ text: {
257
+ type: 'string',
258
+ description: 'Text to fill'
259
+ },
260
+ timeout_ms: {
261
+ type: 'integer',
262
+ default: 8000
263
+ }
264
+ },
265
+ required: ['selector', 'text']
266
+ },
267
+ handler: async (args) => {
268
+ try {
269
+ if (!args.selector) {
270
+ return (0, response_helpers_1.errorResponse)('selector is required');
271
+ }
272
+ if (!args.text) {
273
+ return (0, response_helpers_1.errorResponse)('text is required');
274
+ }
275
+ const result = await client.callTool('pw_fill', {
276
+ selector: args.selector,
277
+ text: args.text,
278
+ timeout_ms: args.timeout_ms || 8000
279
+ });
280
+ return (0, response_helpers_1.formatSuccess)(result);
281
+ }
282
+ catch (error) {
283
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to fill field');
284
+ }
285
+ }
286
+ });
287
+ // 10. cascade_pw_press
288
+ registry.register({
289
+ name: 'cascade_pw_press',
290
+ description: 'Press a key on an element',
291
+ inputSchema: {
292
+ type: 'object',
293
+ properties: {
294
+ selector: {
295
+ type: 'string',
296
+ description: 'CSS selector or Playwright locator'
297
+ },
298
+ key: {
299
+ type: 'string',
300
+ description: 'Key to press (e.g., Enter, Tab, Escape)'
301
+ },
302
+ timeout_ms: {
303
+ type: 'integer',
304
+ default: 8000
305
+ }
306
+ },
307
+ required: ['selector', 'key']
308
+ },
309
+ handler: async (args) => {
310
+ try {
311
+ if (!args.selector) {
312
+ return (0, response_helpers_1.errorResponse)('selector is required');
313
+ }
314
+ if (!args.key) {
315
+ return (0, response_helpers_1.errorResponse)('key is required');
316
+ }
317
+ const result = await client.callTool('pw_press', {
318
+ selector: args.selector,
319
+ key: args.key,
320
+ timeout_ms: args.timeout_ms || 8000
321
+ });
322
+ return (0, response_helpers_1.formatSuccess)(result);
323
+ }
324
+ catch (error) {
325
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to press key');
326
+ }
327
+ }
328
+ });
329
+ // 11. cascade_pw_select_option
330
+ registry.register({
331
+ name: 'cascade_pw_select_option',
332
+ description: 'Select option(s) in a dropdown',
333
+ inputSchema: {
334
+ type: 'object',
335
+ properties: {
336
+ selector: {
337
+ type: 'string',
338
+ description: 'CSS selector for select element'
339
+ },
340
+ values: {
341
+ type: 'array',
342
+ items: { type: 'string' },
343
+ description: 'Values to select'
344
+ }
345
+ },
346
+ required: ['selector', 'values']
347
+ },
348
+ handler: async (args) => {
349
+ try {
350
+ if (!args.selector) {
351
+ return (0, response_helpers_1.errorResponse)('selector is required');
352
+ }
353
+ if (!args.values || !Array.isArray(args.values)) {
354
+ return (0, response_helpers_1.errorResponse)('values is required and must be an array');
355
+ }
356
+ const result = await client.callTool('pw_select_option', {
357
+ selector: args.selector,
358
+ values: args.values
359
+ });
360
+ return (0, response_helpers_1.formatSuccess)({ selected: result.selected });
361
+ }
362
+ catch (error) {
363
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to select option');
364
+ }
365
+ }
366
+ });
367
+ // Evaluation Tools (3)
368
+ // 12. cascade_pw_eval
369
+ registry.register({
370
+ name: 'cascade_pw_eval',
371
+ description: 'Evaluate JavaScript in the page context',
372
+ inputSchema: {
373
+ type: 'object',
374
+ properties: {
375
+ expression: {
376
+ type: 'string',
377
+ description: 'JavaScript expression to evaluate'
378
+ }
379
+ },
380
+ required: ['expression']
381
+ },
382
+ handler: async (args) => {
383
+ try {
384
+ if (!args.expression) {
385
+ return (0, response_helpers_1.errorResponse)('expression is required');
386
+ }
387
+ const result = await client.callTool('pw_eval', {
388
+ expression: args.expression
389
+ });
390
+ return (0, response_helpers_1.formatSuccess)({ result: result.result });
391
+ }
392
+ catch (error) {
393
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to evaluate expression');
394
+ }
395
+ }
396
+ });
397
+ // 13. cascade_pw_eval_on_selector
398
+ registry.register({
399
+ name: 'cascade_pw_eval_on_selector',
400
+ description: 'Evaluate JavaScript on a specific element',
401
+ inputSchema: {
402
+ type: 'object',
403
+ properties: {
404
+ selector: {
405
+ type: 'string',
406
+ description: 'CSS selector for target element'
407
+ },
408
+ expression: {
409
+ type: 'string',
410
+ description: 'JavaScript function body (receives element as argument)'
411
+ }
412
+ },
413
+ required: ['selector', 'expression']
414
+ },
415
+ handler: async (args) => {
416
+ try {
417
+ if (!args.selector) {
418
+ return (0, response_helpers_1.errorResponse)('selector is required');
419
+ }
420
+ if (!args.expression) {
421
+ return (0, response_helpers_1.errorResponse)('expression is required');
422
+ }
423
+ const result = await client.callTool('pw_eval_on_selector', {
424
+ selector: args.selector,
425
+ expression: args.expression
426
+ });
427
+ return (0, response_helpers_1.formatSuccess)({ result: result.result });
428
+ }
429
+ catch (error) {
430
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to evaluate on element');
431
+ }
432
+ }
433
+ });
434
+ // 14. cascade_pw_list_frames
435
+ registry.register({
436
+ name: 'cascade_pw_list_frames',
437
+ description: 'List all frames (iframes) on the current page',
438
+ inputSchema: {
439
+ type: 'object',
440
+ properties: {}
441
+ },
442
+ handler: async () => {
443
+ try {
444
+ const result = await client.callTool('pw_list_frames', {});
445
+ return (0, response_helpers_1.formatSuccess)({ frames: result.frames });
446
+ }
447
+ catch (error) {
448
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to list frames');
449
+ }
450
+ }
451
+ });
452
+ // 15. cascade_pw_get_cookies
453
+ registry.register({
454
+ name: 'cascade_pw_get_cookies',
455
+ description: 'Get all cookies for the current context',
456
+ inputSchema: {
457
+ type: 'object',
458
+ properties: {}
459
+ },
460
+ handler: async () => {
461
+ try {
462
+ const result = await client.callTool('pw_get_cookies', {});
463
+ return (0, response_helpers_1.formatSuccess)({ cookies: result.cookies });
464
+ }
465
+ catch (error) {
466
+ return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to get cookies');
467
+ }
468
+ }
469
+ });
470
+ }
471
+ //# sourceMappingURL=web-automation.js.map