@jshookmcp/jshook 0.2.5 → 0.2.6

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 (210) hide show
  1. package/README.md +5 -5
  2. package/README.zh.md +5 -5
  3. package/dist/packages/extension-sdk/src/workflow.d.ts +17 -2
  4. package/dist/packages/extension-sdk/src/workflow.js +36 -0
  5. package/dist/src/modules/browser/BrowserPool.d.ts +49 -0
  6. package/dist/src/modules/browser/BrowserPool.js +288 -0
  7. package/dist/src/modules/deobfuscator/AdvancedDeobfuscator.d.ts +5 -0
  8. package/dist/src/modules/deobfuscator/AdvancedDeobfuscator.js +43 -2
  9. package/dist/src/modules/deobfuscator/Deobfuscator.js +5 -0
  10. package/dist/src/modules/external/ExternalToolRunner.js +1 -1
  11. package/dist/src/server/MCPServer.context.d.ts +1 -0
  12. package/dist/src/server/domains/browser/handlers/stealth-injection.d.ts +1 -0
  13. package/dist/src/server/domains/browser/handlers/stealth-injection.js +3 -0
  14. package/dist/src/server/domains/shared-state-board/definitions.d.ts +2 -0
  15. package/dist/src/server/domains/shared-state-board/definitions.js +78 -0
  16. package/dist/src/server/domains/shared-state-board/handlers.impl.d.ts +58 -0
  17. package/dist/src/server/domains/shared-state-board/handlers.impl.js +419 -0
  18. package/dist/src/server/domains/shared-state-board/index.d.ts +2 -0
  19. package/dist/src/server/domains/shared-state-board/index.js +2 -0
  20. package/dist/src/server/domains/shared-state-board/manifest.d.ts +57 -0
  21. package/dist/src/server/domains/shared-state-board/manifest.js +74 -0
  22. package/dist/src/server/http/SseStream.d.ts +21 -0
  23. package/dist/src/server/http/SseStream.js +129 -0
  24. package/dist/src/server/teams/TeamManager.d.ts +43 -0
  25. package/dist/src/server/teams/TeamManager.js +238 -0
  26. package/dist/src/server/teams/index.d.ts +1 -0
  27. package/dist/src/server/teams/index.js +1 -0
  28. package/dist/src/server/workflows/WorkflowContract.d.ts +20 -4
  29. package/dist/src/server/workflows/WorkflowContract.js +40 -0
  30. package/dist/src/server/workflows/WorkflowEngine.js +190 -13
  31. package/dist/src/types/deobfuscator.d.ts +1 -0
  32. package/dist/src/utils/cache/CachedDecorator.d.ts +8 -0
  33. package/dist/src/utils/cache/CachedDecorator.js +55 -0
  34. package/dist/src/utils/cache/PersistentCache.d.ts +33 -0
  35. package/dist/src/utils/cache/PersistentCache.js +246 -0
  36. package/dist/src/utils/cache/index.d.ts +2 -0
  37. package/dist/src/utils/cache/index.js +2 -0
  38. package/package.json +11 -12
  39. package/scripts/postinstall.cjs +54 -27
  40. package/workflows/anti-bot-diagnoser/.jshook-install.json +14 -0
  41. package/workflows/anti-bot-diagnoser/LICENSE +21 -0
  42. package/workflows/anti-bot-diagnoser/README.md +105 -0
  43. package/workflows/anti-bot-diagnoser/docs/agent-recipes.md +44 -0
  44. package/workflows/anti-bot-diagnoser/meta.yaml +6 -0
  45. package/workflows/anti-bot-diagnoser/package.json +22 -0
  46. package/workflows/anti-bot-diagnoser/tsconfig.json +15 -0
  47. package/workflows/anti-bot-diagnoser/workflow.ts +224 -0
  48. package/workflows/api-openapi-probe/.jshook-install.json +14 -0
  49. package/workflows/api-openapi-probe/meta.yaml +6 -0
  50. package/workflows/api-openapi-probe/package.json +22 -0
  51. package/workflows/api-openapi-probe/pnpm-lock.yaml +819 -0
  52. package/workflows/api-openapi-probe/tsconfig.json +15 -0
  53. package/workflows/api-openapi-probe/workflow.ts +40 -0
  54. package/workflows/api-probe-batch/.jshook-install.json +14 -0
  55. package/workflows/api-probe-batch/LICENSE +21 -0
  56. package/workflows/api-probe-batch/README.md +45 -0
  57. package/workflows/api-probe-batch/meta.yaml +4 -0
  58. package/workflows/api-probe-batch/package.json +23 -0
  59. package/workflows/api-probe-batch/tsconfig.json +16 -0
  60. package/workflows/api-probe-batch/workflow.ts +111 -0
  61. package/workflows/auth-bootstrap/.jshook-install.json +14 -0
  62. package/workflows/auth-bootstrap/LICENSE +21 -0
  63. package/workflows/auth-bootstrap/README.md +74 -0
  64. package/workflows/auth-bootstrap/meta.yaml +4 -0
  65. package/workflows/auth-bootstrap/package.json +23 -0
  66. package/workflows/auth-bootstrap/tsconfig.json +16 -0
  67. package/workflows/auth-bootstrap/workflow.ts +141 -0
  68. package/workflows/auth-extract/.jshook-install.json +14 -0
  69. package/workflows/auth-extract/meta.yaml +6 -0
  70. package/workflows/auth-extract/package.json +22 -0
  71. package/workflows/auth-extract/pnpm-lock.yaml +819 -0
  72. package/workflows/auth-extract/tsconfig.json +15 -0
  73. package/workflows/auth-extract/workflow.ts +36 -0
  74. package/workflows/auth-surface-mapper/.jshook-install.json +14 -0
  75. package/workflows/auth-surface-mapper/meta.yaml +6 -0
  76. package/workflows/auth-surface-mapper/package.json +22 -0
  77. package/workflows/auth-surface-mapper/pnpm-lock.yaml +819 -0
  78. package/workflows/auth-surface-mapper/tsconfig.json +15 -0
  79. package/workflows/auth-surface-mapper/workflow.ts +104 -0
  80. package/workflows/batch-register/.jshook-install.json +14 -0
  81. package/workflows/batch-register/LICENSE +21 -0
  82. package/workflows/batch-register/README.md +39 -0
  83. package/workflows/batch-register/meta.yaml +4 -0
  84. package/workflows/batch-register/package.json +23 -0
  85. package/workflows/batch-register/tsconfig.json +16 -0
  86. package/workflows/batch-register/workflow.ts +67 -0
  87. package/workflows/bundle-recovery/.jshook-install.json +14 -0
  88. package/workflows/bundle-recovery/LICENSE +21 -0
  89. package/workflows/bundle-recovery/README.md +105 -0
  90. package/workflows/bundle-recovery/docs/agent-recipes.md +44 -0
  91. package/workflows/bundle-recovery/meta.yaml +6 -0
  92. package/workflows/bundle-recovery/package.json +22 -0
  93. package/workflows/bundle-recovery/tsconfig.json +15 -0
  94. package/workflows/bundle-recovery/workflow.ts +179 -0
  95. package/workflows/challenge-detector/.jshook-install.json +14 -0
  96. package/workflows/challenge-detector/meta.yaml +14 -0
  97. package/workflows/challenge-detector/package.json +22 -0
  98. package/workflows/challenge-detector/pnpm-lock.yaml +819 -0
  99. package/workflows/challenge-detector/tsconfig.json +15 -0
  100. package/workflows/challenge-detector/workflow.ts +298 -0
  101. package/workflows/deobfuscation-pipeline/.jshook-install.json +14 -0
  102. package/workflows/deobfuscation-pipeline/meta.yaml +6 -0
  103. package/workflows/deobfuscation-pipeline/package.json +22 -0
  104. package/workflows/deobfuscation-pipeline/pnpm-lock.yaml +819 -0
  105. package/workflows/deobfuscation-pipeline/tsconfig.json +15 -0
  106. package/workflows/deobfuscation-pipeline/workflow.ts +119 -0
  107. package/workflows/electron-bridge-mapper/.jshook-install.json +14 -0
  108. package/workflows/electron-bridge-mapper/meta.yaml +6 -0
  109. package/workflows/electron-bridge-mapper/package.json +22 -0
  110. package/workflows/electron-bridge-mapper/pnpm-lock.yaml +819 -0
  111. package/workflows/electron-bridge-mapper/tsconfig.json +15 -0
  112. package/workflows/electron-bridge-mapper/workflow.ts +125 -0
  113. package/workflows/evidence-pack/.jshook-install.json +14 -0
  114. package/workflows/evidence-pack/LICENSE +21 -0
  115. package/workflows/evidence-pack/README.md +105 -0
  116. package/workflows/evidence-pack/docs/agent-recipes.md +44 -0
  117. package/workflows/evidence-pack/meta.yaml +6 -0
  118. package/workflows/evidence-pack/package.json +22 -0
  119. package/workflows/evidence-pack/tsconfig.json +15 -0
  120. package/workflows/evidence-pack/workflow.ts +154 -0
  121. package/workflows/js-bundle-search/.jshook-install.json +14 -0
  122. package/workflows/js-bundle-search/LICENSE +21 -0
  123. package/workflows/js-bundle-search/README.md +46 -0
  124. package/workflows/js-bundle-search/meta.yaml +4 -0
  125. package/workflows/js-bundle-search/package.json +23 -0
  126. package/workflows/js-bundle-search/tsconfig.json +16 -0
  127. package/workflows/js-bundle-search/workflow.ts +118 -0
  128. package/workflows/protocol-registry/.jshook-install.json +14 -0
  129. package/workflows/protocol-registry/meta.yaml +6 -0
  130. package/workflows/protocol-registry/package.json +22 -0
  131. package/workflows/protocol-registry/pnpm-lock.yaml +819 -0
  132. package/workflows/protocol-registry/tsconfig.json +15 -0
  133. package/workflows/protocol-registry/workflow.ts +107 -0
  134. package/workflows/qwen-mail-open-latest/meta.yaml +7 -0
  135. package/workflows/qwen-mail-open-latest/package.json +22 -0
  136. package/workflows/qwen-mail-open-latest/pnpm-lock.yaml +819 -0
  137. package/workflows/qwen-mail-open-latest/tsconfig.json +15 -0
  138. package/workflows/qwen-mail-open-latest/workflow.ts +77 -0
  139. package/workflows/register-account-flow/.jshook-install.json +14 -0
  140. package/workflows/register-account-flow/LICENSE +21 -0
  141. package/workflows/register-account-flow/README.md +64 -0
  142. package/workflows/register-account-flow/meta.yaml +4 -0
  143. package/workflows/register-account-flow/package.json +23 -0
  144. package/workflows/register-account-flow/tsconfig.json +16 -0
  145. package/workflows/register-account-flow/workflow.ts +127 -0
  146. package/workflows/replay-lab/.jshook-install.json +14 -0
  147. package/workflows/replay-lab/meta.yaml +6 -0
  148. package/workflows/replay-lab/package.json +22 -0
  149. package/workflows/replay-lab/pnpm-lock.yaml +819 -0
  150. package/workflows/replay-lab/tsconfig.json +15 -0
  151. package/workflows/replay-lab/workflow.ts +106 -0
  152. package/workflows/script-evidence-scan/.jshook-install.json +14 -0
  153. package/workflows/script-evidence-scan/LICENSE +21 -0
  154. package/workflows/script-evidence-scan/README.md +61 -0
  155. package/workflows/script-evidence-scan/meta.yaml +4 -0
  156. package/workflows/script-evidence-scan/package.json +23 -0
  157. package/workflows/script-evidence-scan/tsconfig.json +16 -0
  158. package/workflows/script-evidence-scan/workflow.ts +89 -0
  159. package/workflows/signature-hunter/.jshook-install.json +14 -0
  160. package/workflows/signature-hunter/LICENSE +21 -0
  161. package/workflows/signature-hunter/README.md +105 -0
  162. package/workflows/signature-hunter/docs/agent-recipes.md +44 -0
  163. package/workflows/signature-hunter/meta.yaml +6 -0
  164. package/workflows/signature-hunter/package.json +22 -0
  165. package/workflows/signature-hunter/tsconfig.json +15 -0
  166. package/workflows/signature-hunter/workflow.ts +170 -0
  167. package/workflows/signing-lineage/.jshook-install.json +14 -0
  168. package/workflows/signing-lineage/meta.yaml +6 -0
  169. package/workflows/signing-lineage/package.json +22 -0
  170. package/workflows/signing-lineage/pnpm-lock.yaml +819 -0
  171. package/workflows/signing-lineage/tsconfig.json +15 -0
  172. package/workflows/signing-lineage/workflow.ts +120 -0
  173. package/workflows/temp-mail-extract-link/.jshook-install.json +14 -0
  174. package/workflows/temp-mail-extract-link/LICENSE +21 -0
  175. package/workflows/temp-mail-extract-link/README.md +71 -0
  176. package/workflows/temp-mail-extract-link/meta.yaml +4 -0
  177. package/workflows/temp-mail-extract-link/package.json +23 -0
  178. package/workflows/temp-mail-extract-link/tsconfig.json +16 -0
  179. package/workflows/temp-mail-extract-link/workflow.ts +221 -0
  180. package/workflows/temp-mail-open-latest/.jshook-install.json +14 -0
  181. package/workflows/temp-mail-open-latest/LICENSE +21 -0
  182. package/workflows/temp-mail-open-latest/README.md +61 -0
  183. package/workflows/temp-mail-open-latest/meta.yaml +4 -0
  184. package/workflows/temp-mail-open-latest/package.json +23 -0
  185. package/workflows/temp-mail-open-latest/tsconfig.json +16 -0
  186. package/workflows/temp-mail-open-latest/workflow.ts +136 -0
  187. package/workflows/template/.jshook-install.json +14 -0
  188. package/workflows/template/LICENSE +21 -0
  189. package/workflows/template/README.md +45 -0
  190. package/workflows/template/docs/SKILL.md +111 -0
  191. package/workflows/template/meta.yaml +6 -0
  192. package/workflows/template/package.json +22 -0
  193. package/workflows/template/pnpm-lock.yaml +819 -0
  194. package/workflows/template/tsconfig.json +15 -0
  195. package/workflows/template/workflow.ts +73 -0
  196. package/workflows/web-api-capture-session/.jshook-install.json +14 -0
  197. package/workflows/web-api-capture-session/LICENSE +21 -0
  198. package/workflows/web-api-capture-session/README.md +64 -0
  199. package/workflows/web-api-capture-session/meta.yaml +4 -0
  200. package/workflows/web-api-capture-session/package.json +23 -0
  201. package/workflows/web-api-capture-session/tsconfig.json +16 -0
  202. package/workflows/web-api-capture-session/workflow.ts +124 -0
  203. package/workflows/ws-protocol-lifter/.jshook-install.json +14 -0
  204. package/workflows/ws-protocol-lifter/LICENSE +21 -0
  205. package/workflows/ws-protocol-lifter/README.md +105 -0
  206. package/workflows/ws-protocol-lifter/docs/agent-recipes.md +44 -0
  207. package/workflows/ws-protocol-lifter/meta.yaml +6 -0
  208. package/workflows/ws-protocol-lifter/package.json +22 -0
  209. package/workflows/ws-protocol-lifter/tsconfig.json +15 -0
  210. package/workflows/ws-protocol-lifter/workflow.ts +163 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jshookmcp/jshook",
