@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.
- package/README.md +5 -5
- package/README.zh.md +5 -5
- package/dist/packages/extension-sdk/src/workflow.d.ts +17 -2
- package/dist/packages/extension-sdk/src/workflow.js +36 -0
- package/dist/src/modules/browser/BrowserPool.d.ts +49 -0
- package/dist/src/modules/browser/BrowserPool.js +288 -0
- package/dist/src/modules/deobfuscator/AdvancedDeobfuscator.d.ts +5 -0
- package/dist/src/modules/deobfuscator/AdvancedDeobfuscator.js +43 -2
- package/dist/src/modules/deobfuscator/Deobfuscator.js +5 -0
- package/dist/src/modules/external/ExternalToolRunner.js +1 -1
- package/dist/src/server/MCPServer.context.d.ts +1 -0
- package/dist/src/server/domains/browser/handlers/stealth-injection.d.ts +1 -0
- package/dist/src/server/domains/browser/handlers/stealth-injection.js +3 -0
- package/dist/src/server/domains/shared-state-board/definitions.d.ts +2 -0
- package/dist/src/server/domains/shared-state-board/definitions.js +78 -0
- package/dist/src/server/domains/shared-state-board/handlers.impl.d.ts +58 -0
- package/dist/src/server/domains/shared-state-board/handlers.impl.js +419 -0
- package/dist/src/server/domains/shared-state-board/index.d.ts +2 -0
- package/dist/src/server/domains/shared-state-board/index.js +2 -0
- package/dist/src/server/domains/shared-state-board/manifest.d.ts +57 -0
- package/dist/src/server/domains/shared-state-board/manifest.js +74 -0
- package/dist/src/server/http/SseStream.d.ts +21 -0
- package/dist/src/server/http/SseStream.js +129 -0
- package/dist/src/server/teams/TeamManager.d.ts +43 -0
- package/dist/src/server/teams/TeamManager.js +238 -0
- package/dist/src/server/teams/index.d.ts +1 -0
- package/dist/src/server/teams/index.js +1 -0
- package/dist/src/server/workflows/WorkflowContract.d.ts +20 -4
- package/dist/src/server/workflows/WorkflowContract.js +40 -0
- package/dist/src/server/workflows/WorkflowEngine.js +190 -13
- package/dist/src/types/deobfuscator.d.ts +1 -0
- package/dist/src/utils/cache/CachedDecorator.d.ts +8 -0
- package/dist/src/utils/cache/CachedDecorator.js +55 -0
- package/dist/src/utils/cache/PersistentCache.d.ts +33 -0
- package/dist/src/utils/cache/PersistentCache.js +246 -0
- package/dist/src/utils/cache/index.d.ts +2 -0
- package/dist/src/utils/cache/index.js +2 -0
- package/package.json +11 -12
- package/scripts/postinstall.cjs +54 -27
- package/workflows/anti-bot-diagnoser/.jshook-install.json +14 -0
- package/workflows/anti-bot-diagnoser/LICENSE +21 -0
- package/workflows/anti-bot-diagnoser/README.md +105 -0
- package/workflows/anti-bot-diagnoser/docs/agent-recipes.md +44 -0
- package/workflows/anti-bot-diagnoser/meta.yaml +6 -0
- package/workflows/anti-bot-diagnoser/package.json +22 -0
- package/workflows/anti-bot-diagnoser/tsconfig.json +15 -0
- package/workflows/anti-bot-diagnoser/workflow.ts +224 -0
- package/workflows/api-openapi-probe/.jshook-install.json +14 -0
- package/workflows/api-openapi-probe/meta.yaml +6 -0
- package/workflows/api-openapi-probe/package.json +22 -0
- package/workflows/api-openapi-probe/pnpm-lock.yaml +819 -0
- package/workflows/api-openapi-probe/tsconfig.json +15 -0
- package/workflows/api-openapi-probe/workflow.ts +40 -0
- package/workflows/api-probe-batch/.jshook-install.json +14 -0
- package/workflows/api-probe-batch/LICENSE +21 -0
- package/workflows/api-probe-batch/README.md +45 -0
- package/workflows/api-probe-batch/meta.yaml +4 -0
- package/workflows/api-probe-batch/package.json +23 -0
- package/workflows/api-probe-batch/tsconfig.json +16 -0
- package/workflows/api-probe-batch/workflow.ts +111 -0
- package/workflows/auth-bootstrap/.jshook-install.json +14 -0
- package/workflows/auth-bootstrap/LICENSE +21 -0
- package/workflows/auth-bootstrap/README.md +74 -0
- package/workflows/auth-bootstrap/meta.yaml +4 -0
- package/workflows/auth-bootstrap/package.json +23 -0
- package/workflows/auth-bootstrap/tsconfig.json +16 -0
- package/workflows/auth-bootstrap/workflow.ts +141 -0
- package/workflows/auth-extract/.jshook-install.json +14 -0
- package/workflows/auth-extract/meta.yaml +6 -0
- package/workflows/auth-extract/package.json +22 -0
- package/workflows/auth-extract/pnpm-lock.yaml +819 -0
- package/workflows/auth-extract/tsconfig.json +15 -0
- package/workflows/auth-extract/workflow.ts +36 -0
- package/workflows/auth-surface-mapper/.jshook-install.json +14 -0
- package/workflows/auth-surface-mapper/meta.yaml +6 -0
- package/workflows/auth-surface-mapper/package.json +22 -0
- package/workflows/auth-surface-mapper/pnpm-lock.yaml +819 -0
- package/workflows/auth-surface-mapper/tsconfig.json +15 -0
- package/workflows/auth-surface-mapper/workflow.ts +104 -0
- package/workflows/batch-register/.jshook-install.json +14 -0
- package/workflows/batch-register/LICENSE +21 -0
- package/workflows/batch-register/README.md +39 -0
- package/workflows/batch-register/meta.yaml +4 -0
- package/workflows/batch-register/package.json +23 -0
- package/workflows/batch-register/tsconfig.json +16 -0
- package/workflows/batch-register/workflow.ts +67 -0
- package/workflows/bundle-recovery/.jshook-install.json +14 -0
- package/workflows/bundle-recovery/LICENSE +21 -0
- package/workflows/bundle-recovery/README.md +105 -0
- package/workflows/bundle-recovery/docs/agent-recipes.md +44 -0
- package/workflows/bundle-recovery/meta.yaml +6 -0
- package/workflows/bundle-recovery/package.json +22 -0
- package/workflows/bundle-recovery/tsconfig.json +15 -0
- package/workflows/bundle-recovery/workflow.ts +179 -0
- package/workflows/challenge-detector/.jshook-install.json +14 -0
- package/workflows/challenge-detector/meta.yaml +14 -0
- package/workflows/challenge-detector/package.json +22 -0
- package/workflows/challenge-detector/pnpm-lock.yaml +819 -0
- package/workflows/challenge-detector/tsconfig.json +15 -0
- package/workflows/challenge-detector/workflow.ts +298 -0
- package/workflows/deobfuscation-pipeline/.jshook-install.json +14 -0
- package/workflows/deobfuscation-pipeline/meta.yaml +6 -0
- package/workflows/deobfuscation-pipeline/package.json +22 -0
- package/workflows/deobfuscation-pipeline/pnpm-lock.yaml +819 -0
- package/workflows/deobfuscation-pipeline/tsconfig.json +15 -0
- package/workflows/deobfuscation-pipeline/workflow.ts +119 -0
- package/workflows/electron-bridge-mapper/.jshook-install.json +14 -0
- package/workflows/electron-bridge-mapper/meta.yaml +6 -0
- package/workflows/electron-bridge-mapper/package.json +22 -0
- package/workflows/electron-bridge-mapper/pnpm-lock.yaml +819 -0
- package/workflows/electron-bridge-mapper/tsconfig.json +15 -0
- package/workflows/electron-bridge-mapper/workflow.ts +125 -0
- package/workflows/evidence-pack/.jshook-install.json +14 -0
- package/workflows/evidence-pack/LICENSE +21 -0
- package/workflows/evidence-pack/README.md +105 -0
- package/workflows/evidence-pack/docs/agent-recipes.md +44 -0
- package/workflows/evidence-pack/meta.yaml +6 -0
- package/workflows/evidence-pack/package.json +22 -0
- package/workflows/evidence-pack/tsconfig.json +15 -0
- package/workflows/evidence-pack/workflow.ts +154 -0
- package/workflows/js-bundle-search/.jshook-install.json +14 -0
- package/workflows/js-bundle-search/LICENSE +21 -0
- package/workflows/js-bundle-search/README.md +46 -0
- package/workflows/js-bundle-search/meta.yaml +4 -0
- package/workflows/js-bundle-search/package.json +23 -0
- package/workflows/js-bundle-search/tsconfig.json +16 -0
- package/workflows/js-bundle-search/workflow.ts +118 -0
- package/workflows/protocol-registry/.jshook-install.json +14 -0
- package/workflows/protocol-registry/meta.yaml +6 -0
- package/workflows/protocol-registry/package.json +22 -0
- package/workflows/protocol-registry/pnpm-lock.yaml +819 -0
- package/workflows/protocol-registry/tsconfig.json +15 -0
- package/workflows/protocol-registry/workflow.ts +107 -0
- package/workflows/qwen-mail-open-latest/meta.yaml +7 -0
- package/workflows/qwen-mail-open-latest/package.json +22 -0
- package/workflows/qwen-mail-open-latest/pnpm-lock.yaml +819 -0
- package/workflows/qwen-mail-open-latest/tsconfig.json +15 -0
- package/workflows/qwen-mail-open-latest/workflow.ts +77 -0
- package/workflows/register-account-flow/.jshook-install.json +14 -0
- package/workflows/register-account-flow/LICENSE +21 -0
- package/workflows/register-account-flow/README.md +64 -0
- package/workflows/register-account-flow/meta.yaml +4 -0
- package/workflows/register-account-flow/package.json +23 -0
- package/workflows/register-account-flow/tsconfig.json +16 -0
- package/workflows/register-account-flow/workflow.ts +127 -0
- package/workflows/replay-lab/.jshook-install.json +14 -0
- package/workflows/replay-lab/meta.yaml +6 -0
- package/workflows/replay-lab/package.json +22 -0
- package/workflows/replay-lab/pnpm-lock.yaml +819 -0
- package/workflows/replay-lab/tsconfig.json +15 -0
- package/workflows/replay-lab/workflow.ts +106 -0
- package/workflows/script-evidence-scan/.jshook-install.json +14 -0
- package/workflows/script-evidence-scan/LICENSE +21 -0
- package/workflows/script-evidence-scan/README.md +61 -0
- package/workflows/script-evidence-scan/meta.yaml +4 -0
- package/workflows/script-evidence-scan/package.json +23 -0
- package/workflows/script-evidence-scan/tsconfig.json +16 -0
- package/workflows/script-evidence-scan/workflow.ts +89 -0
- package/workflows/signature-hunter/.jshook-install.json +14 -0
- package/workflows/signature-hunter/LICENSE +21 -0
- package/workflows/signature-hunter/README.md +105 -0
- package/workflows/signature-hunter/docs/agent-recipes.md +44 -0
- package/workflows/signature-hunter/meta.yaml +6 -0
- package/workflows/signature-hunter/package.json +22 -0
- package/workflows/signature-hunter/tsconfig.json +15 -0
- package/workflows/signature-hunter/workflow.ts +170 -0
- package/workflows/signing-lineage/.jshook-install.json +14 -0
- package/workflows/signing-lineage/meta.yaml +6 -0
- package/workflows/signing-lineage/package.json +22 -0
- package/workflows/signing-lineage/pnpm-lock.yaml +819 -0
- package/workflows/signing-lineage/tsconfig.json +15 -0
- package/workflows/signing-lineage/workflow.ts +120 -0
- package/workflows/temp-mail-extract-link/.jshook-install.json +14 -0
- package/workflows/temp-mail-extract-link/LICENSE +21 -0
- package/workflows/temp-mail-extract-link/README.md +71 -0
- package/workflows/temp-mail-extract-link/meta.yaml +4 -0
- package/workflows/temp-mail-extract-link/package.json +23 -0
- package/workflows/temp-mail-extract-link/tsconfig.json +16 -0
- package/workflows/temp-mail-extract-link/workflow.ts +221 -0
- package/workflows/temp-mail-open-latest/.jshook-install.json +14 -0
- package/workflows/temp-mail-open-latest/LICENSE +21 -0
- package/workflows/temp-mail-open-latest/README.md +61 -0
- package/workflows/temp-mail-open-latest/meta.yaml +4 -0
- package/workflows/temp-mail-open-latest/package.json +23 -0
- package/workflows/temp-mail-open-latest/tsconfig.json +16 -0
- package/workflows/temp-mail-open-latest/workflow.ts +136 -0
- package/workflows/template/.jshook-install.json +14 -0
- package/workflows/template/LICENSE +21 -0
- package/workflows/template/README.md +45 -0
- package/workflows/template/docs/SKILL.md +111 -0
- package/workflows/template/meta.yaml +6 -0
- package/workflows/template/package.json +22 -0
- package/workflows/template/pnpm-lock.yaml +819 -0
- package/workflows/template/tsconfig.json +15 -0
- package/workflows/template/workflow.ts +73 -0
- package/workflows/web-api-capture-session/.jshook-install.json +14 -0
- package/workflows/web-api-capture-session/LICENSE +21 -0
- package/workflows/web-api-capture-session/README.md +64 -0
- package/workflows/web-api-capture-session/meta.yaml +4 -0
- package/workflows/web-api-capture-session/package.json +23 -0
- package/workflows/web-api-capture-session/tsconfig.json +16 -0
- package/workflows/web-api-capture-session/workflow.ts +124 -0
- package/workflows/ws-protocol-lifter/.jshook-install.json +14 -0
- package/workflows/ws-protocol-lifter/LICENSE +21 -0
- package/workflows/ws-protocol-lifter/README.md +105 -0
- package/workflows/ws-protocol-lifter/docs/agent-recipes.md +44 -0
- package/workflows/ws-protocol-lifter/meta.yaml +6 -0
- package/workflows/ws-protocol-lifter/package.json +22 -0
- package/workflows/ws-protocol-lifter/tsconfig.json +15 -0
- package/workflows/ws-protocol-lifter/workflow.ts +163 -0
|
@@ -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,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createWorkflow,
|
|
3
|
+
SequenceNodeBuilder,
|
|
4
|
+
} from '@jshookmcp/extension-sdk/workflow';
|
|
5
|
+
|
|
6
|
+
// =====================================================
|
|
7
|
+
// Workflow 1: Qwen Mail Activate Link Extractor
|
|
8
|
+
// =====================================================
|
|
9
|
+
|
|
10
|
+
const activateWorkflowId = 'workflow.qwen-mail-activate.v1';
|
|
11
|
+
|
|
12
|
+
export const qwenMailActivate = createWorkflow(activateWorkflowId, 'Qwen Mail Activate')
|
|
13
|
+
.description('Open temp mailbox, refresh inbox, and extract Qwen activation/verify links.')
|
|
14
|
+
.tags(['workflow', 'qwen', 'mail', 'activate'])
|
|
15
|
+
.timeoutMs(3 * 60_000)
|
|
16
|
+
.defaultMaxConcurrency(1)
|
|
17
|
+
.buildGraph(() => {
|
|
18
|
+
const root = new SequenceNodeBuilder('qwen-mail-activate-root');
|
|
19
|
+
|
|
20
|
+
root
|
|
21
|
+
.tool('open-mailbox', 'page_navigate', {
|
|
22
|
+
input: {
|
|
23
|
+
url: 'https://www.linshiyouxiang.net',
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
.tool('refresh-inbox', 'page_press_key', {
|
|
27
|
+
input: { key: 'F5' },
|
|
28
|
+
})
|
|
29
|
+
.tool('wait-load', 'page_wait_for_selector', {
|
|
30
|
+
input: { selector: '.mail-list', timeout: 5000 },
|
|
31
|
+
})
|
|
32
|
+
.tool('extract-link', 'temp_mail_extract_link', {
|
|
33
|
+
config: {
|
|
34
|
+
linkPattern: '/activate',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return root;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// =====================================================
|
|
42
|
+
// Workflow 2: Qwen Mail Open Latest
|
|
43
|
+
// =====================================================
|
|
44
|
+
|
|
45
|
+
const openLatestWorkflowId = 'workflow.qwen-mail-open-latest.v1';
|
|
46
|
+
|
|
47
|
+
export const qwenMailOpenLatest = createWorkflow(openLatestWorkflowId, 'Qwen Mail Open Latest')
|
|
48
|
+
.description('Navigate mailbox, refresh, and open latest Qwen-related mail item if present.')
|
|
49
|
+
.tags(['workflow', 'qwen', 'mail'])
|
|
50
|
+
.timeoutMs(3 * 60_000)
|
|
51
|
+
.defaultMaxConcurrency(1)
|
|
52
|
+
.buildGraph(() => {
|
|
53
|
+
const root = new SequenceNodeBuilder('qwen-mail-open-latest-root');
|
|
54
|
+
|
|
55
|
+
root
|
|
56
|
+
.tool('open-mailbox', 'page_navigate', {
|
|
57
|
+
input: {
|
|
58
|
+
url: 'https://www.linshiyouxiang.net',
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
.tool('refresh-inbox', 'page_press_key', {
|
|
62
|
+
input: { key: 'F5' },
|
|
63
|
+
})
|
|
64
|
+
.tool('wait-load', 'page_wait_for_selector', {
|
|
65
|
+
input: { selector: '.mail-list', timeout: 5000 },
|
|
66
|
+
})
|
|
67
|
+
.tool('open-latest', 'temp_mail_open_latest', {
|
|
68
|
+
config: {
|
|
69
|
+
subjectPattern: 'qwen',
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return root;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Default export: first workflow for backwards compatibility
|
|
77
|
+
export default qwenMailActivate;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"kind": "workflow",
|
|
4
|
+
"slug": "register-account-flow",
|
|
5
|
+
"id": "workflow.register-account-flow.v1",
|
|
6
|
+
"source": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"repo": "https://github.com/vmoranv/jshook_workflow_register_account_flow",
|
|
9
|
+
"ref": "main",
|
|
10
|
+
"commit": "fb1d112",
|
|
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,64 @@
|
|
|
1
|
+
# register-account-flow workflow
|
|
2
|
+
|
|
3
|
+
Declarative workflow for account registration: open a registration page, fill standard fields, submit the form, extract auth findings, and optionally coordinate email verification through shared tab context.
|
|
4
|
+
|
|
5
|
+
## Entry File
|
|
6
|
+
|
|
7
|
+
- `workflow.ts`
|
|
8
|
+
|
|
9
|
+
## Workflow ID
|
|
10
|
+
|
|
11
|
+
- `workflow.register-account-flow.v1`
|
|
12
|
+
|
|
13
|
+
## Structure
|
|
14
|
+
|
|
15
|
+
This workflow mirrors the built-in `handleRegisterAccountFlow` logic as a declarative graph:
|
|
16
|
+
|
|
17
|
+
- `network_enable` before navigation for request/error capture
|
|
18
|
+
- `page_navigate` to the registration page
|
|
19
|
+
- `page_type` steps for `username`, `email`, and `password`
|
|
20
|
+
- Optional checkbox activation via `page_evaluate`
|
|
21
|
+
- `page_click` to submit the form
|
|
22
|
+
- `page_evaluate` delay step to allow registration requests to settle
|
|
23
|
+
- `network_extract_auth` to collect token/auth findings
|
|
24
|
+
- Optional `tab_workflow` branch to open an email tab and transfer the verification URL into shared context
|
|
25
|
+
- `console_execute` summary step for downstream automation
|
|
26
|
+
|
|
27
|
+
## Tools Used
|
|
28
|
+
|
|
29
|
+
- `network_enable`
|
|
30
|
+
- `page_navigate`
|
|
31
|
+
- `page_type`
|
|
32
|
+
- `page_evaluate`
|
|
33
|
+
- `page_click`
|
|
34
|
+
- `network_extract_auth`
|
|
35
|
+
- `tab_workflow`
|
|
36
|
+
- `console_execute`
|
|
37
|
+
|
|
38
|
+
## Config
|
|
39
|
+
|
|
40
|
+
- `workflows.registerAccount.registerUrl`
|
|
41
|
+
- `workflows.registerAccount.username`
|
|
42
|
+
- `workflows.registerAccount.email`
|
|
43
|
+
- `workflows.registerAccount.password`
|
|
44
|
+
- `workflows.registerAccount.submitSelector`
|
|
45
|
+
- `workflows.registerAccount.enableTermsCheckbox`
|
|
46
|
+
- `workflows.registerAccount.termsSelector`
|
|
47
|
+
- `workflows.registerAccount.emailProviderUrl`
|
|
48
|
+
- `workflows.registerAccount.verificationLinkPattern`
|
|
49
|
+
- `workflows.registerAccount.timeoutMs`
|
|
50
|
+
|
|
51
|
+
## Notes
|
|
52
|
+
|
|
53
|
+
- The email-verification branch stores the discovered URL under shared key `__verificationLink`.
|
|
54
|
+
- A downstream runner can read that context value and decide whether to navigate, verify, or hand off to another workflow.
|
|
55
|
+
- If `emailProviderUrl` is empty, the verification branch is skipped.
|
|
56
|
+
|
|
57
|
+
## Local Validation
|
|
58
|
+
|
|
59
|
+
1. Run `pnpm install`.
|
|
60
|
+
2. Run `pnpm typecheck`.
|
|
61
|
+
3. Put this repo under a configured `workflows/` extension root.
|
|
62
|
+
4. Run `extensions_reload` in `jshookmcp`.
|
|
63
|
+
5. Confirm the workflow appears in `extensions_list`.
|
|
64
|
+
6. Execute the workflow and verify registration, auth extraction, and optional verification-link transfer.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jshookmcpextension/workflow-register-account-flow",
|
|
3
|
+
"scripts": {
|
|
4
|
+
"build": "tsc -p tsconfig.json",
|
|
5
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
6
|
+
},
|
|
7
|
+
"type": "module",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
10
|
+
"dotenv": "^17.3.1",
|
|
11
|
+
"@jshookmcp/extension-sdk": "^0.3.0"
|
|
12
|
+
},
|
|
13
|
+
"version": "0.1.0",
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20.0.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^25.3.0",
|
|
19
|
+
"typescript": "^5.9.3"
|
|
20
|
+
},
|
|
21
|
+
"private": true,
|
|
22
|
+
"packageManager": "pnpm@10.28.2"
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"rootDir": ".",
|
|
12
|
+
"outDir": "dist"
|
|
13
|
+
},
|
|
14
|
+
"include": ["workflow.ts"],
|
|
15
|
+
"exclude": ["dist", "node_modules"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { WorkflowContract } from '@jshookmcp/extension-sdk/workflow';
|
|
2
|
+
import { toolNode, sequenceNode, branchNode } from '@jshookmcp/extension-sdk/workflow';
|
|
3
|
+
|
|
4
|
+
const workflow: WorkflowContract = {
|
|
5
|
+
kind: 'workflow-contract',
|
|
6
|
+
version: 1,
|
|
7
|
+
id: 'workflow.register-account-flow.v1',
|
|
8
|
+
displayName: 'Register Account Flow',
|
|
9
|
+
description:
|
|
10
|
+
'Register via page automation, capture auth artifacts, and optionally perform single-tab email verification without tab_workflow.',
|
|
11
|
+
tags: ['workflow', 'registration', 'auth', 'verification', 'automation'],
|
|
12
|
+
timeoutMs: 10 * 60_000,
|
|
13
|
+
defaultMaxConcurrency: 1,
|
|
14
|
+
|
|
15
|
+
build(ctx) {
|
|
16
|
+
const prefix = 'workflows.registerAccount';
|
|
17
|
+
const registerUrl = ctx.getConfig<string>(`${prefix}.registerUrl`, 'https://example.com/register');
|
|
18
|
+
const submitSelector = ctx.getConfig<string>(`${prefix}.submitSelector`, "button[type='submit']");
|
|
19
|
+
const emailProviderUrl = ctx.getConfig<string>(`${prefix}.emailProviderUrl`, '');
|
|
20
|
+
const verificationLinkPattern = ctx.getConfig<string>(`${prefix}.verificationLinkPattern`, '/api/v1/auths/activate');
|
|
21
|
+
const timeoutMs = ctx.getConfig<number>(`${prefix}.timeoutMs`, 90_000);
|
|
22
|
+
const authMinConfidence = ctx.getConfig<number>(`${prefix}.authMinConfidence`, 0.3);
|
|
23
|
+
const emailPollingWaitMs = ctx.getConfig<number>(`${prefix}.emailPollingWaitMs`, 6000);
|
|
24
|
+
|
|
25
|
+
const username = ctx.getConfig<string>(`${prefix}.username`, 'demo-user');
|
|
26
|
+
const email = ctx.getConfig<string>(`${prefix}.email`, 'demo@example.com');
|
|
27
|
+
const password = ctx.getConfig<string>(`${prefix}.password`, 'DemoPassword123!');
|
|
28
|
+
const includeConfirmPassword = ctx.getConfig<boolean>(`${prefix}.includeConfirmPassword`, true);
|
|
29
|
+
const confirmPasswordFieldName = ctx.getConfig<string>(`${prefix}.confirmPasswordFieldName`, 'checkPassword');
|
|
30
|
+
const extraFields = ctx.getConfig<Record<string, unknown>>(`${prefix}.extraFields`, {});
|
|
31
|
+
const enableTermsCheckbox = ctx.getConfig<boolean>(`${prefix}.enableTermsCheckbox`, false);
|
|
32
|
+
const termsSelector = ctx.getConfig<string>(`${prefix}.termsSelector`, "input[type='checkbox']");
|
|
33
|
+
const checkboxSelectors = ctx.getConfig<string[]>(
|
|
34
|
+
`${prefix}.checkboxSelectors`,
|
|
35
|
+
enableTermsCheckbox && termsSelector ? [termsSelector] : [],
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const fields: Record<string, unknown> = { username, email, password, ...extraFields };
|
|
39
|
+
if (includeConfirmPassword) fields[confirmPasswordFieldName] = password;
|
|
40
|
+
|
|
41
|
+
const fillForm = sequenceNode('fill-form');
|
|
42
|
+
for (const [name, value] of Object.entries(fields)) {
|
|
43
|
+
fillForm.step(toolNode(`type-${name}`, 'page_type').input({
|
|
44
|
+
selector: `input[name='${name}']`, text: String(value), delay: 20,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const clickCheckboxes = sequenceNode('click-checkboxes');
|
|
49
|
+
checkboxSelectors.forEach((selector, index) => {
|
|
50
|
+
clickCheckboxes.step(toolNode(`checkbox-${index + 1}`, 'page_evaluate').input({
|
|
51
|
+
code: `(function(){const cb=document.querySelector(${JSON.stringify(selector)});if(!cb)return false;cb.click();if('checked' in cb){cb.checked=true;}cb.dispatchEvent(new Event('change',{bubbles:true}));return true;})()`,
|
|
52
|
+
}));
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const verificationBranch = branchNode('maybe-email-verification', 'register_account_email_verification_enabled')
|
|
56
|
+
.predicateFn(() => Boolean(emailProviderUrl))
|
|
57
|
+
.whenTrue(sequenceNode('email-verification-sequence')
|
|
58
|
+
.step(toolNode('navigate-email-provider', 'page_navigate').input({ url: emailProviderUrl, waitUntil: 'networkidle', enableNetworkMonitoring: true }))
|
|
59
|
+
.step(toolNode('wait-email-poll', 'page_evaluate')
|
|
60
|
+
.input({ code: `new Promise(resolve => setTimeout(() => resolve({ waitedMs: ${emailPollingWaitMs} }), ${emailPollingWaitMs}))` })
|
|
61
|
+
.timeout(Math.max(10_000, emailPollingWaitMs + 2_000)))
|
|
62
|
+
.step(toolNode('open-latest-mail', 'page_evaluate').input({
|
|
63
|
+
code: `(function(){
|
|
64
|
+
const anchors = Array.from(document.querySelectorAll('#message-list a'));
|
|
65
|
+
const view = anchors.find(a => (a.getAttribute('href') || '').includes('/mail/view/'));
|
|
66
|
+
if (!view) return { success: false, step: 'open-latest-mail' };
|
|
67
|
+
const href = view.href || view.getAttribute('href');
|
|
68
|
+
if (!href) return { success: false, step: 'open-latest-mail', reason: 'empty-href' };
|
|
69
|
+
window.location.href = href;
|
|
70
|
+
return { success: true, step: 'open-latest-mail', href };
|
|
71
|
+
})()`,
|
|
72
|
+
}))
|
|
73
|
+
.step(toolNode('wait-mail-detail', 'page_evaluate')
|
|
74
|
+
.input({ code: 'new Promise(resolve => setTimeout(() => resolve({ waitedMs: 1500 }), 1500))' })
|
|
75
|
+
.timeout(10_000))
|
|
76
|
+
.step(toolNode('open-verification-link', 'page_evaluate').input({
|
|
77
|
+
code: `(function(){
|
|
78
|
+
const links = Array.from(document.querySelectorAll('a'));
|
|
79
|
+
const match = links.find(a => (a.href || '').includes(${JSON.stringify(verificationLinkPattern)}));
|
|
80
|
+
if (!match) return { success: false, step: 'open-verification-link' };
|
|
81
|
+
const href = match.href || match.getAttribute('href');
|
|
82
|
+
if (!href) return { success: false, step: 'open-verification-link', reason: 'empty-href' };
|
|
83
|
+
window.location.href = href;
|
|
84
|
+
return { success: true, step: 'open-verification-link', href };
|
|
85
|
+
})()`,
|
|
86
|
+
}))
|
|
87
|
+
.step(toolNode('wait-verification-finish', 'page_evaluate')
|
|
88
|
+
.input({ code: 'new Promise(resolve => setTimeout(() => resolve({ waitedMs: 2500 }), 2500))' })
|
|
89
|
+
.timeout(10_000)))
|
|
90
|
+
.whenFalse(toolNode('skip-email-verification', 'console_execute').input({
|
|
91
|
+
expression: '({ skipped: true, step: "email_verification", reason: "config_disabled" })',
|
|
92
|
+
}));
|
|
93
|
+
|
|
94
|
+
return sequenceNode('register-account-flow-root')
|
|
95
|
+
.step(toolNode('enable-network', 'network_enable').input({ enableExceptions: true }))
|
|
96
|
+
.step(toolNode('navigate-register-page', 'page_navigate').input({ url: registerUrl, waitUntil: 'networkidle', enableNetworkMonitoring: true }))
|
|
97
|
+
.step(toolNode('wait-first-field', 'page_wait_for_selector').input({
|
|
98
|
+
selector: `input[name='${Object.keys(fields)[0] ?? 'email'}']`, timeout: 15000,
|
|
99
|
+
}))
|
|
100
|
+
.step(fillForm)
|
|
101
|
+
.step(clickCheckboxes)
|
|
102
|
+
.step(toolNode('submit-registration-form', 'page_click').input({ selector: submitSelector }))
|
|
103
|
+
.step(toolNode('wait-after-submit', 'page_evaluate')
|
|
104
|
+
.input({ code: 'new Promise(resolve => setTimeout(() => resolve({ waitedMs: 2000 }), 2000))' })
|
|
105
|
+
.timeout(10_000))
|
|
106
|
+
.step(toolNode('extract-auth-findings', 'network_extract_auth').input({ minConfidence: authMinConfidence }))
|
|
107
|
+
.step(verificationBranch)
|
|
108
|
+
.step(toolNode('registration-summary', 'console_execute').input({
|
|
109
|
+
expression: `(${JSON.stringify({ status: 'registration_flow_complete', registerUrl, email, emailProviderUrl, verificationLinkPattern })})`,
|
|
110
|
+
}))
|
|
111
|
+
.build();
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
onStart(ctx) {
|
|
115
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId: 'workflow.register-account-flow.v1', stage: 'start' });
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
onFinish(ctx) {
|
|
119
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId: 'workflow.register-account-flow.v1', stage: 'finish' });
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
onError(ctx, error) {
|
|
123
|
+
ctx.emitMetric('workflow_errors_total', 1, 'counter', { workflowId: 'workflow.register-account-flow.v1', error: error.name });
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export default workflow;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"kind": "workflow",
|
|
4
|
+
"slug": "replay-lab",
|
|
5
|
+
"id": "workflow.replay-lab.v1",
|
|
6
|
+
"source": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"repo": "https://github.com/vmoranv/jshook_workflow_replay_lab",
|
|
9
|
+
"ref": "main",
|
|
10
|
+
"commit": "e6125eee343b3ef7e39f37ec69144d4d774b7eea",
|
|
11
|
+
"subpath": ".",
|
|
12
|
+
"entry": "workflow.ts"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jshook-workflow-replay-lab",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "jshookmcp workflow: replay-lab",
|
|
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
|
+
}
|