@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
@@ -0,0 +1,136 @@
1
+ import type { WorkflowContract } from '@jshookmcp/extension-sdk/workflow';
2
+ import { toolNode, sequenceNode, branchNode } from '@jshookmcp/extension-sdk/workflow';
3
+
4
+ const workflowId = 'workflow.temp-mail-open-latest.v1';
5
+
6
+ const tempMailOpenLatestWorkflow: WorkflowContract = {
7
+ kind: 'workflow-contract',
8
+ version: 1,
9
+ id: workflowId,
10
+ displayName: 'Temp Mail Open Latest',
11
+ description:
12
+ 'Navigate a temporary mailbox, optionally refresh it, and open the latest relevant message using configurable selectors and matching rules.',
13
+ tags: ['workflow', 'mailbox', 'email', 'temp-mail', 'automation'],
14
+ timeoutMs: 3 * 60_000,
15
+ defaultMaxConcurrency: 1,
16
+
17
+ build(ctx) {
18
+ const prefix = 'workflows.tempMailOpenLatest';
19
+ const mailboxUrl = ctx.getConfig<string>(`${prefix}.mailboxUrl`, 'https://example.com/mailbox');
20
+ const waitUntil = ctx.getConfig<string>(`${prefix}.waitUntil`, 'domcontentloaded');
21
+ const readySelector = ctx.getConfig<string>(`${prefix}.readySelector`, 'body');
22
+ const timeoutMs = ctx.getConfig<number>(`${prefix}.timeoutMs`, 60_000);
23
+ const refreshSelector = ctx.getConfig<string>(`${prefix}.refreshSelector`, '');
24
+ const refreshWaitMs = ctx.getConfig<number>(`${prefix}.refreshWaitMs`, 1500);
25
+ const itemSelector = ctx.getConfig<string>(`${prefix}.itemSelector`, 'a[href]');
26
+ const hrefIncludes = ctx.getConfig<string>(`${prefix}.hrefIncludes`, '/mail/view/');
27
+ const hrefRegex = ctx.getConfig<string>(`${prefix}.hrefRegex`, '');
28
+ const textIncludes = ctx.getConfig<string>(`${prefix}.textIncludes`, '');
29
+ const textRegex = ctx.getConfig<string>(`${prefix}.textRegex`, '');
30
+ const openOrder = ctx.getConfig<string>(`${prefix}.openOrder`, 'first');
31
+
32
+ return sequenceNode('temp-mail-open-latest-root')
33
+ .step(toolNode('navigate-mailbox', 'page_navigate').input({
34
+ url: mailboxUrl, waitUntil, timeout: timeoutMs, enableNetworkMonitoring: true,
35
+ }))
36
+ .step(toolNode('wait-mailbox-ready', 'page_wait_for_selector').input({
37
+ selector: readySelector, timeout: timeoutMs,
38
+ }))
39
+ .step(branchNode('maybe-refresh-mailbox', 'temp_mail_open_latest_enable_refresh')
40
+ .predicateFn(() => Boolean(refreshSelector))
41
+ .whenTrue(sequenceNode('refresh-sequence')
42
+ .step(toolNode('refresh-mailbox', 'page_evaluate').input({
43
+ code: `(function(){
44
+ const target = document.querySelector(${JSON.stringify(refreshSelector)});
45
+ if (!target) {
46
+ return { refreshed: false, reason: 'refresh_target_not_found', selector: ${JSON.stringify(refreshSelector)} };
47
+ }
48
+ if (typeof target.click === 'function') {
49
+ target.click();
50
+ return { refreshed: true, selector: ${JSON.stringify(refreshSelector)} };
51
+ }
52
+ return { refreshed: false, reason: 'refresh_target_not_clickable', selector: ${JSON.stringify(refreshSelector)} };
53
+ })()`,
54
+ }))
55
+ .step(toolNode('wait-after-refresh', 'page_evaluate')
56
+ .input({ code: `new Promise(resolve => setTimeout(() => resolve({ waitedMs: ${Math.max(0, refreshWaitMs)} }), ${Math.max(0, refreshWaitMs)}))` })
57
+ .timeout(Math.max(5_000, refreshWaitMs + 2_000))))
58
+ .whenFalse(toolNode('skip-refresh-mailbox', 'console_execute').input({
59
+ expression: '({ skipped: true, step: "refresh_mailbox", reason: "refreshSelector not configured" })',
60
+ })))
61
+ .step(toolNode('open-latest-relevant-mail', 'page_evaluate').input({
62
+ code: `(function(){
63
+ const anchors = Array.from(document.querySelectorAll(${JSON.stringify(itemSelector)}));
64
+ const hrefIncludes = ${JSON.stringify(hrefIncludes)};
65
+ const hrefRegexRaw = ${JSON.stringify(hrefRegex)};
66
+ const textIncludes = ${JSON.stringify(textIncludes)};
67
+ const textRegexRaw = ${JSON.stringify(textRegex)};
68
+ const order = ${JSON.stringify(openOrder)};
69
+
70
+ const hrefRegex = hrefRegexRaw ? new RegExp(hrefRegexRaw, 'i') : null;
71
+ const textRegex = textRegexRaw ? new RegExp(textRegexRaw, 'i') : null;
72
+
73
+ const matches = anchors.filter((anchor) => {
74
+ const href = anchor.href || anchor.getAttribute('href') || '';
75
+ const text = (anchor.textContent || '').trim();
76
+ if (hrefIncludes && !href.includes(hrefIncludes)) return false;
77
+ if (hrefRegex && !hrefRegex.test(href)) return false;
78
+ if (textIncludes && !text.toLowerCase().includes(textIncludes.toLowerCase())) return false;
79
+ if (textRegex && !textRegex.test(text)) return false;
80
+ return true;
81
+ });
82
+
83
+ if (matches.length === 0) {
84
+ return {
85
+ opened: false,
86
+ reason: 'matching_mail_item_not_found',
87
+ totalAnchors: anchors.length,
88
+ filters: { hrefIncludes, hrefRegexRaw, textIncludes, textRegexRaw, order }
89
+ };
90
+ }
91
+
92
+ const selected = order === 'last' ? matches[matches.length - 1] : matches[0];
93
+ const href = selected.href || selected.getAttribute('href') || '';
94
+ const text = (selected.textContent || '').trim();
95
+ if (!href) {
96
+ return {
97
+ opened: false,
98
+ reason: 'selected_item_missing_href',
99
+ text,
100
+ matchCount: matches.length
101
+ };
102
+ }
103
+
104
+ window.location.href = href;
105
+ return {
106
+ opened: true, href, text,
107
+ matchCount: matches.length,
108
+ totalAnchors: anchors.length,
109
+ order
110
+ };
111
+ })()`,
112
+ }))
113
+ .step(toolNode('emit-summary', 'console_execute').input({
114
+ expression: `(${JSON.stringify({
115
+ workflowId, mailboxUrl, readySelector, refreshSelector,
116
+ itemSelector, hrefIncludes, hrefRegex, textIncludes, textRegex, openOrder,
117
+ status: 'temp_mail_open_latest_complete',
118
+ })})`,
119
+ }))
120
+ .build();
121
+ },
122
+
123
+ onStart(ctx) {
124
+ ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId, stage: 'start' });
125
+ },
126
+
127
+ onFinish(ctx) {
128
+ ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId, stage: 'finish' });
129
+ },
130
+
131
+ onError(ctx, error) {
132
+ ctx.emitMetric('workflow_errors_total', 1, 'counter', { workflowId, error: error.name });
133
+ },
134
+ };
135
+
136
+ export default tempMailOpenLatestWorkflow;
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": 1,
3
+ "kind": "workflow",
4
+ "slug": "template",
5
+ "id": "workflow.template.v1",
6
+ "source": {
7
+ "type": "git",
8
+ "repo": "https://github.com/vmoranv/jshook_workflow_template",
9
+ "ref": "main",
10
+ "commit": "422db61",
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,45 @@
1
+ # jshook Workflow Template
2
+
3
+ A minimal template for building jshook MCP workflows.
4
+
5
+ ## What's Included
6
+
7
+ - `workflow.ts` - Workflow definition
8
+ - `meta.yaml` - Extension metadata for registry
9
+ - `.gitignore` - Standard ignores for jshook projects
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ pnpm install
15
+ pnpm run build
16
+ pnpm run check
17
+ ```
18
+
19
+ ## Files Explained
20
+
21
+ | File | Purpose |
22
+ |------|---------|
23
+ | `workflow.ts` | Workflow implementation |
24
+ | `package.json` | Dependencies (uses @jshookmcp/extension-sdk) |
25
+ | `tsconfig.json` | TypeScript configuration |
26
+ | `meta.yaml` | Registry metadata (name, description, author, tags) |
27
+
28
+ ## Local Testing
29
+
30
+ ```bash
31
+ export MCP_WORKFLOW_ROOTS=$(pwd)
32
+ # In jshook: extensions_reload, then list_extension_workflows
33
+ ```
34
+
35
+ ## Publishing
36
+
37
+ 1. Push to GitHub (public repo)
38
+ 2. Ensure `meta.yaml` exists with valid metadata
39
+ 3. Create issue at vmoranv/jshookmcpextension (see docs/SKILL.md for agent usage)
40
+
41
+ ## See Also
42
+
43
+ - [docs/SKILL.md](docs/SKILL.md) - Agent usage documentation
44
+ - [jshookmcp](https://github.com/vmoranv/jshookmcp) - Main repository
45
+ - [Extension Registry](https://github.com/vmoranv/jshookmcpextension) - Registry issues
@@ -0,0 +1,111 @@
1
+ # jshook Workflow Template - Agent Skill Documentation
2
+
3
+ ## For Agents Using This Template
4
+
5
+ This template provides a reusable workflow scaffold for jshook MCP.
6
+
7
+ ## Workflow ID
8
+
9
+ ```
10
+ workflow.template.v1
11
+ ```
12
+
13
+ ## Available Configuration
14
+
15
+ ```yaml
16
+ workflows.template.*
17
+ ```
18
+
19
+ ## Input Parameters
20
+
21
+ ```typescript
22
+ {
23
+ targetUrl?: string, // Target URL to analyze (default: current page)
24
+ collectAuth?: boolean, // Extract auth credentials (default: true)
25
+ collectLinks?: boolean, // Collect page links (default: true)
26
+ }
27
+ ```
28
+
29
+ ## Output Structure
30
+
31
+ ```typescript
32
+ {
33
+ url: string, // Analyzed URL
34
+ timestamp: string, // Analysis timestamp
35
+ auth: { // Extracted auth (if collectAuth=true)
36
+ tokens: array,
37
+ cookies: array,
38
+ headers: array
39
+ },
40
+ links: array, // Page links (if collectLinks=true)
41
+ localStorage: object, // LocalStorage contents
42
+ requests: array // Network requests captured
43
+ }
44
+ ```
45
+
46
+ ## SDK Functions Used
47
+
48
+ ```typescript
49
+ import { defineWorkflow } from '@jshookmcp/extension-sdk';
50
+
51
+ export default defineWorkflow({
52
+ id: 'workflow.template.v1',
53
+ name: 'Template Workflow',
54
+ description: 'A sample workflow',
55
+
56
+ async execute(ctx, config) {
57
+ // Step 1: Enable network monitoring
58
+ await ctx.network_enable();
59
+
60
+ // Step 2: Navigate
61
+ await ctx.page_navigate(config.targetUrl);
62
+
63
+ // Step 3: Parallel collection
64
+ const [storage, cookies, requests] = await Promise.all([
65
+ ctx.page_get_local_storage(),
66
+ ctx.page_get_cookies(),
67
+ ctx.network_get_requests()
68
+ ]);
69
+
70
+ // Step 4: Extract auth
71
+ const auth = await ctx.network_extract_auth();
72
+
73
+ return { storage, cookies, requests, auth };
74
+ },
75
+ });
76
+ ```
77
+
78
+ ## Parallel Read Pattern
79
+
80
+ Safe to parallelize (Promise.all):
81
+ - `page_get_local_storage`
82
+ - `page_get_cookies`
83
+ - `network_get_requests`
84
+ - `page_get_all_links`
85
+
86
+ Do NOT parallelize:
87
+ - `page_click` + `page_type` (state mutations)
88
+ - Multiple `page_navigate` calls
89
+
90
+ ## Build & Verify
91
+
92
+ ```bash
93
+ pnpm install
94
+ pnpm run build # Outputs dist/workflow.js
95
+ pnpm run check # TypeScript type check
96
+ ```
97
+
98
+ ## Load Into jshook
99
+
100
+ 1. Set env: `MCP_WORKFLOW_ROOTS=/path/to/template`
101
+ 2. In jshook: `extensions_reload`
102
+ 3. Verify: `list_extension_workflows` shows the workflow
103
+ 4. Run: `run_extension_workflow --workflow-id workflow.template.v1`
104
+
105
+ ## Example Invocation
106
+
107
+ ```
108
+ run_extension_workflow
109
+ --workflow-id workflow.template.v1
110
+ --config '{"targetUrl":"https://example.com","collectAuth":true}'
111
+ ```
@@ -0,0 +1,6 @@
1
+ name: template
2
+ description: JSHook workflow for template
3
+ author: vmoranv
4
+ tags:
5
+ - workflow
6
+ - template
@@ -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
+ }