3
- "version": "0.2.5",
4
- "description": "MCP server with 327 built-in tools across 23 domains for AI-assisted JavaScript analysis and security analysis — browser automation, CDP debugging, network monitoring, JS hooks, code analysis, and workflow orchestration",
3
+ "version": "0.2.6",
4
+ "description": "MCP server with 337 built-in tools across 24 domains for AI-assisted JavaScript analysis and security analysis — browser automation, CDP debugging, network monitoring, JS hooks, code analysis, and workflow orchestration",
5
5
  "keywords": [
6
6
  "ai",
7
7
  "anti-detection",
@@ -78,7 +78,7 @@
78
78
  "ajv-formats": "^3.0.1",
79
79
  "chalk": "^5.6.2",
80
80
  "commander": "^14.0.3",
81
- "dotenv": "^17.3.1",
81
+ "dotenv": "^17.4.0",
82
82
  "koffi": "^2.15.1",
83
83
  "openai": "^6.25.0",
84
84
  "ora": "^9.3.0",
@@ -92,20 +92,19 @@
92
92
  "@types/babel__traverse": "^7.28.0",
93
93
  "@types/better-sqlite3": "^7.6.13",
94
94
  "@types/node": "^25.3.0",
95
- "@vitest/coverage-v8": "^4.0.18",
95
+ "@vitest/coverage-v8": "^4.1.2",
96
96
  "cross-env": "^10.1.0",
97
97
  "estree-walker": "^2.0.2",
98
- "lefthook": "^2.1.3",
98
+ "lefthook": "^2.1.4",
99
99
  "medium-zoom": "^1.1.0",
100
- "nodemon": "^3.1.14",
101
- "oxfmt": "^0.41.0",
102
- "oxlint": "^1.56.0",
100
+ "oxfmt": "^0.43.0",
101
+ "oxlint": "^1.58.0",
103
102
  "tsc-alias": "^1.8.16",
104
103
  "tsx": "^4.21.0",
105
104
  "typescript": "^5.9.3",
106
- "vite": "^6.0.0",
105
+ "vite": "^8.0.2",
107
106
  "vitepress": "1.6.4",
108
- "vitest": "^4.0.18",
107
+ "vitest": "^4.1.2",
109
108
  "vue": "^3.5.30"
110
109
  },
