@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,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createWorkflow,
|
|
3
|
+
type WorkflowExecutionContext,
|
|
4
|
+
SequenceNodeBuilder,
|
|
5
|
+
} from '@jshookmcp/extension-sdk/workflow';
|
|
6
|
+
|
|
7
|
+
const workflowId = 'workflow.auth-surface-mapper.v1';
|
|
8
|
+
|
|
9
|
+
export default createWorkflow(workflowId, 'Auth Surface Mapper')
|
|
10
|
+
.description(
|
|
11
|
+
'Enumerates all authentication surfaces on a page: cookies, localStorage tokens, sessionStorage, authorization headers, JWT payloads, CSRF tokens, OAuth parameters, and API keys — producing a unified auth surface report with confidence scores.',
|
|
12
|
+
)
|
|
13
|
+
.tags(['reverse', 'auth', 'token', 'cookie', 'credential', 'jwt', 'csrf', 'mission'])
|
|
14
|
+
.timeoutMs(6 * 60_000)
|
|
15
|
+
.defaultMaxConcurrency(5)
|
|
16
|
+
.buildGraph((ctx: WorkflowExecutionContext) => {
|
|
17
|
+
const prefix = 'workflows.authSurfaceMapper';
|
|
18
|
+
const url = String(ctx.getConfig(`${prefix}.url`, 'https://example.com'));
|
|
19
|
+
const waitUntil = String(ctx.getConfig(`${prefix}.waitUntil`, 'networkidle0'));
|
|
20
|
+
const requestTail = Number(ctx.getConfig(`${prefix}.requestTail`, 50));
|
|
21
|
+
const minConfidence = Number(ctx.getConfig(`${prefix}.minConfidence`, 0.2));
|
|
22
|
+
const maxConcurrency = Number(ctx.getConfig(`${prefix}.parallel.maxConcurrency`, 5));
|
|
23
|
+
const triggerActions = Boolean(ctx.getConfig(`${prefix}.triggerActions`, false));
|
|
24
|
+
|
|
25
|
+
const root = new SequenceNodeBuilder('auth-surface-mapper-root');
|
|
26
|
+
|
|
27
|
+
// Phase 1: Network & Navigation
|
|
28
|
+
root
|
|
29
|
+
.tool('enable-network', 'network_enable', { input: { enableExceptions: true } })
|
|
30
|
+
.tool('navigate', 'page_navigate', { input: { url, waitUntil } })
|
|
31
|
+
|
|
32
|
+
// Phase 2: Parallel Surface Collection
|
|
33
|
+
.parallel('collect-auth-surfaces', (p: any) => {
|
|
34
|
+
p.maxConcurrency(maxConcurrency)
|
|
35
|
+
.failFast(false)
|
|
36
|
+
.tool('get-cookies', 'page_get_cookies')
|
|
37
|
+
.tool('get-local-storage', 'page_get_local_storage')
|
|
38
|
+
.tool('get-requests', 'network_get_requests', { input: { tail: requestTail } })
|
|
39
|
+
.tool('extract-auth', 'network_extract_auth', { input: { minConfidence } })
|
|
40
|
+
.tool('search-auth-patterns', 'search_in_scripts', {
|
|
41
|
+
input: { query: 'authorization,bearer,jwt,token,csrf,x-csrf,api-key,apikey,secret', matchType: 'any' },
|
|
42
|
+
})
|
|
43
|
+
.tool('detect-crypto', 'detect_crypto', { input: {} });
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
// Phase 3: Token Deep Analysis
|
|
47
|
+
.tool('evaluate-auth-state', 'page_evaluate', {
|
|
48
|
+
input: {
|
|
49
|
+
expression: `(function() {
|
|
50
|
+
const result = {};
|
|
51
|
+
try { result.localStorage = Object.keys(localStorage).filter(k => /token|auth|jwt|session|csrf|key|secret/i.test(k)); } catch(e) {}
|
|
52
|
+
try { result.sessionStorage = Object.keys(sessionStorage).filter(k => /token|auth|jwt|session|csrf|key|secret/i.test(k)); } catch(e) {}
|
|
53
|
+
result.metaTags = [...document.querySelectorAll('meta[name*=csrf], meta[name*=token], meta[name*=auth]')].map(m => ({name:m.name,content:m.content?.slice(0,50)}));
|
|
54
|
+
result.hiddenInputs = [...document.querySelectorAll('input[type=hidden]')].filter(i => /token|csrf|auth|nonce/i.test(i.name)).map(i => ({name:i.name,value:i.value?.slice(0,50)}));
|
|
55
|
+
return result;
|
|
56
|
+
})()`,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Phase 4: Optional Login Trigger
|
|
61
|
+
if (triggerActions) {
|
|
62
|
+
root
|
|
63
|
+
.tool('find-login-buttons', 'dom_find_clickable', { input: {} })
|
|
64
|
+
.tool('get-forms', 'dom_query_all', { input: { selector: 'form[action]' } });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Phase 5: Evidence Recording
|
|
68
|
+
root
|
|
69
|
+
.tool('create-evidence-session', 'instrumentation_session_create', {
|
|
70
|
+
input: {
|
|
71
|
+
name: `auth-surface-${new Date().toISOString().slice(0, 10)}`,
|
|
72
|
+
metadata: { url, workflowId },
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
.tool('record-summary', 'console_execute', {
|
|
76
|
+
input: {
|
|
77
|
+
expression: `(${JSON.stringify({ status: 'auth_surface_recorded', url, minConfidence })})`,
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// Phase 6: Session Insight
|
|
82
|
+
.tool('emit-insight', 'append_session_insight', {
|
|
83
|
+
input: {
|
|
84
|
+
insight: JSON.stringify({
|
|
85
|
+
status: 'auth_surface_mapper_complete',
|
|
86
|
+
workflowId,
|
|
87
|
+
url,
|
|
88
|
+
minConfidence,
|
|
89
|
+
}),
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return root;
|
|
94
|
+
})
|
|
95
|
+
.onStart((ctx) => {
|
|
96
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId, mission: 'auth_surface_mapper', stage: 'start' });
|
|
97
|
+
})
|
|
98
|
+
.onFinish((ctx) => {
|
|
99
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId, mission: 'auth_surface_mapper', stage: 'finish' });
|
|
100
|
+
})
|
|
101
|
+
.onError((ctx, error) => {
|
|
102
|
+
ctx.emitMetric('workflow_errors_total', 1, 'counter', { workflowId, mission: 'auth_surface_mapper', stage: 'error', error: error.name });
|
|
103
|
+
})
|
|
104
|
+
.build();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"kind": "workflow",
|
|
4
|
+
"slug": "batch-register",
|
|
5
|
+
"id": "workflow.batch-register.v1",
|
|
6
|
+
"source": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"repo": "https://github.com/vmoranv/jshook_workflow_batch_register",
|
|
9
|
+
"ref": "main",
|
|
10
|
+
"commit": "6d57ba1",
|
|
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,39 @@
|
|
|
1
|
+
# batch-register workflow
|
|
2
|
+
|
|
3
|
+
Declarative example workflow for batch account registration.
|
|
4
|
+
|
|
5
|
+
## Entry File
|
|
6
|
+
|
|
7
|
+
- `workflow.ts`
|
|
8
|
+
|
|
9
|
+
## Workflow ID
|
|
10
|
+
|
|
11
|
+
- `workflow.batch-register.v1`
|
|
12
|
+
|
|
13
|
+
## Structure
|
|
14
|
+
|
|
15
|
+
This workflow demonstrates all core node types:
|
|
16
|
+
|
|
17
|
+
- `ToolNode`: precheck and summary steps
|
|
18
|
+
- `ParallelNode`: concurrent account registration
|
|
19
|
+
- `BranchNode`: success-rate-based branching
|
|
20
|
+
- `SequenceNode`: end-to-end orchestration
|
|
21
|
+
|
|
22
|
+
## Tools Used
|
|
23
|
+
|
|
24
|
+
- `web_api_capture_session` (precheck)
|
|
25
|
+
- `register_account_flow` (parallel tasks)
|
|
26
|
+
- `console_execute` (summary output)
|
|
27
|
+
|
|
28
|
+
## Config
|
|
29
|
+
|
|
30
|
+
- `workflows.batchRegister.maxConcurrency` (default: `3`)
|
|
31
|
+
|
|
32
|
+
## Local Validation
|
|
33
|
+
|
|
34
|
+
1. Load extension roots in `jshookmcp`.
|
|
35
|
+
2. Run `extensions_reload`.
|
|
36
|
+
3. Confirm workflow is listed in `extensions_list`.
|
|
37
|
+
4. Trigger the workflow via your workflow runner and verify:
|
|
38
|
+
- parallel execution occurs
|
|
39
|
+
- summary branch step emits result
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jshookmcpextension/workflow-batch-register",
|
|
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,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example workflow: Batch Account Registration.
|
|
3
|
+
* Demonstrates SequenceNode, ToolNode, ParallelNode, and BranchNode.
|
|
4
|
+
* Declarative — executed by a WorkflowEngine.
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkflowContract } from '@jshookmcp/extension-sdk/workflow';
|
|
7
|
+
import { toolNode, sequenceNode, parallelNode, branchNode } from '@jshookmcp/extension-sdk/workflow';
|
|
8
|
+
|
|
9
|
+
const batchRegisterWorkflow: WorkflowContract = {
|
|
10
|
+
kind: 'workflow-contract',
|
|
11
|
+
version: 1,
|
|
12
|
+
id: 'workflow.batch-register.v1',
|
|
13
|
+
displayName: 'Batch Register Accounts',
|
|
14
|
+
description:
|
|
15
|
+
'Run register_account_flow for multiple accounts with concurrency controls, ' +
|
|
16
|
+
'retry policies, and success rate gating.',
|
|
17
|
+
tags: ['workflow', 'registration', 'batch', 'automation'],
|
|
18
|
+
timeoutMs: 15 * 60_000,
|
|
19
|
+
defaultMaxConcurrency: 3,
|
|
20
|
+
|
|
21
|
+
build(ctx) {
|
|
22
|
+
const maxConcurrency = ctx.getConfig<number>('workflows.batchRegister.maxConcurrency', 3);
|
|
23
|
+
|
|
24
|
+
return sequenceNode('batch-register-root')
|
|
25
|
+
.step(toolNode('precheck', 'web_api_capture_session').input({
|
|
26
|
+
url: 'about:blank', exportHar: false, exportReport: false,
|
|
27
|
+
}))
|
|
28
|
+
.step(parallelNode('register-parallel')
|
|
29
|
+
.maxConcurrency(maxConcurrency)
|
|
30
|
+
.failFast(false)
|
|
31
|
+
.step(toolNode('register-account-1', 'register_account_flow')
|
|
32
|
+
.input({
|
|
33
|
+
registerUrl: 'https://example.com/register',
|
|
34
|
+
fields: { username: 'user1', email: 'user1@temp.mail', password: '{{PLACEHOLDER}}' },
|
|
35
|
+
})
|
|
36
|
+
.retry({ maxAttempts: 2, backoffMs: 1000, multiplier: 2 }))
|
|
37
|
+
.step(toolNode('register-account-2', 'register_account_flow')
|
|
38
|
+
.input({
|
|
39
|
+
registerUrl: 'https://example.com/register',
|
|
40
|
+
fields: { username: 'user2', email: 'user2@temp.mail', password: '{{PLACEHOLDER}}' },
|
|
41
|
+
})
|
|
42
|
+
.retry({ maxAttempts: 2, backoffMs: 1000, multiplier: 2 })))
|
|
43
|
+
.step(branchNode('summary-branch', 'batch_success_rate_gte_80')
|
|
44
|
+
.predicateFn(() => true)
|
|
45
|
+
.whenTrue(toolNode('success-summary', 'console_execute').input({
|
|
46
|
+
expression: '({ status: "batch_complete", successRate: ">=80%" })',
|
|
47
|
+
}))
|
|
48
|
+
.whenFalse(toolNode('failure-summary', 'console_execute').input({
|
|
49
|
+
expression: '({ status: "needs_retry", successRate: "<80%", suggestion: "Check captcha provider or increase timeout" })',
|
|
50
|
+
})))
|
|
51
|
+
.build();
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
onStart(ctx) {
|
|
55
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId: 'workflow.batch-register.v1', stage: 'start' });
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
onFinish(ctx) {
|
|
59
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId: 'workflow.batch-register.v1', stage: 'finish' });
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
onError(ctx, error) {
|
|
63
|
+
ctx.emitMetric('workflow_errors_total', 1, 'counter', { workflowId: 'workflow.batch-register.v1', error: error.name });
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default batchRegisterWorkflow;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"kind": "workflow",
|
|
4
|
+
"slug": "bundle-recovery",
|
|
5
|
+
"id": "workflow.bundle-recovery.v1",
|
|
6
|
+
"source": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"repo": "https://github.com/vmoranv/jshook_workflow_bundle_recovery",
|
|
9
|
+
"ref": "main",
|
|
10
|
+
"commit": "0dd0e8d12c89c5deb8bacd8c158a3daaeeda3023",
|
|
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,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
|
+
}
|