@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,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createWorkflow,
|
|
3
|
+
type WorkflowExecutionContext,
|
|
4
|
+
SequenceNodeBuilder,
|
|
5
|
+
} from '@jshookmcp/extension-sdk/workflow';
|
|
6
|
+
|
|
7
|
+
const workflowId = 'workflow.replay-lab.v1';
|
|
8
|
+
|
|
9
|
+
export default createWorkflow(workflowId, 'Replay Lab')
|
|
10
|
+
.description(
|
|
11
|
+
'Captures a target request, extracts its full context (headers, cookies, auth tokens, body), replays it with modifications, compares responses, and produces a replay script — enabling parameter tampering, signature validation, and API probing.',
|
|
12
|
+
)
|
|
13
|
+
.tags(['reverse', 'replay', 'request', 'api', 'tamper', 'probe', 'mission'])
|
|
14
|
+
.timeoutMs(8 * 60_000)
|
|
15
|
+
.defaultMaxConcurrency(3)
|
|
16
|
+
.buildGraph((ctx: WorkflowExecutionContext) => {
|
|
17
|
+
const prefix = 'workflows.replayLab';
|
|
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`, 30));
|
|
21
|
+
const targetUrlPattern = String(ctx.getConfig(`${prefix}.targetUrlPattern`, ''));
|
|
22
|
+
const replayCount = Number(ctx.getConfig(`${prefix}.replayCount`, 1));
|
|
23
|
+
const maxConcurrency = Number(ctx.getConfig(`${prefix}.parallel.maxConcurrency`, 3));
|
|
24
|
+
const exportHar = Boolean(ctx.getConfig(`${prefix}.exportHar`, true));
|
|
25
|
+
|
|
26
|
+
const root = new SequenceNodeBuilder('replay-lab-root');
|
|
27
|
+
|
|
28
|
+
// Phase 1: Network Setup & Navigate
|
|
29
|
+
root
|
|
30
|
+
.tool('enable-network', 'network_enable', { input: { enableExceptions: true } })
|
|
31
|
+
.tool('navigate', 'page_navigate', { input: { url, waitUntil } })
|
|
32
|
+
|
|
33
|
+
// Phase 2: Capture Traffic
|
|
34
|
+
.tool('capture-requests', 'network_get_requests', { input: { tail: requestTail } })
|
|
35
|
+
|
|
36
|
+
// Phase 3: Parallel Context Collection
|
|
37
|
+
.parallel('collect-context', (p) => {
|
|
38
|
+
p.maxConcurrency(maxConcurrency)
|
|
39
|
+
.failFast(false)
|
|
40
|
+
.tool('get-cookies', 'page_get_cookies')
|
|
41
|
+
.tool('get-local-storage', 'page_get_local_storage')
|
|
42
|
+
.tool('extract-auth', 'network_extract_auth', { input: { minConfidence: 0.2 } })
|
|
43
|
+
.tool('get-network-stats', 'network_get_stats', { input: {} });
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
// Phase 4: Replay Target Request
|
|
47
|
+
.tool('replay-request', 'network_replay_request', {
|
|
48
|
+
input: { urlPattern: targetUrlPattern, count: replayCount },
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// Phase 5: Instrumentation-level replay
|
|
52
|
+
.tool('instrumentation-replay', 'instrumentation_network_replay', {
|
|
53
|
+
input: {},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Phase 6: HAR Export (Optional)
|
|
57
|
+
if (exportHar) {
|
|
58
|
+
root.tool('export-har', 'network_export_har', { input: {} });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Phase 7: XHR/Fetch interceptor for live capture
|
|
62
|
+
root.tool('inject-fetch-interceptor', 'console_inject_fetch_interceptor', {
|
|
63
|
+
input: { persistent: false },
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Phase 8: Evidence Recording
|
|
67
|
+
root
|
|
68
|
+
.tool('create-evidence-session', 'instrumentation_session_create', {
|
|
69
|
+
input: {
|
|
70
|
+
name: `replay-lab-${new Date().toISOString().slice(0, 10)}`,
|
|
71
|
+
metadata: { url, workflowId, targetUrlPattern },
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
.tool('record-artifact', 'instrumentation_artifact_record', {
|
|
75
|
+
input: {
|
|
76
|
+
type: 'replay_session',
|
|
77
|
+
label: `Replay lab for ${url}`,
|
|
78
|
+
metadata: { url, targetUrlPattern, replayCount },
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
// Phase 9: Session Insight
|
|
83
|
+
.tool('emit-insight', 'append_session_insight', {
|
|
84
|
+
input: {
|
|
85
|
+
insight: JSON.stringify({
|
|
86
|
+
status: 'replay_lab_complete',
|
|
87
|
+
workflowId,
|
|
88
|
+
url,
|
|
89
|
+
targetUrlPattern,
|
|
90
|
+
replayCount,
|
|
91
|
+
}),
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
return root;
|
|
96
|
+
})
|
|
97
|
+
.onStart((ctx) => {
|
|
98
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId, mission: 'replay_lab', stage: 'start' });
|
|
99
|
+
})
|
|
100
|
+
.onFinish((ctx) => {
|
|
101
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId, mission: 'replay_lab', stage: 'finish' });
|
|
102
|
+
})
|
|
103
|
+
.onError((ctx, error) => {
|
|
104
|
+
ctx.emitMetric('workflow_errors_total', 1, 'counter', { workflowId, mission: 'replay_lab', stage: 'error', error: error.name });
|
|
105
|
+
})
|
|
106
|
+
.build();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"kind": "workflow",
|
|
4
|
+
"slug": "script-evidence-scan",
|
|
5
|
+
"id": "workflow.script-evidence-scan.v1",
|
|
6
|
+
"source": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"repo": "https://github.com/vmoranv/jshook_workflow_script_evidence_scan",
|
|
9
|
+
"ref": "main",
|
|
10
|
+
"commit": "2ff377c",
|
|
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,61 @@
|
|
|
1
|
+
# script-evidence-scan workflow
|
|
2
|
+
|
|
3
|
+
Declarative workflow for extracting evidence from **browser-loaded scripts** instead of relying on `collect_code + search_in_scripts`.
|
|
4
|
+
|
|
5
|
+
## Entry File
|
|
6
|
+
|
|
7
|
+
- `workflow.ts`
|
|
8
|
+
|
|
9
|
+
## Workflow ID
|
|
10
|
+
|
|
11
|
+
- `workflow.script-evidence-scan.v1`
|
|
12
|
+
|
|
13
|
+
## Structure
|
|
14
|
+
|
|
15
|
+
This workflow codifies a loaded-script-first evidence path:
|
|
16
|
+
|
|
17
|
+
- `page_navigate` into the target page
|
|
18
|
+
- optional `page_script_run(auth_extract)` to capture ambient auth context
|
|
19
|
+
- `get_all_scripts(includeSource=false)` to enumerate scripts currently loaded in the browser
|
|
20
|
+
- `get_script_source(preview=true)` for a configurable list of URL hints / wildcard patterns
|
|
21
|
+
- `console_execute` summary step listing which hints were inspected
|
|
22
|
+
|
|
23
|
+
## Tools Used
|
|
24
|
+
|
|
25
|
+
- `page_navigate`
|
|
26
|
+
- `page_script_run`
|
|
27
|
+
- `get_all_scripts`
|
|
28
|
+
- `get_script_source`
|
|
29
|
+
- `console_execute`
|
|
30
|
+
|
|
31
|
+
## Config
|
|
32
|
+
|
|
33
|
+
- `workflows.scriptEvidenceScan.pageUrl`
|
|
34
|
+
- `workflows.scriptEvidenceScan.waitUntil`
|
|
35
|
+
- `workflows.scriptEvidenceScan.runAuthExtract`
|
|
36
|
+
- `workflows.scriptEvidenceScan.maxScripts`
|
|
37
|
+
- `workflows.scriptEvidenceScan.includeDefaultHints`
|
|
38
|
+
- `workflows.scriptEvidenceScan.targetScriptHints`
|
|
39
|
+
- `workflows.scriptEvidenceScan.previewMaxLines`
|
|
40
|
+
|
|
41
|
+
## Default Hints
|
|
42
|
+
|
|
43
|
+
The workflow can inspect these script URL hints by default:
|
|
44
|
+
|
|
45
|
+
- `*main*.js`
|
|
46
|
+
- `*index*.js`
|
|
47
|
+
- `*app*.js`
|
|
48
|
+
|
|
49
|
+
You can add explicit bundle URLs or wildcard patterns via config.
|
|
50
|
+
|
|
51
|
+
## Local Validation
|
|
52
|
+
|
|
53
|
+
1. Run `pnpm install`.
|
|
54
|
+
2. Run `pnpm typecheck`.
|
|
55
|
+
3. Put this repo under a configured `workflows/` extension root.
|
|
56
|
+
4. Run `reload_extensions` in `jshookmcp`.
|
|
57
|
+
5. Confirm the workflow appears in `list_extension_workflows`.
|
|
58
|
+
6. Execute the workflow and verify it outputs:
|
|
59
|
+
- loaded scripts summary
|
|
60
|
+
- preview(s) for configured script hints
|
|
61
|
+
- final summary of inspected hints
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jshookmcpextension/workflow-script-evidence-scan",
|
|
3
|
+
"scripts": {
|
|
4
|
+
"build": "tsc -p tsconfig.json",
|
|
5
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
6
|
+
},
|
|
7
|
+
"type": "module",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@jshookmcp/extension-sdk": "^0.3.0",
|
|
10
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
11
|
+
"dotenv": "^17.3.1"
|
|
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,89 @@
|
|
|
1
|
+
import type { WorkflowContract } from '@jshookmcp/extension-sdk/workflow';
|
|
2
|
+
import { toolNode, sequenceNode, branchNode } from '@jshookmcp/extension-sdk/workflow';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_HINTS = ['*main*.js', '*index*.js', '*app*.js'] as const;
|
|
5
|
+
|
|
6
|
+
const workflow: WorkflowContract = {
|
|
7
|
+
kind: 'workflow-contract',
|
|
8
|
+
version: 1,
|
|
9
|
+
id: 'workflow.script-evidence-scan.v1',
|
|
10
|
+
displayName: 'Script Evidence Scan',
|
|
11
|
+
description:
|
|
12
|
+
'Navigate to a page, enumerate browser-loaded scripts, and inspect configured script URL hints via get_script_source previews.',
|
|
13
|
+
tags: ['workflow', 'reverse', 'script', 'evidence', 'browser'],
|
|
14
|
+
timeoutMs: 8 * 60_000,
|
|
15
|
+
defaultMaxConcurrency: 1,
|
|
16
|
+
|
|
17
|
+
build(ctx) {
|
|
18
|
+
const prefix = 'workflows.scriptEvidenceScan';
|
|
19
|
+
const pageUrl = ctx.getConfig<string>(`${prefix}.pageUrl`, 'https://example.com/');
|
|
20
|
+
const waitUntil = ctx.getConfig<string>(`${prefix}.waitUntil`, 'networkidle');
|
|
21
|
+
const runAuthExtract = ctx.getConfig<boolean>(`${prefix}.runAuthExtract`, true);
|
|
22
|
+
const maxScripts = ctx.getConfig<number>(`${prefix}.maxScripts`, 80);
|
|
23
|
+
const includeDefaultHints = ctx.getConfig<boolean>(`${prefix}.includeDefaultHints`, true);
|
|
24
|
+
const configuredHints = ctx.getConfig<string[]>(`${prefix}.targetScriptHints`, []);
|
|
25
|
+
const includeFullSource = ctx.getConfig<boolean>(`${prefix}.includeFullSource`, true);
|
|
26
|
+
const previewMaxLines = ctx.getConfig<number>(`${prefix}.previewMaxLines`, 120);
|
|
27
|
+
|
|
28
|
+
const targetHints = [
|
|
29
|
+
...(includeDefaultHints ? [...DEFAULT_HINTS] : []),
|
|
30
|
+
...configuredHints,
|
|
31
|
+
].filter((value, index, array) => value.trim().length > 0 && array.indexOf(value) === index);
|
|
32
|
+
|
|
33
|
+
return sequenceNode('script-evidence-scan-root')
|
|
34
|
+
.step(toolNode('navigate-target', 'page_navigate').input({
|
|
35
|
+
url: pageUrl, waitUntil, enableNetworkMonitoring: true,
|
|
36
|
+
}))
|
|
37
|
+
.step(branchNode('maybe-auth-extract', 'script_evidence_run_auth_extract')
|
|
38
|
+
.predicateFn(() => runAuthExtract)
|
|
39
|
+
.whenTrue(toolNode('auth-extract', 'page_script_run').input({ name: 'auth_extract' }))
|
|
40
|
+
.whenFalse(toolNode('skip-auth-extract', 'console_execute').input({
|
|
41
|
+
expression: '({ skipped: true, step: "auth_extract", reason: "config_disabled" })',
|
|
42
|
+
})))
|
|
43
|
+
.step(toolNode('list-loaded-scripts', 'get_all_scripts').input({
|
|
44
|
+
includeSource: includeFullSource, maxScripts,
|
|
45
|
+
}))
|
|
46
|
+
.step(toolNode('summarize-script-hints', 'page_evaluate').input({
|
|
47
|
+
code: `(function(){
|
|
48
|
+
const hints = ${JSON.stringify(targetHints)};
|
|
49
|
+
const urls = Array.from(document.scripts)
|
|
50
|
+
.map(s => s.src || '')
|
|
51
|
+
.filter(Boolean);
|
|
52
|
+
const matches = hints.map((hint) => {
|
|
53
|
+
const escaped = hint
|
|
54
|
+
.replace(/[.+^()|[\\\\]\\\\]/g, '\\\\$&')
|
|
55
|
+
.replace(/\\\\\\*/g, '.*');
|
|
56
|
+
const rx = new RegExp('^' + escaped + '$', 'i');
|
|
57
|
+
return {
|
|
58
|
+
hint,
|
|
59
|
+
matchedUrls: urls.filter(url => rx.test(url)).slice(0, 10),
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
return { hints, totalScriptsWithSrc: urls.length, matches };
|
|
63
|
+
})()`,
|
|
64
|
+
}))
|
|
65
|
+
.step(toolNode('emit-summary', 'console_execute').input({
|
|
66
|
+
expression: `(${JSON.stringify({
|
|
67
|
+
workflowId: 'workflow.script-evidence-scan.v1',
|
|
68
|
+
pageUrl, waitUntil, runAuthExtract, maxScripts, previewMaxLines,
|
|
69
|
+
inspectedHints: targetHints,
|
|
70
|
+
strategy: ['navigate', 'optional_auth_extract', 'get_all_scripts', 'get_script_source(preview)'],
|
|
71
|
+
})})`,
|
|
72
|
+
}))
|
|
73
|
+
.build();
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
onStart(ctx) {
|
|
77
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId: 'workflow.script-evidence-scan.v1', stage: 'start' });
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
onFinish(ctx) {
|
|
81
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId: 'workflow.script-evidence-scan.v1', stage: 'finish' });
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
onError(ctx, error) {
|
|
85
|
+
ctx.emitMetric('workflow_errors_total', 1, 'counter', { workflowId: 'workflow.script-evidence-scan.v1', error: error.name });
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default workflow;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"kind": "workflow",
|
|
4
|
+
"slug": "signature-hunter",
|
|
5
|
+
"id": "workflow.signature-hunter.v1",
|
|
6
|
+
"source": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"repo": "https://github.com/vmoranv/jshook_workflow_signature_hunter",
|
|
9
|
+
"ref": "main",
|
|
10
|
+
"commit": "9d24e172bbb841ae8d6516ab50757857da9b8bc5",
|
|
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
|
+
}
|