111
110
  "optionalDependencies": {
@@ -115,7 +114,7 @@
115
114
  "webcrack": "^2.15.1"
116
115
  },
117
116
  "engines": {
118
- "node": ">=20.0.0"
117
+ "node": "^20.19.0 || >=22.12.0"
119
118
  },
120
119
  "mcpName": "io.github.vmoranv/jshookmcp",
121
120
  "scripts": {
@@ -135,7 +134,7 @@
135
134
  "format:check": "oxfmt \"src/**\" \"tests/**\" \"!tests/tmp/**\" --check --no-error-on-unmatched-pattern",
136
135
  "test": "vitest run",
137
136
  "test:e2e": "cross-env E2E_TARGET_URL=https://vmoranv.github.io/jshookmcp/ vitest run --config tests/e2e/vitest.e2e.config.ts",
138
- "test:coverage": "cross-env ENABLE_INJECTION_TOOLS=true vitest run --coverage",
137
+ "test:coverage": "node -e \"require('fs').mkdirSync('coverage/.tmp', { recursive: true })\" && cross-env ENABLE_INJECTION_TOOLS=true COVERAGE_FULL=true vitest run --coverage",
139
138
  "package:verify-bin": "node scripts/verify-packed-bin.mjs",
140
139
  "package:verify-install": "node scripts/verify-packed-install.mjs",
141
140
  "package:verify-release": "node scripts/verify-release-artifact.mjs",
@@ -2,36 +2,63 @@ const fs = require('node:fs');
2
2
  const path = require('node:path');
3
3
  const { spawnSync } = require('node:child_process');
4
4
 
5
- const repoGitDir = path.join(process.cwd(), '.git');
6
- const localBin = path.join(
7
- process.cwd(),
8
- 'node_modules',
9
- '.bin',
10
- process.platform === 'win32' ? 'lefthook.cmd' : 'lefthook'
11
- );
12
-
13
- if (!fs.existsSync(repoGitDir)) {
14
- process.exit(0);
15
- }
5
+ const repoGitDir = path.join(process.cwd(), '.git');
6
+ const localBin = path.join(
7
+ process.cwd(),
8
+ 'node_modules',
9
+ '.bin',
10
+ process.platform === 'win32' ? 'lefthook.cmd' : 'lefthook'
11
+ );
12
+ const isCi = process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true';
13
+
14
+ if (isCi || !fs.existsSync(repoGitDir)) {
15
+ process.exit(0);
16
+ }
16
17
 
17
18
  if (!fs.existsSync(localBin)) {
18
19
  console.warn('[postinstall] lefthook not found locally; skipping git hook installation.');
19
20
  process.exit(0);
20
21
  }
21
22
 
22
- const result = spawnSync(localBin, ['install'], {
23
- stdio: 'inherit',
24
- shell: process.platform === 'win32',
25
- });
26
-
27
- if (result.error) {
28
- console.warn(
29
- `[postinstall] lefthook install failed to spawn: ${result.error.message}; skipping git hook installation.`
30
- );
31
- } else if (result.status !== 0) {
32
- console.warn(
33
- `[postinstall] lefthook install exited with status ${result.status}; skipping git hook installation.`
34
- );
35
- }
36
-
37
- process.exit(0);
23
+ const hooksPathResult = spawnSync('git', ['config', '--local', '--get', 'core.hooksPath'], {
24
+ encoding: 'utf8',
25
+ shell: process.platform === 'win32',
26
+ });
27
+
28
+ const configuredHooksPath = hooksPathResult.status === 0 ? hooksPathResult.stdout.trim() : '';
29
+ if (configuredHooksPath) {
30
+ const resolvedHooksPath = path.resolve(process.cwd(), configuredHooksPath);
31
+ const defaultHooksPath = path.resolve(repoGitDir, 'hooks');
32
+
33
+ if (resolvedHooksPath === defaultHooksPath) {
34
+ process.exit(0);
35
+ }
36
+
37
+ console.warn(
38
+ `[postinstall] core.hooksPath is already set to "${configuredHooksPath}"; skipping git hook installation.`
39
+ );
40
+ process.exit(0);
41
+ }
42
+
43
+ const result = spawnSync(localBin, ['install'], {
44
+ encoding: 'utf8',
45
+ stdio: ['ignore', 'pipe', 'pipe'],
46
+ shell: process.platform === 'win32',
47
+ });
48
+
49
+ if (result.error) {
50
+ console.warn(
51
+ `[postinstall] lefthook install failed to spawn: ${result.error.message}; skipping git hook installation.`
52
+ );
53
+ } else if (result.status !== 0) {
54
+ const firstDetailLine = [result.stdout, result.stderr]
55
+ .join('\n')
56
+ .split(/\r?\n/)
57
+ .map((line) => line.trim())
58
+ .find(Boolean);
59
+ console.warn(
60
+ `[postinstall] lefthook install exited with status ${result.status}; skipping git hook installation${firstDetailLine ? ` (${firstDetailLine})` : ''}.`
61
+ );
62
+ }
63
+
64
+ process.exit(0);
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": 1,
3
+ "kind": "workflow",
4
+ "slug": "anti-bot-diagnoser",
5
+ "id": "workflow.anti-bot-diagnoser.v1",
6
+ "source": {
7
+ "type": "git",
8
+ "repo": "https://github.com/vmoranv/jshook_workflow_anti_bot_diagnoser",
9
+ "ref": "main",
10
+ "commit": "b7e270de2a0cbb90ed431bd9de4fcd101cc53439",
11
+ "subpath": ".",
12
+ "entry": "workflow.ts"
13
+ }
14
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 vmoranv
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,105 @@
1
+ # jshook_workflow_template
2
+
3
+ TypeScript-first template repository for building a reusable `jshook` workflow.
4
+
5
+ This template focuses on one thing:
6
+
7
+ - codify an existing built-in tool chain into a reusable workflow contract
8
+ - keep TypeScript source in Git and generated JavaScript out of Git
9
+
10
+ ## Included in the template
11
+
12
+ - `workflow.ts`: workflow source entrypoint
13
+ - `docs/agent-recipes.md`: recipes for orchestration, parallel reads, and subagent-assisted analysis
14
+ - `dist/workflow.js`: generated locally by `pnpm run build` and ignored by Git
15
+
16
+ ## What the MVP workflow demonstrates
17
+
18
+ The sample workflow runs this shape:
19
+
20
+ 1. `network_enable`
21
+ 2. `page_navigate`
22
+ 3. parallel surface collection
23
+ - `page_get_local_storage`
24
+ - `page_get_cookies`
25
+ - `network_get_requests`
26
+ - `page_get_all_links`
27
+ - optional `console_get_logs`
28
+ 4. `network_extract_auth`
29
+ 5. `console_execute` summary output
30
+
31
+ ## Dependency model
32
+
33
+ This template uses the published npm package:
34
+
35
+ ```json
36
+ {
37
+ "@jshookmcp/extension-sdk": "^0.1.3"
38
+ }
39
+ ```
40
+
41
+ ## Install and build
42
+
43
+ ```bash
44
+ pnpm install
45
+ pnpm run build
46
+ pnpm run check
47
+ ```
48
+
49
+ ## Loading behavior
50
+
51
+ `jshook` discovers both `workflow.ts` and `dist/workflow.js`, but when both exist it prefers the generated JavaScript entry.
52
+
53
+ Recommended workflow:
54
+
55
+ 1. edit `workflow.ts`
56
+ 2. run `pnpm run build`
57
+ 3. let `jshook` load `dist/workflow.js`
58
+
59
+ Do **not** commit `dist/`.
60
+
61
+ ## Load the workflow into jshook
62
+
63
+ Set:
64
+
65
+ ```bash
66
+ MCP_WORKFLOW_ROOTS=<path-to-cloned-jshook_workflow_template>
67
+ ```
68
+
69
+ Then run inside `jshook`:
70
+
71
+ 1. `extensions_reload`
72
+ 2. `extensions_list`
73
+ 3. `list_extension_workflows`
74
+ 4. `run_extension_workflow`
75
+
76
+ ## Configuration prefix
77
+
78
+ The template uses:
79
+
80
+ ```text
81
+ workflows.templateCapture.*
82
+ ```
83
+
84
+ Rename that prefix early when adapting the template for real use.
85
+
86
+ ## Git hygiene
87
+
88
+ Keep this repo focused on source and docs.
89
+ Do not commit:
90
+
91
+ - `dist/`
92
+ - `node_modules/`
93
+ - `.env`
94
+ - runtime artifacts
95
+ - screenshots
96
+ - local sessions
97
+ - host-specific temp output
98
+
99
+ ## What to change first
100
+
101
+ 1. replace `workflowId` and `displayName`
102
+ 2. rename the config prefix
103
+ 3. keep state-mutating steps serialized
104
+ 4. keep read-only collection steps parallel where safe
105
+ 5. validate the workflow through `extensions_reload` and `list_extension_workflows`
@@ -0,0 +1,44 @@
1
+ # Agent Recipes for `jshook_workflow_template`
2
+
3
+ ## Core rule
4
+
5
+ - parallelize reads, not shared page state mutations
6
+ - let the main agent keep the active browser session
7
+ - use subagents for sidecar analysis and report drafting
8
+
9
+ ## Recipe 1: run workflow, then delegate analysis
10
+
11
+ Recommended split:
12
+
13
+ - main agent
14
+ - `run_extension_workflow`
15
+ - optional `network_get_response_body`
16
+ - subagent
17
+ - classify endpoints
18
+ - summarize auth and session artifacts
19
+ - draft report output
20
+
21
+ ## Recipe 2: main agent navigates, subagent reviews outputs
22
+
23
+ Recommended split:
24
+
25
+ - main agent
26
+ - `page_navigate`
27
+ - page actions
28
+ - `network_get_requests`
29
+ - subagent
30
+ - endpoint matrix
31
+ - auth header and signature review
32
+ - next-step probing suggestions
33
+
34
+ ## Recipe 3: when to use parallel tool calls
35
+
36
+ Good read-only candidates:
37
+
38
+ - `extensions_list`
39
+ - `search_tools`
40
+ - `page_get_local_storage`
41
+ - `page_get_cookies`
42
+ - `console_get_logs`
43
+
44
+ Avoid parallelizing any action that changes the current page state.
@@ -0,0 +1,6 @@
1
+ name: anti-bot-diagnoser
2
+ description: JSHook workflow for anti-bot-diagnoser
3
+ author: vmoranv
4
+ tags:
5
+ - workflow
6
+ - anti-bot-diagnoser
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "jshook-workflow-template",
3
+ "private": true,
4
+ "version": "0.1.0",
5
+ "description": "Standalone template repository for building jshook workflows.",
6
+ "type": "module",
7
+ "packageManager": "pnpm@10.28.2",
8
+ "scripts": {
9
+ "build": "tsc -p tsconfig.json",
10
+ "check": "tsc -p tsconfig.json --noEmit"
11
+ },
12
+ "dependencies": {
13
+ "@jshookmcp/extension-sdk": "^0.3.0"
14
+ },
15
+ "devDependencies": {
16
+ "@types/node": "^25.3.0",
17
+ "typescript": "^5.9.3"
18
+ },
19
+ "engines": {
20
+ "node": ">=20.0.0"
21
+ }
22
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "noEmit": false,
7
+ "outDir": "dist",
8
+ "rootDir": ".",
9
+ "strict": true,
10
+ "skipLibCheck": true,
11
+ "types": ["node"]
12
+ },
13
+ "include": ["workflow.ts"],
14
+ "exclude": ["dist", "node_modules"]
15
+ }
@@ -0,0 +1,224 @@
1
+ import {
2
+ createWorkflow,
3
+ type WorkflowExecutionContext,
4
+ SequenceNodeBuilder,
5
+ } from '@jshookmcp/extension-sdk/workflow';
6
+
7
+ const workflowId = 'workflow.anti-bot-diagnoser.v1';
8
+
9
+ /**
10
+ * Anti-Bot Diagnoser — Reverse Mission Workflow
11
+ *
12
+ * Differential analysis to detect bot-detection mechanisms:
13
+ * 1. Creates a baseline fingerprint (normal browser context)
14
+ * 2. Creates a stealth fingerprint (stealth executor)
15
+ * 3. Compares both against known detection probes
16
+ * 4. Identifies specific detection points (webdriver, CDP, timing, canvas, etc.)
17
+ * 5. Produces a detection map and remediation hints
18
+ * 6. Records evidence for the diagnostic session
19
+ */
20
+ export default createWorkflow(workflowId, 'Anti-Bot Diagnoser')
21
+ .description(
22
+ 'Compares normal vs stealth browser fingerprints, identifies bot-detection triggers (webdriver, CDP, canvas, WebRTC, timing), and produces a detection report with remediation hints.',
23
+ )
24
+ .tags([
25
+ 'reverse',
26
+ 'antibot',
27
+ 'stealth',
28
+ 'fingerprint',
29
+ 'detection',
30
+ 'webdriver',
31
+ 'mission',
32
+ ])
33
+ .timeoutMs(12 * 60_000)
34
+ .defaultMaxConcurrency(2)
35
+ .buildGraph((ctx: WorkflowExecutionContext) => {
36
+ const prefix = 'workflows.antiBotDiagnoser';
37
+
38
+ // ── Config ──────────────────────────────────────────────────────
39
+ const url = String(ctx.getConfig(`${prefix}.url`, 'https://example.com'));
40
+ const waitUntil = String(ctx.getConfig(`${prefix}.waitUntil`, 'networkidle0'));
41
+ const probeCategories = String(
42
+ ctx.getConfig(
43
+ `${prefix}.probeCategories`,
44
+ 'webdriver,navigator,timing,canvas,webgl,webrtc,audio,fonts,plugins,permissions',
45
+ ),
46
+ );
47
+ const maxConcurrency = Number(ctx.getConfig(`${prefix}.parallel.maxConcurrency`, 2));
48
+ const stealthMode = String(ctx.getConfig(`${prefix}.stealthMode`, 'patchright'));
49
+
50
+ const root = new SequenceNodeBuilder('anti-bot-diagnoser-root');
51
+
52
+ root
53
+ // ── Phase 1: Enable Network & Navigate ────────────────────────
54
+ .tool('enable-network', 'network_enable', {
55
+ input: { enableExceptions: true },
56
+ })
57
+ .tool('navigate', 'page_navigate', {
58
+ input: { url, waitUntil },
59
+ })
60
+
61
+ // ── Phase 2: Baseline Fingerprint (Normal) ────────────────────
62
+ .tool('fingerprint-baseline', 'page_evaluate', {
63
+ input: {
64
+ expression: `
65
+ (function() {
66
+ const probes = {};
67
+ // webdriver
68
+ probes.webdriver = navigator.webdriver;
69
+ probes.webdriverDefined = 'webdriver' in navigator;
70
+ // navigator properties
71
+ probes.userAgent = navigator.userAgent;
72
+ probes.platform = navigator.platform;
73
+ probes.languages = navigator.languages;
74
+ probes.hardwareConcurrency = navigator.hardwareConcurrency;
75
+ probes.deviceMemory = navigator.deviceMemory;
76
+ // timing
77
+ probes.timingResolution = (() => {
78
+ const t0 = performance.now();
79
+ for (let i = 0; i < 1000; i++) performance.now();
80
+ return performance.now() - t0;
81
+ })();
82
+ // canvas
83
+ probes.canvasFingerprint = (() => {
84
+ const c = document.createElement('canvas');
85
+ c.width = 200; c.height = 50;
86
+ const ctx = c.getContext('2d');
87
+ if (!ctx) return null;
88
+ ctx.textBaseline = 'top';
89
+ ctx.font = '14px Arial';
90
+ ctx.fillText('probe', 2, 2);
91
+ return c.toDataURL().slice(0, 100);
92
+ })();
93
+ // chrome
94
+ probes.chromeRuntime = typeof chrome !== 'undefined' && !!chrome.runtime;
95
+ // permissions
96
+ probes.permissionsQuery = typeof navigator.permissions !== 'undefined';
97
+ // plugins
98
+ probes.pluginCount = navigator.plugins ? navigator.plugins.length : -1;
99
+ return probes;
100
+ })()
101
+ `,
102
+ },
103
+ })
104
+
105
+ // ── Phase 3: Parallel Detection Checks ────────────────────────
106
+ .parallel('detection-checks', (p) => {
107
+ p.maxConcurrency(maxConcurrency)
108
+ .failFast(false)
109
+ // Check CDP leak
110
+ .tool('check-cdp-leak', 'stealth_check_cdp_leak', {
111
+ input: {},
112
+ })
113
+ // Check webdriver property
114
+ .tool('check-webdriver', 'stealth_check_webdriver', {
115
+ input: {},
116
+ })
117
+ // Check automation flags
118
+ .tool('check-automation-flags', 'stealth_check_automation', {
119
+ input: {},
120
+ })
121
+ // Run all stealth probes
122
+ .tool('run-stealth-probes', 'stealth_run_probes', {
123
+ input: { categories: probeCategories },
124
+ });
125
+ })
126
+
127
+ // ── Phase 4: Stealth Mode Fingerprint ─────────────────────────
128
+ .tool('switch-stealth', 'browser_set_stealth_mode', {
129
+ input: { mode: stealthMode },
130
+ })
131
+ .tool('navigate-stealth', 'page_navigate', {
132
+ input: { url, waitUntil },
133
+ })
134
+ .tool('fingerprint-stealth', 'page_evaluate', {
135
+ input: {
136
+ expression: `
137
+ (function() {
138
+ const probes = {};
139
+ probes.webdriver = navigator.webdriver;
140
+ probes.webdriverDefined = 'webdriver' in navigator;
141
+ probes.userAgent = navigator.userAgent;
142
+ probes.platform = navigator.platform;
143
+ probes.chromeRuntime = typeof chrome !== 'undefined' && !!chrome.runtime;
144
+ probes.pluginCount = navigator.plugins ? navigator.plugins.length : -1;
145
+ return probes;
146
+ })()
147
+ `,
148
+ },
149
+ })
150
+
151
+ // ── Phase 5: Differential Analysis ────────────────────────────
152
+ .tool('compute-diff', 'console_execute', {
153
+ input: {
154
+ expression: `
155
+ (function() {
156
+ return {
157
+ analysis: 'differential_fingerprint_complete',
158
+ hint: 'Compare baseline vs stealth results in evidence graph',
159
+ };
160
+ })()
161
+ `,
162
+ },
163
+ })
164
+
165
+ // ── Phase 6: Detection Report ─────────────────────────────────
166
+ .tool('generate-report', 'stealth_generate_report', {
167
+ input: {
168
+ includeRemediation: true,
169
+ },
170
+ })
171
+
172
+ // ── Phase 7: Evidence Recording ───────────────────────────────
173
+ .tool('create-evidence-session', 'instrumentation_session_create', {
174
+ input: {
175
+ name: `antibot-diagnosis-${new Date().toISOString().slice(0, 10)}`,
176
+ metadata: { url, workflowId, stealthMode },
177
+ },
178
+ })
179
+ .tool('record-artifact', 'instrumentation_artifact_record', {
180
+ input: {
181
+ type: 'antibot_report',
182
+ label: `Anti-bot diagnosis for ${url}`,
183
+ metadata: { url, probeCategories, stealthMode },
184
+ },
185
+ })
186
+
187
+ // ── Phase 8: Session Insight ──────────────────────────────────
188
+ .tool('emit-insight', 'append_session_insight', {
189
+ input: {
190
+ insight: JSON.stringify({
191
+ status: 'anti_bot_diagnoser_complete',
192
+ workflowId,
193
+ url,
194
+ probeCategories,
195
+ stealthMode,
196
+ }),
197
+ },
198
+ });
199
+
200
+ return root;
201
+ })
202
+ .onStart((ctx) => {
203
+ ctx.emitMetric('workflow_runs_total', 1, 'counter', {
204
+ workflowId,
205
+ mission: 'anti_bot_diagnoser',
206
+ stage: 'start',
207
+ });
208
+ })
209
+ .onFinish((ctx) => {
210
+ ctx.emitMetric('workflow_runs_total', 1, 'counter', {
211
+ workflowId,
212
+ mission: 'anti_bot_diagnoser',
213
+ stage: 'finish',
214
+ });
215
+ })
216
+ .onError((ctx, error) => {
217
+ ctx.emitMetric('workflow_errors_total', 1, 'counter', {
218
+ workflowId,
219
+ mission: 'anti_bot_diagnoser',
220
+ stage: 'error',
221
+ error: error.name,
222
+ });
223
+ })
224
+ .build();
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": 1,
3
+ "kind": "workflow",
4
+ "slug": "api-openapi-probe",
5
+ "id": "workflow.api-openapi-probe.v1",
6
+ "source": {
7
+ "type": "git",
8
+ "repo": "https://github.com/vmoranv/jshook_workflow_api_openapi_probe",
9
+ "ref": "main",
10
+ "commit": "94e1573fef500945d2da18f1cadda68b9187f22f",
11
+ "subpath": ".",
12
+ "entry": "workflow.ts"
13
+ }
14
+ }
@@ -0,0 +1,6 @@
1
+ name: api-openapi-probe
2
+ description: JSHook workflow for api-openapi-probe
3
+ author: vmoranv
4
+ tags:
5
+ - workflow
6
+ - api-openapi-probe
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "jshook-workflow-api-openapi-probe",
3
+ "private": true,
4
+ "version": "0.1.0",
5
+ "description": "jshookmcp workflow: api-openapi-probe",
6
+ "type": "module",
7
+ "packageManager": "pnpm@10.28.2",
8
+ "scripts": {
9
+ "build": "tsc -p tsconfig.json",
10
+ "check": "tsc -p tsconfig.json --noEmit"
11
+ },
12
+ "dependencies": {
13
+ "@jshookmcp/extension-sdk": "^0.3.0"
14
+ },
15
+ "devDependencies": {
16
+ "@types/node": "^25.3.0",
17
+ "typescript": "^5.9.3"
18
+ },
19
+ "engines": {
20
+ "node": ">=20.0.0"
21
+ }
22
+ }